07-19-2012, 04:07 AM | #46 | |
Wannabe Connoisseur
Posts: 425
Karma: 2516674
Join Date: Apr 2011
Location: Geelong, Australia
Device: Kobo Libra 2, Kobo Aura 2, Sony PRS-T1, Sony PRS-350, Palm TX
|
Quote:
At worst, you might find that some books mysteriously jump to the top of your recently opened list. At best, you won't notice a thing . Either way, I don't think that trigger will cause any damage. Cheers, Simon. |
|
07-19-2012, 09:59 AM | #47 |
ebooknut
Posts: 297
Karma: 688154
Join Date: Oct 2011
Device: Kindle Voyage & Oasis
|
How to Create "Recently Opened" Trigger on Mac using MesaSQLite
@Snarkophilus: I think you're right that the database is being updated a lot. I'm getting the spinning arrows more than usual, plus for some reason the alphabetization when sorting by filename has gone wonky (it seems to be using "date added" rather than "alphabetical" for some, but not all, books).
I experimented some more -- this is like a puzzle where you know you have all the pieces but you're not sure where to put them. But I think I finally figured out which snippets of code go in which MesaSQLite box. Screenshots attached. So far everything seems to be working properly. Yippee! Thanks Simon and jackie_w for your help -- and of course, thank you Kolenka for the nice piece of code! Last edited by pssquirrel; 07-19-2012 at 02:09 PM. Reason: updated info, including solution |
Advert | |
|
07-19-2012, 08:23 PM | #48 |
Junior Member
Posts: 4
Karma: 2034
Join Date: Dec 2011
Device: Sony PRS T1
|
I ran the code in the books.db from both the reader and my SD card using the 'SQLite Manager' add-on for Firefox, and everything worked perfectly
Thanks so much for the code and the great step-by-step!! |
07-20-2012, 12:04 AM | #49 |
ebooknut
Posts: 297
Karma: 688154
Join Date: Oct 2011
Device: Kindle Voyage & Oasis
|
I feel like a complete idiot. After successfully figuring out how to create the trigger using MesaSQLite, I decided to try it using SQLite Manager (which I wasn't aware of before, and after taking a look, I rather like it). Should be simple, right? Well, I've tried for over an hour, and every time I try, I get an error -- most commonly "near UPDATE: syntax error"
J.L.C., would it be possible for you to upload a screenshot of what you did? The closest I get without an error is attached. When I remove the quote marks from the WHEN clause, I get an error message. But the resulting trigger with quote marks isn't exactly the same as Kolenka's original code, and I don't know enough about this stuff to know if it makes a difference. Help! Last edited by pssquirrel; 07-20-2012 at 12:57 AM. Reason: added screenshots and more details |
07-20-2012, 10:20 AM | #50 |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
in the absence of JLC, re: the SQLite Manager Firefox add-on, you could try doing it this way:
The attached image is before the trigger is created, not after. |
Advert | |
|
07-20-2012, 11:27 AM | #51 |
ebooknut
Posts: 297
Karma: 688154
Join Date: Oct 2011
Device: Kindle Voyage & Oasis
|
OMG - thank you so much, jackie_w!!!
That was sooooooooooooooooooooo much easier than messing with the "create trigger" interface. You are the very, very best! Mucho karma to you! |
07-20-2012, 11:36 AM | #52 | |
Junior Member
Posts: 4
Karma: 2034
Join Date: Dec 2011
Device: Sony PRS T1
|
Quote:
Attached is my screenshot. I am on Ubuntu 11.10 64-bit. I opened the books.db using the 'All files' option from the open file dialogue. Then just copied the code as written from the OP into the 'Enter SQL' field on the 'Execute SQL' tab. Then I just copied the books.db files back over to the reader and over-wrote the existing ones. |
|
07-20-2012, 11:47 AM | #53 |
ebooknut
Posts: 297
Karma: 688154
Join Date: Oct 2011
Device: Kindle Voyage & Oasis
|
Thanks JLC! Karma to you, too!
I have to laugh because both you and jackie_w seem to have gone immediately to the Execute SQL tab, where this task was easy as can be, while I spent hours and hours messing with the "Create Trigger" tool, which, from its name, would seem to be the best way to create a trigger -- not! In any event, I am so very pleased to have learned a few things about SQLite databases and creating triggers. Happy Day! |
09-03-2012, 04:32 PM | #54 |
Junior Member
Posts: 5
Karma: 10
Join Date: Aug 2012
Device: Sony PRS-T1
|
Hi!
I'm having problems when I switch between books in different storages. After some tests, it seems to me that the trigger is being launched when I stop reading a book and I open the next. If the book is in the same storage, there is no problem, and the update is done. However, if the book is in the SD card, the trigger can't update the previous book since it's in a different database. ¿Any solution to this? Cheers! |
09-03-2012, 05:44 PM | #55 | ||||
ebooknut
Posts: 297
Karma: 688154
Join Date: Oct 2011
Device: Kindle Voyage & Oasis
|
Quote:
Quote:
Quote:
Quote:
|
||||
09-04-2012, 05:09 AM | #56 |
Junior Member
Posts: 5
Karma: 10
Join Date: Aug 2012
Device: Sony PRS-T1
|
Hi pssquirrel,
Thanks for the tips. Of course I had already tried all those options before my previous post. This is the trigger I currently have in both databases (internal and SD): Code:
CREATE TRIGGER recently_opened_trigger AFTER UPDATE OF reading_time ON books BEGIN UPDATE books SET added_date = reading_time WHERE reading_time NOT NULL AND _id <> new._id; END; |
09-04-2012, 06:11 AM | #57 |
Junior Member
Posts: 5
Karma: 10
Join Date: Aug 2012
Device: Sony PRS-T1
|
Hi!
Ok, it seems I have solved the problem. For whatever reason, the original trigger simply does not work for me, and I don't really understand how it works for everyone else :P Here is the trigger with some tweaks so that it will work with books in both storages. It has the problem of seeing the current book twice, but it's an improvement. I'll try to solve that later. Code:
CREATE TRIGGER recently_opened_trigger AFTER UPDATE OF reading_time ON books BEGIN UPDATE books SET added_date = new.reading_time WHERE new.reading_time NOT NULL AND _id = old._id; END Last edited by Xosen; 09-04-2012 at 12:38 PM. |
09-05-2012, 08:31 AM | #58 |
Addict
Posts: 299
Karma: 511516
Join Date: Jun 2004
Device: Kobo Forma; Pocketbook Color 633
|
Hack still works on a T2! Great.
|
09-06-2012, 03:54 PM | #59 |
Member
Posts: 12
Karma: 10
Join Date: Aug 2012
Device: PRS-T2
|
Just used it on my T2 !
I don't understand why Sony doesn't do this by default. |
10-31-2012, 09:14 AM | #60 |
Readaholic
Posts: 255
Karma: 1058454
Join Date: Jul 2009
Location: Swindon, UK
Device: Sony PRS-T2 (previously 505 and 650)
|
I applied this to my T2 and whilst it worked as advertised, my device took a *really* long time to restart afterwards (I have a large number of books on SD card, so that may well be the cause). More problematically, the change also lost my collections and notes (bookmarks).
I imagine that I could have got round this by reloading my library from Calibre, but given the number of books involved I decided to put that on my "to be done sometime" pile. The good news is that copying my backup copies (paranoia can be good!) of the books.db files back onto the device and sd card worked perfectly, so I've lost nothing. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Accessing the most recently opened ebooks | africalass | Library Management | 11 | 04-03-2011 04:14 AM |
Sideloaded book on homescreen solution for Rooted NC | mad5427 | Nook Developer's Corner | 17 | 03-14-2011 08:20 AM |
I don't know what to put on my homescreen. | SCION | Nook Developer's Corner | 3 | 01-16-2011 01:09 AM |
Content PDF: Homescreen shows Filename instead of Title (Metadata) | bear4hunter | Amazon Kindle | 1 | 08-02-2010 12:35 AM |
Feature request: show recently opened e-books | yegorich | Calibre | 1 | 01-18-2010 11:35 AM |