From a54b89e8edcec87e4e6ee2f49c97971538b39311 Mon Sep 17 00:00:00 2001 From: Prinz23 Date: Sun, 21 Aug 2016 21:31:18 +0100 Subject: [PATCH] Add handling for 'part' numbered new releases and also for specific existing 'part' numbered releases. --- CHANGES.md | 1 + sickbeard/name_parser/parser.py | 5 + sickbeard/providers/generic.py | 2 + sickbeard/providers/iptorrents.py | 2 +- sickbeard/providers/newznab.py | 4 +- sickbeard/scene_exceptions.py | 6 + tests/name_parser_tests.py | 216 ++++++++++++++++++++---------- 7 files changed, 161 insertions(+), 75 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 3054d73b..534926bc 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -113,6 +113,7 @@ * Change increase delay between requests to nnab servers to over 2 seconds * Change set Specials to status "Skipped" not "Wanted" during show updates * Change improve debug log message for CloudFlare response that indicate website is offline +* Add handling for 'part' numbered new releases and also for specific existing 'part' numbered releases [develop changelog] * Change send nzb data to NZBGet for Anizb instead of url diff --git a/sickbeard/name_parser/parser.py b/sickbeard/name_parser/parser.py index 7c38db9c..ac82389c 100644 --- a/sickbeard/name_parser/parser.py +++ b/sickbeard/name_parser/parser.py @@ -208,6 +208,11 @@ class NameParser(object): else: result.version = -1 + if None is result.season_number and result.episode_numbers and not result.air_date and \ + cur_regex_name in ['no_season', 'no_season_general', 'no_season_multi_ep'] and \ + re.search(r'(?i)\bpart.?\d{1,2}\b', result.original_name): + result.season_number = 1 + matches.append(result) if len(matches): diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index b65c54f7..9861dd63 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -768,6 +768,8 @@ class TorrentProvider(object, GenericProvider): ep_dict = self._ep_dict(ep_obj) ep_detail = sickbeard.config.naming_ep_type[2] % ep_dict \ if 'ep_detail' not in kwargs.keys() else kwargs['ep_detail'](ep_dict) + if sickbeard.scene_exceptions.has_abs_episodes(ep_obj): + ep_detail = [ep_detail] + ['%d' % ep_dict['episodenumber']] ep_detail = ([ep_detail], ep_detail)[isinstance(ep_detail, list)] detail = ({}, {'Episode_only': ep_detail})[detail_only and not show.is_sports and not show.is_anime] return [dict({'Episode': self._build_search_strings(ep_detail, scene, prefix)}.items() + detail.items())] diff --git a/sickbeard/providers/iptorrents.py b/sickbeard/providers/iptorrents.py index 94a05637..b144f8bd 100644 --- a/sickbeard/providers/iptorrents.py +++ b/sickbeard/providers/iptorrents.py @@ -30,7 +30,7 @@ class IPTorrentsProvider(generic.TorrentProvider): generic.TorrentProvider.__init__(self, 'IPTorrents') self.url_home = (['https://iptorrents.%s/' % u for u in 'eu', 'com', 'me', 'ru'] + - ['https://mysite.access.ly/', 'https://pcgame.servegame.com/']) + ['http://11111.workisboring.com/']) self.url_vars = {'login': 'getrss.php', 'search': 't?%s;q=%s;qf=ti%s%s#torrents', 'get': '%s'} self.url_tmpl = {'config_provider_home_uri': '%(home)s', 'login': '%(home)s%(vars)s', diff --git a/sickbeard/providers/newznab.py b/sickbeard/providers/newznab.py index 49935c55..530cfba1 100755 --- a/sickbeard/providers/newznab.py +++ b/sickbeard/providers/newznab.py @@ -1,4 +1,4 @@ -# Author: Nic Wolfe +# Author: Nic Wolfe # URL: http://code.google.com/p/sickbeard/ # # This file is part of SickGear. @@ -210,6 +210,8 @@ class NewznabProvider(generic.NZBProvider): scene_exceptions.get_scene_exceptions(ep_obj.show.indexerid) + [ep_obj.show.name]])) spacer = 'geek' in self.get_id() and ' ' or '.' + if sickbeard.scene_exceptions.has_abs_episodes(ep_obj): + search_params.append({'q': '%s%s%s' % (ep_obj.show.name, spacer, base_params['ep'])}) for cur_exception in name_exceptions: params = base_params.copy() cur_exception = cur_exception.replace('.', spacer) diff --git a/sickbeard/scene_exceptions.py b/sickbeard/scene_exceptions.py index e8ca621a..7b1867d1 100644 --- a/sickbeard/scene_exceptions.py +++ b/sickbeard/scene_exceptions.py @@ -352,3 +352,9 @@ def get_xem_ids(): xem_ids = _xem_get_ids(indexer['name'], indexer['xem_origin']) if len(xem_ids): xem_ids_list[indexer['id']] = xem_ids + + +def has_abs_episodes(ep_obj=None, name=None): + return any((name or ep_obj.show.name or '').lower().startswith(x.lower()) for x in [ + 'The Eighties', 'The Making of the Mob', 'The Night Of', 'Roots 2016', 'Trepalium' + ]) diff --git a/tests/name_parser_tests.py b/tests/name_parser_tests.py index 2f8223be..562c270f 100644 --- a/tests/name_parser_tests.py +++ b/tests/name_parser_tests.py @@ -1,9 +1,9 @@ from __future__ import print_function import datetime -import unittest +import os.path import test_lib as test - -import sys, os.path +import sys +import unittest sys.path.insert(1, os.path.abspath('..')) sys.path.insert(1, os.path.abspath('../lib')) @@ -18,16 +18,21 @@ DEBUG = VERBOSE = False simple_test_cases = { 'standard': { - 'Mr.Show.Name.S01E02.Source.Quality.Etc-Group': parser.ParseResult(None, 'Mr Show Name', 1, [2], 'Source.Quality.Etc', 'Group'), + 'Mr.Show.Name.S01E02.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Mr Show Name', 1, [2], 'Source.Quality.Etc', 'Group'), 'Show.Name.S01E02': parser.ParseResult(None, 'Show Name', 1, [2]), 'Show Name - S01E02 - My Ep Name': parser.ParseResult(None, 'Show Name', 1, [2], 'My Ep Name'), - 'Show.1.0.Name.S01.E03.My.Ep.Name-Group': parser.ParseResult(None, 'Show 1.0 Name', 1, [3], 'My.Ep.Name', 'Group'), - 'Show.Name.S01E02E03.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name', 1, [2, 3], 'Source.Quality.Etc', 'Group'), + 'Show.1.0.Name.S01.E03.My.Ep.Name-Group': + parser.ParseResult(None, 'Show 1.0 Name', 1, [3], 'My.Ep.Name', 'Group'), + 'Show.Name.S01E02E03.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Show Name', 1, [2, 3], 'Source.Quality.Etc', 'Group'), 'Mr. Show Name - S01E02-03 - My Ep Name': parser.ParseResult(None, 'Mr. Show Name', 1, [2, 3], 'My Ep Name'), 'Show.Name.S01.E02.E03': parser.ParseResult(None, 'Show Name', 1, [2, 3]), - 'Show.Name-0.2010.S01E02.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name-0 2010', 1, [2], 'Source.Quality.Etc', 'Group'), + 'Show.Name-0.2010.S01E02.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Show Name-0 2010', 1, [2], 'Source.Quality.Etc', 'Group'), 'S01E02 Ep Name': parser.ParseResult(None, None, 1, [2], 'Ep Name'), - 'Show Name - S06E01 - 2009-12-20 - Ep Name': parser.ParseResult(None, 'Show Name', 6, [1], '2009-12-20 - Ep Name'), + 'Show Name - S06E01 - 2009-12-20 - Ep Name': + parser.ParseResult(None, 'Show Name', 6, [1], '2009-12-20 - Ep Name'), 'Show Name - S06E01 - -30-': parser.ParseResult(None, 'Show Name', 6, [1], '30-'), 'Show-Name-S06E01-720p': parser.ParseResult(None, 'Show-Name', 6, [1], '720p'), 'Show-Name-S06E01-1080i': parser.ParseResult(None, 'Show-Name', 6, [1], '1080i'), @@ -37,11 +42,13 @@ simple_test_cases = { }, 'fov': { - 'Show_Name.1x02.Source_Quality_Etc-Group': parser.ParseResult(None, 'Show Name', 1, [2], 'Source_Quality_Etc', 'Group'), + 'Show_Name.1x02.Source_Quality_Etc-Group': + parser.ParseResult(None, 'Show Name', 1, [2], 'Source_Quality_Etc', 'Group'), 'Show Name 1x02': parser.ParseResult(None, 'Show Name', 1, [2]), 'Show Name 1x02 x264 Test': parser.ParseResult(None, 'Show Name', 1, [2], 'x264 Test'), 'Show Name - 1x02 - My Ep Name': parser.ParseResult(None, 'Show Name', 1, [2], 'My Ep Name'), - 'Show_Name.1x02x03x04.Source_Quality_Etc-Group': parser.ParseResult(None, 'Show Name', 1, [2, 3, 4], 'Source_Quality_Etc', 'Group'), + 'Show_Name.1x02x03x04.Source_Quality_Etc-Group': + parser.ParseResult(None, 'Show Name', 1, [2, 3, 4], 'Source_Quality_Etc', 'Group'), 'Show Name - 1x02-03-04 - My Ep Name': parser.ParseResult(None, 'Show Name', 1, [2, 3, 4], 'My Ep Name'), '1x02 Ep Name': parser.ParseResult(None, None, 1, [2], 'Ep Name'), 'Show-Name-1x02-720p': parser.ParseResult(None, 'Show-Name', 1, [2], '720p'), @@ -51,23 +58,29 @@ simple_test_cases = { }, 'standard_repeat': { - 'Show.Name.S01E02.S01E03.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name', 1, [2, 3], 'Source.Quality.Etc', 'Group'), + 'Show.Name.S01E02.S01E03.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Show Name', 1, [2, 3], 'Source.Quality.Etc', 'Group'), 'Show.Name.S01E02.S01E03': parser.ParseResult(None, 'Show Name', 1, [2, 3]), - 'Show Name - S01E02 - S01E03 - S01E04 - Ep Name': parser.ParseResult(None, 'Show Name', 1, [2, 3, 4], 'Ep Name'), + 'Show Name - S01E02 - S01E03 - S01E04 - Ep Name': + parser.ParseResult(None, 'Show Name', 1, [2, 3, 4], 'Ep Name'), 'Show.Name.S01E02.S01E03.WEB-DL': parser.ParseResult(None, 'Show Name', 1, [2, 3], 'WEB-DL'), }, 'fov_repeat': { - 'Show.Name.1x02.1x03.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name', 1, [2, 3], 'Source.Quality.Etc', 'Group'), + 'Show.Name.1x02.1x03.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Show Name', 1, [2, 3], 'Source.Quality.Etc', 'Group'), 'Show.Name.1x02.1x03': parser.ParseResult(None, 'Show Name', 1, [2, 3]), 'Show Name - 1x02 - 1x03 - 1x04 - Ep Name': parser.ParseResult(None, 'Show Name', 1, [2, 3, 4], 'Ep Name'), 'Show.Name.1x02.1x03.WEB-DL': parser.ParseResult(None, 'Show Name', 1, [2, 3], 'WEB-DL'), }, 'bare': { - 'Show.Name.102.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name', 1, [2], 'Source.Quality.Etc', 'Group'), - 'show.name.2010.123.source.quality.etc-group': parser.ParseResult(None, 'show name 2010', 1, [23], 'source.quality.etc', 'group'), - 'show.name.2010.222.123.source.quality.etc-group': parser.ParseResult(None, 'show name 2010.222', 1, [23], 'source.quality.etc', 'group'), + 'Show.Name.102.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Show Name', 1, [2], 'Source.Quality.Etc', 'Group'), + 'show.name.2010.123.source.quality.etc-group': + parser.ParseResult(None, 'show name 2010', 1, [23], 'source.quality.etc', 'group'), + 'show.name.2010.222.123.source.quality.etc-group': + parser.ParseResult(None, 'show name 2010.222', 1, [23], 'source.quality.etc', 'group'), 'Show.Name.102': parser.ParseResult(None, 'Show Name', 1, [2]), 'the.event.401.hdtv-lol': parser.ParseResult(None, 'the event', 4, [1], 'hdtv', 'lol'), # 'show.name.2010.special.hdtv-blah': None, @@ -82,74 +95,113 @@ simple_test_cases = { 'Show Name - 01 - Ep Name': parser.ParseResult(None, 'Show Name', None, [1], 'Ep Name'), '01 - Ep Name': parser.ParseResult(None, None, None, [1], 'Ep Name'), 'Show Name - 01 - Ep Name - WEB-DL': parser.ParseResult(None, 'Show Name', None, [1], 'Ep Name - WEB-DL'), + 'Show.Name.2015.04.19.Ep.Name.Part.2.PROPER.PDTV.x264-GROUP': + parser.ParseResult(None, 'Show Name', release_group='GROUP', extra_info='Ep.Name.Part.2.PROPER.PDTV.x264', + air_date=datetime.date(2015, 4, 19)), }, 'no_season_general': { - 'Show.Name.E23.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name', None, [23], 'Source.Quality.Etc', 'Group'), + 'Show.Name.E23.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Show Name', None, [23], 'Source.Quality.Etc', 'Group'), 'Show Name - Episode 01 - Ep Name': parser.ParseResult(None, 'Show Name', None, [1], 'Ep Name'), - 'Show.Name.Part.3.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name', None, [3], 'Source.Quality.Etc', 'Group'), - 'Show.Name.Part.1.and.Part.2.Blah-Group': parser.ParseResult(None, 'Show Name', None, [1, 2], 'Blah', 'Group'), - 'Show.Name.Part.IV.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name', None, [4], 'Source.Quality.Etc', 'Group'), - 'Deconstructed.E07.1080i.HDTV.DD5.1.MPEG2-TrollHD': parser.ParseResult(None, 'Deconstructed', None, [7], '1080i.HDTV.DD5.1.MPEG2', 'TrollHD'), + 'Show.Name.Part.3.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Show Name', 1, [3], 'Source.Quality.Etc', 'Group'), + 'Show.Name.Part.1.and.Part.2.Blah-Group': parser.ParseResult(None, 'Show Name', 1, [1, 2], 'Blah', 'Group'), + 'Show.Name.Part.IV.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Show Name', None, [4], 'Source.Quality.Etc', 'Group'), + 'Deconstructed.E07.1080i.HDTV.DD5.1.MPEG2-TrollHD': + parser.ParseResult(None, 'Deconstructed', None, [7], '1080i.HDTV.DD5.1.MPEG2', 'TrollHD'), 'Show.Name.E23.WEB-DL': parser.ParseResult(None, 'Show Name', None, [23], 'WEB-DL'), }, 'no_season_multi_ep': { - 'Show.Name.E23-24.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name', None, [23, 24], 'Source.Quality.Etc', 'Group'), + 'Show.Name.E23-24.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Show Name', None, [23, 24], 'Source.Quality.Etc', 'Group'), 'Show Name - Episode 01-02 - Ep Name': parser.ParseResult(None, 'Show Name', None, [1, 2], 'Ep Name'), 'Show.Name.E23-24.WEB-DL': parser.ParseResult(None, 'Show Name', None, [23, 24], 'WEB-DL'), }, 'season_only': { - 'Show.Name.S02.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name', 2, [], 'Source.Quality.Etc', 'Group'), + 'Show.Name.S02.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Show Name', 2, [], 'Source.Quality.Etc', 'Group'), 'Show Name Season 2': parser.ParseResult(None, 'Show Name', 2), 'Season 02': parser.ParseResult(None, None, 2), }, 'scene_date_format': { - 'Show.Name.2010.11.23.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name', None, [], 'Source.Quality.Etc', 'Group', datetime.date(2010, 11, 23)), + 'Show.Name.2010.11.23.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Show Name', None, [], 'Source.Quality.Etc', 'Group', datetime.date(2010, 11, 23)), 'Show Name - 2010.11.23': parser.ParseResult(None, 'Show Name', air_date=datetime.date(2010, 11, 23)), - 'Show.Name.2010.23.11.Source.Quality.Etc-Group': parser.ParseResult(None, 'Show Name', None, [], 'Source.Quality.Etc', 'Group', datetime.date(2010, 11, 23)), - 'Show Name - 2010-11-23 - Ep Name': parser.ParseResult(None, 'Show Name', extra_info='Ep Name', air_date=datetime.date(2010, 11, 23)), + 'Show.Name.2010.23.11.Source.Quality.Etc-Group': + parser.ParseResult(None, 'Show Name', None, [], 'Source.Quality.Etc', 'Group', datetime.date(2010, 11, 23)), + 'Show Name - 2010-11-23 - Ep Name': + parser.ParseResult(None, 'Show Name', extra_info='Ep Name', air_date=datetime.date(2010, 11, 23)), '2010-11-23 - Ep Name': parser.ParseResult(None, extra_info='Ep Name', air_date=datetime.date(2010, 11, 23)), - 'Show.Name.2010.11.23.WEB-DL': parser.ParseResult(None, 'Show Name', None, [], 'WEB-DL', None, datetime.date(2010, 11, 23)), + 'Show.Name.2010.11.23.WEB-DL': + parser.ParseResult(None, 'Show Name', None, [], 'WEB-DL', None, datetime.date(2010, 11, 23)), }, 'anime_ultimate': { - '[Tsuki] Bleach - 301 [1280x720][61D1D4EE]': parser.ParseResult(None, 'Bleach', None, [], '1280x720', 'Tsuki', None, [301]), - '[Tsuki] Fairy Tail - 70 [1280x720][C4807111]': parser.ParseResult(None, 'Fairy Tail', None, [], '1280x720', 'Tsuki', None, [70]), - '[SGKK] Bleach 312v2 [720p MKV]': parser.ParseResult(None, 'Bleach', None, [], '720p MKV', 'SGKK', None, [312]), - '[BSS-Anon] Tengen Toppa Gurren Lagann - 22-23 [1280x720][h264][6039D9AF]': parser.ParseResult(None, 'Tengen Toppa Gurren Lagann', None, [], '1280x720', 'BSS-Anon', None, [22, 23]), - '[SJSUBS]_Naruto_Shippuden_-_02_[480p AAC]': parser.ParseResult(None, 'Naruto Shippuden', None, [], '480p AAC', 'SJSUBS', None, [2]), - '[SFW-Chihiro] Dance in the Vampire Bund - 12 [1920x1080 Blu-ray FLAC][2F6DBC66].mkv': parser.ParseResult(None, 'Dance in the Vampire Bund', None, [], '1920x1080 Blu-ray FLAC', 'SFW-Chihiro', None, [12]), - '[SHiN-gx] Hanasaku Iroha - 01 [1280x720 h.264 AAC][BDC36683]': parser.ParseResult(None, 'Hanasaku Iroha', None, [], '1280x720 h.264 AAC', 'SHiN-gx', None, [1]), - '[SFW-Chihiro] Dance in the Vampire Bund - 02 [1920x1080 Blu-ray FLAC][C1FA0A09]': parser.ParseResult(None, 'Dance in the Vampire Bund', None, [], '1920x1080 Blu-ray FLAC', 'SFW-Chihiro', None, [2]), - '[HorribleSubs] No. 6 - 11 [720p]': parser.ParseResult(None, 'No. 6', None, [], '720p', 'HorribleSubs', None, [11]), - '[HorribleSubs] D Gray-Man - 312 (480p) [F501C9BE]': parser.ParseResult(None, 'D Gray-Man', None, [], '480p', 'HorribleSubs', None, [312]), - '[SGKK] Tengen Toppa Gurren Lagann - 45-46 (720p h264) [F501C9BE]': parser.ParseResult(None, 'Tengen Toppa Gurren Lagann', None, [], '720p h264', 'SGKK', None, [45, 46]), - '[Stratos-Subs]_Infinite_Stratos_-_12_(1280x720_H.264_AAC)_[379759DB]': parser.ParseResult(None, 'Infinite Stratos', None, [], '1280x720_H.264_AAC', 'Stratos-Subs', None, [12]), - '[ShinBunBu-Subs] Bleach - 02-03 (CX 1280x720 x264 AAC)': parser.ParseResult(None, 'Bleach', None, [], 'CX 1280x720 x264 AAC', 'ShinBunBu-Subs', None, [2, 3]), - '[Doki] Hanasaku Iroha - 03 (848x480 h264 AAC) [CB1AA73B]': parser.ParseResult(None, 'Hanasaku Iroha', None, [], '848x480 h264 AAC', 'Doki', None, [3]), - '[UTW]_Fractal_-_01_[h264-720p][96D3F1BF]': parser.ParseResult(None, 'Fractal', None, [], 'h264-720p', 'UTW', None, [1]), - '[a-s]_inuyasha_-_028_rs2_[BFDDF9F2]': parser.ParseResult(None, 'inuyasha', None, [], 'BFDDF9F2', 'a-s', None, [28]), - '[HorribleSubs] Fairy Tail S2 - 37 [1080p]': parser.ParseResult(None,'Fairy Tail S2', None, [], '1080p', 'HorribleSubs', None, [37]), - '[HorribleSubs] Sword Art Online II - 23 [720p]': parser.ParseResult(None, 'Sword Art Online II', None, [], '720p', 'HorribleSubs', None, [23]), + '[Tsuki] Bleach - 301 [1280x720][61D1D4EE]': + parser.ParseResult(None, 'Bleach', None, [], '1280x720', 'Tsuki', None, [301]), + '[Tsuki] Fairy Tail - 70 [1280x720][C4807111]': + parser.ParseResult(None, 'Fairy Tail', None, [], '1280x720', 'Tsuki', None, [70]), + '[SGKK] Bleach 312v2 [720p MKV]': + parser.ParseResult(None, 'Bleach', None, [], '720p MKV', 'SGKK', None, [312]), + '[BSS-Anon] Tengen Toppa Gurren Lagann - 22-23 [1280x720][h264][6039D9AF]': + parser.ParseResult(None, 'Tengen Toppa Gurren Lagann', None, [], '1280x720', 'BSS-Anon', None, [22, 23]), + '[SJSUBS]_Naruto_Shippuden_-_02_[480p AAC]': + parser.ParseResult(None, 'Naruto Shippuden', None, [], '480p AAC', 'SJSUBS', None, [2]), + '[SFW-Chihiro] Dance in the Vampire Bund - 12 [1920x1080 Blu-ray FLAC][2F6DBC66].mkv': + parser.ParseResult( + None, 'Dance in the Vampire Bund', None, [], '1920x1080 Blu-ray FLAC', 'SFW-Chihiro', None, [12]), + '[SHiN-gx] Hanasaku Iroha - 01 [1280x720 h.264 AAC][BDC36683]': + parser.ParseResult(None, 'Hanasaku Iroha', None, [], '1280x720 h.264 AAC', 'SHiN-gx', None, [1]), + '[SFW-Chihiro] Dance in the Vampire Bund - 02 [1920x1080 Blu-ray FLAC][C1FA0A09]': + parser.ParseResult( + None, 'Dance in the Vampire Bund', None, [], '1920x1080 Blu-ray FLAC', 'SFW-Chihiro', None, [2]), + '[HorribleSubs] No. 6 - 11 [720p]': + parser.ParseResult(None, 'No. 6', None, [], '720p', 'HorribleSubs', None, [11]), + '[HorribleSubs] D Gray-Man - 312 (480p) [F501C9BE]': + parser.ParseResult(None, 'D Gray-Man', None, [], '480p', 'HorribleSubs', None, [312]), + '[SGKK] Tengen Toppa Gurren Lagann - 45-46 (720p h264) [F501C9BE]': + parser.ParseResult(None, 'Tengen Toppa Gurren Lagann', None, [], '720p h264', 'SGKK', None, [45, 46]), + '[Stratos-Subs]_Infinite_Stratos_-_12_(1280x720_H.264_AAC)_[379759DB]': + parser.ParseResult(None, 'Infinite Stratos', None, [], '1280x720_H.264_AAC', 'Stratos-Subs', None, [12]), + '[ShinBunBu-Subs] Bleach - 02-03 (CX 1280x720 x264 AAC)': + parser.ParseResult(None, 'Bleach', None, [], 'CX 1280x720 x264 AAC', 'ShinBunBu-Subs', None, [2, 3]), + '[Doki] Hanasaku Iroha - 03 (848x480 h264 AAC) [CB1AA73B]': + parser.ParseResult(None, 'Hanasaku Iroha', None, [], '848x480 h264 AAC', 'Doki', None, [3]), + '[UTW]_Fractal_-_01_[h264-720p][96D3F1BF]': + parser.ParseResult(None, 'Fractal', None, [], 'h264-720p', 'UTW', None, [1]), + '[a-s]_inuyasha_-_028_rs2_[BFDDF9F2]': + parser.ParseResult(None, 'inuyasha', None, [], 'BFDDF9F2', 'a-s', None, [28]), + '[HorribleSubs] Fairy Tail S2 - 37 [1080p]': + parser.ParseResult(None, 'Fairy Tail S2', None, [], '1080p', 'HorribleSubs', None, [37]), + '[HorribleSubs] Sword Art Online II - 23 [720p]': + parser.ParseResult(None, 'Sword Art Online II', None, [], '720p', 'HorribleSubs', None, [23]), }, 'anime_standard': { - '[Cthuko] Shirobako - 05v2 [720p H264 AAC][80C9B09B]': parser.ParseResult(None, 'Shirobako', None, [], '720p H264 AAC', 'Cthuko', None, [5]), - '[Ayako]_Minami-ke_Okaeri_-_01v2_[1024x576 H264+AAC][B1912CD8]': parser.ParseResult(None, 'Minami-ke Okaeri', None, [], '1024x576 H264+AAC', 'Ayako', None, [1]), + '[Cthuko] Shirobako - 05v2 [720p H264 AAC][80C9B09B]': + parser.ParseResult(None, 'Shirobako', None, [], '720p H264 AAC', 'Cthuko', None, [5]), + '[Ayako]_Minami-ke_Okaeri_-_01v2_[1024x576 H264+AAC][B1912CD8]': + parser.ParseResult(None, 'Minami-ke Okaeri', None, [], '1024x576 H264+AAC', 'Ayako', None, [1]), 'Show.Name.123-11001001': parser.ParseResult(None, 'Show Name', None, [], None, None, None, [123]), }, 'anime_ep_name': { - '[TzaTziki]_One_Piece_279_Chopper_Man_1_[720p][8AE5F25D]': parser.ParseResult(None, 'One Piece', None, [], '720p', 'TzaTziki', None, [279]), - "[ACX]Wolf's_Rain_-_04_-_Scars_in_the_Wasteland_[octavarium]_[82B7E357]": parser.ParseResult(None, "Wolf's Rain", None, [], 'octavarium', 'ACX', None, [4]), - '[ACX]Black Lagoon - 02v2 - Mangrove Heaven [SaintDeath] [7481F875]': parser.ParseResult(None, 'Black Lagoon', None, [], 'SaintDeath', 'ACX', None, [2]), + '[TzaTziki]_One_Piece_279_Chopper_Man_1_[720p][8AE5F25D]': + parser.ParseResult(None, 'One Piece', None, [], '720p', 'TzaTziki', None, [279]), + "[ACX]Wolf's_Rain_-_04_-_Scars_in_the_Wasteland_[octavarium]_[82B7E357]": + parser.ParseResult(None, "Wolf's Rain", None, [], 'octavarium', 'ACX', None, [4]), + '[ACX]Black Lagoon - 02v2 - Mangrove Heaven [SaintDeath] [7481F875]': + parser.ParseResult(None, 'Black Lagoon', None, [], 'SaintDeath', 'ACX', None, [2]), }, 'anime_standard_round': { - '[SGKK] Bleach - 312v2 (1280x720 h264 AAC) [F501C9BE]': parser.ParseResult(None, 'Bleach', None, [], '1280x720 h264 AAC', 'SGKK', None, [312]), + '[SGKK] Bleach - 312v2 (1280x720 h264 AAC) [F501C9BE]': + parser.ParseResult(None, 'Bleach', None, [], '1280x720 h264 AAC', 'SGKK', None, [312]), }, 'anime_slash': { @@ -158,19 +210,27 @@ simple_test_cases = { }, 'anime_standard_codec': { - '[Ayako]_Infinite_Stratos_-_IS_-_07_[H264][720p][EB7838FC]': parser.ParseResult(None, 'Infinite Stratos', None, [], '720p', 'Ayako', None, [7]), - '[Ayako] Infinite Stratos - IS - 07v2 [H264][720p][44419534]': parser.ParseResult(None, 'Infinite Stratos', None, [], '720p', 'Ayako', None, [7]), - '[Ayako-Shikkaku] Oniichan no Koto Nanka Zenzen Suki Janain Dakara ne - 10 [LQ][h264][720p] [8853B21C]': parser.ParseResult(None, 'Oniichan no Koto Nanka Zenzen Suki Janain Dakara ne', None, [], '720p', 'Ayako-Shikkaku', None, [10]), - '[Tsuki] Fairy Tail - 72 [XviD][C4807111]': parser.ParseResult(None, 'Fairy Tail', None, [], 'C4807111', 'Tsuki', None, [72]), - 'Bubblegum Crisis Tokyo 2040 - 25 [aX] [F4E2E558]': parser.ParseResult(None, 'Bubblegum Crisis Tokyo 2040', None, [], 'aX', None, None, [25]), + '[Ayako]_Infinite_Stratos_-_IS_-_07_[H264][720p][EB7838FC]': + parser.ParseResult(None, 'Infinite Stratos', None, [], '720p', 'Ayako', None, [7]), + '[Ayako] Infinite Stratos - IS - 07v2 [H264][720p][44419534]': + parser.ParseResult(None, 'Infinite Stratos', None, [], '720p', 'Ayako', None, [7]), + '[Ayako-Shikkaku] Oniichan no Koto Nanka Zenzen Suki Janain Dakara ne - 10 [LQ][h264][720p] [8853B21C]': + parser.ParseResult(None, 'Oniichan no Koto Nanka Zenzen Suki Janain Dakara ne', None, [], + '720p', 'Ayako-Shikkaku', None, [10]), + '[Tsuki] Fairy Tail - 72 [XviD][C4807111]': + parser.ParseResult(None, 'Fairy Tail', None, [], 'C4807111', 'Tsuki', None, [72]), + 'Bubblegum Crisis Tokyo 2040 - 25 [aX] [F4E2E558]': + parser.ParseResult(None, 'Bubblegum Crisis Tokyo 2040', None, [], 'aX', None, None, [25]), }, 'anime_and_normal': { 'Bleach - s02e03 - 012 - Name & Name': parser.ParseResult(None, 'Bleach', 2, [3], None, None, None, [12]), - 'Bleach - s02e03e04 - 012-013 - Name & Name': parser.ParseResult(None, 'Bleach', 2, [3, 4], None, None, None, [12, 13]), + 'Bleach - s02e03e04 - 012-013 - Name & Name': + parser.ParseResult(None, 'Bleach', 2, [3, 4], None, None, None, [12, 13]), 'Bleach - s16e03-04 - 313-314': parser.ParseResult(None, 'Bleach', 16, [3, 4], None, None, None, [313, 314]), - 'Blue Submarine No. 6 s16e03e04 313-314': parser.ParseResult(None, 'Blue Submarine No. 6', 16, [3, 4], None, None, None, [313, 314]), + 'Blue Submarine No. 6 s16e03e04 313-314': + parser.ParseResult(None, 'Blue Submarine No. 6', 16, [3, 4], None, None, None, [313, 314]), 'Bleach.s16e03-04.313-314': parser.ParseResult(None, 'Bleach', 16, [3, 4], None, None, None, [313, 314]), '.hack roots s01e01 001.mkv': parser.ParseResult(None, 'hack roots', 1, [1], None, None, None, [1]), '.hack sign s01e01 001.mkv': parser.ParseResult(None, 'hack sign', 1, [1], None, None, None, [1]) @@ -179,14 +239,19 @@ simple_test_cases = { 'anime_and_normal_reverse': { 'Bleach - 012 - s02e03 - Name & Name': parser.ParseResult(None, 'Bleach', 2, [3], None, None, None, [12]), - 'Blue Submarine No. 6 - 012-013 - s02e03e04 - Name & Name': parser.ParseResult(None, 'Blue Submarine No. 6', 2, [3, 4], None, None, None, [12, 13]), - '07-GHOST - 012-013 - s02e03e04 - Name & Name': parser.ParseResult(None, '07-GHOST', 2, [3, 4], None, None, None, [12, 13]), - '3x3 Eyes - 012-013 - s02e03-04 - Name & Name': parser.ParseResult(None, '3x3 Eyes', 2, [3, 4], None, None, None, [12, 13]), + 'Blue Submarine No. 6 - 012-013 - s02e03e04 - Name & Name': + parser.ParseResult(None, 'Blue Submarine No. 6', 2, [3, 4], None, None, None, [12, 13]), + '07-GHOST - 012-013 - s02e03e04 - Name & Name': + parser.ParseResult(None, '07-GHOST', 2, [3, 4], None, None, None, [12, 13]), + '3x3 Eyes - 012-013 - s02e03-04 - Name & Name': + parser.ParseResult(None, '3x3 Eyes', 2, [3, 4], None, None, None, [12, 13]), }, 'anime_and_normal_front': { - '165.Naruto Shippuuden.s08e014': parser.ParseResult(None, 'Naruto Shippuuden', 8, [14], None, None, None, [165]), - '165-166.Naruto Shippuuden.s08e014e015': parser.ParseResult(None, 'Naruto Shippuuden', 8, [14, 15], None, None, None, [165, 166]), + '165.Naruto Shippuuden.s08e014': + parser.ParseResult(None, 'Naruto Shippuuden', 8, [14], None, None, None, [165]), + '165-166.Naruto Shippuuden.s08e014e015': + parser.ParseResult(None, 'Naruto Shippuuden', 8, [14, 15], None, None, None, [165, 166]), '165-166.07-GHOST.s08e014-015': parser.ParseResult(None, '07-GHOST', 8, [14, 15], None, None, None, [165, 166]), '165-166.3x3 Eyes.S08E014E015': parser.ParseResult(None, '3x3 Eyes', 8, [14, 15], None, None, None, [165, 166]), }, @@ -195,8 +260,10 @@ simple_test_cases = { 'One Piece 102': parser.ParseResult(None, 'One Piece', None, [], None, None, None, [102]), 'bleach - 010': parser.ParseResult(None, 'bleach', None, [], None, None, None, [10]), 'Naruto Shippuden - 314v2': parser.ParseResult(None, 'Naruto Shippuden', None, [], None, None, None, [314]), - 'Blue Submarine No. 6 104-105': parser.ParseResult(None, 'Blue Submarine No. 6', None, [], None, None, None, [104, 105]), - 'Samurai X: Trust & Betrayal (OVA) 001-002': parser.ParseResult(None, 'Samurai X: Trust & Betrayal (OVA)', None, [], None, None, None, [1, 2]), + 'Blue Submarine No. 6 104-105': + parser.ParseResult(None, 'Blue Submarine No. 6', None, [], None, None, None, [104, 105]), + 'Samurai X: Trust & Betrayal (OVA) 001-002': + parser.ParseResult(None, 'Samurai X: Trust & Betrayal (OVA)', None, [], None, None, None, [1, 2]), "[ACX]_Wolf's_Spirit_001.mkv": parser.ParseResult(None, "Wolf's Spirit", None, [], None, 'ACX', None, [1]) } @@ -215,7 +282,8 @@ combination_test_cases = [ parser.ParseResult(None, 'MythBusters', 8, [16], '720p.HDTV.x264', 'aAF'), ['standard']), - ('/home/drop/storage/TV/Terminator The Sarah Connor Chronicles/Season 2/S02E06 The Tower is Tall, But the Fall is Short.mkv', + ('/home/drop/storage/TV/Terminator The Sarah Connor Chronicles' + + '/Season 2/S02E06 The Tower is Tall, But the Fall is Short.mkv', parser.ParseResult(None, None, 2, [6], 'The Tower is Tall, But the Fall is Short'), ['standard']), @@ -239,17 +307,18 @@ combination_test_cases = [ unicode_test_cases = [ (u'The.Big.Bang.Theory.2x07.The.Panty.Pi\xf1ata.Polarization.720p.HDTV.x264.AC3-SHELDON.mkv', parser.ParseResult(None, 'The.Big.Bang.Theory', 2, [7], '720p.HDTV.x264.AC3', 'SHELDON') - ), + ), ('The.Big.Bang.Theory.2x07.The.Panty.Pi\xc3\xb1ata.Polarization.720p.HDTV.x264.AC3-SHELDON.mkv', parser.ParseResult(None, 'The.Big.Bang.Theory', 2, [7], '720p.HDTV.x264.AC3', 'SHELDON') - ), + ), ] failure_cases = ['7sins-jfcs01e09-720p-bluray-x264'] class UnicodeTests(test.SickbeardTestDBCase): - def _test_unicode(self, name, result): + @staticmethod + def _test_unicode(name, result): np = parser.NameParser(True) try: @@ -258,7 +327,8 @@ class UnicodeTests(test.SickbeardTestDBCase): return False # this shouldn't raise an exception - a = repr(str(parse_result)) + void = repr(str(parse_result)) + void += '' def test_unicode(self): for (name, result) in unicode_test_cases: @@ -266,7 +336,8 @@ class UnicodeTests(test.SickbeardTestDBCase): class FailureCaseTests(test.SickbeardTestDBCase): - def _test_name(self, name): + @staticmethod + def _test_name(name): np = parser.NameParser(True) try: parse_result = np.parse(name) @@ -343,7 +414,6 @@ class BasicTests(test.SickbeardTestDBCase): print(result) raise - def test_standard_names(self): np = parser.NameParser(False, testing=True) self._test_names(np, 'standard') @@ -491,4 +561,4 @@ if __name__ == '__main__': unittest.TextTestRunner(verbosity=2).run(suite) suite = unittest.TestLoader().loadTestsFromTestCase(FailureCaseTests) - unittest.TextTestRunner(verbosity=2).run(suite) \ No newline at end of file + unittest.TextTestRunner(verbosity=2).run(suite)