1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-12 11:02:21 -05:00

Merge pull request #312 from WebSpider/dev-code_cleanup

Code cleanup
This commit is contained in:
echel0n 2014-05-03 05:24:15 -07:00
commit c29b29a7e7
5 changed files with 15 additions and 15 deletions

View File

@ -179,7 +179,7 @@ def change_VERSION_NOTIFY(version_notify):
sickbeard.VERSION_NOTIFY = version_notify sickbeard.VERSION_NOTIFY = version_notify
if version_notify == False: if not version_notify:
sickbeard.NEWEST_VERSION_STRING = None sickbeard.NEWEST_VERSION_STRING = None
if oldSetting == False and version_notify == True: if oldSetting == False and version_notify == True:

View File

@ -146,7 +146,7 @@ def snatchEpisode(result, endStatus=SNATCHED):
logger.log(u"Unknown result type, unable to download it", logger.ERROR) logger.log(u"Unknown result type, unable to download it", logger.ERROR)
dlResult = False dlResult = False
if dlResult == False: if not dlResult:
return False return False
if sickbeard.USE_FAILED_DOWNLOADS: if sickbeard.USE_FAILED_DOWNLOADS:

View File

@ -74,7 +74,7 @@ class BacklogSearcher:
else: else:
show_list = sickbeard.showList show_list = sickbeard.showList
if self.amActive == True: if self.amActive:
logger.log(u"Backlog is still running, not starting it again", logger.DEBUG) logger.log(u"Backlog is still running, not starting it again", logger.DEBUG)
return return

View File

@ -1316,14 +1316,14 @@ class TVEpisode(object):
pass pass
# if we tried loading it from NFO and didn't find the NFO, try the Indexers # if we tried loading it from NFO and didn't find the NFO, try the Indexers
if self.hasnfo == False: if not self.hasnfo:
try: try:
result = self.loadFromIndexer(season, episode, scene_season, scene_episode) result = self.loadFromIndexer(season, episode, scene_season, scene_episode)
except exceptions.EpisodeDeletedException: except exceptions.EpisodeDeletedException:
result = False result = False
# if we failed SQL *and* NFO, Indexers then fail # if we failed SQL *and* NFO, Indexers then fail
if result == False: if not result:
raise exceptions.EpisodeNotFoundException( raise exceptions.EpisodeNotFoundException(
"Couldn't find episode " + str(season) + "x" + str(episode)) "Couldn't find episode " + str(season) + "x" + str(episode))
@ -2139,17 +2139,17 @@ class TVEpisode(object):
for cur_related_file in related_files: for cur_related_file in related_files:
cur_result = helpers.rename_ep_file(cur_related_file, absolute_proper_path, cur_result = helpers.rename_ep_file(cur_related_file, absolute_proper_path,
absolute_current_path_no_ext_length) absolute_current_path_no_ext_length)
if cur_result == False: if not cur_result:
logger.log(str(self.indexerid) + u": Unable to rename file " + cur_related_file, logger.ERROR) logger.log(str(self.indexerid) + u": Unable to rename file " + cur_related_file, logger.ERROR)
for cur_related_sub in related_subs: for cur_related_sub in related_subs:
cur_result = helpers.rename_ep_file(cur_related_sub, absolute_proper_subs_path,absolute_current_path_no_ext_length) cur_result = helpers.rename_ep_file(cur_related_sub, absolute_proper_subs_path,absolute_current_path_no_ext_length)
if cur_result == False: if not cur_result:
logger.log(str(self.indexerid) + u": Unable to rename file " + cur_related_sub, logger.ERROR) logger.log(str(self.indexerid) + u": Unable to rename file " + cur_related_sub, logger.ERROR)
# save the ep # save the ep
with self.lock: with self.lock:
if result != False: if result:
self.location = absolute_proper_path + file_ext self.location = absolute_proper_path + file_ext
for relEp in self.relatedEps: for relEp in self.relatedEps:
relEp.location = absolute_proper_path + file_ext relEp.location = absolute_proper_path + file_ext

View File

@ -193,7 +193,7 @@ class Api:
else: else:
del kwargs["apikey"] del kwargs["apikey"]
if sickbeard.USE_API != True: if not sickbeard.USE_API:
msg = u"API :: " + remoteIp + " - SB API Disabled. ACCESS DENIED" msg = u"API :: " + remoteIp + " - SB API Disabled. ACCESS DENIED"
return False, msg, args, kwargs return False, msg, args, kwargs
elif apiKey == realKey: elif apiKey == realKey:
@ -373,10 +373,10 @@ class ApiCall(object):
""" function to check passed params for the shorthand wrapper """ function to check passed params for the shorthand wrapper
and to detect missing/required param and to detect missing/required param
""" """
# Fix for applications that send tvdbid instead of indexerid # Fix for applications that send tvdbid instead of indexerid
if key == "indexerid" and "indexerid" not in kwargs: if key == "indexerid" and "indexerid" not in kwargs:
key = "tvdbid" key = "tvdbid"
missing = True missing = True
orgDefault = default orgDefault = default
@ -803,7 +803,7 @@ class CMD_ComingEpisodes(ApiCall):
ep["airs"] = str(ep["airs"]).replace('am', ' AM').replace('pm', ' PM').replace(' ', ' ') ep["airs"] = str(ep["airs"]).replace('am', ' AM').replace('pm', ' PM').replace(' ', ' ')
# start day of the week on 1 (monday) # start day of the week on 1 (monday)
ep["weekday"] = 1 + datetime.date.fromordinal(ordinalAirdate).weekday() ep["weekday"] = 1 + datetime.date.fromordinal(ordinalAirdate).weekday()
# Add tvdbid for backward compability # Add tvdbid for backward compability
ep["tvdbid"] = ep['indexerid'] ep["tvdbid"] = ep['indexerid']
# TODO: check if this obsolete # TODO: check if this obsolete
@ -1170,7 +1170,7 @@ class CMD_History(ApiCall):
_rename_element(row, "showid", "indexerid") _rename_element(row, "showid", "indexerid")
row["resource_path"] = os.path.dirname(row["resource"]) row["resource_path"] = os.path.dirname(row["resource"])
row["resource"] = os.path.basename(row["resource"]) row["resource"] = os.path.basename(row["resource"])
# Add tvdbid for backward compability # Add tvdbid for backward compability
row['tvdbid'] = row['indexerid'] row['tvdbid'] = row['indexerid']
results.append(row) results.append(row)
@ -1512,7 +1512,7 @@ class CMD_SickBeardPauseBacklog(ApiCall):
def run(self): def run(self):
""" pause the backlog search """ """ pause the backlog search """
if self.pause == True: if self.pause:
sickbeard.searchQueueScheduler.action.pause_backlog() #@UndefinedVariable sickbeard.searchQueueScheduler.action.pause_backlog() #@UndefinedVariable
return _responds(RESULT_SUCCESS, msg="Backlog paused") return _responds(RESULT_SUCCESS, msg="Backlog paused")
else: else:
@ -2172,7 +2172,7 @@ class CMD_ShowPause(ApiCall):
if not showObj: if not showObj:
return _responds(RESULT_FAILURE, msg="Show not found") return _responds(RESULT_FAILURE, msg="Show not found")
if self.pause == True: if self.pause:
showObj.paused = 1 showObj.paused = 1
return _responds(RESULT_SUCCESS, msg=str(showObj.name) + " has been paused") return _responds(RESULT_SUCCESS, msg=str(showObj.name) + " has been paused")
else: else: