Quantcast
Channel: MobileRead Forums - Kobo Reader
Viewing all articles
Browse latest Browse all 11157

Choosing a screensaver cover by adding an image into a Shelf

$
0
0
Hi,
Following an idea of davidfor discussed here ; I figure this out :

This is working, basis on database tests only
(where i simulated the adding, the updating, etc by sql cmd) assuming :

1. the shelf is named Screensaver (watch the capital S)
2. the images are in a root directory named screensaver OR are named screensaverXX.ext
3. the images are added into the shelf by a insert (how could be)
4. remove an item from a shelf doesn’t delete the line in ShefContent but sets the _IsDeleted value at ‘true’
5. re-adding the item updates the line with ‘false’ value.
6. the kobo is configured to display the cover of the book which is reading
7. It’s not designed to have more than one image inside the Screensaver shelf at the same time but I’m also curious to see what happen if two images have exactly the same content DateLastRead and ReadStatus...
Options I could imagine are 1. choose randomly (which could be great but from my experience, the system don’t do that) 2. take another image which has an earlier date 3. take always the same image by choosing on another thing (the row, the id, alphabetically ?).


Won’t be able to test it on a kobo device before friday. If somebody want to try... :) (at your own risk and after a backup of koboreader.sqlite)


Code:

create trigger add_screensaver
after insert on ShelfContent
for each row
when new.ShelfName = 'Screensaver'
and new.ContentId like '%screensaver%'
BEGIN
update content
set DateLastRead = '2032-01-01T12:00:00Z', ReadStatus = '1'
where ContentID = new.ContentId
and ContentType = '6';
END

create trigger delete_screensaver
after update of _IsDeleted
on ShelfContent
for each row
when new._IsDeleted = 'true'
and old._IsDeleted = 'false'
and old.ShelfName = 'Screensaver'
and old.ContentId like '%screensaver%'
BEGIN
update content
set DateLastRead = '2015-01-01T12:00:00Z', ReadStatus = '2'
where ContentID = old.ContentId
and ContentType = '6';
END

create trigger addagain_screensaver
after update of _IsDeleted
on ShelfContent
for each row
when new._IsDeleted = 'false'
and old._IsDeleted = 'true'
and new.ShelfName = 'Screensaver'
and new.ContentId like '%screensaver%'
BEGIN
update content
set DateLastRead = '2032-01-01T12:00:00Z', ReadStatus = '1'
where ContentID = new.ContentId
and ContentType = '6';
END

heavily used the doc available here for the relation (even if it’s a little old now)

Viewing all articles
Browse latest Browse all 11157

Trending Articles