Skip to content

Commit

Permalink
Merge pull request #215 from p0psicles/improve-version-checker
Browse files Browse the repository at this point in the history
Fix: We don't need to check for updates if we need the current installed version
  • Loading branch information
p0psicles committed Mar 25, 2016
2 parents dd1d839 + 743aa56 commit 101b7e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 7 additions & 3 deletions sickbeard/versionChecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ def __init__(self):
self._newest_commit_hash = None
self._num_commits_behind = 0
self._num_commits_ahead = 0
self._cur_version = ''

def get_cur_commit_hash(self):
return self._cur_commit_hash
Expand All @@ -373,13 +374,16 @@ def get_newest_commit_hash(self):
return self._newest_commit_hash

def get_cur_version(self):
return self._run_git(self._git_path, 'describe --abbrev=0 {}'.format(self._cur_commit_hash))[0]
if self._cur_commit_hash or self._find_installed_version():
self._cur_version = self._run_git(self._git_path, 'describe --abbrev=0 {}'.format(self._cur_commit_hash))[0]
return self._cur_version

def get_newest_version(self):
if self._newest_commit_hash:
return self._run_git(self._git_path, "describe --abbrev=0 " + self._newest_commit_hash)[0]
self._cur_version = self._run_git(self._git_path, "describe --abbrev=0 " + self._newest_commit_hash)[0]
else:
return self._run_git(self._git_path, "describe --abbrev=0 " + self._cur_commit_hash)[0]
self._cur_version = self._run_git(self._git_path, "describe --abbrev=0 " + self._cur_commit_hash)[0]
return self._cur_version

def get_num_commits_behind(self):
return self._num_commits_behind
Expand Down
3 changes: 1 addition & 2 deletions sickbeard/webserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@ def branchCheckout(self, branch):
@staticmethod
def getDBcompare():

checkversion = CheckVersion()
checkversion = CheckVersion() # TODO: replace with settings var
db_status = checkversion.getDBcompare()

if db_status == 'upgrade':
Expand Down Expand Up @@ -3988,7 +3988,6 @@ def index(self):
if sickbeard.VERSION_NOTIFY:
updater = CheckVersion().updater
if updater:
updater.need_update()
sr_version = updater.get_cur_version()

return t.render(
Expand Down

0 comments on commit 101b7e0

Please sign in to comment.