-
Notifications
You must be signed in to change notification settings - Fork 6
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
Feature request: Reload library while syncing if new books are added. #12
Comments
This would also be useful when books are removed. :-) Personally, I use PocketBook's DropBox integration and then I mount the DropBox folder using So I'm guessing I might take a look at how the DropBox app for PocketBook makes the library reload and see if we can replicate that. But in the meantime, can you perhaps try if there's a Sync button on your PocketBook somewhere and whether it reloads the library perhaps? |
Okay, I've done the research: We need to do roughly the following: int task = FindTaskByAppName("scanner.app")
if (task != -1) {
const char *params = "-scan:<directory to reload>"
SendRequestTo(task, REQ_OPENBOOK, params, strlen(params) + 1, 0, 2000)
} I haven't written any Lua yet, I've only been doing |
Unfortunately KOReader doesn't seem to have hooks for refreshing the library. There's just hacks like this to refresh KOReader's file browser if it happens to be open. But we'd need to hook into other places as well, like when you finish a book and get the option to delete it. That might need some refactoring in KOReader itself :-/ |
When we make changes to the file system — either by moving/copying in the file manager, by deleting a book that's just been finished, or by adding books using the Calibre plugin — the user expects PocketBook's library and home screen to be updated. This commit implements a function that asks the scanner task to rescan the home directory (as set in KOReader's file manager). Unfortunately, KOReader currently doesn't expose any hooks/events for the file system being changed, so this function is only made available as a menu item. The full functionality of automatically rescanning whenever necessary shall be implemented later, when hooks/events in KOReader are available. Related: ckilb#12
I've implemented this as a menu entry for the time being: main...liskin:pocketbooksync.koplugin:reload-library Next step is to hook this into KOReader, but that will require some way to hook into all the places where the rescan needs to happen. I don't honestly expect to get to that any time soon, so if you could open an issue at https://github.com/koreader/koreader/issues that would be immensely helpful. |
@liskin Is it OK for you, if I add your code into this repository? Also, I'd be interested if you could quickly tell me how you found out how to do this. Especially, how did you know about scanner.app and it's params? |
Yeah absolutely, if you think some of the code in my fork is ready, feel free to use it. How I found this - it was a mix of reverse engineering the Dropbox binary and scanner.app using Ghidra and a lot of trial and error. 🙂 |
Happy to elaborate later but am on my mobile at a party now |
When we make changes to the file system — either by moving/copying in the file manager, by deleting a book that's just been finished, or by adding books using the Calibre plugin — the user expects PocketBook's library and home screen to be updated. This commit implements a function that asks the scanner task to rescan the home directory (as set in KOReader's file manager). Unfortunately, KOReader currently doesn't expose any hooks/events for the file system being changed, so this function is only made available as a menu item. The full functionality of automatically rescanning whenever necessary shall be implemented later, when hooks/events in KOReader are available. Related: ckilb#12
Most of us add our books with calibre, it's less inserts/removal's of the USB port and allows for use of magnetic attachment as data is not needed.
The drawback here is, that to get the built in library of the pocketbook to update to add the new books to it you need to either reboot the device or connect it to the PC with a USB cable.
I'd like to request adding a reload of the library when new books are added, this would make this addon as complete as can be for pocketbook integration to koreader.
The text was updated successfully, but these errors were encountered: