From ca0379285ee8894f8ee3b1471bbd06eccfcff5e0 Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 25 Nov 2015 20:12:40 +0800 Subject: [PATCH] Fix removal of non-release groups such that anime qualities are not trimmed from name --- CHANGES.md | 1 + sickbeard/helpers.py | 2 +- tests/helpers_tests.py | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index c37ea68a..c06335f2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -85,6 +85,7 @@ * Enable Alpha Ratio again now that the secure login page over https is fixed * Add ability to parse command line output from unix unrar version 4 and below * Fix show search box on non-poster show list views +* Fix removal of non-release groups such that anime qualities are not trimmed from name ### 0.10.0 (2015-08-06 11:05:00 UTC) diff --git a/sickbeard/helpers.py b/sickbeard/helpers.py index afb77840..34b2b803 100644 --- a/sickbeard/helpers.py +++ b/sickbeard/helpers.py @@ -104,7 +104,7 @@ def remove_non_release_groups(name): '([\s\.\-_\[\{\(]*(no-rar|nzbgeek|ripsalot|rp|siklopentan)[\s\.\-_\]\}\)]*)$', '(?<=\w)([\s\.\-_]*[\[\{\(][\s\.\-_]*(www\.\w+.\w+)[\s\.\-_]*[\]\}\)][\s\.\-_]*)$', '(?<=\w)([\s\.\-_]*[\[\{\(]\s*(rar(bg|tv)|((e[tz]|v)tv))[\s\.\-_]*[\]\}\)][\s\.\-_]*)$', - '(?<=\w)([\s\.\-_]*[\[\{\(][\s\.\-_]*[\w\s\.\-\_]+[\s\.\-_]*[\]\}\)][\s\.\-_]*)$' + '(?<=\w)([\s\.\-_]*[\[\{\(][\s\.\-_]*)((?!(\d{3,4}[xp]))([\w\s\.\-\_]+))([\s\.\-_]*[\]\}\)][\s\.\-_]*)$' ] rename = name while rename: diff --git a/tests/helpers_tests.py b/tests/helpers_tests.py index 1ca736c5..9439f23e 100644 --- a/tests/helpers_tests.py +++ b/tests/helpers_tests.py @@ -29,6 +29,14 @@ class HelpersTests(unittest.TestCase): self.assertEqual(helpers.sizeof_fmt(2 ** 20), '1.0 MB') self.assertEqual(helpers.sizeof_fmt(1234567), '1.2 MB') + def test_remove_non_release_groups(self): + test_names = { + '[HorribleSubs] Hidan no Aria AA - 08 [1080p]': '[HorribleSubs] Hidan no Aria AA - 08 [1080p]', + 'The.Last.Man.On.Earth.S02E08.No.Bull.1080p.WEB-DL.DD5.1.H264-BTN[rartv]': 'The.Last.Man.On.Earth.S02E08.No.Bull.1080p.WEB-DL.DD5.1.H264-BTN' + } + for test_name, test_result in test_names.items(): + self.assertEqual(helpers.remove_non_release_groups(test_name), test_result) + if __name__ == '__main__': suite = unittest.TestLoader().loadTestsFromTestCase(HelpersTests)