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 07-23-2018, 11:58 AM   #1
zavorra
Junior Member
zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.
 
zavorra's Avatar
 
Posts: 8
Karma: 9886
Join Date: Jul 2018
Device: Kobo Clara HD
Sync to gdrive!

This is something I badly hacked together to sync a folder on GDrive with my Kobo Clara HD. It should work on all other Kobo...

The attached archive contains the following files:

- ".drive/drive" is a command line utility I built from this (https://github.com/odeke-em/drive) github repository.
- ".drive/fbink" is the NiLuJe utility to print on eink devices. (https://www.mobileread.com/forums/sh...d.php?t=299110)
- ".drive/sync_gdrive.sh" is the actual script I run to sync the "gdrive/EbookSync" folder on my kobo sdcard with the "EbookSync" folder on my gdrive
- ".drive/config.sh" is a file which can be modified to change the folders to be synced
- ".drive/ca-certificates.crt" taken from (https://packages.ubuntu.com/bionic/ca-certificates) contains the certificate authorities shipped with Mozilla's browser to allow SSL-based applications to check for the authenticity of SSL connections.
- the stuff in ".adds/kfmon/config" and in "00_hacks" is what I use to launch it with NiLuJe KFMON (https://www.mobileread.com/forums/sh...d.php?t=274231)


Installation:

1) Create a "EbookSync" folder on your gdrive, set as readable from all those which have the link. This is the folder where you will put your ebooks to send them to the reader.

2) explode the archive on your kobo sdcard

3) to authorize the kobo on your gdrive you have to:
- go to "https://accounts.google.com/o/oauth2...2Fauth%2Fdrive"
- authorize your account
- copy the provided authorization code, and paste it into a new file on the .drive folder on your kobo, naming it "authcode.txt"

4) Lauch it. If you have kfmon installed you should be able to do it from the provided icon, otherwise you will have to hack your preferred launcher to start /mnt/onboard/.drive/sync_gdrive.sh On the first run it should create a gdrive folder on your kobo, with a .gd subfolder needed to authenticate the client on your GDrive.

After syncing the script will fake an USB connection / disconnection to force the kobo to update the library. You have to push the "connect" button or the new ebooks won't be added to the nickel catalog.

As of now, I arranged this for my needs, and I am short of time to maintain it. You can use it at your own risk. If it is of some interest I can upload it on github.

Sorry for the bad code and for the bad english, I am in a hurry


Z
Attached Files
File Type: zip drive_20180724.zip (3.10 MB, 309 views)

Last edited by zavorra; 07-24-2018 at 09:53 AM. Reason: attachment updated
zavorra is offline   Reply With Quote
Old 07-23-2018, 12:29 PM   #2
Derf
Connoisseur
Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.
 
Derf's Avatar
 
Posts: 99
Karma: 1173714
Join Date: Jul 2018
Location: Long Island, NY
Device: Kobo Clara HD / Mac User
Cool!
Derf is offline   Reply With Quote
Advert
Old 07-23-2018, 12:49 PM   #3
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,477
Karma: 26012494
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
@zavorra: That's not a static build of FBInk, so it won't work for people who don't have my standalone version installed .

I basically have three different types of builds in the wild:

* FBInk: shared, full feature set.
* KFMon & KOReader: static, minimal feature set.
* KoboStuff: static, full feature set.

You can easily pull the latest KoboStuff binary from here, if need be .

EDIT: You can also probably shorten the watch config to just this:

Code:
[watch]
; Those next two keys are MANDATORY
filename = /mnt/onboard/00_hacks/kfmon_icons/xxx_GDriveSync.png ; Absolute path of the icon to watch for
action = /mnt/onboard/00_hacks/scripts/GDriveSync.sh                    ; Absolute path of the command to launch when the icon is opened
; The following keys are NOT mandatory
block_spawns = 1
EDIT²: I'd also find a way to get drive to use a custom certdb path instead of clobbering the system's one .

Last edited by NiLuJe; 07-23-2018 at 02:24 PM.
NiLuJe is offline   Reply With Quote
Old 07-23-2018, 01:52 PM   #4
Mrs_Often
Wizard
Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.
 
Mrs_Often's Avatar
 
Posts: 1,775
Karma: 2694823
Join Date: Dec 2011
Location: The Netherlands
Device: Kobo Touch, Glo, Clara HD
Yay! And then implement the script that collects all email attachments from Gmail inbox and saves them in EbookSync folder in Gdrive automatically, and we have email to Kobo!


Quote:
Originally Posted by zavorra View Post

2) explode the archive on your kobo sdcard

Last edited by Mrs_Often; 07-23-2018 at 01:56 PM.
Mrs_Often is offline   Reply With Quote
Old 07-23-2018, 05:51 PM   #5
Derf
Connoisseur
Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.Derf ought to be getting tired of karma fortunes by now.
 
Derf's Avatar
 
Posts: 99
Karma: 1173714
Join Date: Jul 2018
Location: Long Island, NY
Device: Kobo Clara HD / Mac User
Quote:
Originally Posted by Mrs_Often View Post
Yay! And then implement the script that collects all email attachments from Gmail inbox and saves them in EbookSync folder in Gdrive automatically, and we have email to Kobo!


If that is possible, it would really be awesome because that is one of the key features that people love about Kobo’s closest competitor : Kindle.
Derf is offline   Reply With Quote
Advert
Old 07-24-2018, 04:18 AM   #6
Mrs_Often
Wizard
Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.Mrs_Often ought to be getting tired of karma fortunes by now.
 
Mrs_Often's Avatar
 
Posts: 1,775
Karma: 2694823
Join Date: Dec 2011
Location: The Netherlands
Device: Kobo Touch, Glo, Clara HD
Sync to gdrive!

Quote:
Originally Posted by Derf View Post
If that is possible, it would really be awesome because that is one of the key features that people love about Kobo’s closest competitor : Kindle.


I actually had a working script running a while ago doing just that, in a Kobo-dedicated gmail account. However it stopped working at some point and I never checked or tried to fix it because the Kobo browser stopped being able to download documents from gdrive. However, it might be worth looking into this again now:

https://www.labnol.org/internet/send...e-drive/21236/


Edit: I just had a look at the URL I shared... apparently the auto-save to drive thing is just a spreadsheets add-on now. I remember following instructions mucking around with a script. Nice and easy now! I'll go give it a try.

Edit 2: The "Save emails and attachments" add-on works like a charm!

Last edited by Mrs_Often; 07-24-2018 at 07:08 AM.
Mrs_Often is offline   Reply With Quote
Old 07-24-2018, 09:52 AM   #7
zavorra
Junior Member
zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.
 
zavorra's Avatar
 
Posts: 8
Karma: 9886
Join Date: Jul 2018
Device: Kobo Clara HD
Quote:
Originally Posted by NiLuJe View Post
@zavorra: That's not a static build of FBInk

...

EDIT: You can also probably shorten the watch config to just this:

...

EDIT²: I'd also find a way to get drive to use a custom certdb path instead of clobbering the system's one .
@NiLuJe,

I am uploading a new version with the static fbink and the shortened watch config as you suggested, thanks.

The certdb path seems to be wired on the golang sources (https://golang.org/src/crypto/x509/root_linux.go) and I can't spot an easy way to add my own path...

Last edited by zavorra; 07-24-2018 at 09:54 AM.
zavorra is offline   Reply With Quote
Old 07-29-2018, 02:23 PM   #8
aymeric106
Junior Member
aymeric106 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2015
Device: kobo aura
Quote:
Originally Posted by Mrs_Often View Post
Yay! And then implement the script that collects all email attachments from Gmail inbox and saves them in EbookSync folder in Gdrive automatically, and we have email to Kobo!
You can do it very easily with IFTTT (https://ifttt.com/)

Create an applet ( IF new attachment in gmail THEN Upload to Drive)

aymeric106 is offline   Reply With Quote
Old 07-29-2018, 04:02 PM   #9
aymeric106
Junior Member
aymeric106 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2015
Device: kobo aura
When i run the script, i've got an error

'token expired and refresh token is not set'. I tried to generate a new code, but same issue

Drivepull.log
Quote:
Resolving...Get https://www.googleapis.com/drive/v2/...ashed%3Dfalse: oauth2: token expired and refresh token is not set
sync_gdrive.log
Quote:
Sun Jul 29 21:56:52 CEST 2018
Sun Jul 29 21:56:52 CEST 2018
gdrive sync
...
Resolving...

Get https://www.googleapis.com/drive/v2/...ashed%3Dfalse: oauth2: token expired and refresh token is not set
drive pull returned 255
forcing DB update
Any idea ?
aymeric106 is offline   Reply With Quote
Old 07-30-2018, 07:44 AM   #10
zavorra
Junior Member
zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.zavorra knows what is on the back of the AURYN.
 
zavorra's Avatar
 
Posts: 8
Karma: 9886
Join Date: Jul 2018
Device: Kobo Clara HD
It happened once also to me.

I am not sure but try removing authcode.txt, create a new one with a new authorization code and make sure there is a blank line at the end of file

Z
zavorra is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Glo Help Email? Dropbox? Gdrive? diahr Kobo Reader 7 07-29-2017 01:39 AM
Moon+ Reader preventing Gdrive downloads KipPrdy Android Devices 0 06-15-2017 05:41 PM
[synchronization] synch calibre via Gdrive with several Pc godlich Library Management 6 01-17-2014 03:46 AM
Folder problems with GDrive BlackBomber Library Management 3 08-05-2013 12:56 AM
gDrive 0.6 - PHP script to store files on Gmail TadW Lounge 0 02-24-2005 05:08 PM


All times are GMT -4. The time now is 07:53 PM.


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