mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 00:43:37 +00:00
Fixed issue with reverts to master on startup due to bug in version checker.
Fixed issues with indexerApi caching code, seemed TVRage was really the only one experiancing the problems but has been corrected for theTVDB just in case.
This commit is contained in:
parent
6e6ae5bb87
commit
7cb2296b6a
3 changed files with 18 additions and 17 deletions
|
@ -471,13 +471,11 @@ class Tvdb:
|
||||||
if cache is True:
|
if cache is True:
|
||||||
self.config['cache_enabled'] = True
|
self.config['cache_enabled'] = True
|
||||||
self.config['cache_location'] = self._getTempDir()
|
self.config['cache_location'] = self._getTempDir()
|
||||||
self.sess = CacheControl(cache=caches.FileCache(self.config['cache_location']))
|
|
||||||
elif cache is False:
|
elif cache is False:
|
||||||
self.config['cache_enabled'] = False
|
self.config['cache_enabled'] = False
|
||||||
elif isinstance(cache, basestring):
|
elif isinstance(cache, basestring):
|
||||||
self.config['cache_enabled'] = True
|
self.config['cache_enabled'] = True
|
||||||
self.config['cache_location'] = cache
|
self.config['cache_location'] = cache
|
||||||
self.sess = CacheControl(cache=caches.FileCache(self.config['cache_location']))
|
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid value for Cache %r (type was %s)" % (cache, type(cache)))
|
raise ValueError("Invalid value for Cache %r (type was %s)" % (cache, type(cache)))
|
||||||
|
|
||||||
|
@ -565,14 +563,15 @@ class Tvdb:
|
||||||
|
|
||||||
# get response from TVDB
|
# get response from TVDB
|
||||||
if self.config['cache_enabled']:
|
if self.config['cache_enabled']:
|
||||||
|
session = CacheControl(cache=caches.FileCache(self.config['cache_location']))
|
||||||
if self.config['proxy']:
|
if self.config['proxy']:
|
||||||
log().debug("Using proxy for URL: %s" % url)
|
log().debug("Using proxy for URL: %s" % url)
|
||||||
self.sess.proxies = {
|
session.proxies = {
|
||||||
"http": self.config['proxy'],
|
"http": self.config['proxy'],
|
||||||
"https": self.config['proxy'],
|
"https": self.config['proxy'],
|
||||||
}
|
}
|
||||||
|
|
||||||
resp = self.sess.get(url, cache_auto=True, params=params)
|
resp = session.get(url, cache_auto=True, params=params)
|
||||||
else:
|
else:
|
||||||
resp = requests.get(url, params=params)
|
resp = requests.get(url, params=params)
|
||||||
except requests.exceptions.HTTPError, e:
|
except requests.exceptions.HTTPError, e:
|
||||||
|
@ -630,7 +629,7 @@ class Tvdb:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
src = self._loadUrl(url, params=params, language=language)
|
src = self._loadUrl(url, params=params, language=language)
|
||||||
src = [src[item] for item in src][0]
|
src = [src[item] for item in src][0] if src else []
|
||||||
except:
|
except:
|
||||||
errormsg = "There was an error with the XML retrieved from thetvdb.com:"
|
errormsg = "There was an error with the XML retrieved from thetvdb.com:"
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,6 @@ class TVRage:
|
||||||
|
|
||||||
self.shows = ShowContainer() # Holds all Show classes
|
self.shows = ShowContainer() # Holds all Show classes
|
||||||
self.corrections = {} # Holds show-name to show_id mapping
|
self.corrections = {} # Holds show-name to show_id mapping
|
||||||
self.sess = requests.session() # HTTP Session
|
|
||||||
|
|
||||||
self.config = {}
|
self.config = {}
|
||||||
|
|
||||||
|
@ -323,13 +322,11 @@ class TVRage:
|
||||||
if cache is True:
|
if cache is True:
|
||||||
self.config['cache_enabled'] = True
|
self.config['cache_enabled'] = True
|
||||||
self.config['cache_location'] = self._getTempDir()
|
self.config['cache_location'] = self._getTempDir()
|
||||||
self.sess = CacheControl(cache=caches.FileCache(self.config['cache_location']))
|
|
||||||
elif cache is False:
|
elif cache is False:
|
||||||
self.config['cache_enabled'] = False
|
self.config['cache_enabled'] = False
|
||||||
elif isinstance(cache, basestring):
|
elif isinstance(cache, basestring):
|
||||||
self.config['cache_enabled'] = True
|
self.config['cache_enabled'] = True
|
||||||
self.config['cache_location'] = cache
|
self.config['cache_location'] = cache
|
||||||
self.sess = CacheControl(cache=caches.FileCache(self.config['cache_location']))
|
|
||||||
else:
|
else:
|
||||||
raise ValueError("Invalid value for Cache %r (type was %s)" % (cache, type(cache)))
|
raise ValueError("Invalid value for Cache %r (type was %s)" % (cache, type(cache)))
|
||||||
|
|
||||||
|
@ -396,6 +393,7 @@ class TVRage:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
return os.path.join(tempfile.gettempdir(), "tvrage_api")
|
return os.path.join(tempfile.gettempdir(), "tvrage_api")
|
||||||
|
|
||||||
|
|
||||||
return os.path.join(tempfile.gettempdir(), "tvrage_api-%s" % (uid))
|
return os.path.join(tempfile.gettempdir(), "tvrage_api-%s" % (uid))
|
||||||
|
|
||||||
#@retry(tvrage_error)
|
#@retry(tvrage_error)
|
||||||
|
@ -405,14 +403,15 @@ class TVRage:
|
||||||
|
|
||||||
# get response from TVRage
|
# get response from TVRage
|
||||||
if self.config['cache_enabled']:
|
if self.config['cache_enabled']:
|
||||||
|
session = CacheControl(cache=caches.FileCache(self.config['cache_location']))
|
||||||
if self.config['proxy']:
|
if self.config['proxy']:
|
||||||
log().debug("Using proxy for URL: %s" % url)
|
log().debug("Using proxy for URL: %s" % url)
|
||||||
self.sess.proxies = {
|
session.proxies = {
|
||||||
"http": self.config['proxy'],
|
"http": self.config['proxy'],
|
||||||
"https": self.config['proxy'],
|
"https": self.config['proxy'],
|
||||||
}
|
}
|
||||||
|
|
||||||
resp = self.sess.get(url.strip(), cache_auto=True, params=params)
|
resp = session.get(url.strip(), cache_auto=True, params=params)
|
||||||
else:
|
else:
|
||||||
resp = requests.get(url.strip(), params=params)
|
resp = requests.get(url.strip(), params=params)
|
||||||
|
|
||||||
|
@ -488,7 +487,7 @@ class TVRage:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
src = self._loadUrl(url, params)
|
src = self._loadUrl(url, params)
|
||||||
src = [src[item] for item in src][0]
|
src = [src[item] for item in src][0] if src else []
|
||||||
except:
|
except:
|
||||||
errormsg = "There was an error with the XML retrieved from tvrage.com"
|
errormsg = "There was an error with the XML retrieved from tvrage.com"
|
||||||
|
|
||||||
|
|
|
@ -200,10 +200,11 @@ class WindowsUpdateManager(UpdateManager):
|
||||||
|
|
||||||
sickbeard.NEWEST_VERSION_STRING = newest_text
|
sickbeard.NEWEST_VERSION_STRING = newest_text
|
||||||
|
|
||||||
def update(self, branch='windows_binaries'):
|
def update(self, branch=None):
|
||||||
|
|
||||||
# set branch version
|
# set branch version
|
||||||
self.branch = branch
|
if branch:
|
||||||
|
self.branch = branch
|
||||||
|
|
||||||
zip_download_url = self._find_newest_version(True)
|
zip_download_url = self._find_newest_version(True)
|
||||||
logger.log(u"new_link: " + repr(zip_download_url), logger.DEBUG)
|
logger.log(u"new_link: " + repr(zip_download_url), logger.DEBUG)
|
||||||
|
@ -505,14 +506,15 @@ class GitUpdateManager(UpdateManager):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def update(self, branch=sickbeard.version.SICKBEARD_VERSION):
|
def update(self, branch=None):
|
||||||
"""
|
"""
|
||||||
Calls git pull origin <branch> in order to update SickRage. Returns a bool depending
|
Calls git pull origin <branch> in order to update SickRage. Returns a bool depending
|
||||||
on the call's success.
|
on the call's success.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# set branch version
|
# set branch version
|
||||||
self.branch = branch
|
if branch:
|
||||||
|
self.branch = branch
|
||||||
|
|
||||||
if self.branch == sickbeard.version.SICKBEARD_VERSION:
|
if self.branch == sickbeard.version.SICKBEARD_VERSION:
|
||||||
output, err, exit_status = self._run_git(self._git_path, 'pull -f origin ' + self.branch) # @UnusedVariable
|
output, err, exit_status = self._run_git(self._git_path, 'pull -f origin ' + self.branch) # @UnusedVariable
|
||||||
|
@ -645,13 +647,14 @@ class SourceUpdateManager(UpdateManager):
|
||||||
|
|
||||||
sickbeard.NEWEST_VERSION_STRING = newest_text
|
sickbeard.NEWEST_VERSION_STRING = newest_text
|
||||||
|
|
||||||
def update(self, branch=sickbeard.version.SICKBEARD_VERSION):
|
def update(self, branch=None):
|
||||||
"""
|
"""
|
||||||
Downloads the latest source tarball from github and installs it over the existing version.
|
Downloads the latest source tarball from github and installs it over the existing version.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# set branch version
|
# set branch version
|
||||||
self.branch = branch
|
if branch:
|
||||||
|
self.branch = branch
|
||||||
|
|
||||||
base_url = 'http://github.com/' + self.github_repo_user + '/' + self.github_repo
|
base_url = 'http://github.com/' + self.github_repo_user + '/' + self.github_repo
|
||||||
tar_download_url = base_url + '/tarball/' + self.branch
|
tar_download_url = base_url + '/tarball/' + self.branch
|
||||||
|
|
Loading…
Reference in a new issue