From 4c7d4c312dda94ed7d8643546ec87bdbf9920fc4 Mon Sep 17 00:00:00 2001 From: "Andrew W. Buchanan" Date: Mon, 4 Apr 2022 22:34:31 -0400 Subject: [PATCH 1/2] Fix parsing of filenames that end with an ID such as [__######__] --- comicapi/filenameparser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comicapi/filenameparser.py b/comicapi/filenameparser.py index f669a96..f2250c5 100644 --- a/comicapi/filenameparser.py +++ b/comicapi/filenameparser.py @@ -89,7 +89,7 @@ class FileNameParser: # is the series name followed by issue filename = re.sub(r"--.*", self.repl, filename) - elif "__" in filename: + elif "__" in filename and not re.search('\\[__\\d+__\\]', filename): # the pattern seems to be that anything to left of the first "__" # is the series name followed by issue filename = re.sub(r"__.*", self.repl, filename) From e85fae86f4050c8450acb73606efb9d3dd138984 Mon Sep 17 00:00:00 2001 From: abuchanan920 Date: Tue, 5 Apr 2022 10:37:33 -0400 Subject: [PATCH 2/2] Use more idiomatic regular expression string Co-authored-by: Timmy Welch --- comicapi/filenameparser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comicapi/filenameparser.py b/comicapi/filenameparser.py index f2250c5..c2fb459 100644 --- a/comicapi/filenameparser.py +++ b/comicapi/filenameparser.py @@ -89,7 +89,7 @@ class FileNameParser: # is the series name followed by issue filename = re.sub(r"--.*", self.repl, filename) - elif "__" in filename and not re.search('\\[__\\d+__\\]', filename): + elif "__" in filename and not re.search(r"\[__\d+__\]", filename): # the pattern seems to be that anything to left of the first "__" # is the series name followed by issue filename = re.sub(r"__.*", self.repl, filename)