diff --git a/sickbeard/tv.py b/sickbeard/tv.py index 52842f16..c8520f15 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -1742,7 +1742,7 @@ class TVEpisode(object): Returns: A string representing the episode's name and season/ep numbers """ - return self._format_pattern('%SN - %SSx%0SE - %EN') + return self._format_pattern('%SN - %XMSx%0XME - %EN') def _ep_name(self): """ @@ -1843,10 +1843,10 @@ class TVEpisode(object): '%0S': '%02d' % self.season, '%E': str(self.episode), '%0E': '%02d' % self.episode, - '%XS': str(self.scene_season), - '%0XS': '%02d' % self.scene_season, - '%XE': str(self.scene_episode), - '%0XE': '%02d' % self.scene_episode, + '%XMS': str(self.scene_season), + '%0XMS': '%02d' % self.scene_season, + '%XME': str(self.scene_episode), + '%0XME': '%02d' % self.scene_episode, '%RN': release_name(self.release_name), '%RG': release_group(self.release_name), '%AD': str(self.airdate).replace('-', ' '), diff --git a/tests/name_parser_tests.py b/tests/name_parser_tests.py index cdc900d4..c535fb29 100644 --- a/tests/name_parser_tests.py +++ b/tests/name_parser_tests.py @@ -109,10 +109,6 @@ simple_test_cases = { '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)), }, - - 'scene_sports_date_format': { - 'UFC 165 Jones vs Gustafsson 21st Sept 2013 HDTV x264-Sir Paul': parser.ParseResult(None, 'UFC', None, [], 'HDTV x264-Sir Paul', 'Group', datetime.date(2013,11,23)) - } } combination_test_cases = [ @@ -335,10 +331,6 @@ class BasicTests(unittest.TestCase): # np = parser.NameParser() # self._test_names(np, 'scene_date_format', lambda x: x + '.avi') - def test_scene_sports_date_format_file_names(self): - np = parser.NameParser() - self._test_names(np, 'scene_sports_date_format', lambda x: x + '.avi') - def test_combination_names(self): pass diff --git a/tests/snatch_tests.py b/tests/snatch_tests.py index 5ae0ea32..f44afbb8 100644 --- a/tests/snatch_tests.py +++ b/tests/snatch_tests.py @@ -69,7 +69,7 @@ def test_generator(tvdbdid, show_name, curData, forceSearch): def test(self): global searchItems searchItems = curData["i"] - show = TVShow(tvdbdid) + show = TVShow(1, tvdbdid) show.name = show_name show.quality = curData["q"] show.saveToDB() diff --git a/tests/tests.py b/tests/tests.py deleted file mode 100644 index 3689cc4f..00000000 --- a/tests/tests.py +++ /dev/null @@ -1,49 +0,0 @@ -# coding=UTF-8 -# Author: Dennis Lutter -# URL: http://code.google.com/p/sickbeard/ -# -# This file is part of Sick Beard. -# -# Sick Beard is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Sick Beard is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Sick Beard. If not, see . - -from __future__ import with_statement -import re - -import unittest - -import sys, os.path - -sys.path.append(os.path.abspath('..')) -sys.path.append(os.path.abspath('../lib')) - -import sickbeard -from lib.feedparser import feedparser - -class APICheck(unittest.TestCase): - resultFilters = ["sub(pack|s|bed)", "swesub(bed)?", - "(dir|sample|sub|nfo)fix", "sample", "(dvd)?extras", - "dub(bed)?"] - - search_term = u'Watershed.-.Exploring.a.New.Water.Ethic.for.the.New.West.1080i.HDTV.DD2.0.H.264-TrollHD' - #search_term = re.escape(search_term) - - filters = [re.compile('(^|[\W_]|[\s_])%s($|[\W_]|[\s_])' % filter.strip(), re.I) for filter in resultFilters + sickbeard.IGNORE_WORDS.split(',')] - for regfilter in filters: - if regfilter.search(search_term): - print 'bad' - - print 'good' - - if __name__ == "__main__": - unittest.main() \ No newline at end of file diff --git a/tests/tv_tests.py b/tests/tv_tests.py index 1eb9f014..769ea11c 100644 --- a/tests/tv_tests.py +++ b/tests/tv_tests.py @@ -30,11 +30,11 @@ class TVShowTests(test.SickbeardTestDBCase): sickbeard.showList = [] def test_init_tvdbid(self): - show = TVShow(0001, "en") + show = TVShow(1, 0001, "en") self.assertEqual(show.tvdbid, 0001) def test_change_tvdbid(self): - show = TVShow(0001, "en") + show = TVShow(1, 0001, "en") show.name = "show name" show.tvrname = "show name" show.network = "cbs" @@ -54,7 +54,7 @@ class TVShowTests(test.SickbeardTestDBCase): self.assertEqual(show.tvdbid, 0002) def test_set_name(self): - show = TVShow(0001, "en") + show = TVShow(1, 0001, "en") show.name = "newName" show.saveToDB() show.loadFromDB(skipNFO=True) @@ -68,7 +68,7 @@ class TVEpisodeTests(test.SickbeardTestDBCase): sickbeard.showList = [] def test_init_empty_db(self): - show = TVShow(0001, "en") + show = TVShow(1, 0001, "en") ep = TVEpisode(show, 1, 1) ep.name = "asdasdasdajkaj" ep.saveToDB() @@ -83,7 +83,7 @@ class TVTests(test.SickbeardTestDBCase): sickbeard.showList = [] def test_getEpisode(self): - show = TVShow(0001, "en") + show = TVShow(1, 0001, "en") show.name = "show name" show.tvrname = "show name" show.network = "cbs" diff --git a/tests/xem_tests.py b/tests/xem_tests.py new file mode 100644 index 00000000..bf54599f --- /dev/null +++ b/tests/xem_tests.py @@ -0,0 +1,61 @@ +# coding=UTF-8 +# Author: Dennis Lutter +# URL: http://code.google.com/p/sickbeard/ +# +# This file is part of Sick Beard. +# +# Sick Beard is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Sick Beard is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Sick Beard. If not, see . + +from __future__ import with_statement + +import unittest +import sys, os.path + +sys.path.append(os.path.abspath('..')) +sys.path.append(os.path.abspath('../lib')) + +import test_lib as test +import sickbeard +from sickbeard.tv import TVShow, TVEpisode + +class XEMBasicTests(test.SickbeardTestDBCase): + def loadFromDB(self): + """ + Populates the showList with shows from the database + """ + + myDB = test.db.DBConnection() + sqlResults = myDB.select("SELECT * FROM tv_shows") + + for sqlShow in sqlResults: + try: + curShow = TVShow(int(sqlShow["indexer"]), int(sqlShow["indexer_id"])) + sickbeard.showList.append(curShow) + except Exception, e: + print "There was an error creating the show" + + def test_formating(self): + self.loadFromDB() + show = sickbeard.helpers.findCertainShow(sickbeard.showList, 111051) + ep = show.getEpisode(2014, 34) + + print( + u'Searching "%s" for "%s" as "%s"' % (show.name, ep.prettyName(), ep.scene_prettyName())) + +if __name__ == "__main__": + print "==================" + print "STARTING - XEM Scene Numbering TESTS" + print "==================" + print "######################################################################" + suite = unittest.TestLoader().loadTestsFromTestCase(XEMBasicTests) \ No newline at end of file