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

coverbrowser: allow for batch metadata extraction #3750

Merged
merged 3 commits into from Mar 14, 2018

Conversation

Projects
None yet
3 participants
@poire-z
Contributor

poire-z commented Mar 14, 2018

This adds a button to the Tap Plus menu, that allows extracting metadata and cover images for books in
current directory. Info about the process and questions are initially shown and asked, and the process can be aborted at any moment.

Request from https://www.mobileread.com/forums/showthread.php?t=295302, and I found myself once or twice having to browse my whole home and wait a few seconds on each page.

coverbrowser: allow for batch metadata extraction
This adds a button to the Tap Plus menu, that allows
extracting metadata and cover images for books in
current directory. Info about the process and questions are
initially shown and asked, and the process can be aborted at any
moment.
end
elseif not files or #files == 0 then
UIManager:close(info)
info = InfoMessage:new{text = _("No book were found that would need indexing.")}

This comment has been minimized.

@Frenzie

Frenzie Mar 14, 2018

Member

books

return files
end, info)
if not completed then
abort = Trapper:confirm(_("Do you want to abort extraction?"), _("No"), _("Yes"))

This comment has been minimized.

@Frenzie

Frenzie Mar 14, 2018

Member

Don't abort, Abort?

This comment has been minimized.

@poire-z

poire-z Mar 14, 2018

Contributor

Continue / Abort ?

This comment has been minimized.

@Frenzie

Frenzie Mar 14, 2018

Member

Right, better.

This comment has been minimized.

@Frenzie

Frenzie Mar 14, 2018

Member

Although it might be unclear what continue is.

This comment has been minimized.

@poire-z

poire-z Mar 14, 2018

Contributor

Yes, thought so too. Will go with "Don't abort".

return files
end, info)
if not completed then
abort = Trapper:confirm(_("Do you want to abort extraction?"), _("No"), _("Yes"))

This comment has been minimized.

@Frenzie

Frenzie Mar 14, 2018

Member

Don't abort/Abort?

return self:removeNonExistantEntries()
end, info)
if not completed then
abort = Trapper:confirm(_("Do you want to abort extraction?"), _("No"), _("Yes"))

This comment has been minimized.

@Frenzie

Frenzie Mar 14, 2018

Member

This question occurs a lot. :-P

local prune = Trapper:confirm(_([[
If you have removed many books, or have renamed some directories, it is good to remove them from cache database.

This comment has been minimized.

@Frenzie

Frenzie Mar 14, 2018

Member

the cache database

Cover images will be saved with the adequate size for the current display mode.
If you later change display mode, they may need to be extracted again.
This extraction may take time and use some battery power: you may wish to keep your device plugged.

This comment has been minimized.

@Frenzie

Frenzie Mar 14, 2018

Member

plugged in

return self:extractBookInfo(filepath, cover_specs)
end, info)
if not completed then
abort = Trapper:confirm(_("Do you want to abort extraction?"), _("No"), _("Yes"))

This comment has been minimized.

@Frenzie

Frenzie Mar 14, 2018

Member

Another one :-P

@Frenzie

This comment has been minimized.

Member

Frenzie commented Mar 14, 2018

Looks good besides the luacheck remarks.

end
elseif not files or #files == 0 then
UIManager:close(info)
info = InfoMessage:new{text = _("No books were found that would need indexing.")}

This comment has been minimized.

@Frenzie

Frenzie Mar 14, 2018

Member

I'd say No books were found that need to be indexed.

@Frenzie

lgtm

@poire-z poire-z merged commit 9849d89 into koreader:master Mar 14, 2018

1 check passed

ci/circleci Your tests passed on CircleCI!
Details

@poire-z poire-z deleted the poire-z:coverbro_batchextract branch Mar 14, 2018

end
elseif not files or #files == 0 then
UIManager:close(info)
info = InfoMessage:new{text = _("No book were found.")}

This comment has been minimized.

@Frenzie

Frenzie Mar 15, 2018

Member

Drat, missed one.

@gilali

This comment has been minimized.

gilali commented Mar 16, 2018

Tested successfully on v2015.11-1573-g0a4fb89_2018-03-15
What a script !
More than the poor command line I imagined, this is a new feature fully included in the GUI.
And its integration is very well thought
Thank you a lot guys :)

local go_on = Trapper:confirm(_([[
This will extract metadata and cover images for books in current directory.
Once extraction has started, you can abort at any moment by taping on the screen.

This comment has been minimized.

@Frenzie

Frenzie Mar 16, 2018

Member

tapping on the screen

(I didn't proofread this very well apparently.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment