diff --git a/sickchill/gui/slick/views/config_search.mako b/sickchill/gui/slick/views/config_search.mako index eca52cc6c0..18c992232a 100644 --- a/sickchill/gui/slick/views/config_search.mako +++ b/sickchill/gui/slick/views/config_search.mako @@ -36,7 +36,7 @@
+ class="enabler" ${checked(settings.RANDOMIZE_PROVIDERS)}/>
@@ -47,7 +47,7 @@
+ class="enabler" ${checked(settings.DOWNLOAD_PROPERS)}/>
@@ -78,12 +78,12 @@ -
- +
@@ -102,8 +102,8 @@
+ value="${settings.BACKLOG_DAYS}" class="form-control input-sm input75" + autocapitalize="off" id="backlog_days" />
@@ -122,8 +122,8 @@
+ value="${settings.BACKLOG_FREQUENCY}" class="form-control input-sm input75" + id="backlog_frequency" autocapitalize="off" />
@@ -142,8 +142,8 @@
+ id="dailysearch_frequency" value="${settings.DAILYSEARCH_FREQUENCY}" + class="form-control input-sm input75" autocapitalize="off" />
@@ -161,8 +161,8 @@
+ value="${settings.CACHE_RETENTION}" class="form-control input-sm input75" + autocapitalize="off" id="cache_retention" />
@@ -185,7 +185,8 @@
- +
@@ -204,7 +205,8 @@
- +
@@ -223,7 +225,9 @@
- +
@@ -237,14 +241,14 @@
+ class="form-control input-sm input350" autocapitalize="off" />
- +
@@ -256,7 +260,7 @@
+ id="allow_high_priority" ${checked(settings.ALLOW_HIGH_PRIORITY)}/>
@@ -268,7 +272,7 @@
+ name="use_failed_downloads" ${checked(settings.USE_FAILED_DOWNLOADS)} />
@@ -290,7 +294,7 @@
+ name="delete_failed" ${checked(settings.DELETE_FAILED)}/>
@@ -314,7 +318,7 @@
+ name="backlog_missing_only" ${checked(settings.BACKLOG_MISSING_ONLY)}/>
@@ -338,8 +342,8 @@
+ value="${settings.SHOW_SKIP_OLDER}" class="form-control input-sm input75" + autocapitalize="off" id="show_skip_older" />
@@ -382,7 +386,7 @@
+ id="use_nzbs" ${checked(settings.USE_NZBS)}/>
@@ -396,8 +400,8 @@
+ value="${settings.USENET_RETENTION}" class="form-control input-sm input75" + id="usenet_retention" autocapitalize="off" />
@@ -430,7 +434,7 @@
+ class="form-control input-sm input350" autocapitalize="off" />
@@ -449,8 +453,8 @@
+ value="${settings.SAB_USERNAME}" class="form-control input-sm input200" + autocapitalize="off" autocomplete="no" />
@@ -511,8 +515,8 @@
+ value="${settings.SAB_CATEGORY}" class="form-control input-sm input200" + autocapitalize="off" />
@@ -531,8 +535,8 @@
+ value="${settings.SAB_CATEGORY_BACKLOG}" + class="form-control input-sm input200" autocapitalize="off" />
@@ -551,8 +555,8 @@
+ value="${settings.SAB_CATEGORY_ANIME}" + class="form-control input-sm input200" autocapitalize="off" />
@@ -572,9 +576,9 @@
+ id="sab_category_anime_backlog" + value="${settings.SAB_CATEGORY_ANIME_BACKLOG}" + class="form-control input-sm input200" autocapitalize="off" />
@@ -592,7 +596,7 @@
+ id="sab_forced" ${checked(settings.SAB_FORCED)}/>
@@ -608,7 +612,7 @@
+ class="form-control input-sm input350" autocapitalize="off" />
@@ -630,7 +634,7 @@
+ name="nzbget_use_https" ${checked(settings.NZBGET_USE_HTTPS)}/>
@@ -649,8 +653,8 @@
+ value="${settings.NZBGET_HOST}" class="form-control input-sm input350" + autocapitalize="off" />
@@ -674,8 +678,8 @@
+ class="form-control input-sm input200" autocapitalize="off" + id="nzbget_username" autocomplete="no" />
@@ -715,8 +719,8 @@
+ value="${settings.NZBGET_CATEGORY}" + class="form-control input-sm input200" autocapitalize="off" />
@@ -735,8 +739,8 @@
+ value="${settings.NZBGET_CATEGORY_BACKLOG}" + class="form-control input-sm input200" autocapitalize="off" />
@@ -755,8 +759,8 @@
+ value="${settings.NZBGET_CATEGORY_ANIME}" + class="form-control input-sm input200" autocapitalize="off" />
@@ -775,9 +779,9 @@
+ id="nzbget_category_anime_backlog" + value="${settings.NZBGET_CATEGORY_ANIME_BACKLOG}" + class="form-control input-sm input200" autocapitalize="off" />
@@ -824,8 +828,8 @@
+ value="${settings.SYNOLOGY_DSM_HOST}" + class="form-control input-sm input350" autocapitalize="off" />
@@ -844,9 +848,9 @@
+ value="${settings.SYNOLOGY_DSM_USERNAME}" + class="form-control input-sm input200" autocapitalize="off" + autocomplete="no" />
@@ -886,8 +890,8 @@
+ value="${settings.SYNOLOGY_DSM_PATH}" + class="form-control input-sm input350" autocapitalize="off" />
@@ -944,7 +948,7 @@
+ id="use_torrents" ${checked(settings.USE_TORRENTS)}/>
@@ -957,13 +961,14 @@
+ class="form-control input-sm input350" autocapitalize="off" />
@@ -990,8 +995,8 @@
+ value="${settings.TORRENT_DIR}" + class="form-control input-sm input350" autocapitalize="off" />
@@ -1016,7 +1021,7 @@
+ class="form-control input-sm input350" autocapitalize="off" />
@@ -1034,8 +1039,8 @@
+ value="${settings.TORRENT_RPCURL}" + class="form-control input-sm input350" autocapitalize="off" />
@@ -1054,7 +1059,7 @@ <% http_authtype = {'none': "None", 'basic': "Basic", 'digest': "Digest"} %> % for authvalue, authname in http_authtype.items(): + value="${authvalue}" ${selected(settings.TORRENT_AUTH_TYPE == authvalue)}>${authname} % endfor
@@ -1065,7 +1070,7 @@
+ id="torrent_verify_cert" ${checked(settings.TORRENT_VERIFY_CERT)}/>
@@ -1077,9 +1082,9 @@
+ value="${settings.TORRENT_USERNAME}" + class="form-control input-sm input200" autocapitalize="off" + autocomplete="no" />
@@ -1117,8 +1122,8 @@
+ value="${settings.TORRENT_LABEL}" + class="form-control input-sm input200" autocapitalize="off" />
@@ -1143,8 +1148,8 @@
+ value="${settings.TORRENT_LABEL_ANIME}" + class="form-control input-sm input200" autocapitalize="off" />
@@ -1170,7 +1175,7 @@
+ class="form-control input-sm input350" autocapitalize="off" />
@@ -1194,8 +1199,8 @@
+ value="${settings.TORRENT_PATH_INCOMPLETE}" + class="form-control input-sm input350" autocapitalize="off" />
@@ -1216,7 +1221,7 @@
+ value="${settings.TORRENT_SEED_TIME}" class="form-control input-sm input100" />
@@ -1239,7 +1244,7 @@
+ id="torrent_paused" ${checked(settings.TORRENT_PAUSED)}/>
@@ -1254,7 +1259,7 @@
+ id="torrent_high_bandwidth" ${checked(settings.TORRENT_HIGH_BANDWIDTH)}/>
diff --git a/sickchill/gui/slick/views/editShow.mako b/sickchill/gui/slick/views/editShow.mako index 249596ec76..aafc8c2e4a 100644 --- a/sickchill/gui/slick/views/editShow.mako +++ b/sickchill/gui/slick/views/editShow.mako @@ -80,8 +80,8 @@
+ class="form-control input-sm input350" + autocapitalize="off" title="Location" />
@@ -125,9 +125,9 @@
@@ -209,7 +209,7 @@
+ name="anime" ${checked(show.is_anime)}>
@@ -303,8 +303,8 @@
+ name="rls_ignore_words" value="${show.rls_ignore_words}" + class="form-control input-sm input350" autocapitalize="off" />
@@ -314,8 +314,8 @@
- +
@@ -329,8 +329,8 @@
+ value="${show.rls_prefer_words}" autocapitalize="off" + class="form-control input-sm input350" />
@@ -341,8 +341,8 @@
- +
@@ -357,20 +357,21 @@
+ value="${show.rls_require_words}" autocapitalize="off" + class="form-control input-sm input350" />
- +
- +
@@ -434,7 +435,8 @@
- +
@@ -460,15 +462,15 @@
+ list="scene_exceptions" + class="form-control input-sm input350" + autocapitalize="off" title="Name" />
%if -1 in scene_exceptions: - %for exception in scene_exceptions[-1]: - + %for exception in scene_exceptions[-1]: + %endfor %endif @@ -485,8 +487,8 @@
${_('Poster for')} ${show.name}
@@ -505,8 +507,8 @@
@@ -525,8 +527,8 @@
${_('Fanart for')} ${show.name}
diff --git a/sickchill/helper/common.py b/sickchill/helper/common.py index 3f1122c8e6..9d51c0e9a7 100644 --- a/sickchill/helper/common.py +++ b/sickchill/helper/common.py @@ -1,7 +1,7 @@ +import os import platform import re import uuid -import os from fnmatch import fnmatch from os import PathLike from pathlib import Path diff --git a/sickchill/oldbeard/show_name_helpers.py b/sickchill/oldbeard/show_name_helpers.py index abc11b6187..0e2ea713ac 100644 --- a/sickchill/oldbeard/show_name_helpers.py +++ b/sickchill/oldbeard/show_name_helpers.py @@ -35,6 +35,28 @@ def contains_at_least_one_word(name, words): return False +def contains_all_words(name, words): + """ + Filters out results based on filter_words + + name: name to check + words : string of words separated by a ',' or list of words + + Returns: True if all words from the list are present in name, or the first word from the list not found in name. + """ + if isinstance(words, str): + words = words.split(",") + + words = {word.strip() for word in words if word.strip()} + if not any(words): + return True + + for word, regexp in {word: re.compile(r"(^|[\W_]){0}($|[\W_])".format(re.escape(word)), re.I) for word in words}.items(): + if not regexp.search(name): + return word + return True + + def filter_bad_releases(name, parse=True, show=None): """ Filters out non-english and just all-around stupid releases by comparing them @@ -60,13 +82,16 @@ def filter_bad_releases(name, parse=True, show=None): def clean_set(words): return {x.strip() for x in set((words or "").lower().split(",")) if x.strip()} + def remove_plus_sign(words): + return {s[1:] if s.startswith("+") else s for s in words} + # if any of the bad strings are in the name then say no ignore_words = resultFilters ignore_words = ignore_words.union(clean_set(show and show.rls_ignore_words or "")) # Show specific ignored words ignore_words = ignore_words.union(clean_set(settings.IGNORE_WORDS)) # Plus Global ignored words - ignore_words = ignore_words.difference(clean_set(show and show.rls_require_words or "")) # Minus show specific required words + ignore_words = ignore_words.difference(remove_plus_sign(clean_set(show and show.rls_require_words or ""))) # Minus show specific required words if settings.REQUIRE_WORDS and not (show and show.rls_ignore_words): # Only remove global require words from the list if we aren't using show ignore words - ignore_words = ignore_words.difference(clean_set(settings.REQUIRE_WORDS)) + ignore_words = ignore_words.difference(remove_plus_sign(clean_set(settings.REQUIRE_WORDS))) word = contains_at_least_one_word(name, ignore_words) if word: @@ -77,12 +102,21 @@ def clean_set(words): require_words = set() require_words = require_words.union(clean_set(show and show.rls_require_words or "")) # Show specific required words require_words = require_words.union(clean_set(settings.REQUIRE_WORDS)) # Plus Global required words + require_words_absolute = {s[1:] for s in require_words if s.startswith("+")} # Check for words starting with '+' which are an absolute requirement + require_words = remove_plus_sign(require_words) # Clean require_words (remove leading '+') require_words = require_words.difference(clean_set(show and show.rls_ignore_words or "")) # Minus show specific ignored words if settings.IGNORE_WORDS and not (show and show.rls_require_words): # Only remove global ignore words from the list if we arent using show require words require_words = require_words.difference(clean_set(settings.IGNORE_WORDS)) + # First check for the words which are an absolute requirement + if require_words_absolute: + word = contains_all_words(name, require_words_absolute) + if isinstance(word, str): + logger.info(f"Release: {name} doesn't contain required word {word}, ignoring it") + return False + if require_words and not contains_at_least_one_word(name, require_words): - logger.info(f"Release: {name} doesn't contain a required word {require_words}, ignoring it") + logger.info("Release: " + name + " doesn't contain any of " + ", ".join(set(require_words)) + ", ignoring it") return False return True