From 40b8b8eb319e03892a5a24e9854d4cc7f07e6236 Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 20 Dec 2022 15:55:11 +0700 Subject: [PATCH] fix year substraction for short names --- src/tvsort.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tvsort.py b/src/tvsort.py index 49375f8..5ad8fc5 100644 --- a/src/tvsort.py +++ b/src/tvsort.py @@ -76,7 +76,10 @@ class Static: year_pattern = re.compile(r'\(?[0-9]{4}\)?') year = year_pattern.findall(showname) if year and year[0] != showname: - showname = showname.replace(year[0], '').replace("..", ".") + words = showname.split() + words.remove(year[0]) + if len(words) > 1: + showname = showname.replace(year[0], '').replace("..", ".") # find acronym acronym = [i for i in showname.split(".") if len(i) == 1] # clean up