Fix removal of non-release groups such that anime qualities are not trimmed from name

This commit is contained in:
Adam 2015-11-25 20:12:40 +08:00
parent 1dc6ea3cef
commit ca0379285e
3 changed files with 10 additions and 1 deletions

View file

@ -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)

View file

@ -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:

View file

@ -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)