-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] DocumentRegistry: add getProviders() and preferred by weight #3651
Conversation
676477e
to
d46e539
Compare
|
||
--- Returns the registered document handlers. | ||
-- @string file | ||
-- @treturn string provider, or nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, table. :-P
-- @string file | ||
-- @treturn string provider, or nil | ||
function DocumentRegistry:getProvider(file) | ||
local providers = self:getProviders(file) | ||
|
||
if #providers >= 1 then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test should probably be in getProviders(), just return nil instead of an empty table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine.
return provider.provider | ||
-- stick highest weighted provider at the front | ||
if #providers >= 1 and provider.weight > providers[#providers].weight then | ||
table.insert(providers, #providers, provider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the two #providers
be 1
if you want to stick it at the front ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely. Kind of a half-finished thought about sorting by weight when I realized that doesn't really matter I suppose.
frontend/document/picdocument.lua
Outdated
@@ -6,7 +6,8 @@ local pic = nil | |||
local PicDocument = Document:new{ | |||
_document = false, | |||
is_pic = true, | |||
dc_null = DrawContext.new() | |||
dc_null = DrawContext.new(), | |||
provider_name = "Picture Document (MuPDF)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this one uses MuPDF: it uses some libjpeg/libpng/libgif directly.
d591f34
to
0a60c7b
Compare
a1a4302
to
9eed3f5
Compare
This is step one toward "open with". References koreader#3345 * Fix up some mimetypes * Add XHTML to supported filetypes * Add a few image files to MuPDF * ".bmp", * ".gif", * ".hdp", * ".j2k", * ".jp2", * ".jpeg", * ".jpg", * ".jpx", * ".jxr", * ".pam", * ".pbm", * ".pgm", * ".png", * ".pnm", * ".ppm", * ".tif", * ".tiff", * ".wdp",
9eed3f5
to
ad3cc46
Compare
Time to change the description from "An ebook reader application" to "An ebook reader and image viewer application". :) |
As color becomes more important to KOReader, on Android Phones and tablets, and, someday a color eink/epaper, the image viewer function might become a factor. Maybe there could be a "Slideshow" plugin some day? |
This is step one toward "open with".
References #3345
@poire-z Any thoughts on this before I start thinking about GUI and settings?
PS Regarding GUI, I was thinking maybe something like this: