diff --git a/sickbeard/postProcessor.py b/sickbeard/postProcessor.py index 8b0343b1e9c336d5ee0007bb906472baf26d38f8..5c88dcd5f17e383ec5aac0ae2aa1c2e0276b0b9c 100644 --- a/sickbeard/postProcessor.py +++ b/sickbeard/postProcessor.py @@ -509,8 +509,9 @@ class PostProcessor(object): self.in_history = True self.version = version - to_return = (str(show), season, [], quality, version) - self._log("Found result in history: " + str(to_return), logger.DEBUG) + to_return = (show, season, [], quality, version) + + self._log("Found result in history for %s - Season: %s - Quality: %s - Version: %s" % (show.name, season, common.Quality.qualityStrings[quality], version), logger.DEBUG) return to_return diff --git a/sickbeard/providers/__init__.py b/sickbeard/providers/__init__.py index 3923308c2fcc82f84895f726ec921227d28d906d..05dc3407394a3608b1c00bfd15bb01485ebffac3 100644 --- a/sickbeard/providers/__init__.py +++ b/sickbeard/providers/__init__.py @@ -26,7 +26,7 @@ from sickbeard import logger from sickbeard.providers import btn, newznab, rsstorrent, womble, thepiratebay, torrentleech, kat, iptorrents, torrentz, \ omgwtfnzbs, scc, hdtorrents, torrentday, hdbits, hounddawgs, speedcd, nyaatorrents, animenzb, bluetigers, cpasbien, fnt, xthor, torrentbytes, \ freshontv, titansoftv, morethantv, bitsoup, t411, tokyotoshokan, shazbat, rarbg, alpharatio, tntvillage, binsearch, torrentproject, extratorrent, \ - scenetime, btdigg, strike, transmitthenet, tvchaosuk, bitcannon, pretome, gftracker, hdspace, newpct, elitetorrent, bitsnoop, danishbits, hd4free + scenetime, btdigg, transmitthenet, tvchaosuk, bitcannon, pretome, gftracker, hdspace, newpct, elitetorrent, bitsnoop, danishbits, hd4free __all__ = [ 'womble', 'btn', 'thepiratebay', 'kat', 'torrentleech', 'scc', 'hdtorrents', @@ -34,7 +34,7 @@ __all__ = [ 'speedcd', 'nyaatorrents', 'animenzb', 'torrentbytes', 'freshontv', 'titansoftv', 'morethantv', 'bitsoup', 't411', 'tokyotoshokan', 'alpharatio', 'shazbat', 'rarbg', 'tntvillage', 'binsearch', 'bluetigers', 'cpasbien', - 'fnt', 'xthor', 'scenetime', 'btdigg', 'strike', 'transmitthenet', 'tvchaosuk', + 'fnt', 'xthor', 'scenetime', 'btdigg', 'transmitthenet', 'tvchaosuk', 'torrentproject', 'extratorrent', 'bitcannon', 'torrentz', 'pretome', 'gftracker', 'hdspace', 'newpct', 'elitetorrent', 'bitsnoop', 'danishbits', 'hd4free' ] diff --git a/sickbeard/subtitles.py b/sickbeard/subtitles.py index 932caded5b61b2dd5d53a85f1add51836e67bba8..931ca7e97b1f713563aae651400db98b02243ee0 100644 --- a/sickbeard/subtitles.py +++ b/sickbeard/subtitles.py @@ -32,8 +32,8 @@ from sickbeard import logger from sickbeard import history from sickbeard import db from sickbeard import processTV -from sickbeard.helpers import remove_non_release_groups -from sickrage.helper.common import media_extensions, dateTimeFormat +from sickbeard.helpers import remove_non_release_groups, isMediaFile +from sickrage.helper.common import dateTimeFormat from sickrage.helper.encoding import ek from sickrage.helper.exceptions import ex from sickrage.show.Show import Show @@ -223,8 +223,7 @@ def download_subtitles(subtitles_info): # pylint: disable=too-many-locals sickbeard.helpers.chmodAsParent(subtitle_path) sickbeard.helpers.fixSetGroupID(subtitle_path) - if (not sickbeard.EMBEDDED_SUBTITLES_ALL and sickbeard.SUBTITLES_EXTRA_SCRIPTS and - video_path.rsplit(".", 1)[1] in media_extensions): + if sickbeard.SUBTITLES_EXTRA_SCRIPTS and isMediaFile(video_path) and not sickbeard.EMBEDDED_SUBTITLES_ALL: run_subs_extra_scripts(subtitles_info, found_subtitles, video, single=not sickbeard.SUBTITLES_MULTI) current_subtitles = [subtitle.language.opensubtitles for subtitle in found_subtitles] @@ -346,7 +345,7 @@ class SubtitlesFinder(object): except Exception as error: logger.log(u'Could not remove non release groups from video file. Error: %r' % ex(error), logger.DEBUG) - if video_filename.rsplit(".", 1)[1] in media_extensions: + if isMediaFile(video_filename): try: video = subliminal.scan_video(os.path.join(root, video_filename), subtitles=False, embedded_subtitles=False) @@ -357,6 +356,7 @@ class SubtitlesFinder(object): % ek(os.path.join, root, video_filename), logger.DEBUG) continue + logger.log(u'Found subtitle(s) canditate(s) for %s' % video_filename, logger.INFO) hearing_impaired = sickbeard.SUBTITLES_HEARING_IMPAIRED user_score = 132 if sickbeard.SUBTITLES_PERFECT_MATCH else 111 found_subtitles = pool.download_best_subtitles(subtitles_list, video, languages=languages, @@ -414,7 +414,7 @@ class SubtitlesFinder(object): if sickbeard.SUBTITLES_DOWNLOAD_IN_PP: self.subtitles_download_in_pp() - logger.log(u'Checking for subtitles', logger.INFO) + logger.log(u'Checking for missed subtitles', logger.INFO) # get episodes on which we want subtitles # criteria is: @@ -464,9 +464,6 @@ class SubtitlesFinder(object): % (ep_to_sub['show_name'], ep_to_sub['season'], ep_to_sub['episode']), logger.DEBUG) continue - logger.log(u"%s S%02dE%02d doesn't have all needed subtitles" - % (ep_to_sub['show_name'], ep_to_sub['season'], ep_to_sub['episode']), logger.DEBUG) - try: try: lastsearched = datetime.datetime.strptime(ep_to_sub['lastsearch'], dateTimeFormat) @@ -478,7 +475,7 @@ class SubtitlesFinder(object): (ep_to_sub['airdate_daydiff'] <= 7 and ep_to_sub['searchcount'] < 7 and now - lastsearched > datetime.timedelta(hours=rules['new'][ep_to_sub['searchcount']]))): - logger.log(u'Started subtitles search for %s S%02dE%02d' + logger.log(u'Started missed subtitles search for %s S%02dE%02d' % (ep_to_sub['show_name'], ep_to_sub['season'], ep_to_sub['episode']), logger.INFO) show_object = Show.find(sickbeard.showList, int(ep_to_sub['showid'])) @@ -507,6 +504,10 @@ class SubtitlesFinder(object): logger.log(u'Downloaded %s subtitles for %s S%02dE%02d' % (', '.join(new_subtitles), ep_to_sub['show_name'], ep_to_sub["season"], ep_to_sub["episode"])) + else: + logger.log(u"Subtitle search limit reached for %s S%02dE%02d" + % (ep_to_sub['show_name'], ep_to_sub['season'], ep_to_sub['episode']), logger.INFO) + except Exception as error: logger.log(u'Error while searching subtitles for %s S%02dE%02d. Error: %r' % (ep_to_sub['show_name'], ep_to_sub['season'], ep_to_sub['episode'], diff --git a/sickbeard/tv.py b/sickbeard/tv.py index bdaac1d4689b7e20ac92b178892e94d3b7eb4452..050fd6ccb6b071f7bedd120d24da3bd541e6e4a6 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -1435,8 +1435,8 @@ class TVEpisode(object): % (self.season or 0, self.episode or 0, self.show.name), logger.DEBUG) return - logger.log(u"%s: Downloading subtitles for %s S%02dE%02d" - % (self.show.indexerid, self.show.name, self.season or 0, self.episode or 0), logger.DEBUG) + logger.log(u"Checking subtitle candidates for %s S%02dE%02d (%s)" + % (self.show.name, self.season or 0, self.episode or 0, os.path.basename(self.location)), logger.DEBUG) subtitles_info = {'location': self.location, 'subtitles': self.subtitles, 'season': self.season, 'episode': self.episode, 'name': self.name, 'show_name': self.show.name, diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 82bd3dccad2c8c947790cc81804f6e0f62ec4921..5d9a5c247e1351f9ba08ce13197c540490349b44 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -2969,7 +2969,7 @@ class Manage(Home, WebRoot): def showSubtitleMissed(indexer_id, whichSubs): myDB = db.DBConnection() cur_show_results = myDB.select( - "SELECT season, episode, name, subtitles FROM tv_episodes WHERE showid = ? AND season != 0 AND status LIKE '%4'", + "SELECT season, episode, name, subtitles FROM tv_episodes WHERE showid = ? AND season != 0 AND (status LIKE '%4' OR status LIKE '%6') and location != ''", [int(indexer_id)]) result = {} @@ -3008,8 +3008,8 @@ class Manage(Home, WebRoot): status_results = myDB.select( "SELECT show_name, tv_shows.indexer_id as indexer_id, tv_episodes.subtitles subtitles " + "FROM tv_episodes, tv_shows " + - "WHERE tv_shows.subtitles = 1 AND tv_episodes.status LIKE '%4' AND tv_episodes.season != 0 " + - "AND tv_episodes.showid = tv_shows.indexer_id ORDER BY show_name") + "WHERE tv_shows.subtitles = 1 AND (tv_episodes.status LIKE '%4' OR tv_episodes.status LIKE '%6') AND tv_episodes.season != 0 " + + "AND tv_episodes.location != '' AND tv_episodes.showid = tv_shows.indexer_id ORDER BY show_name") ep_counts = {} show_names = {} @@ -3056,7 +3056,7 @@ class Manage(Home, WebRoot): if 'all' in to_download[cur_indexer_id]: myDB = db.DBConnection() all_eps_results = myDB.select( - "SELECT season, episode FROM tv_episodes WHERE status LIKE '%4' AND season != 0 AND showid = ?", + "SELECT season, episode FROM tv_episodes WHERE (status LIKE '%4' OR status LIKE '%6') AND season != 0 AND showid = ? AND location != ''", [cur_indexer_id]) to_download[cur_indexer_id] = [str(x["season"]) + 'x' + str(x["episode"]) for x in all_eps_results]