Simplify the naming of the thumbnails/waveform cache files
Currently we compute a hash of the start of the content of the file, and that represents the name of the cache file with thumbnails/waveform.
We should trust the file system and simply use v1/filename+hash(uri)+mtime instead:
- v1 will make it easy to identify obsolete thumbnails in case we make changes to the thumbnails/waveform storage system.
- filename makes it easily identifiable when we debug
- hash(uri) tells from which file the thumbnails/waveform have been obtained
- mtime assures we ignore the obsolete thumbnails/waveform when the file is changed
This means when a file is moved we regenerate the cache, but we're fine with that supposing files move rarely.
With this, we should introduce some cleanup logic, to delete all the (obsolete) files in the main cache dirs in case "v1" (or the latest equivalent) does not exist yet:
os.path.join(xdg_cache_home(), "thumbs")
os.path.join(xdg_cache_home(), "waves")
See ThumbnailCache.dbfile_name
and ThumbnailCache.get_wavefile_location_for_uri
.