diff --git a/gui/slick/views/config_subtitles.mako b/gui/slick/views/config_subtitles.mako index df6c0246bc93ccd0f37616548a54ef0536a5d716..765d96db2cfb95b9902400025116ab15bc0420bc 100644 --- a/gui/slick/views/config_subtitles.mako +++ b/gui/slick/views/config_subtitles.mako @@ -100,6 +100,10 @@ $('#subtitles_dir').fileBrowser({ title: 'Select Subtitles Download Directory' } <p>Append language codes to subtitle filenames?</p> </span> </label> + <label> + <span class="component-title"> </span> + <span class="component-desc"><b>NOTE:</b> This option is required if you use multiple subtitle languages.</span> + </label> </div> <div class="field-pair"> <label class="clearfix" for="subtitles_download_in_pp"> diff --git a/gui/slick/views/displayShow.mako b/gui/slick/views/displayShow.mako index 8e78f7332e10a33aa9301dbcbdcb566d434e2e23..9b7515d7ff7681da6e9bb316a590fcb9c70c674d 100644 --- a/gui/slick/views/displayShow.mako +++ b/gui/slick/views/displayShow.mako @@ -519,8 +519,10 @@ <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"] and (len(epResult["subtitles"]) == 0 or 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> + % 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 % endif </td> </tr> diff --git a/gui/slick/views/manage_subtitleMissed.mako b/gui/slick/views/manage_subtitleMissed.mako index 25d8442888f380f71b78b1f8afad353b544da957..cd9d2d241e0cf2f78457c1400ed3cd66b655a365 100644 --- a/gui/slick/views/manage_subtitleMissed.mako +++ b/gui/slick/views/manage_subtitleMissed.mako @@ -22,13 +22,25 @@ % endif <form action="${srRoot}/manage/subtitleMissed" method="get"> - Manage episodes without <select name="whichSubs" class="form-control form-control-inline input-sm"> - <option value="all">All</option> - % for sub_code in subtitles.wanted_languages(): - <option value="${sub_code}">${subtitles.name_from_code(sub_code)}</option> - % endfor + % if sickbeard.SUBTITLES_MULTI: + Manage episodes without <select name="whichSubs" class="form-control form-control-inline input-sm"> + <option value="all">All</option> + % for sub_code in subtitles.wanted_languages(): + <option value="${sub_code}">${subtitles.name_from_code(sub_code)}</option> + % endfor + % else: + Manage episodes without <select name="whichSubs" class="form-control form-control-inline input-sm"> + % if not subtitles.wanted_languages(): + <option value="all">All</option> + % else: + % for index, sub_code in enumerate(subtitles.wanted_languages()): + % if index == 0: + <option value="und">${subtitles.name_from_code(sub_code)}</option> + % endif + % endfor + % endif </select> - + % endif <input class="btn" type="submit" value="Manage" /> </form> @@ -36,7 +48,15 @@ ##Strange that this is used by js but is an input outside of any form? <input type="hidden" id="selectSubLang" name="selectSubLang" value="${whichSubs}" /> <form action="${srRoot}/manage/downloadSubtitleMissed" method="post"> - <h2>Episodes without ${subsLanguage} subtitles.</h2> + % if sickbeard.SUBTITLES_MULTI: + <h2>Episodes without ${subsLanguage} subtitles.</h2> + % else: + % for index, sub_code in enumerate(subtitles.wanted_languages()): + % if index == 0: + <h2>Episodes without ${subtitles.name_from_code(sub_code)} (undefined) subtitles.</h2> + % endif + % endfor + % endif <br> Download missed subtitles for selected episodes <input class="btn btn-inline" type="submit" value="Go" /> <div> diff --git a/sickbeard/subtitles.py b/sickbeard/subtitles.py index d568aa6d0e27abe3370753b7c9e823de401b135b..d0ab532c4c84b9b3a4152154464a918da320c498 100644 --- a/sickbeard/subtitles.py +++ b/sickbeard/subtitles.py @@ -123,13 +123,13 @@ def subtitle_code_filter(): def needs_subtitles(subtitles): - if isinstance(subtitles, basestring): + if isinstance(subtitles, basestring) and sickbeard.SUBTITLES_MULTI: subtitles = {subtitle.strip() for subtitle in subtitles.split(',')} if sickbeard.SUBTITLES_MULTI: return len(wanted_languages().difference(subtitles)) > 0 - else: - return len(subtitles) == 0 + elif 'und' not in subtitles: + return True # Hack around this for now.