diff --git a/sickbeard/postProcessor.py b/sickbeard/postProcessor.py index 500c236e9a6688c894caccbb418d604946fe93b9..b9c48f8e3dadf131dfc8b6fcfa8febd784a5c487 100644 --- a/sickbeard/postProcessor.py +++ b/sickbeard/postProcessor.py @@ -835,6 +835,12 @@ class PostProcessor(object): logger.log("good results: " + repr(self.good_results), logger.DEBUG) cur_ep.status = common.Quality.compositeStatus(common.DOWNLOADED, new_ep_quality) + + cur_ep.subtitles = [] + + cur_ep.subtitles_searchcount = 0 + + subtitles_lastsearch = '0001-01-01 00:00:00' cur_ep.is_proper = self.is_proper @@ -857,7 +863,7 @@ class PostProcessor(object): # download subtitles if sickbeard.USE_SUBTITLES and ep_obj.show.subtitles: cur_ep.location = self.file_path - cur_ep.downloadSubtitles() + cur_ep.downloadSubtitles(force=True) # figure out the base name of the resulting episode file if sickbeard.RENAME_EPISODES: diff --git a/sickbeard/tv.py b/sickbeard/tv.py index 8d810088714a30b82cc9cc2935d2e636a36661a8..2c4434042260a0539644e796693681e7ff08a7ad 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -912,7 +912,7 @@ class TVShow(object): curEp.saveToDB() - def downloadSubtitles(self): + def downloadSubtitles(self, force=False): #TODO: Add support for force option if not ek.ek(os.path.isdir, self._location): logger.log(str(self.tvdbid) + ": Show dir doesn't exist, can't download subtitles", logger.DEBUG) @@ -923,7 +923,7 @@ class TVShow(object): episodes = db.DBConnection().select("SELECT location FROM tv_episodes WHERE showid = ? AND location NOT LIKE '' ORDER BY season DESC, episode DESC", [self.tvdbid]) for episodeLoc in episodes: episode = self.makeEpFromFile(episodeLoc['location']); - subtitles = episode.downloadSubtitles() + subtitles = episode.downloadSubtitles(force=force) if sickbeard.SUBTITLES_DIR: for video in subtitles: @@ -1155,7 +1155,7 @@ class TVEpisode(object): """Look for subtitles files and refresh the subtitles property""" self.subtitles = subtitles.subtitlesLanguages(self.location) - def downloadSubtitles(self): + def downloadSubtitles(self,force=False): #TODO: Add support for force option if not ek.ek(os.path.isfile, self.location): logger.log(str(self.show.tvdbid) + ": Episode file doesn't exist, can't download subtitles for episode " + str(self.season) + "x" + str(self.episode), logger.DEBUG) @@ -1166,7 +1166,7 @@ class TVEpisode(object): try: need_languages = set(sickbeard.SUBTITLES_LANGUAGES) - set(self.subtitles) - subtitles = subliminal.download_subtitles([self.location], languages=need_languages, services=sickbeard.subtitles.getEnabledServiceList(), force=False, multi=True, cache_dir=sickbeard.CACHE_DIR) + subtitles = subliminal.download_subtitles([self.location], languages=need_languages, services=sickbeard.subtitles.getEnabledServiceList(), force=force, multi=True, cache_dir=sickbeard.CACHE_DIR) except Exception as e: logger.log("Error occurred when downloading subtitles: " + str(e), logger.DEBUG)