View Single Post
Old 06-24-2011, 02:34 PM   #38
Iņigo
Guru
Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.
 
Posts: 712
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, in love with iRex DR800S. Also a K4NT. Now a Kobo Aura
It's working

There is a lot of work to be done yet, but it works.
I'm including some screenshots and some code (patch against r49 of https://bitbucket.org/inigoserna/dr800, remember to do "hg udpdate -C dr800+ -r49" after cloning the repository).

Could anyone check for memory leaks please? Lot of time since I used to code in C...

CTB: covers in file system instead of global.db
* some comments about the code
- the basic idea is to keep global.db free of book covers, they will be in the file system SD_card/System/.icons/medium/XX/asdfgdgdfh.png
- the original method store all the pixbufs (images) for current view loaded from the db in the model, here we get from file system on demand
- it should be a bit slower than original method in case of few books in the view, but this method use less memory, the difference is huge with lots of books so then it should be much faster too
- id is not stored in the model, so we can't use id % 256 to distribute the covers over the covers root directory
I'm using the first 2 chars of the md5_hex_digest on the fullpath of the book
- erGtkIconView needs to be patched in order to get the images as needed on runtime instead of retrieving from db (look previous screenshots in this thread)
- it handles "system" icons perfectly except a few (see below) => screenshots: test10, test11
- IT WORKS!!! => screenshot: test13: image showing the billiard ball is the presumed cover loaded from the file system

TODO:
* this PoC only works with iconview by now, it needs some code for contentview as well => very easy
* "fix" old code which uses model store
- remove pixbuf column and references to it
- don't query db for thumbnails
* remaining special icons not managed by now
- settings apps => screenshots: test12
- shorcuts?
* we use a cache, a hash table
- i think it stores some entries repeated -> glib's g_str_equal bug?
- clean contents when changedir, change_view
- destroy at end
* write a tool (in vala) to move images from db to fs, remove them from db and do a vacuum
* update other programs to copy new icons to fs instead of db
- mdbindex
- cover from uds
* test in the real DR with lots of books and compare

Kind regard,
Iņigo
Attached Thumbnails
Click image for larger version

Name:	test10.png
Views:	63
Size:	101.2 KB
ID:	73277   Click image for larger version

Name:	test11.png
Views:	69
Size:	39.0 KB
ID:	73278   Click image for larger version

Name:	test12.png
Views:	68
Size:	65.6 KB
ID:	73279   Click image for larger version

Name:	test13.png
Views:	68
Size:	60.6 KB
ID:	73280  
Attached Files
File Type: gz covers_in_fs.patch.gz (9.1 KB, 49 views)
Iņigo is offline   Reply With Quote