View Single Post
Old 10-13-2011, 11:58 PM   #1
Kolenka
<Insert Wit Here>
Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.Kolenka ought to be getting tired of karma fortunes by now.
 
Kolenka's Avatar
 
Posts: 1,017
Karma: 1275899
Join Date: Jan 2008
Location: Puget Sound
Device: Kindle Oasis, Kobo Forma
Recently Opened on Homescreen Hack for T1

So, I've been spoiled by PRS+ on my 950 letting me show the most recently opened books on the home screen. I wanted something similar on my T1 when I suddenly had some inspiration on how it can be done: SQL Triggers!

A little bit of time, and now I have my home screen behaving differently. Instead of just the recently added books there, it also includes recently opened books. So even when I download a new book, it will also display, making it quite handy.

The following SQL code needs to be run against books.db on both internal memory, and the micro-SD card (if you have one). How to run it is unfortunately left up to the reader at this point. You will need some sort of SQLite client that lets you run SQL queries directly (like MesaSQLite on OS X).

Not entirely user-friendly, but for those who with a bit of know-how, it's been working fine for me on the stock firmware.

Code:
CREATE TRIGGER recently_opened_trigger AFTER UPDATE OF reading_time ON books
BEGIN
   UPDATE books SET added_date = 0 WHERE _id = new._id;
   UPDATE books SET added_date = reading_time WHERE reading_time NOT NULL AND _id <> new._id;
END
Some caveats:
  • Firmware updates may break this.
  • Hack will need to be reapplied if you format memory, or delete books.db.

I guess the upside to SQLite being used is that we can actually create SQL triggers to customize the behavior a little here and there. Within some limits anyhow.
Kolenka is offline   Reply With Quote