Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 08-08-2022, 02:57 PM   #1
ajkessel
Connoisseur
ajkessel began at the beginning.
 
Posts: 58
Karma: 10
Join Date: Jul 2017
Device: Kindle Paperwhite 3rd Generation
Any progress with rclone?

The Kobo rclone wrapper appears defunct with no commits or email threads since 2018. Has anyone made any progress since then? rclone would have a big benefit over kobocloud in that it has bidirectional syncing, so the user could remove a book from the kobo and have that removed from the cloud, and also annotations would be updated in cloud storage. I have rclone running on the kobo but don't see a simple way to cause the synced folders to appear in my library. Anyone working on this?
ajkessel is offline   Reply With Quote
Old 08-08-2022, 04:50 PM   #2
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,491
Karma: 129668758
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by ajkessel View Post
The Kobo rclone wrapper appears defunct with no commits or email threads since 2018. Has anyone made any progress since then? rclone would have a big benefit over kobocloud in that it has bidirectional syncing, so the user could remove a book from the kobo and have that removed from the cloud, and also annotations would be updated in cloud storage. I have rclone running on the kobo but don't see a simple way to cause the synced folders to appear in my library. Anyone working on this?
The problem with bidirectional syncing can be that if something gets messed up on the cloud storage, it gets synced back to your Reader to also be messed up. Unless you know for sure that there is nothing wrong on the cloud srorage, I would not want bidirectional syncing.
JSWolf is offline   Reply With Quote
Advert
Old 08-08-2022, 05:31 PM   #3
ajkessel
Connoisseur
ajkessel began at the beginning.
 
Posts: 58
Karma: 10
Join Date: Jul 2017
Device: Kindle Paperwhite 3rd Generation
Quote:
Originally Posted by JSWolf View Post
The problem with bidirectional syncing can be that if something gets messed up on the cloud storage, it gets synced back to your Reader to also be messed up. Unless you know for sure that there is nothing wrong on the cloud srorage, I would not want bidirectional syncing.
I have a pretty simple queue system for my synced cloud folder, and I would really like to be able to remove items on my Kobo once read and not have them re-appear at the next sync. Bidirectional syncing seems like the only way to accomplish this. I would keep a separate backup snapshot of the cloud folder that could be restored in the event things go awry.
ajkessel is offline   Reply With Quote
Old 08-08-2022, 05:33 PM   #4
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,491
Karma: 129668758
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by ajkessel View Post
I have a pretty simple queue system for my synced cloud folder, and I would really like to be able to remove items on my Kobo once read and not have them re-appear at the next sync. Bidirectional syncing seems like the only way to accomplish this. I would keep a separate backup snapshot of the cloud folder that could be restored in the event things go awry.
You read the eBook, remove it, and because of the bidirectional sync, it's also gone from the cloud. You have to have one-way syncing that you can control the direction.
JSWolf is offline   Reply With Quote
Old 08-08-2022, 05:36 PM   #5
ajkessel
Connoisseur
ajkessel began at the beginning.
 
Posts: 58
Karma: 10
Join Date: Jul 2017
Device: Kindle Paperwhite 3rd Generation
Quote:
Originally Posted by JSWolf View Post
You read the eBook, remove it, and because of the bidirectional sync, it's also gone from the cloud. You have to have one-way syncing that you can control the direction.
Right, this is exactly what I want. I don't need the cloud to be an archive -- I just want it to be a queue that disappears as items are read (essentially like Pocket).

The other way to do this would be to somehow cause Kobocloud (or rclone) not to download something again if it had already been downloaded but then removed from the device.

I don't think any of the existing solutions allow for either of these approaches.
ajkessel is offline   Reply With Quote
Advert
Old 08-09-2022, 11:19 AM   #6
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,480
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Just write a minimal shell script that uses rclone/rsync for the bidir sync, and NickelDBus/NickelMenu for the library refresh?
NiLuJe is offline   Reply With Quote
Old 08-09-2022, 02:57 PM   #7
ajkessel
Connoisseur
ajkessel began at the beginning.
 
Posts: 58
Karma: 10
Join Date: Jul 2017
Device: Kindle Paperwhite 3rd Generation
Quote:
Originally Posted by NiLuJe View Post
Just write a minimal shell script that uses rclone/rsync for the bidir sync, and NickelDBus/NickelMenu for the library refresh?
You're right, that works. I just wasn't putting the synced books in the right place. The bidir sync seems reliable enough for my purposes, and I created a separate Google Drive account just for this purpose so any snafu won't infect any other files.
ajkessel is offline   Reply With Quote
Old 08-09-2022, 04:43 PM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,491
Karma: 129668758
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by ajkessel View Post
You're right, that works. I just wasn't putting the synced books in the right place. The bidir sync seems reliable enough for my purposes, and I created a separate Google Drive account just for this purpose so any snafu won't infect any other files.
Don't use Google Drive. It can corrupt things.

Use something else such as Dropbox of OneDrive.
JSWolf is offline   Reply With Quote
Old 08-09-2022, 04:52 PM   #9
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,236
Karma: 74000000
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
Quote:
Originally Posted by JSWolf View Post
Don't use Google Drive. It can corrupt things.



Use something else such as Dropbox of OneDrive.
Jon; google drive is great as a file storage / retrieval tool; just not a good location for a live calibre library (but nothing wrong as a one way clone of a calibre library).

Sent from my Pixel 4a using Tapatalk
PeterT is offline   Reply With Quote
Old 08-10-2022, 04:16 AM   #10
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 74,491
Karma: 129668758
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by PeterT View Post
Jon; google drive is great as a file storage / retrieval tool; just not a good location for a live calibre library (but nothing wrong as a one way clone of a calibre library).

Sent from my Pixel 4a using Tapatalk
Google Drive is not good as a one way clone of your library. If you need to download it, it will be corrupt. The same reason you cannot put a live library is the same reason you cannot put a copy.
JSWolf is offline   Reply With Quote
Old 02-16-2023, 05:54 PM   #11
qkqw
Connoisseur
qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.
 
Posts: 58
Karma: 143000
Join Date: Apr 2022
Device: Kobo Libra 2
After KoboCloud had disappointed me a few times, mostly resulting in me loosing my library (probably due to the bind mount trick), I've decided to give rclone a go. Here's a few pointers if anybody wants to follow along:

Code:
[local]
encoding = Slash,LtGt,DoubleQuote,Colon,Question,Asterisk,Pipe,BackSlash,Ctl,RightSpace,RightPeriod,InvalidUtf8,Dot

[yourRemoteLibrary]
[...]
Kobo uses a VFAT filesystem, which does not like most of the special characters, hence we need to tell rclone to convert them. rclone isn't too smart about this unfortunately, thinking this is a normal Linux setup.

Next, create a script named sync.sh in the same folder:

Code:
#!/bin/sh

RCLONE="/mnt/onboard/.adds/rclone"
REMOTE="yourRemoteLibrary:"
LIBRARY="/mnt/onboard/library"

echo "waiting for internet connection"
r=1;i=0
while [ $r != 0 ]; do
  if [ $i -gt 60 ]; then
    echo "error! no network available"...
    exit 1
  fi
  ping -c 1 -w 3 aws.amazon.com >/dev/null 2>&1
  r=$?
  if [ $r != 0 ]; then sleep 1; fi
  i=$(($i + 1))
done

$RCLONE/rclone \
  --workdir $RCLONE/.cache \
  --ca-cert $RCLONE/cacert.pem \
  --log-file "$RCLONE/rclone.log" \
  --modify-window 3s --ignore-checksum --no-update-modtime \
  --verbose \
  bisync $REMOTE $LIBRARY &&
  qndb -m pfmRescanBooks
A few notes:
  • I've set the workdir to the same folder, in order to not pollute anything else
  • There's a log file called rclone.log which you can use when things go wrong
  • I've had some issues with synchronization and file modification times, as VFAT only seems to support a granularity of up to 2 seconds, hence the modify-window
  • Ignoring the checksum is probably unsafer (only relying on mod-time and file size), but way faster
  • I've decided to not update the file modification times locally, as this led to some interesting problems when rebooting the kobo and having to deal with different timezones

Attention! Before running the script the first time, you need to append a `--resync` flag in order to get bisync working. See the rclone docs: https://rclone.org/bisync/

In case you want to run this script automatically, you can just add a udev rule (e.g. /etc/udev/rules.d/97-rcloud.rules) like this:

Code:
KERNEL=="eth*", ACTION=="add", RUN+="/mnt/onboard/.adds/rclone/sync.sh"
KERNEL=="wlan*", ACTION=="add", RUN+="/mnt/onboard/.adds/rclone/sync.sh"
Thanks @ajkessel who helped me to get started with this.

Ps. You can also just use "rclone sync", if you don't need bidirectional syncing.
qkqw is offline   Reply With Quote
Old 02-17-2023, 02:23 PM   #12
NiLuJe
BLAM!
NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.NiLuJe ought to be getting tired of karma fortunes by now.
 
NiLuJe's Avatar
 
Posts: 13,480
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
Quote:
Originally Posted by qkqw View Post
I've decided to not update the file modification times locally, as this led to some interesting problems when rebooting the kobo and having to deal with different timezones
Yeah, FAT32 is... not really easy on bidirectional sync frameworks. Besides the timestamp granularity issue you mentioned, it also happens to store timestamps in... local time >_<".
So, yeah, UTC vs. local vs. DST; plus weird Linux quirks regarding timezones at boot make this a power keg for stupid timestamp discrepancies .
NiLuJe is offline   Reply With Quote
Old 02-18-2023, 05:16 AM   #13
qkqw
Connoisseur
qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.
 
Posts: 58
Karma: 143000
Join Date: Apr 2022
Device: Kobo Libra 2
Quote:
Originally Posted by NiLuJe View Post
Yeah, FAT32 is... not really easy on bidirectional sync frameworks. Besides the timestamp granularity issue you mentioned, it also happens to store timestamps in... local time >_<".
For now everything seems to work nicely, but just in case, there's a --localtime flag for the bisync command which does exactly that: https://rclone.org/bisync/
qkqw is offline   Reply With Quote
Old 02-20-2023, 10:13 PM   #14
jmacindoe
Junior Member
jmacindoe began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Feb 2023
Device: Kobo Libra H2O, Kobo Clara 2E
Thanks for the guide @qkqw! A couple of small things I'd add

1. On my Clara 2E the network device is mlan0 so I needed this rule
Code:
KERNEL=="mlan*", ACTION=="add", RUN+="..."
2. For some reason the command didn't run unless I wrapped it with /bin/sh and made it run async
Code:
KERNEL=="eth*", ACTION=="add", RUN+="/bin/sh -c '/bin/pull &'"
3. I use "rclone copy --ignore-existing" which will ignore both checksum and modification time, only checking if the file exists. Since I'm mostly syncing ebooks that are never modified, there's no need for any modification checks at all, and as you say the modification time is super buggy. But this won't work if you want to bisync .sdr's of course, since they change.

4. I like to output the log to the screen so I can check it worked. So
Code:
rclone copy --args-etc 2>&1 | /usr/local/kfmon/bin/fbink
Logging the errors 2>&1 was really useful for debugging.

5. For some reason rclone used a different config file location when running from SSH and koreader vs when running from udev. Can be fixed by specifying with the --config flag.
jmacindoe is offline   Reply With Quote
Old 02-21-2023, 03:29 AM   #15
qkqw
Connoisseur
qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.qkqw is at one with the great books of the world.
 
Posts: 58
Karma: 143000
Join Date: Apr 2022
Device: Kobo Libra 2
Quote:
Originally Posted by jmacindoe View Post
1. On my Clara 2E the network device is mlan0 so I needed this rule
Code:
KERNEL=="mlan*", ACTION=="add", RUN+="..."
Interesting. Most examples list a eth* device, never understood why the Kobo would have one.

Quote:
Originally Posted by jmacindoe View Post
2. For some reason the command didn't run unless I wrapped it with /bin/sh and made it run async
Code:
KERNEL=="eth*", ACTION=="add", RUN+="/bin/sh -c '/bin/pull &'"
Might be because it needs an executable bit? The root system is an ext filesystem.

Quote:
Originally Posted by jmacindoe View Post
4. I like to output the log to the screen so I can check it worked. So
Code:
rclone copy --args-etc 2>&1 | /usr/local/kfmon/bin/fbink
Logging the errors 2>&1 was really useful for debugging.
You could also use qndb for that as it can trigger popups and dialogs.

Quote:
Originally Posted by jmacindoe View Post
5. For some reason rclone used a different config file location when running from SSH and koreader vs when running from udev. Can be fixed by specifying with the --config flag.
Should be enough to put the config in the same directory as rclone?
qkqw is offline   Reply With Quote
Reply

Tags
rclone


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tools rclone mount on jailbroken kindle? xiatian Kindle Developer's Corner 0 08-24-2021 05:36 AM
Progress bar: this unknown. (chapter progress) gabryele Kobo Reader 23 12-14-2019 06:02 PM
[WIP] kobo-rclone - Kobo wrapper for Rclone sherman Kobo Developer's Corner 32 08-08-2018 12:00 AM
Progress felinus Conversion 2 06-13-2012 09:06 AM
Novel in Progress plumboz Writers' Corner 10 12-11-2009 12:03 AM


All times are GMT -4. The time now is 08:52 AM.


MobileRead.com is a privately owned, operated and funded community.