harmtemolder / koreader-calibre-plugin

A calibre plugin to synchronize metadata from KOReader to calibre
GNU General Public License v3.0
75 stars 7 forks source link

[Bug]: Moving books to different folders causes them to appear as "Not in device" #45

Closed onatbas closed 3 months ago

onatbas commented 3 months ago

KOreader Sync plugin version

0.6.7

KOreader version

2024.07

Operating System

Windows

Connection type

Wireless (over wifi)

Describe the bug

When I move books on the device to other folders, the books appear as "Not in Device" when synced to Calibre again. This persists even if I move the books back into the previous location. A workaround is to send the book to device again, which overrides the book (but not the metadata thankfully) and then it works.

How to reproduce

  1. Send a book to the device using content server in Calibre for wireless transfer.
  2. In KOReader, move the book to another folder
  3. Sync Calibre again.
  4. See that the book is not appearing as "In Device" anymore.

Expected behavior

The book should be found in the new location, or even if it is moved to the previous location.

Provide details output from plugin pop-up window

No response

Screenshots

No response

Any additional info

I organize my books into a few folders. next-up, read, unread, archived. In the beginning I thought the paths were causing the confusion on the Calibre side when I move them to folders. To fix this, I make a custom pathing operation using this template for file paths to sync into:

I use folders for read, unread, next-up etc. and my template pathing allows me to push books into relevant folders, it looks like this:

{#collections:contains(^read$,read,)}{#collections:contains(^next-up$,next-up,)}{#collections:contains(^unread$,unread,)}{#collections:contains(^((un)?read)|(next-up)$,,archived)}/{title} - {Author} ({id})

In simple terms, The #collections field determine whether the book is sent into one of these folders:

read/BOOKTITLE.epub
unread/BOOKTITLE.epub
next-up/BOOKTITLE.epub
archived/BOOKTITLE.epub

On every send to device operation, I see that get end up in the right folder. If I finish a book, I move them to "read" folder and mark them as "read" in their #collections field in Calibre to match the paths. This still didn't fix it. But the workaround of sending the book again at least restores the status.

kyxap commented 3 months ago

Provide details output from plugin pop-up window - is actually usefully information for bug reports but anyway.

My understanding that this is not a bug with koreader-calibre-plugin it's how calibre works with koreader. When you change book folder calibre going to lost track of your book (the green check mark will be removed from the UI ✅) and metadata file is not updated on behind the scenes. Sync plugin is relying on calibre file tracking on the device to be able to make sync. And again tracking your book on the device is calibre wifi driver responsibility not the sync plugin feature.

I do not remember how I've configured my book folder but seems like calibre does not support multiple folder (I've checked UI did not find any clues) if it does let me know.

onatbas commented 3 months ago

image

There it is.

Thanks for the explanation. Also, it absolutely does support multiple folders, so long as things stay put in their own folders. The template I provided above will make the sync work with 4 folders and you'll get to keep them ticked unti you move.

kyxap commented 3 months ago

I have no idea how to use that template and where, can you give me a link to the any sort of documentation?

kyxap commented 3 months ago

so does your books stay in sync (green check mark does not disappears) with calibre using your template and moving books from one to another folder?

UPD: missed that one:

you'll get to keep them ticked unti you move.

so yeah without calibre\folder sync we can't do much at this point, maybe open a bug for calibre? :)

onatbas commented 3 months ago

No, they stay in sync so long as they’re in the folder they’re sent into, but it works with multiple folders. The minute I move, the checkmark is gone.

The template goes into here: image

It lets the user define what path they want their books to go into, and with what name. An explanation and a good template editor is available under "Preferences > Send Books to device > Template Editor", which looks like this:

image