Private GIT

Skip to content
Snippets Groups Projects
Commit eef4a7ce authored by medariox's avatar medariox
Browse files

Add back needed subs check

fix indent

more small subs improvements

less noodles!

more checks
parent 98126ee1
No related branches found
No related tags found
No related merge requests found
......@@ -521,11 +521,9 @@
<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}&amp;season=${epResult["season"]}&amp;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"]):
% if sickbeard.USE_SUBTITLES and show.subtitles and epResult["location"] and subtitles.needs_subtitles(epResult['subtitles']):
<a class="epSubtitlesSearch" href="searchEpisodeSubtitles?show=${show.indexerid}&amp;season=${epResult["season"]}&amp;episode=${epResult["episode"]}"><img src="${srRoot}/images/closed_captioning.png" height="16" alt="search subtitles" title="Search Subtitles" /></a>
% endif
% endif
</td>
</tr>
% endfor
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment