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 02-01-2017, 02:17 PM   #31
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by kido.resuri View Post
You can't use the real and virtual sd at the same time, can you?
Yes this works. However, I have trouble to update the library after umount /mnt/sd (and this happens when the user removes the sd) and mount bind again. Then the books of the virtual sd get only shown in the library if I touch (or rename) them before executing "sd add /dev/mmcblk1p1 >> /tmp/nickel-hardware-status".

Edit: I guess I mistook "at the same time". I meant to say you can use the virtual sd, when the real sd is inserted. But now I see that you rather meant that you can access the content of both at the same time

Last edited by tshering; 02-01-2017 at 03:10 PM.
tshering is offline   Reply With Quote
Old 02-01-2017, 02:28 PM   #32
kido.resuri
Groupie
kido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura about
 
Posts: 172
Karma: 4282
Join Date: Dec 2016
Location: Hungary
Device: Kobo Aura H2O
Quote:
Originally Posted by frostschutz View Post
You can try using a subdir of /mnt/sd as mount point instead of /mnt/sd itself. (It will vanish and need to be re-mounted when someone actually puts in an sd card later)
Maybe, but Kobo puts some data, creates some subdirs on /mnt/sd after the mount, so I don't know what happens when a virtual sd is mounted in a subdir of /mnt/sd
kido.resuri is offline   Reply With Quote
Advert
Old 02-01-2017, 02:33 PM   #33
kido.resuri
Groupie
kido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura about
 
Posts: 172
Karma: 4282
Join Date: Dec 2016
Location: Hungary
Device: Kobo Aura H2O
Quote:
Originally Posted by tshering View Post
However, I have trouble to update the library after umount /mnt/sd (and this happens when the user removes the sd) and mount bind again. Then the books of the virtual sd get only shown in the library if I touch (or rename) them before executing "sd add /dev/mmcblk1p1 >> /tmp/nickel-hardware-status".
I did an umount after the "sd add", and the book was still shown in the library, however when I tried opening it, Kobo displayed a message that the document couldn't be opened and something about DRM. (the book was calibre's user manual)
kido.resuri is offline   Reply With Quote
Old 02-01-2017, 02:40 PM   #34
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Taking a sub folder of /mnt/sd as mount point, as advised by Frostschutz, seems to have solved my problem with the library not updating after remounting the virtual sd.

Last edited by tshering; 02-01-2017 at 02:49 PM.
tshering is offline   Reply With Quote
Old 02-01-2017, 03:22 PM   #35
kido.resuri
Groupie
kido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura about
 
Posts: 172
Karma: 4282
Join Date: Dec 2016
Location: Hungary
Device: Kobo Aura H2O
What if you mount /mnt/onboad/.mysd to /mnt/sd/virtual, then after nickel does the content update, you execute this sql query:

Code:
UPDATE content SET ContentID = REPLACE(ContentID,'/mnt/sd/virtual/','/mnt/onboard/.mysd/'), BookID = REPLACE(BookID,'/mnt/sd/virtual/','/mnt/onboard/.mysd/');
UPDATE Activity SET Id = REPLACE(Id,'/mnt/sd/virtual/','/mnt/onboard/.mysd/');
DELETE FROM Activity WHERE Id LIKE '%/mnt/sd/virtual/%';

I tried, but edited the database offline, then copied back over ftp, rebooted, and it works. So it should work on Kobo itself with a script.

EDIT: I tried the query on the Kobo itself, and it works. nickel needs a restart tho to see the changes. It would be good to detect when nickel finishes the content update from the virtual sd, so we could execute a script with the query and make a restart. Maybe it's not a real good idea, because every time it gets mounted, the old files are updated to, so it would be a better idea to move the content already read by nickel to another subdir. Makes it too complicated and vulnerable maybe.

Last edited by kido.resuri; 02-01-2017 at 03:42 PM. Reason: added some comments after testing
kido.resuri is offline   Reply With Quote
Advert
Old 02-01-2017, 04:24 PM   #36
kido.resuri
Groupie
kido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura about
 
Posts: 172
Karma: 4282
Join Date: Dec 2016
Location: Hungary
Device: Kobo Aura H2O
Ok, played with it a bit.

Code:
mkdir -p /mnt/onboard/.mysd
mkdir -p /mnt/onboard/.mybooks
Then I copied 3 epubs over ftp to /mnt/onboard/.mysd

Then i did over telnet:
Code:
mount --bind /mnt/onboard/.mysd/ /mnt/sd/virtual
echo sd add /dev/mmcblk1p1 >> /tmp/nickel-hardware-status
(wait untill nickel finished reading content)
umount /mnt/sd/virtual/
mv /mnt/onboard/.mysd/* /mnt/onboard/.mybooks/
echo "UPDATE Activity SET Id = REPLACE(Id,'/mnt/sd/virtual/','/mnt/onboard/.mybooks/');" | sqlite3 "/mnt/onboard/.kobo/KoboReader.sqlite"
echo "UPDATE content SET ContentID = REPLACE(ContentID,'/mnt/sd/virtual/','/mnt/onboard/.mybooks/'), BookID = REPLACE(BookID,'/mnt/sd/virtual/','/mnt/onboard/.mybooks/') WHERE (ContentID LIKE '%/mnt/sd/virtual/%') OR (BookID LIKE '%/mnt/sd/virtual/%');" | sqlite3 "/mnt/onboard/.kobo/KoboReader.sqlite"
reboot
After this, I had the 3 books in the library, nickel worked on them a bit to create the cover images, after that they opened perfectly. I think this could be automated. The slowest command was the sql query for content table, it took a few seconds to finish, but everything else was quite fast. The UPDATE Activity sql query could be changed to DELETE, as no new book notification is shown after the reboot, so it makes no sense really to UPDATE it.

Last edited by kido.resuri; 02-02-2017 at 03:51 PM. Reason: modified sql query to work faster
kido.resuri is offline   Reply With Quote
Old 02-01-2017, 04:58 PM   #37
anarcat
Connoisseur
anarcat began at the beginning.
 
anarcat's Avatar
 
Posts: 81
Karma: 10
Join Date: Jul 2013
Location: Planet Ocean
Device: Kobo Glo HD, Onyx Boox Note Pro 2, Samsung Galaxy Tab S5e, Pixel 4a
Quote:
Originally Posted by kido.resuri View Post
Code:
reboot
reboot is actually necessary? seems a bit extreme...
anarcat is offline   Reply With Quote
Old 02-01-2017, 05:08 PM   #38
kido.resuri
Groupie
kido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura about
 
Posts: 172
Karma: 4282
Join Date: Dec 2016
Location: Hungary
Device: Kobo Aura H2O
Seems extreme, but unless anyone can find a better way to make nickel recognize the database changes, i have no better idea.
kido.resuri is offline   Reply With Quote
Old 02-01-2017, 05:20 PM   #39
anarcat
Connoisseur
anarcat began at the beginning.
 
anarcat's Avatar
 
Posts: 81
Karma: 10
Join Date: Jul 2013
Location: Planet Ocean
Device: Kobo Glo HD, Onyx Boox Note Pro 2, Samsung Galaxy Tab S5e, Pixel 4a
can't you kill nickel and restart it?
anarcat is offline   Reply With Quote
Old 02-01-2017, 05:30 PM   #40
kido.resuri
Groupie
kido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura about
 
Posts: 172
Karma: 4282
Join Date: Dec 2016
Location: Hungary
Device: Kobo Aura H2O
Would that make any difference? Besides, i would have to make sure wifi is off when starting nickel, and that would make it impossible to run any telnet commands... sure a script could do it, but i find reboot more clean and fast than restarting nickel.
kido.resuri is offline   Reply With Quote
Old 02-01-2017, 06:03 PM   #41
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by kido.resuri View Post
What if you mount /mnt/onboad/.mysd to /mnt/sd/virtual, then after nickel does the content update, you execute this sql query:

Code:
UPDATE content SET ContentID = REPLACE(ContentID,'/mnt/sd/virtual/','/mnt/onboard/.mysd/'), BookID = REPLACE(BookID,'/mnt/sd/virtual/','/mnt/onboard/.mysd/');
UPDATE Activity SET Id = REPLACE(Id,'/mnt/sd/virtual/','/mnt/onboard/.mysd/');
DELETE FROM Activity WHERE Id LIKE '%/mnt/sd/virtual/%';

I tried, but edited the database offline, then copied back over ftp, rebooted, and it works. So it should work on Kobo itself with a script.

EDIT: I tried the query on the Kobo itself, and it works. nickel needs a restart tho to see the changes. It would be good to detect when nickel finishes the content update from the virtual sd, so we could execute a script with the query and make a restart. Maybe it's not a real good idea, because every time it gets mounted, the old files are updated to, so it would be a better idea to move the content already read by nickel to another subdir. Makes it too complicated and vulnerable maybe.
You might be able to use a trigger to do the change as the book is added when the virtual SD card is inserted. But, you also need to prevent the book from being added each time the virtual SD card is inserted.
davidfor is offline   Reply With Quote
Old 02-02-2017, 03:52 AM   #42
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by kido.resuri View Post
Would that make any difference? Besides, i would have to make sure wifi is off when starting nickel, and that would make it impossible to run any telnet commands... sure a script could do it, but i find reboot more clean and fast than restarting nickel.
I do not exactly understand your use case of the whole thing, but I wonder whether it is necessary to move the new files and modify the database immediately after nickel has processed them. You could as well continue to use your reader (for reading), and if you exit nickel and nickel gives control back to start_nickel.sh (from the above description I guess you are using KSM), the script could check whether there are files in /mnt/onboard/.mysd, and if so move them to /mnt/onboard/.mybooks and modify the database. And once you really need that the library knows the newly downloaded books and those located on the external sd, you simply exit nickel and reenter again.
tshering is offline   Reply With Quote
Old 02-02-2017, 09:46 AM   #43
kido.resuri
Groupie
kido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura about
 
Posts: 172
Karma: 4282
Join Date: Dec 2016
Location: Hungary
Device: Kobo Aura H2O
Well, the above was just a test, to see if this works. I didn't use any scripts yet, but manually started the commands in telnet. I don't use KSM, but according to that, I can't simply close nickel and start it again if the wifi is on, is that right? And if I'm on telnet, executing commands manually, it didn't sound a good idea to turn the wifi off, so I used reboot command.

This whole thing could be of course done on next reboot, before nickel starts, as the user won't unmount the virtual sd on normal usage. But what if (s)he wants to plug in a real sd when the virtual one is still mounted? I didn't try that yet.
kido.resuri is offline   Reply With Quote
Old 02-02-2017, 10:08 AM   #44
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by kido.resuri View Post
Well, the above was just a test, to see if this works. I didn't use any scripts yet, but manually started the commands in telnet. I don't use KSM, but according to that, I can't simply close nickel and start it again if the wifi is on, is that right? And if I'm on telnet, executing commands manually, it didn't sound a good idea to turn the wifi off, so I used reboot command.

This whole thing could be of course done on next reboot, before nickel starts, as the user won't unmount the virtual sd on normal usage. But what if (s)he wants to plug in a real sd when the virtual one is still mounted? I didn't try that yet.
The books of the the real sd are read into the library. The books of the virtual sd get removed from the library (if I remember correctly).
tshering is offline   Reply With Quote
Old 02-02-2017, 02:28 PM   #45
kido.resuri
Groupie
kido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura aboutkido.resuri has a spectacular aura about
 
Posts: 172
Karma: 4282
Join Date: Dec 2016
Location: Hungary
Device: Kobo Aura H2O
Quote:
Originally Posted by davidfor View Post
You might be able to use a trigger to do the change as the book is added when the virtual SD card is inserted. But, you also need to prevent the book from being added each time the virtual SD card is inserted.
What trigger could be used? How to (easily) check if the book is added?
Moving the files can prevent beeing added each time.
kido.resuri is offline   Reply With Quote
Reply

Tags
filesystem, hack, reload, sdcard


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Refresh library MrX Calibre 11 06-07-2016 04:45 PM
Is it no possible to refresh the page automatically in Moon+ Reader? cicabum Android Devices 4 10-22-2015 12:23 PM
Library refresh after editing metadata kelleybean Library Management 2 01-13-2015 09:10 AM
Refresh library view? Pepin33 Development 4 08-31-2012 05:18 AM
7.40 - Automatically refresh the covers edbro Calibre 0 01-14-2011 10:02 PM


All times are GMT -4. The time now is 10:13 PM.


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