diff --git a/gui/slick/views/displayShow.mako b/gui/slick/views/displayShow.mako index f53a654886cec80d558c306314dfa1955b4377ca..c071de73206444bf3871d404defdf3a90232274a 100644 --- a/gui/slick/views/displayShow.mako +++ b/gui/slick/views/displayShow.mako @@ -521,10 +521,8 @@ <a class="epSearch" id="${str(show.indexerid)}x${str(epResult["season"])}x${str(epResult["episode"])}" name="${str(show.indexerid)}x${str(epResult["season"])}x${str(epResult["episode"])}" href="searchEpisode?show=${show.indexerid}&season=${epResult["season"]}&episode=${epResult["episode"]}"><img src="${srRoot}/images/search16.png" width="16" height="16" alt="search" title="Manual Search" /></a> % endif % endif - % if sickbeard.USE_SUBTITLES and show.subtitles and epResult["location"]: - % if (sickbeard.SUBTITLES_MULTI and subtitles.needs_subtitles(epResult["subtitles"])) or (not sickbeard.SUBTITLES_MULTI and len(subtitles.wanted_languages()) > 0 and "und" not in epResult["subtitles"] and list(subtitles.wanted_languages())[0] not in epResult["subtitles"]): - <a class="epSubtitlesSearch" href="searchEpisodeSubtitles?show=${show.indexerid}&season=${epResult["season"]}&episode=${epResult["episode"]}"><img src="${srRoot}/images/closed_captioning.png" height="16" alt="search subtitles" title="Search Subtitles" /></a> - % endif + % if sickbeard.USE_SUBTITLES and show.subtitles and epResult["location"] and subtitles.needs_subtitles(epResult['subtitles']): + <a class="epSubtitlesSearch" href="searchEpisodeSubtitles?show=${show.indexerid}&season=${epResult["season"]}&episode=${epResult["episode"]}"><img src="${srRoot}/images/closed_captioning.png" height="16" alt="search subtitles" title="Search Subtitles" /></a> % endif </td> </tr> diff --git a/sickbeard/subtitles.py b/sickbeard/subtitles.py index 6bb68761e0ad931b24b5a616a65f44a6973877ba..932caded5b61b2dd5d53a85f1add51836e67bba8 100644 --- a/sickbeard/subtitles.py +++ b/sickbeard/subtitles.py @@ -122,13 +122,16 @@ def subtitle_code_filter(): def needs_subtitles(subtitles): - if isinstance(subtitles, basestring) and sickbeard.SUBTITLES_MULTI: - subtitles = {subtitle.strip() for subtitle in subtitles.split(',')} + if not wanted_languages(): + return False + + if isinstance(subtitles, basestring): + subtitles = {subtitle.strip() for subtitle in subtitles.split(',') if subtitle.strip()} if sickbeard.SUBTITLES_MULTI: - return len(wanted_languages().difference(subtitles)) > 0 - elif 'und' not in subtitles: - return True + return wanted_languages().difference(subtitles) + + return 'und' not in subtitles # Hack around this for now. @@ -456,6 +459,11 @@ class SubtitlesFinder(object): % (ep_to_sub['show_name'], ep_to_sub['season'], ep_to_sub['episode']), logger.DEBUG) continue + if not needs_subtitles(ep_to_sub['subtitles']): + logger.log(u'Episode already has all needed subtitles, skipping %s S%02dE%02d' + % (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)