1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-11-05 17:05:03 -05:00

Malformed airdates now raises a warning instead of a error so we dont clutter logs.

Updates now remove untracked files plus perform a hard reset on branch if first update attempt fails then trys to update for a 2nd time.
This commit is contained in:
echel0n 2014-12-20 07:07:37 -08:00
parent 3b37dc0540
commit 482f20b735
2 changed files with 27 additions and 15 deletions

View File

@ -1686,8 +1686,8 @@ class TVEpisode(object):
except (ValueError, IndexError):
logger.log(u"Malformed air date of " + str(firstaired) + " retrieved from " + sickbeard.indexerApi(
self.indexer).name + " for (" + self.show.name + " - " + str(season) + "x" + str(episode) + ")",
logger.ERROR)
# if I'm incomplete on TVDB but I once was complete then just delete myself from the DB for now
logger.WARNING)
# if I'm incomplete on the indexer but I once was complete then just delete myself from the DB for now
if self.indexerid != -1:
self.deleteEpisode()
return False

View File

@ -395,10 +395,19 @@ class GitUpdateManager(UpdateManager):
# update remote origin url
self.update_remote_origin()
if self.branch == self._find_installed_branch():
output, err, exit_status = self._run_git(self._git_path, 'pull -f %s %s' % (sickbeard.GIT_REMOTE, self.branch)) # @UnusedVariable
else:
output, err, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch) # @UnusedVariable
def update_cmd():
if self.branch == self._find_installed_branch():
output, err, exit_status = self._run_git(self._git_path, 'pull -f %s %s' % (sickbeard.GIT_REMOTE, self.branch)) # @UnusedVariable
else:
output, err, exit_status = self._run_git(self._git_path, 'checkout -f ' + self.branch) # @UnusedVariable
return output, err, exit_status
output, err, exit_status = update_cmd()
if not exit_status == 0:
# remove untracked files and reset branch then attempt updating again
if self.clean() and self.reset():
output, err, exit_status = update_cmd()
if exit_status == 0:
self._find_installed_version()
@ -406,13 +415,17 @@ class GitUpdateManager(UpdateManager):
# Notify update successful
if sickbeard.NOTIFY_ON_UPDATE:
notifiers.notify_git_update(sickbeard.CUR_COMMIT_HASH if sickbeard.CUR_COMMIT_HASH else "")
return True
else:
# perform a hard reset to try and resolve the issue
if self.reset() and self.update():
return True
return False
return True
def clean(self):
"""
Calls git clean to remove all untracked files. Returns a bool depending
on the call's success.
"""
output, err, exit_status = self._run_git(self._git_path, 'clean -d -fx ""') # @UnusedVariable
if exit_status == 0:
return True
def reset(self):
"""
@ -421,11 +434,10 @@ class GitUpdateManager(UpdateManager):
"""
if sickbeard.GIT_RESET:
output, err, exit_status = self._run_git(self._git_path, 'reset --hard') # @UnusedVariable
if exit_status == 0:
return True
return False
else:
return True
def list_remote_branches(self):
# update remote origin url