|
|
@ -19,6 +19,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
require "alt_getopt"
|
|
|
|
require "alt_getopt"
|
|
|
|
require "pdfreader"
|
|
|
|
require "pdfreader"
|
|
|
|
|
|
|
|
require "filechooser"
|
|
|
|
|
|
|
|
|
|
|
|
-- option parsing:
|
|
|
|
-- option parsing:
|
|
|
|
longopts = {
|
|
|
|
longopts = {
|
|
|
@ -41,6 +42,9 @@ if optarg["h"] or ARGV[optind] == nil then
|
|
|
|
print(" currently one of \"kdxg\" (default), \"k3\"")
|
|
|
|
print(" currently one of \"kdxg\" (default), \"k3\"")
|
|
|
|
print("-h, --help show this usage help")
|
|
|
|
print("-h, --help show this usage help")
|
|
|
|
print("")
|
|
|
|
print("")
|
|
|
|
|
|
|
|
print("If you give the name of a directory instead of a path, a file")
|
|
|
|
|
|
|
|
print("chooser will show up and let you select a PDF file")
|
|
|
|
|
|
|
|
print("")
|
|
|
|
print("This software is licensed under the GPLv3.")
|
|
|
|
print("This software is licensed under the GPLv3.")
|
|
|
|
print("See http://github.com/hwhw/kindlepdfviewer for more info.")
|
|
|
|
print("See http://github.com/hwhw/kindlepdfviewer for more info.")
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -68,7 +72,20 @@ end
|
|
|
|
fb = einkfb.open("/dev/fb0")
|
|
|
|
fb = einkfb.open("/dev/fb0")
|
|
|
|
width, height = fb:getSize()
|
|
|
|
width, height = fb:getSize()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if lfs.attributes(ARGV[optind], "mode") == "directory" then
|
|
|
|
|
|
|
|
local running = true
|
|
|
|
|
|
|
|
while running do
|
|
|
|
|
|
|
|
local pdffile = FileChooser:choose(ARGV[optind],0,height)
|
|
|
|
|
|
|
|
if pdffile ~= nil then
|
|
|
|
|
|
|
|
PDFReader:open(pdffile,"") -- TODO: query for password
|
|
|
|
|
|
|
|
PDFReader:goto(tonumber(PDFReader.settings:readsetting("last_page") or 1))
|
|
|
|
|
|
|
|
PDFReader:inputloop()
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
running = false
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
PDFReader:open(ARGV[optind], optarg["p"])
|
|
|
|
PDFReader:open(ARGV[optind], optarg["p"])
|
|
|
|
PDFReader:goto(tonumber(optarg["g"]) or tonumber(PDFReader.settings:readsetting("last_page") or 1))
|
|
|
|
PDFReader:goto(tonumber(optarg["g"]) or tonumber(PDFReader.settings:readsetting("last_page") or 1))
|
|
|
|
PDFReader:inputloop()
|
|
|
|
PDFReader:inputloop()
|
|
|
|
|
|
|
|
end
|
|
|
|