Commit c6d7c187 authored by echel0n's avatar echel0n

Merge branch 'release/9.4.31'

parents 47e0d2d9 2abdafec
# Changelog
- * 1589213 - 2018-11-11: Release v9.4.30
- * fa636d3 - 2018-11-12: Release v9.4.31
- * fcdd0e0 - 2018-11-12: Added more UI notifications for version updater.
- * 971fc67 - 2018-11-12: Pre-Release v9.4.31.dev5
- * 4d0d839 - 2018-11-12: Pre-Release v9.4.31.dev4
- * 12f8ad6 - 2018-11-12: Pre-Release v9.4.31.dev3
- * 82115fc - 2018-11-12: Pre-Release v9.4.31.dev2
- * bbac0e2 - 2018-11-12: Pre-Release v9.4.31.dev1
- * ae00748 - 2018-11-12: Updater now waits for show queue to finish before updating.
- * 34aa88c - 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.
- * f87d6ad - 2018-11-11: Release v9.4.29
......
......@@ -473,7 +473,7 @@ class Core(object):
self.wserver.start()
# fire off startup events
self.event_queue.fire_event(self.version_updater.run)
self.event_queue.fire_event(self.version_updater.run, force=True)
self.event_queue.fire_event(self.tz_updater.run)
# start ioloop
......@@ -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:
......
......@@ -346,7 +346,7 @@ class srDatabase(object):
def all(self, *args, **kwargs):
with_doc = kwargs.pop('with_doc', True)
for data in self.db.all(*args, **kwargs):
if with_doc:
if with_doc :
try:
doc = self.db.get('id', data['_id'])
yield doc
......
......@@ -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:
......
......@@ -45,7 +45,7 @@ class srQueue(threading.Thread):
self.daemon = True
self._queue = PriorityQueue()
self._result_queue = Queue()
self.currentItem = None
self._current_items = []
self.min_priority = srQueuePriorities.EXTREME
self.amActive = False
self.lock = threading.Lock()
......@@ -61,20 +61,18 @@ class srQueue(threading.Thread):
self.amActive = True
if not self.is_paused:
if self.currentItem:
if self.next_item_priority < self.currentItem.priority:
__ = self.currentItem
self.currentItem = self.get()
self.currentItem.start()
self.currentItem.join()
self.currentItem = __
if self.current_item:
if self.next_item_priority < self.current_item.priority:
self.current_item = self.get()
self.current_item.start()
self.current_item.join()
if not self.currentItem or not self.currentItem.isAlive():
if self.currentItem:
self.currentItem = None
if not self.current_item or not self.current_item.isAlive():
if self.current_item:
self.current_item = None
self.currentItem = self.get()
self.currentItem.start()
self.current_item = self.get()
self.current_item.start()
self.amActive = False
......@@ -93,6 +91,18 @@ class srQueue(threading.Thread):
return priority
@property
def current_item(self):
if len(self._current_items):
return self._current_items[0]
@current_item.setter
def current_item(self, value):
if value:
self._current_items.insert(0, value)
else:
del self._current_items[0]
def get(self, *args, **kwargs):
__, __, item = self._queue.get(*args, **kwargs)
return item
......@@ -110,18 +120,22 @@ class srQueue(threading.Thread):
self._queue.put((item.priority, time.time(), item), *args, **kwargs)
return item
@property
def is_busy(self):
return bool(len([x for x in self._current_items if x.isAlive()]))
@property
def is_paused(self):
return self.min_priority == srQueuePriorities.PAUSED
def pause(self):
"""Pauses this queue"""
sickrage.app.log.info("Pausing queue")
sickrage.app.log.info("Pausing {}".format(self.name))
self.min_priority = srQueuePriorities.PAUSED
def unpause(self):
"""Unpauses this queue"""
sickrage.app.log.info("Unpausing queue")
sickrage.app.log.info("Un-pausing {}".format(self.name))
self.min_priority = srQueuePriorities.EXTREME
def shutdown(self):
......
......@@ -15,8 +15,11 @@
#
# You should have received a copy of the GNU General Public License
# along with SickRage. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
from functools import partial
from sickrage.core.queues import srQueue, srQueueItem
......@@ -24,8 +27,8 @@ class EventQueue(srQueue):
def __init__(self):
srQueue.__init__(self, "EVENTQUEUE")
def fire_event(self, event, force=False):
return self.put(EventQueueItem(event))
def fire_event(self, event, **kwargs):
return self.put(EventQueueItem(event, **kwargs))
class EventQueueItem(srQueueItem):
......@@ -33,9 +36,9 @@ class EventQueueItem(srQueueItem):
Represents an event in the queue waiting to be executed
"""
def __init__(self, event):
def __init__(self, event, **kwargs):
super(EventQueueItem, self).__init__('Firing Event')
self.event = event
self.event = partial(event, **kwargs)
def run(self):
self.event()
......@@ -53,7 +53,7 @@ class PostProcessorQueue(srQueue):
:param proc_type: processing type, auto/manual
:return: instance of PostProcessorItem or None
"""
for __, __, cur_item in self.queue + [(None, None, self.currentItem)]:
for __, __, cur_item in self.queue + [(None, None, self.current_item)]:
if isinstance(cur_item,
PostProcessorItem) and cur_item.dirName == dirName and cur_item.proc_type == proc_type:
return cur_item
......@@ -61,7 +61,7 @@ class PostProcessorQueue(srQueue):
@property
def is_in_progress(self):
for __, __, cur_item in self.queue + [(None, None, self.currentItem)]:
for __, __, cur_item in self.queue + [(None, None, self.current_item)]:
if isinstance(cur_item, PostProcessorItem):
return True
return False
......@@ -74,7 +74,7 @@ class PostProcessorQueue(srQueue):
"""
length = {'auto': 0, 'manual': 0}
for __, __, cur_item in self.queue + [(None, None, self.currentItem)]:
for __, __, cur_item in self.queue + [(None, None, self.current_item)]:
if isinstance(cur_item, PostProcessorItem):
if cur_item.proc_type == 'auto':
length['auto'] += 1
......@@ -116,7 +116,7 @@ class PostProcessorQueue(srQueue):
item = self.find_in_queue(dirName, proc_type)
if item:
if self.currentItem == item:
if self.current_item == item:
return logHelper("Directory {} is already being processed right now, please wait until it completes "
"before trying again".format(dirName))
......
......@@ -94,20 +94,20 @@ class SearchQueue(srQueue):
def is_manualsearch_in_progress(self):
# Only referenced in webviews.py, only current running manualsearch or failedsearch is needed!!
if isinstance(self.currentItem, (ManualSearchQueueItem, FailedQueueItem)):
if isinstance(self.current_item, (ManualSearchQueueItem, FailedQueueItem)):
return True
return False
def is_backlog_in_progress(self):
for __, __, cur_item in self.queue + [(None, None, self.currentItem)]:
for __, __, cur_item in self.queue + [(None, None, self.current_item)]:
if isinstance(cur_item, BacklogQueueItem):
return True
return False
def is_dailysearch_in_progress(self):
for __, __, cur_item in self.queue + [(None, None, self.currentItem)]:
for __, __, cur_item in self.queue + [(None, None, self.current_item)]:
if isinstance(cur_item, DailySearchQueueItem):
return True
......@@ -115,7 +115,7 @@ class SearchQueue(srQueue):
def queue_length(self):
length = {'backlog': 0, 'daily': 0, 'manual': 0, 'failed': 0}
for __, __, cur_item in self.queue + [(None, None, self.currentItem)]:
for __, __, cur_item in self.queue + [(None, None, self.current_item)]:
if isinstance(cur_item, DailySearchQueueItem):
length['daily'] += 1
elif isinstance(cur_item, BacklogQueueItem):
......
......@@ -52,7 +52,7 @@ class ShowQueue(srQueue):
x.action_id in actions] if show else False
def _is_being(self, show, actions):
return self.currentItem is not None and show == self.currentItem.show and self.currentItem.action_id in actions
return self.current_item is not None and show == self.current_item.show and self.current_item.action_id in actions
def is_in_update_queue(self, show):
return self._is_in_queue(show, (ShowQueueActions.UPDATE, ShowQueueActions.FORCEUPDATE))
......@@ -84,8 +84,11 @@ class ShowQueue(srQueue):
def is_being_subtitled(self, show):
return self._is_being(show, (ShowQueueActions.SUBTITLE,))
def _get_queue_items(self):
return [x for __, __, x in self.queue + [(None, None, self.current_item)] if x]
def _get_loading_show_list(self):
return [x for __, __, x in self.queue + [(None, None, self.currentItem)] if x and x.is_loading]
return [x for x in self._get_queue_items() if x.is_loading]
def updateShow(self, show, force=False):
if self.is_being_added(show):
......@@ -118,7 +121,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,
......@@ -155,7 +158,7 @@ class ShowQueue(srQueue):
# remove other queued actions for this show.
for __, __, x in self.queue:
if x and x.show and x != self.currentItem and show.indexerid == x.show.indexerid:
if x and x.show and x != self.current_item and show.indexerid == x.show.indexerid:
self.queue.remove(x)
return self.put(QueueItemRemove(show=show, full=full))
......@@ -201,10 +204,10 @@ 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.currentItem]
return self in sickrage.app.show_queue.queue + [sickrage.app.show_queue.current_item]
@property
def show_name(self):
......@@ -332,7 +335,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
......@@ -397,7 +400,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())
......@@ -408,7 +411,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(
......@@ -416,7 +419,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())
......@@ -426,8 +429,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
......@@ -450,7 +453,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)
......@@ -479,10 +482,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)
......@@ -509,7 +512,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:
......@@ -541,7 +544,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()
......@@ -560,7 +563,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))
......@@ -577,12 +580,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))
......@@ -603,7 +606,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
......@@ -646,7 +649,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):