koreader-calibre-plugin icon indicating copy to clipboard operation
koreader-calibre-plugin copied to clipboard

Add support for books on SD card

Open harmtemolder opened this issue 2 years ago • 8 comments

(Copied from #9 on sourcehut.)

See MobileRead Forum: https://www.mobileread.com/forums/showpost.php?p=4223014&postcount=52

harmtemolder avatar Dec 27 '22 06:12 harmtemolder

I'm not sure when this was introduced in KoReader but at least 2023.03 supports storing all metadata in the folder "koreader/docsettings/"

Supporting this might solve this for multiple devices

ScrambleTheRamble avatar Apr 16 '23 14:04 ScrambleTheRamble

Having access to the koreader/ folder would also enable reading koreader/history.lua for proper sidecar_changed integration for multiple devices / wireless devices.

The question is: How do we access the koreader/ folder? Currently it seems that the only way to obtain files (at least for wireless connected devices) is through calibres driver. Using the function get_file which is also used to get the sidecars we can access this koreader/ folder if we know the relative path. For wireless connection this is the path relatively to the inbox folder.

I couldn't find any way to obtain that path through calibres driver.

So the only option that currently comes to my mind is a per device configuration where the user has to enter the path of the koreader/ folder manually for each device (and maybe for every connection type? wired vs wireless)(full path vs relative path?).

elmodor avatar May 16 '23 19:05 elmodor

If you have some time I would love your input on this @harmtemolder

elmodor avatar May 24 '23 22:05 elmodor

I don't actually use an SD card with my e-reader, but it has a slot, so I'll go find one to test.

I also read your comments in https://github.com/koreader/koreader/issues/10432 and how you got the get_file function to work with ../../koreader/history.lua. As you said, not very intuitive, but something we could try finding with a scan. (Does history.lua exist? Does koreader/history.lua exist? Does ../koreader/history.lua exist? Etc.) The only caveat would be if books are in a completely different corner of the file system.

harmtemolder avatar May 25 '23 05:05 harmtemolder

I don't see any specific mentions of storing metadata in history.lua in KOReader's release notes: https://github.com/koreader/koreader/releases

But I do see history.lua mentioned in commits as far back as 2016: https://github.com/search?q=repo%3Akoreader%2Fkoreader+%22history.lua%22&type=commits

Not that it really matters when this option was added to KOReader. I was just curious

harmtemolder avatar May 25 '23 05:05 harmtemolder

The history.lua files contains this information. This is an example of its content:

return {
    [1] = {
        ["file"] = "/full/path/book.epub",
        ["time"] = 1681835840,
    },
}

Obtaining the koreader folder could hence solve two issues:

  • To obtain docsettings which can contain all sidecar's (if the option is enabled in koreader to store sidecar content in docsettings instead of next to the epub)
  • To obtain history.lua for a proper last_modified time for (at least) wireless devices

We could try finding it via a scan but the problem is that for wireless devices we would need to use get_file since (as far as I know) this is the only function that allows us to get access to a file on the connected device. If it fails to find it, then we would need a per device configuration. But I think this would also be different for the connection type?

  • For wireless connected devices: the relative path from the inbox folder (it's the folder selected when you do a wireless connection).
  • For wired connected devices: I assume the full path since get_file will start at /? Plus this could be different on different OS systems. However, there we could possibly use python to search for this folder/files.

This might be the way but probably a very complex setup.

elmodor avatar May 25 '23 16:05 elmodor

hey @elmodor @ScrambleTheRamble wanted to ask if this still needed? If so can you try it with latest release and let me know what you see on your end? https://github.com/harmtemolder/koreader-calibre-plugin/releases/tag/v0.6.3

kyxap avatar Jul 27 '24 17:07 kyxap

please upvote author post if you want to see this in future releases with👍 or 👎

kyxap avatar Jul 27 '24 17:07 kyxap