Commit 0366d157 authored by echel0n's avatar echel0n
Browse files

Changed the way TheTVDB cache's its shows, improved performance of app

parent faefa9d1
# Changelog
- * c27cc36 - 2018-08-23: Fixed issues with custom web roots and redirects Checking for updates now redirects back to referrer url
- * 7a1a457 - 2018-08-23: Changed the way TheTVDB cache's its shows, improved performance of app
- * faefa9d - 2018-08-23: Fixed issues with custom web roots and redirects Checking for updates now redirects back to referrer url
- * bd35aae - 2018-08-23: Pre-Release v9.3.58.dev2
- * 45d0b32 - 2018-08-23: Switch TorrentLeech provider to login via cookies due to reCAPTCHA
- * 2f40c76 - 2018-08-22: Pre-Release v9.3.58.dev1
......
......@@ -22,7 +22,6 @@ import functools
import io
import json
import os
import pickle
import re
import time
import urlparse
......@@ -312,10 +311,10 @@ class Tvdb:
headers = {}
self.shows = ShowCache()
if os.path.isfile(os.path.join(sickrage.app.data_dir, 'thetvdb.db')):
with io.open(os.path.join(sickrage.app.data_dir, 'thetvdb.db'), 'rb') as fp:
if os.path.isfile(os.path.join(sickrage.app.data_dir, 'thetvdb.json')):
with io.open(os.path.join(sickrage.app.data_dir, 'thetvdb.json'), 'rb') as fp:
try:
self.shows = ShowCache(pickle.load(fp))
self.shows = ShowCache(json.load(fp))
except:
pass
......@@ -497,9 +496,6 @@ class Tvdb:
self.shows[sid].data[key] = value
with io.open(os.path.join(sickrage.app.data_dir, 'thetvdb.db'), 'wb') as fp:
pickle.dump(self.shows, fp)
def _cleanData(self, data):
"""Cleans up strings returned by TheTVDB.com
......@@ -657,6 +653,10 @@ class Tvdb:
# set last updated
self._setShowData(sid, 'last_updated', int(time.mktime(datetime.now().timetuple())))
# save show cache
with io.open(os.path.join(sickrage.app.data_dir, 'thetvdb.json'), 'wb') as fp:
json.dump(self.shows, fp)
return self.shows[int(sid)]
@login_required
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment