SqlAlbum image retrieval
Seb Ruiz
ruiz at kde.org
Mon Jun 9 04:11:06 CEST 2008
I'd like to implement the following logic for image handling for
SqlAlbums. The rationale is that in Amarok 1 we had lots of
difficultly keeping track of where the correct image to use resides on
the system. Case in point is to examine the situation where there is a
cover.jpg in a directory and the user has also downloaded artwork from
the web. My logic ensures that we always use the last set image, and
allows us to simplify code by getting rid of stuff like: if(
!findAmazonImage() ) findDiskImage().
If there are no objections I'll go ahead and implement it.
- sebr
psuedo code:
*** Retreival:
if scaled image found in cache
return cache
get image path from database
if path not empty and image exists
scale image, save to cache and return cached image
otherwise, return 'no cover' image
*** Insertion:
if setting custom cover
delete all caches
update database path with path to disk
if retrieving from amazon/or other web service
delete all caches
get data from web service, save to downloaded covers directory
update database path with path to downloaded image
*** Removal:
delete all caches
find image path from database
if image was downloaded
delete image file
if image is custom set
delete?
set image path in database to empty
--
Seb Ruiz
http://www.sebruiz.net/
More information about the Amarok-devel
mailing list