add XPS and CBZ support (muPDF provides this)

pull/2/merge
HW 12 years ago
parent 2fcfe4a329
commit 48463d4739

@ -52,10 +52,13 @@ function FileChooser:readdir()
if lfs.attributes(self.path.."/"..f, "mode") == "directory" and f ~= "." and not (f==".." and self.path=="/") and not string.match(f, "^%.[^.]") then if lfs.attributes(self.path.."/"..f, "mode") == "directory" and f ~= "." and not (f==".." and self.path=="/") and not string.match(f, "^%.[^.]") then
--print(self.path.." -> adding: '"..f.."'") --print(self.path.." -> adding: '"..f.."'")
table.insert(self.dirs, f) table.insert(self.dirs, f)
elseif string.match(f, ".+%.[pP][dD][fF]$") or string.match(f, ".+%.[dD][jJ][vV][uU]$") then else
local file_type = string.lower(string.match(f, ".+%.([^.]+)") or "")
if file_type == "djvu" or file_type == "pdf" or file_type == "xps" or file_type == "cbz" then
table.insert(self.files, f) table.insert(self.files, f)
end end
end end
end
--@TODO make sure .. is sortted to the first item 16.02 2012 --@TODO make sure .. is sortted to the first item 16.02 2012
table.sort(self.dirs) table.sort(self.dirs)
table.sort(self.files) table.sort(self.files)

@ -34,7 +34,7 @@ longopts = {
} }
function openFile(filename) function openFile(filename)
local file_type = string.lower(string.match(filename, ".+%.(.+)")) local file_type = string.lower(string.match(filename, ".+%.([^.]+)"))
if file_type == "djvu" then if file_type == "djvu" then
if DJVUReader:open(filename) then if DJVUReader:open(filename) then
page_num = DJVUReader.settings:readsetting("last_page") or 1 page_num = DJVUReader.settings:readsetting("last_page") or 1
@ -42,7 +42,7 @@ function openFile(filename)
reader_settings:savesetting("lastfile", filename) reader_settings:savesetting("lastfile", filename)
return DJVUReader:inputloop() return DJVUReader:inputloop()
end end
elseif file_type == "pdf" then elseif file_type == "pdf" or file_type == "xps" or file_type == "cbz" then
if PDFReader:open(filename,"") then -- TODO: query for password if PDFReader:open(filename,"") then -- TODO: query for password
page_num = PDFReader.settings:readsetting("last_page") or 1 page_num = PDFReader.settings:readsetting("last_page") or 1
PDFReader:goto(tonumber(page_num)) PDFReader:goto(tonumber(page_num))

Loading…
Cancel
Save