Commit 34aa88cd authored by echel0n's avatar echel0n

Refactored show object class, cleaned up naming conventions for functions.

parent 753625db
# Changelog
- * e191b1e - 2018-11-12: Refactored queue current item property to always represent current running task.
- * 3176978 - 2018-11-12: Refactored show object class, cleaned up naming conventions for functions.
- * 753625d - 2018-11-12: Refactored queue current item property to always represent current running task.
- * 8bd128e - 2018-11-11: Release v9.4.30
- * 90fdbb1 - 2018-11-11: Pre-Release v9.4.30.dev1
- * 007df0a - 2018-11-11: Refactored get, all, and get_many database functions.
......
......@@ -544,7 +544,7 @@ class Core(object):
self.log.info("Saving all shows to the database")
for show in self.showlist:
try:
show.saveToDB()
show.save_to_db()
except Exception:
continue
......
......@@ -288,7 +288,7 @@ class TVCache(object):
continue
try:
result.episodes = [result.show.getEpisode(curSeason, int(curEp)) for curEp in
result.episodes = [result.show.get_episode(curSeason, int(curEp)) for curEp in
filter(None, curResult["episodes"].split("|"))]
except EpisodeNotFoundException:
continue
......@@ -300,7 +300,7 @@ class TVCache(object):
# make sure we want the episode
wantEp = False
for curEp in result.episodes:
if result.show.wantEpisode(curEp.season, curEp.episode, result.quality, manualSearch, downCurQuality):
if result.show.want_episode(curEp.season, curEp.episode, result.quality, manualSearch, downCurQuality):
wantEp = True
if not wantEp:
......
......@@ -170,7 +170,7 @@ def makeSceneSeasonSearchString(show, ep_obj, extraSearchType=None):
# the search string for air by date shows is just
seasonStrings = [str(ep_obj.airdate).split('-')[0]]
elif show.is_anime:
seasonEps = show.getAllEpisodes(ep_obj.season)
seasonEps = show.get_all_episodes(ep_obj.season)
# get show qualities
anyQualities, bestQualities = Quality.splitQuality(show.quality)
......
......@@ -176,7 +176,7 @@ def splitNZBResult(result):
wantEp = True
for epNo in parse_result.episode_numbers:
if not result.extraInfo[0].wantEpisode(season, epNo, result.quality):
if not result.extraInfo[0].want_episode(season, epNo, result.quality):
sickrage.app.log.info(
"Ignoring result " + newNZB + " because we don't want an episode that is " +
Quality.qualityStrings[result.quality])
......@@ -188,7 +188,7 @@ def splitNZBResult(result):
# get all the associated episode objects
epObjList = []
for curEp in parse_result.episode_numbers:
epObjList.append(result.extraInfo[0].getEpisode(season, curEp))
epObjList.append(result.extraInfo[0].get_episode(season, curEp))
# make a result
curResult = classes.NZBDataSearchResult(epObjList)
......
......@@ -19,7 +19,7 @@
from __future__ import print_function, unicode_literals
import sickrage
from sickrage.core.common import Quality, WANTED, DOWNLOADED, SNATCHED, SNATCHED_PROPER, SNATCHED_BEST
from sickrage.core.common import Quality, SNATCHED, SNATCHED_PROPER, SNATCHED_BEST
from sickrage.core.exceptions import FailedPostProcessingFailedException
from sickrage.core.helpers import show_names
from sickrage.core.nameparser import InvalidNameException, InvalidShowException, \
......@@ -77,7 +77,7 @@ class FailedProcessor(object):
sickrage.app.log.debug(" - " + str(parsed.air_date))
for episode in parsed.episode_numbers:
segment = parsed.show.getEpisode(parsed.season_number, episode)
segment = parsed.show.get_episode(parsed.season_number, episode)
curStatus, curQuality = Quality.splitCompositeStatus(segment.status)
if curStatus not in {SNATCHED, SNATCHED_BEST, SNATCHED_PROPER}:
......
......@@ -775,7 +775,7 @@ class PostProcessor(object):
# now that we've figured out which episode this file is just load it manually
try:
curEp = show.getEpisode(season, cur_episode)
curEp = show.get_episode(season, cur_episode)
except EpisodeNotFoundException as e:
self._log("Unable to create episode: {}".format(e)), sickrage.app.log.DEBUG
raise EpisodePostProcessingFailedException()
......@@ -1060,7 +1060,7 @@ class PostProcessor(object):
"Unable to create the show directory: " + ep_obj.show.location)
# write metadata for the show (but not episode because it hasn't been fully processed)
ep_obj.show.writeMetadata(True)
ep_obj.show.write_metadata(True)
# update the ep info before we rename so the quality & release name go into the name properly
for cur_ep in [ep_obj] + ep_obj.relatedEps:
......@@ -1091,7 +1091,7 @@ class PostProcessor(object):
else:
cur_ep.release_group = ""
cur_ep.saveToDB()
cur_ep.save_to_db()
# Just want to keep this consistent for failed handling right now
releaseName = show_names.determineReleaseName(self.folder_path, self.nzb_name)
......@@ -1164,13 +1164,13 @@ class PostProcessor(object):
with cur_ep.lock:
cur_ep.location = os.path.join(dest_path, new_file_name)
cur_ep.refreshSubtitles()
cur_ep.downloadSubtitles()
cur_ep.download_subtitles()
# put the new location in the database
for cur_ep in [ep_obj] + ep_obj.relatedEps:
with cur_ep.lock:
cur_ep.location = os.path.join(dest_path, new_file_name)
cur_ep.saveToDB()
cur_ep.save_to_db()
# set file modify stamp to show airdate
if sickrage.app.config.airdate_episodes:
......
......@@ -125,7 +125,7 @@ class ShowQueue(srQueue):
def renameShowEpisodes(self, show):
return self.put(QueueItemRename(show))
def downloadSubtitles(self, show):
def download_subtitles(self, show):
return self.put(QueueItemSubtitle(show))
def addShow(self, indexer, indexer_id, showDir, default_status=None, quality=None, flatten_folders=None,
......@@ -208,7 +208,7 @@ class ShowQueueItem(srQueueItem):
self.show = show
def finish(self):
self.show.flushEpisodes()
self.show.flush_episodes()
def is_in_queue(self):
return self in sickrage.app.show_queue.queue + [sickrage.app.show_queue.current_item]
......@@ -339,7 +339,7 @@ class QueueItemAdd(ShowQueueItem):
try:
self.show = TVShow(self.indexer, self.indexer_id, self.lang)
self.show.loadFromIndexer()
self.show.load_from_indexer()
# set up initial values
self.show.location = self.showDir
......@@ -404,7 +404,7 @@ class QueueItemAdd(ShowQueueItem):
sickrage.app.log.error("Error loading IMDb info: {}".format(e))
try:
self.show.saveToDB()
self.show.save_to_db()
except Exception as e:
sickrage.app.log.error("Error saving the show to the database: {}".format(e))
sickrage.app.log.debug(traceback.format_exc())
......@@ -415,7 +415,7 @@ class QueueItemAdd(ShowQueueItem):
sickrage.app.showlist.append(self.show)
try:
self.show.loadEpisodesFromIndexer()
self.show.load_episodes_from_indexer()
except Exception as e:
sickrage.app.log.error(
"Error with " + IndexerApi(
......@@ -423,7 +423,7 @@ class QueueItemAdd(ShowQueueItem):
sickrage.app.log.debug(traceback.format_exc())
try:
self.show.loadEpisodesFromDir()
self.show.load_episodes_from_dir()
except Exception as e:
sickrage.app.log.debug("Error searching dir for episodes: {}".format(e))
sickrage.app.log.debug(traceback.format_exc())
......@@ -433,8 +433,8 @@ class QueueItemAdd(ShowQueueItem):
sickrage.app.log.info("Launching backlog for this show since its episodes are WANTED")
sickrage.app.backlog_searcher.search_backlog([self.show])
self.show.writeMetadata(force=True)
self.show.populateCache()
self.show.write_metadata(force=True)
self.show.populate_cache()
if sickrage.app.config.use_trakt:
# if there are specific episodes that need to be added by trakt
......@@ -457,7 +457,7 @@ class QueueItemAdd(ShowQueueItem):
self.show.default_ep_status = self.default_status_after
self.show.saveToDB()
self.show.save_to_db()
sickrage.app.name_cache.build(self.show)
......@@ -486,10 +486,10 @@ class QueueItemRefresh(ShowQueueItem):
sickrage.app.log.info("Performing refresh for show: {}".format(self.show.name))
self.show.refreshDir()
self.show.refresh_dir()
self.show.writeMetadata(force=self.force)
self.show.populateCache(force=self.force)
self.show.write_metadata(force=self.force)
self.show.populate_cache(force=self.force)
# Load XEM data to DB for show
# xem_refresh(self.show.indexerid, self.show.indexer)
......@@ -516,7 +516,7 @@ class QueueItemRename(ShowQueueItem):
ep_obj_rename_list = []
ep_obj_list = self.show.getAllEpisodes(has_location=True)
ep_obj_list = self.show.get_all_episodes(has_location=True)
for cur_ep_obj in ep_obj_list:
# Only want to rename if we have a location
if cur_ep_obj.location:
......@@ -548,7 +548,7 @@ class QueueItemSubtitle(ShowQueueItem):
def run(self):
sickrage.app.log.info("Started downloading subtitles for show: {}".format(self.show.name))
self.show.downloadSubtitles()
self.show.download_subtitles()
self.finish()
......@@ -567,7 +567,7 @@ class QueueItemUpdate(ShowQueueItem):
try:
sickrage.app.log.debug("Retrieving show info from " + IndexerApi(self.show.indexer).name + "")
self.show.loadFromIndexer(cache=False)
self.show.load_from_indexer(cache=False)
except indexer_error as e:
sickrage.app.log.warning(
"Unable to contact " + IndexerApi(self.show.indexer).name + ", aborting: {}".format(e))
......@@ -584,12 +584,12 @@ class QueueItemUpdate(ShowQueueItem):
sickrage.app.log.warning("Error loading IMDb info for {}: {}".format(IndexerApi(self.show.indexer).name, e))
# get episode list from DB
DBEpList = self.show.loadEpisodesFromDB()
DBEpList = self.show.load_episodes_from_db()
IndexerEpList = None
# get episode list from TVDB
try:
IndexerEpList = self.show.loadEpisodesFromIndexer()
IndexerEpList = self.show.load_episodes_from_indexer()
except indexer_exception as e:
sickrage.app.log.error("Unable to get info from " + IndexerApi(
self.show.indexer).name + ", the show info will not be refreshed: {}".format(e))
......@@ -610,7 +610,7 @@ class QueueItemUpdate(ShowQueueItem):
sickrage.app.log.info(
"Permanently deleting episode " + str(curSeason) + "x" + str(curEpisode) + " from the database")
try:
self.show.getEpisode(curSeason, curEpisode).deleteEpisode()
self.show.get_episode(curSeason, curEpisode).deleteEpisode()
except EpisodeDeletedException:
pass
......@@ -653,7 +653,7 @@ class QueueItemRemove(ShowQueueItem):
sickrage.app.quicksearch_cache.del_show(self.show.indexerid)
self.show.deleteShow(full=self.full)
self.show.delete_show(full=self.full)
if sickrage.app.config.use_trakt:
try:
......
......@@ -244,7 +244,7 @@ def set_scene_numbering(indexer_id, indexer, season=0, episode=0, absolute_numbe
# Reload data from DB so that cache and db are in sync
show = findCertainShow(indexer_id)
show.flushEpisodes()
show.flush_episodes()
def find_xem_numbering(indexer_id, indexer, season, episode):
......
......@@ -110,7 +110,7 @@ def snatchEpisode(result, endStatus=SNATCHED):
curEpObj.status = Quality.compositeStatus(endStatus, result.quality)
# save episode to DB
curEpObj.saveToDB()
curEpObj.save_to_db()
if curEpObj.status not in Quality.DOWNLOADED:
try:
......@@ -446,7 +446,7 @@ def searchProviders(show, episodes, manualSearch=False, downCurQuality=False, up
anyWanted = False
for curEpNum in allEps:
for season in set([x.season for x in episodes]):
if not show.wantEpisode(season, curEpNum, seasonQual, downCurQuality):
if not show.want_episode(season, curEpNum, seasonQual, downCurQuality):
allWanted = False
else:
anyWanted = True
......@@ -460,7 +460,7 @@ def searchProviders(show, episodes, manualSearch=False, downCurQuality=False, up
epObjs = []
for curEpNum in allEps:
for season in set([x.season for x in episodes]):
epObjs.append(show.getEpisode(season, curEpNum))
epObjs.append(show.get_episode(season, curEpNum))
bestSeasonResult.episodes = epObjs
......@@ -497,7 +497,7 @@ def searchProviders(show, episodes, manualSearch=False, downCurQuality=False, up
epObjs = []
for curEpNum in allEps:
for season in set([x.season for x in episodes]):
epObjs.append(show.getEpisode(season, curEpNum))
epObjs.append(show.get_episode(season, curEpNum))
bestSeasonResult.episodes = epObjs
if MULTI_EP_RESULT in found_results[providerObj.name]:
......
......@@ -63,7 +63,7 @@ def new_episode_finder():
if air_time > curTime:
continue
ep_obj = show.getEpisode(int(episode['season']), int(episode['episode']))
ep_obj = show.get_episode(int(episode['season']), int(episode['episode']))
with ep_obj.lock:
ep_obj.status = show.default_ep_status if ep_obj.season else SKIPPED
sickrage.app.log.info('Setting status ({status}) for show airing today: {name} {special}'.format(
......@@ -72,4 +72,4 @@ def new_episode_finder():
special='(specials are not supported)' if not ep_obj.season else '',
))
ep_obj.saveToDB()
\ No newline at end of file
ep_obj.save_to_db()
\ No newline at end of file
......@@ -143,7 +143,7 @@ class BacklogSearcher(object):
if curStatus == DOWNLOADED and show.skip_downloaded:
continue
epObj = show.getEpisode(int(result["season"]), int(result["episode"]))
epObj = show.get_episode(int(result["season"]), int(result["episode"]))
wanted.append(epObj)
return wanted
......
......@@ -104,7 +104,7 @@ class DailySearcher(object):
if curStatus == DOWNLOADED and show.skip_downloaded:
continue
epObj = show.getEpisode(int(dbData["season"]), int(dbData["episode"]))
epObj = show.get_episode(int(dbData["season"]), int(dbData["episode"]))
epObj.wantedQuality = [i for i in allQualities if (i > curQuality and i != Quality.UNKNOWN)]
wanted.append(epObj)
......
......@@ -77,7 +77,7 @@ class FailedSnatchSearcher(object):
if not show or show.paused:
continue
ep_obj = show.getEpisode(int(episode['season']), int(episode['episode']))
ep_obj = show.get_episode(int(episode['season']), int(episode['episode']))
if isinstance(ep_obj, TVEpisode):
curStatus, curQuality = Quality.splitCompositeStatus(ep_obj.status)
if curStatus not in {SNATCHED, SNATCHED_BEST, SNATCHED_PROPER}:
......
......@@ -265,7 +265,7 @@ class ProperSearcher(object):
continue
# make the result object
result = curProper.provider.getResult([curProper.show.getEpisode(curProper.season, curProper.episode)])
result = curProper.provider.getResult([curProper.show.get_episode(curProper.season, curProper.episode)])
result.show = curProper.show
result.url = curProper.url
result.name = curProper.name
......
......@@ -125,7 +125,7 @@ class SubtitleSearcher(object):
sickrage.app.log.debug('Show not found')
return
epObj = showObj.getEpisode(int(epToSub["season"]), int(epToSub["episode"]))
epObj = showObj.get_episode(int(epToSub["season"]), int(epToSub["episode"]))
if isinstance(epObj, str):
sickrage.app.log.debug('Episode not found')
return
......@@ -133,7 +133,7 @@ class SubtitleSearcher(object):
existing_subtitles = epObj.subtitles
try:
epObj.downloadSubtitles()
epObj.download_subtitles()
except Exception as e:
sickrage.app.log.debug('Unable to find subtitles')
sickrage.app.log.debug(str(e))
......
......@@ -36,7 +36,7 @@ def setEpisodeToWanted(show, s, e):
"""
Sets an episode to wanted, only if it is currently skipped
"""
epObj = show.getEpisode(int(s), int(e))
epObj = show.get_episode(int(s), int(e))
if epObj:
with epObj.lock:
if epObj.status != SKIPPED or epObj.airdate == date.fromordinal(1):
......@@ -46,7 +46,7 @@ def setEpisodeToWanted(show, s, e):
# figure out what segment the episode is in and remember it so we can backlog it
epObj.status = WANTED
epObj.saveToDB()
epObj.save_to_db()
sickrage.app.search_queue.put(BacklogQueueItem(show, [epObj]))
......
......@@ -286,9 +286,9 @@ class TVEpisode(object):
"""Look for subtitles files and refresh the subtitles property"""
self.subtitles, save_subtitles = refresh_subtitles(self)
if save_subtitles:
self.saveToDB()
self.save_to_db()
def downloadSubtitles(self):
def download_subtitles(self):
if not os.path.isfile(self.location):
sickrage.app.log.debug("%s: Episode file doesn't exist, can't download subtitles for S%02dE%02d" %
(self.show.indexerid, self.season or 0, self.episode or 0))
......@@ -302,7 +302,7 @@ class TVEpisode(object):
self.subtitles_searchcount += 1 if self.subtitles_searchcount else 1
self.subtitles_lastsearch = datetime.datetime.now().strftime(dateTimeFormat)
self.saveToDB()
self.save_to_db()
if newSubtitles:
subtitleList = ", ".join([name_from_code(newSub) for newSub in newSubtitles])
......@@ -352,9 +352,9 @@ class TVEpisode(object):
'db': False}
for method, func in OrderedDict([
('db', lambda: self.loadFromDB(season, episode)),
('db', lambda: self.load_from_db(season, episode)),
('nfo', lambda: self.loadFromNFO(self.location)),
('indexer', lambda: self.loadFromIndexer(season, episode)),
('indexer', lambda: self.load_from_indexer(season, episode)),
]).items():
try:
......@@ -372,7 +372,7 @@ class TVEpisode(object):
# we failed to populate the episode
raise EpisodeNotFoundException("Couldn't find episode S%02dE%02d" % (season or 0, episode or 0))
def loadFromDB(self, season, episode):
def load_from_db(self, season, episode):
sickrage.app.log.debug("%s: Loading episode details from DB for episode %s S%02dE%02d" % (
self.show.indexerid, self.show.name, season or 0, episode or 0))
......@@ -427,7 +427,7 @@ class TVEpisode(object):
return True
def loadFromIndexer(self, season=None, episode=None, cache=True, tvapi=None, cachedSeason=None):
def load_from_indexer(self, season=None, episode=None, cache=True, tvapi=None, cachedSeason=None):
indexer_name = IndexerApi(self.indexer).name
season = (self.season, season)[season is not None]
......@@ -679,7 +679,7 @@ class TVEpisode(object):
self.createThumbnail(force)
if self.checkForMetaFiles():
self.saveToDB()
self.save_to_db()
def createNFO(self, force=False):
......@@ -705,7 +705,7 @@ class TVEpisode(object):
"Deleting %s S%02dE%02d from the DB" % (self.show.name, self.season or 0, self.episode or 0))
# remove myself from the show dictionary
if self.show.getEpisode(self.season, self.episode, noCreate=True) == self:
if self.show.get_episode(self.season, self.episode, noCreate=True) == self:
sickrage.app.log.debug("Removing myself from my show's list")
del self.show.episodes[self.season][self.episode]
......@@ -730,7 +730,7 @@ class TVEpisode(object):
raise EpisodeDeletedException()
def saveToDB(self, force_save=False):
def save_to_db(self, force_save=False):
"""
Saves this episode to the database if any of its data has been changed since the last save.
......@@ -921,7 +921,7 @@ class TVEpisode(object):
# save any changes to the database
with self.lock:
for relEp in [self] + self.relatedEps:
relEp.saveToDB()
relEp.save_to_db()
def airdateModifyStamp(self):
"""
......
This diff is collapsed.
......@@ -317,7 +317,7 @@ class FailedHistory(object):
else:
sickrage.app.log.debug("WARNING: Episode not found in history. Setting it back to WANTED")
epObj.status = WANTED
epObj.saveToDB()
epObj.save_to_db()
except EpisodeNotFoundException as e:
sickrage.app.log.warning(
......@@ -337,7 +337,7 @@ class FailedHistory(object):
with epObj.lock:
quality = Quality.splitCompositeStatus(epObj.status)[1]
epObj.status = Quality.compositeStatus(FAILED, quality)
epObj.saveToDB()
epObj.save_to_db()
except EpisodeNotFoundException as e:
sickrage.app.log.warning(
......
......@@ -771,7 +771,7 @@ class CMD_EpisodeSearch(ApiCall):
return _responds(RESULT_FAILURE, msg="Show not found")
# retrieve the episode object and fail if we can't get one
epObj = showObj.getEpisode(int(self.s), int(self.e))
epObj = showObj.get_episode(int(self.s), int(self.e))
if isinstance(epObj, str):
return _responds(RESULT_FAILURE, msg="Episode not found")
......@@ -835,13 +835,13 @@ class CMD_EpisodeSetStatus(ApiCall):
ep_list = []
if self.e:
epObj = showObj.getEpisode(self.s, self.e)
epObj = showObj.get_episode(self.s, self.e)
if epObj is None:
return _responds(RESULT_FAILURE, msg="Episode not found")
ep_list = [epObj]
else:
# get all episode numbers frome self,season
ep_list = showObj.getAllEpisodes(season=self.s)
ep_list = showObj.get_all_episodes(season=self.s)
def _epResult(result_code, ep, msg=""):
return {'season': ep.season, 'episode': ep.episode, 'status': _get_status_Strings(ep.status),
......@@ -877,7 +877,7 @@ class CMD_EpisodeSetStatus(ApiCall):
continue
epObj.status = self.status
epObj.saveToDB()
epObj.save_to_db()
if self.status == WANTED:
start_backlog = True
......@@ -926,7 +926,7 @@ class CMD_SubtitleSearch(ApiCall):
return _responds(RESULT_FAILURE, msg="Show not found")
# retrieve the episode object and fail if we can't get one
epObj = showObj.getEpisode(int(self.s), int(self.e))
epObj = showObj.get_episode(int(self.s), int(self.e))
if isinstance(epObj, str):
return _responds(RESULT_FAILURE, msg="Episode not found")
......@@ -934,7 +934,7 @@ class CMD_SubtitleSearch(ApiCall):
previous_subtitles = epObj.subtitles
try:
subtitles = epObj.downloadSubtitles()
subtitles = epObj.download_subtitles()
except Exception:
return _responds(RESULT_FAILURE, msg='Unable to find subtitles')
......@@ -1105,7 +1105,7 @@ class CMD_Backlog(ApiCall):
for e in sorted((e for e in sickrage.app.main_db.get_many('tv_episodes', s.indexerid) if s.paused == 0),
key=lambda d: (d['season'], d['episode']), reverse=True):
curEpCat = s.getOverview(int(e["status"] or -1))
curEpCat = s.get_overview(int(e["status"] or -1))
if curEpCat and curEpCat in (Overview.WANTED, Overview.QUAL):
showEps += [e]
......@@ -1798,7 +1798,7 @@ class CMD_Show(ApiCall):
showDict["skip_downloaded"] = (0, 1)[showObj.skip_downloaded]
showDict["indexerid"] = showObj.indexerid
showDict["tvdbid"] = showObj.mapIndexers()[1]
showDict["tvdbid"] = showObj.map_indexers()[1]
showDict["imdbid"] = showObj.imdbid
showDict["network"] = showObj.network
......@@ -2312,7 +2312,7 @@ class CMD_ShowPause(ApiCall):
else:
showObj.paused = self.pause
showObj.saveToDB()
showObj.save_to_db()
return _responds(RESULT_SUCCESS, msg='%s has been %s' % (showObj.name, ('resumed', 'paused')[showObj.paused]))
......@@ -2672,7 +2672,7 @@ class CMD_Shows(ApiCall):
if self.paused is not None and bool(self.paused) != bool(curShow.paused):
continue
indexerShow = curShow.mapIndexers()
indexerShow = curShow.map_indexers()
showDict = {
"paused": (0, 1)[curShow.paused],
......
......@@ -602,9 +602,9 @@ class Home(WebHandler):
return _("Invalid show paramaters")
if absolute:
epObj = showObj.getEpisode(absolute_number=int(absolute))
epObj = showObj.get_episode(absolute_number=int(absolute))
elif season and episode:
epObj = showObj.getEpisode(int(season), int(episode))
epObj = showObj.get_episode(int(season), int(episode))
else:
return _("Invalid paramaters")
......@@ -973,7 +973,7 @@ class Home(WebHandler):
try:
show = findCertainShow(int(show))
show.notify_list = emails
show.saveToDB()
show.save_to_db()
except Exception:
return 'ERROR'
......@@ -1206,7 +1206,7 @@ class Home(WebHandler):
}
for curEp in episodeResults:
curEpCat = showObj.getOverview(int(curEp['status'] or -1))
curEpCat = showObj.get_overview(int(curEp['status'] or -1))
if curEp['airdate'] != 1:
today = datetime.datetime.now().replace(tzinfo=sickrage.app.tz)
......@@ -1485,7 +1485,7 @@ class Home(WebHandler):
"you change the directory in SiCKRAGE.") % location)
# save it to the DB
showObj.saveToDB()
showObj.save_to_db()
# force the update
if do_update:
......@@ -1537,7 +1537,7 @@ class Home(WebHandler):
showObj.paused = not showObj.paused
showObj.saveToDB()
showObj.save_to_db()
sickrage.app.alerts.message(
_('%s has been %s') % (showObj.name, (_('resumed'), _('paused'))[showObj.paused]))
......@@ -1620,7 +1620,7 @@ class Home(WebHandler):
return self._genericMessage(_("Error"), _("Unable to find the specified show"))
# search and download subtitles
sickrage.app.show_queue.downloadSubtitles(showObj)
sickrage.app.show_queue.download_subtitles(showObj)
time.sleep(cpu_presets[sickrage.app.config.cpu_preset])
......@@ -1719,7 +1719,7 @@ class Home(WebHandler):
epInfo[0], epInfo[1]))
continue
epObj = showObj.getEpisode(int(epInfo[0]), int(epInfo[1]))
epObj = showObj.get_episode(int(epInfo[0]), int(epInfo[1]))
if not epObj:
return self._genericMessage(_("Error"), _("Episode couldn't be retrieved"))
......@@ -1780,7 +1780,7 @@ class Home(WebHandler):
epInfo[0], epInfo[1]))
continue
epObj = showObj.getEpisode(int(epInfo[0]), int(epInfo[1]))
epObj = showObj.get_episode(int(epInfo[0]), int(epInfo[1]))
if not epObj:
return self._genericMessage(_("Error"), _("Episode couldn't be retrieved"))
......@@ -1820,7 +1820,7 @@ class Home(WebHandler):
epObj.status = int(status)
# save to database
epObj.saveToDB()
epObj.save_to_db()
trakt_data.append((epObj.season, epObj.episode))
......@@ -1896,7 +1896,7 @@ class Home(WebHandler):
ep_obj_rename_list = []
ep_obj_list = showObj.getAllEpisodes(has_location=True)
ep_obj_list = showObj.get_all_episodes(has_location=True)
for cur_ep_obj in ep_obj_list:
# Only want to rename if we have a location
......@@ -1959,12 +1959,12 @@ class Home(WebHandler):
sickrage.app.log.warning("Unable to find an episode for " + curEp + ", skipping")
continue
root_ep_obj = show_obj.getEpisode(int(epInfo[0]), int(epInfo[1]))
root_ep_obj = show_obj.get_episode(int(epInfo[0]), int(epInfo[1]))
root_ep_obj.relatedEps = []
for cur_related_ep in (x for x in sickrage.app.main_db.all('tv_episodes')
if x['location'] == ep_result[0]['location'] and x['episode'] != int(epInfo[1])):
related_ep_obj = show_obj.getEpisode(int(cur_related_ep["season"]), int(cur_related_ep["episode"]))
related_ep_obj = show_obj.get_episode(int(cur_related_ep["season"]), int(cur_related_ep["episode"]))
if related_ep_obj not in root_ep_obj.relatedEps:
root_ep_obj.relatedEps.append(related_ep_obj)
......@@ -2007,7 +2007,7 @@ class Home(WebHandler):
'status': statusStrings[searchThread.segment.status],
'quality': self.getQualityClass(searchThread.segment),
'overview': Overview.overviewStrings[
showObj.getOverview(int(searchThread.segment.status or -1))]})
showObj.get_overview(int(searchThread.segment.status or -1))]})
else:
for epObj in searchThread.segment:
results.append({'show': epObj.show.indexerid,
......@@ -2017,7 +2017,7 @@ class Home(WebHandler):
'searchstatus': searchstatus,
'status': statusStrings[epObj.status],