2019-08-07, 00:17
(2019-08-06, 18:31)the_bo Wrote:(2019-08-05, 04:20)jurialmunkey Wrote:(2019-08-05, 02:14)the_bo Wrote: Awesome work. This looks like it can replace skin helper which isn't being updated.Yeah caching definitely on the cards. Just want to get default functionality all working first and run it through some heavy testing, then I'll look at extending functionality.
Be good if could cache the data so doesn't fetch data everytime. Maybe have an option to set how long to keep cache before it refetches.
Cheers
EDIT: Added Caching.
That was easier than expected using simplecache.
Thanks.
Will the simple cache interfere with skin helper cache as it uses simplecache also?
Will try disabling skin helper as this plugin replaces most of it.
No because I don't use metadatautils which is what is really cached by skinhelper.
Simplecache is just a SQL database that stores python lists/objects.
What this decorator that I wrote does is when a request is made to the api, it will check simplecache for a key name with the plugin name + request type + request query.
For example say I search for the movie "Alien", the key will be called:
"plugin.video.themoviedb.helper/tmdb_api/search/movie&query=Alien"
If that key is found in simplecache, then it's data will be returned instead of making an actual request to the API. If the key is NOT found, then I make the request and store it in the appropriately named simplecache key before returning it to the original method making the call.
I only rate limit requests to the actual APIs, not the cache. So if data is cached, it should return fairly quickly.
The rate limiting is currently set to 2 seconds between http requests if your own key is set and 4 seconds if my default key is being used (I'm currently trialing providing a default TMDb api key so I can see what the request levels are).