summaryrefslogtreecommitdiffhomepage
path: root/libs
diff options
context:
space:
mode:
authorVitiko <[email protected]>2023-09-18 15:14:22 -0400
committerVitiko <[email protected]>2023-09-18 15:15:36 -0400
commitb9648172ba4e5599350b408bad6a5fe54c082129 (patch)
tree3c9c4cdaae77a223928cbb1d71b68f6039bad7af /libs
parent17add7fbb3ae1919a40d505470d499d46df9ae6b (diff)
downloadbazarr-b9648172ba4e5599350b408bad6a5fe54c082129.tar.gz
bazarr-b9648172ba4e5599350b408bad6a5fe54c082129.zip
Subdivx provider: improve movies matches
Add one year tolerancy for movies. False positives probability is low enough to do so. (Fix #2245)
Diffstat (limited to 'libs')
-rw-r--r--libs/subliminal_patch/providers/subdivx.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/subliminal_patch/providers/subdivx.py b/libs/subliminal_patch/providers/subdivx.py
index 6bdc58eb0..4f473e773 100644
--- a/libs/subliminal_patch/providers/subdivx.py
+++ b/libs/subliminal_patch/providers/subdivx.py
@@ -29,6 +29,7 @@ _CLEAN_TITLE_RES = [
_SPANISH_RE = re.compile(r"españa|ib[eé]rico|castellano|gallego|castilla")
_YEAR_RE = re.compile(r"(\(\d{4}\))")
+_YEAR_RE_INT = re.compile(r"\((\d{4})\)")
_SERIES_RE = re.compile(
@@ -351,7 +352,14 @@ def _check_episode(video, title):
def _check_movie(video, title):
- if str(video.year) not in title:
+ try:
+ year = int(_YEAR_RE_INT.search(title).group(1)) # type: ignore
+ except (AttributeError, ValueError):
+ logger.debug("Year not found in title (%s). Discarding movie", title)
+ return False
+
+ if video.year and abs(year - video.year) > 1:
+ logger.debug("Year not matching: %s -> %s", year, video.year)
return False
aka_split = re.split("aka", title, flags=re.IGNORECASE)