I am creating an app which downloads many images and would like to cache them locally.
So I came across the org.nemomobile.socialcache
plugin, which has a generic SocialImageCache
type.
Playing around with it I got it to the point where it actually downloads my image and tries to store it in the cache.
Note I do not actually have any Account corresponding to the image data, so I do not use any of the Accounts management, and call imageFile()
with some null
s.
import QtQuick 2.6
import org.nemomobile.socialcache 1.0
ListModel { id: imgModel }
SocialImageCache{ id: imgCache
property SocialImageCache downloader: SocialImageCache{}
}
GridView {
model: imgModel
delegate: Image { id: imgDelegate
...
property SocialImageCache downloader: imgCache.downloader
// called by downloader.imageFile
function imageCached(imageFile) {
imgDelegate.source = imageFile
}
function download(url) }
downloader.imageFile(url, null, imgDelegate, null, imageId, null)
}
}
}
But we then fail with:
18:10:06.968 unknown:0 AbstractImageDownloader::about to fetch image: "http://example.org/123/56789/icon.jpg"
18:10:06.980 unknown:0 Unable to write downloaded image data to file: "/home/nemo/.local/share/system/privileged/Images/cache/b/b5160b690283d8b66d3af07524252c57.jpg"
18:10:06.981 unknown:0 SocialImageDownloader: failed to download ""
I can see that that location is set at compile time to the privileged directory:
My Questions:
- What are other tools available to locally cache larger amounts of remote files such as images and media files? (I tried
Nemo.Thumbnailer
but that doesn’t work with non-local files). - is using an “Account” through the Sailfish Accounts management mandatory for using libsocialcache so we get access to that location?
- Could it be considered a bug or useful enhancement to request a cache being available at a user-writable location?