From 7a1524f13638de533be1c85bebec46b8dc27716a Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Thu, 24 May 2018 18:42:40 +0200 Subject: [PATCH] Fix anime parser and anime PROPER level. --- CHANGES.md | 7 ++++++- sickbeard/common.py | 4 +--- sickbeard/name_parser/parser.py | 2 +- sickbeard/search_queue.py | 2 +- tests/common_tests.py | 7 +++++-- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 810f3f3b..02ca589a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,9 @@ -### 0.16.11 (2018-05-22 00:00:00 UTC) +### 0.16.12 (2018-05-25 00:40:00 UTC) + +* Fix anime parser and anime PROPER level + + +### 0.16.11 (2018-05-22 00:00:00 UTC) * Fix SickGear-NG.py post processing script diff --git a/sickbeard/common.py b/sickbeard/common.py index 1f2a3de4..c2d8807d 100644 --- a/sickbeard/common.py +++ b/sickbeard/common.py @@ -120,9 +120,7 @@ class Quality: is_repack = False if is_anime: if isinstance(version, (int, long)): - level = version - else: - level = 1 + level = (0, version - 1)[1 < version] elif isinstance(extra_no_name, basestring): for p, r_check in Quality.proper_levels: a = len(p.findall(extra_no_name)) diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index db2b90ae..3802c1ad 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -242,7 +242,7 @@ class NameParser(object): # assigns version to anime file if detected using anime regex. Non-anime regex receives -1 version = match.group('version') if version: - result.version = version + result.version = helpers.tryInt(version) else: result.version = 1 else: diff --git a/sickbeard/search_queue.py b/sickbeard/search_queue.py index 336d879d..783f94d9 100644 --- a/sickbeard/search_queue.py +++ b/sickbeard/search_queue.py @@ -263,7 +263,7 @@ class RecentSearchQueueItem(generic_queue.QueueItem): propers = {} my_db = db.DBConnection('cache.db') sql_results = my_db.select('SELECT * FROM provider_cache') - re_p = (r'\brepack|proper|real\b', r'\brepack|proper|real|v[1-5]\b')[needed.need_anime] + re_p = r'\brepack|proper|real%s\b' % ('', '|v[2-9]')[needed.need_anime] proper_regex = re.compile(re_p, flags=re.I) diff --git a/tests/common_tests.py b/tests/common_tests.py index 7461f3ca..f69b8c71 100644 --- a/tests/common_tests.py +++ b/tests/common_tests.py @@ -1752,11 +1752,14 @@ class QualityTests(unittest.TestCase): ]), ]) - # TODO: add anime test cases def test_get_proper_level_anime(self): # release_name, expected level self.check_proper_level([ - + ('Boruto - Naruto Next Generations - 59 [480p]', 0), + ('[SGKK] Bleach - 312v2 (1280x720 h264 AAC) [F501C9BE]', 1), + ('[SGKK] Bleach 312v1 [720p/MKV]', 0), + ('[Cthuko] Shirobako - 05v2 [720p H264 AAC][80C9B09B]', 1), + ('Naruto Shippuden - 314v3', 2) ], is_anime=True) if __name__ == '__main__':