mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
d3a7f0ff5e
Add newznab smart logic to avoid missing releases when there are a great many recent releases. Change improve performance by using newznab server advertised capabilities. Change config/providers newznab to display only non-default categories. Change use scene season for wanted segment in backlog if show is scene numbering. Change combine Manage Searches / Backlog Search / Limited and Full to Force. Change consolidate limited and full backlog. Change config / Search / Backlog search frequency to instead spread backlog searches over a number of days. Change migrate minimum used value for search frequency into new minimum 7 for search spread. Change restrict nzb providers to 1 backlog batch run per day. Add to Config/Search/Unaired episodes/Allow episodes that are released early. Add to Config/Search/Unaired episodes/Use specific api requests to search for early episode releases. Add use related ids for newznab searches to increase search efficiency. Add periodic update of related show ids. Change terminology Edit Show/"Post processing" tab name to "Other". Add advanced feature "Related show IDs" to Edit Show/Other used for finding episodes and TV info. Add search info source image links to those that have zero id under Edit Show/Other/"Related show IDs". Add "set master" button to Edit Show/Other/"Related show IDs" for info source that can be changed. Change terminology displayShow "Indexers" to "Links" to cover internal and web links. Change add related show info sources on displayShow page. Change don't display "temporarily" defunct TVRage image link on displayShow pages unless it is master info source. Change if a defunct info source is the master of a show then present a link on displayShow to edit related show IDs. Change simplify the next backlog search run time display in the page footer. Change try ssl when fetching data thetvdb, imdb, trakt, scene exception. Change improve reliability to Trakt notifier by using show related id support. Change improve config/providers newznab categories layout. Change show loaded log message at start up and include info source. Change if episode has no airdate then set status to unaired (was skipped). Technical Change move scene_exceptions table from cache.db to sickbeard.db. Add related ids to show obj. Add use of mapped indexer ids for newznab. Add indexer to sql in wanted_eps. Add aired in (scene) season for wanted episodes. Add need_anime, need_sports, need_sd, need_hd, need_uhd to wanted episodes and added as parameter to update_providers. Add fix for lib lockfile/mkdirlockfile. Add set master TV info source logic. Change harden ui input validation. Add per action dialog confirmation. Change to reload page under more events. Change implement "Mark all added episodes Wanted to search for releases" when setting new info source.
106 lines
4.8 KiB
Python
106 lines
4.8 KiB
Python
# coding=utf-8
|
|
|
|
import unittest
|
|
import test_lib as test
|
|
|
|
import sys
|
|
import os.path
|
|
sys.path.insert(1, os.path.abspath('..'))
|
|
|
|
from sickbeard import show_name_helpers, scene_exceptions, common, name_cache
|
|
|
|
import sickbeard
|
|
from sickbeard import db
|
|
from sickbeard.tv import TVShow as Show
|
|
|
|
|
|
class SceneTests(test.SickbeardTestDBCase):
|
|
|
|
def _test_allPossibleShowNames(self, name, indexerid=0, expected=[]):
|
|
s = Show(1, indexerid)
|
|
s.name = name
|
|
|
|
result = show_name_helpers.allPossibleShowNames(s)
|
|
self.assertTrue(len(set(expected).intersection(set(result))) == len(expected))
|
|
|
|
def _test_pass_wordlist_checks(self, name, expected):
|
|
result = show_name_helpers.pass_wordlist_checks(name)
|
|
self.assertEqual(result, expected)
|
|
|
|
def test_allPossibleShowNames(self):
|
|
# common.sceneExceptions[-1] = ['Exception Test']
|
|
my_db = db.DBConnection()
|
|
my_db.action('INSERT INTO scene_exceptions (indexer_id, show_name, season) VALUES (?,?,?)', [-1, 'Exception Test', -1])
|
|
common.countryList['Full Country Name'] = 'FCN'
|
|
|
|
self._test_allPossibleShowNames('Show Name', expected=['Show Name'])
|
|
self._test_allPossibleShowNames('Show Name', -1, expected=['Show Name', 'Exception Test'])
|
|
self._test_allPossibleShowNames('Show Name FCN', expected=['Show Name FCN', 'Show Name (Full Country Name)'])
|
|
self._test_allPossibleShowNames('Show Name (FCN)', expected=['Show Name (FCN)', 'Show Name (Full Country Name)'])
|
|
self._test_allPossibleShowNames('Show Name Full Country Name', expected=['Show Name Full Country Name', 'Show Name (FCN)'])
|
|
self._test_allPossibleShowNames('Show Name (Full Country Name)', expected=['Show Name (Full Country Name)', 'Show Name (FCN)'])
|
|
|
|
def test_pass_wordlist_checks(self):
|
|
self._test_pass_wordlist_checks('Show.S02.German.Stuff-Grp', False)
|
|
self._test_pass_wordlist_checks('Show.S02.Some.Stuff-Core2HD', False)
|
|
self._test_pass_wordlist_checks('Show.S02.Some.German.Stuff-Grp', False)
|
|
# self._test_pass_wordlist_checks('German.Show.S02.Some.Stuff-Grp', True)
|
|
self._test_pass_wordlist_checks('Show.S02.This.Is.German', False)
|
|
|
|
|
|
class SceneExceptionTestCase(test.SickbeardTestDBCase):
|
|
|
|
def setUp(self):
|
|
super(SceneExceptionTestCase, self).setUp()
|
|
|
|
sickbeard.showList = [Show(1, 79604), Show(1, 251085)]
|
|
scene_exceptions.retrieve_exceptions()
|
|
name_cache.buildNameCache()
|
|
|
|
def test_sceneExceptionsEmpty(self):
|
|
self.assertEqual(scene_exceptions.get_scene_exceptions(0), [])
|
|
|
|
def test_sceneExceptionsBlack_Lagoon(self):
|
|
self.assertEqual(sorted(scene_exceptions.get_scene_exceptions(79604)), ['Black-Lagoon'])
|
|
|
|
def test_sceneExceptionByName(self):
|
|
self.assertEqual(scene_exceptions.get_scene_exception_by_name('Black-Lagoon'), [79604, -1])
|
|
self.assertEqual(scene_exceptions.get_scene_exception_by_name('Black Lagoon: The Second Barrage'), [79604, 2])
|
|
self.assertEqual(scene_exceptions.get_scene_exception_by_name('Rokka no Yuusha'), [None, None])
|
|
|
|
def test_sceneExceptionByNameAnime(self):
|
|
sickbeard.showList = None
|
|
sickbeard.showList = [Show(1, 79604), Show(1, 295243)]
|
|
sickbeard.showList[0].anime = 1
|
|
sickbeard.showList[1].anime = 1
|
|
scene_exceptions.retrieve_exceptions()
|
|
name_cache.buildNameCache()
|
|
self.assertEqual(scene_exceptions.get_scene_exception_by_name(u'ブラック・ラグーン'), [79604, -1])
|
|
self.assertEqual(scene_exceptions.get_scene_exception_by_name(u'Burakku Ragūn'), [79604, -1])
|
|
self.assertEqual(scene_exceptions.get_scene_exception_by_name('Rokka no Yuusha'), [295243, -1])
|
|
|
|
def test_sceneExceptionByNameEmpty(self):
|
|
self.assertEqual(scene_exceptions.get_scene_exception_by_name('nothing useful'), [None, None])
|
|
|
|
def test_sceneExceptionsResetNameCache(self):
|
|
# clear the exceptions
|
|
my_db = db.DBConnection()
|
|
my_db.action('DELETE FROM scene_exceptions')
|
|
|
|
# put something in the cache
|
|
name_cache.addNameToCache('Cached Name', 0)
|
|
|
|
# updating should not clear the cache this time since our exceptions didn't change
|
|
scene_exceptions.retrieve_exceptions()
|
|
self.assertEqual(name_cache.retrieveNameFromCache('Cached Name'), 0)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if len(sys.argv) > 1:
|
|
suite = unittest.TestLoader().loadTestsFromName('scene_helpers_tests.SceneExceptionTestCase.test_' + sys.argv[1])
|
|
unittest.TextTestRunner(verbosity=2).run(suite)
|
|
else:
|
|
suite = unittest.TestLoader().loadTestsFromTestCase(SceneTests)
|
|
unittest.TextTestRunner(verbosity=2).run(suite)
|
|
suite = unittest.TestLoader().loadTestsFromTestCase(SceneExceptionTestCase)
|
|
unittest.TextTestRunner(verbosity=2).run(suite)
|