Welcome to the Rockbox Technical Forums!
Maybe a better option would be to skip album art above a certain size on slower devices.
I suppose you could save an additional .bmp of the resized image and then skip the jpeg version on subsequent loads. Since you can't save as jpeg it's a little less efficient but the resized images would be small anyway.
/* Check if a cached BMP file exists within the .rockbox directory * * id3 - metadata of the current track. * buf - buffer to store the path of the cached BMP file. * buflen - size of the buffer. * * Return true if a cached BMP file is found, false otherwise. */bool check_cached_bmp(const struct mp3entry *id3, char *buf, int buflen){ char path[MAX_PATH + 11]; /* need room for filename and null termination */ const char *artist = id3->albumartist != NULL ? id3->albumartist : id3->artist; if (!id3 || !buf || !artist || !id3->album) return false; snprintf(path, sizeof(path), ROCKBOX_DIR "/albumart/cache/%s-%s.bmp", artist, id3->album); printf("Path: %s\n", path); if (file_exists(path)) { strmemccpy(buf, path, buflen); logf("Cached album art found: %s", path); return true; } return false;}
Album art already has an ordered list of places to look on load. You just need to add one more location, wherever you cache the resized file. Then if the cached item is there, it will be loaded, if not it will continue down the list as normal.
The database is a system for generating playlists from file tags. Since album art doesn't really relate to playlists, it doesn't make sense to tie this to the database. Just make one cached item per file or per folder and you can use the existing load logic to pick the cached item when available.
Page created in 0.046 seconds with 18 queries.