當前位置: 首頁>>代碼示例>>Python>>正文


Python show.TVShow類代碼示例

本文整理匯總了Python中sickrage.core.tv.show.TVShow的典型用法代碼示例。如果您正苦於以下問題:Python TVShow類的具體用法?Python TVShow怎麽用?Python TVShow使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TVShow類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_init_empty_db

    def test_init_empty_db(self):
        show = TVShow(1, 0001, "en")
        show.saveToDB()
        show.loadFromDB(skipNFO=True)

        ep = TVEpisode(show, 1, 1)
        ep.name = "asdasdasdajkaj"
        ep.saveToDB()
        ep.loadFromDB(1, 1)
        self.assertEqual(ep.name, "asdasdasdajkaj")
開發者ID:gborri,項目名稱:SiCKRAGE,代碼行數:10,代碼來源:test_tv.py

示例2: _test_allPossibleShowNames

    def _test_allPossibleShowNames(self, name, indexerid=0, expected=None):
        if expected is None:
            expected = []

        s = TVShow(1, indexerid)
        s.name = name
        s.save_to_db()

        result = show_names.allPossibleShowNames(s)
        self.assertTrue(len(set(expected).intersection(set(result))) == len(expected))
開發者ID:SiCKRAGETV,項目名稱:SiCKRAGE,代碼行數:10,代碼來源:test_scene_helpers.py

示例3: test_process

    def test_process(self):
        show = TVShow(1, 3)
        show.name = self.SHOWNAME
        show.location = self.SHOWDIR
        show.save_to_db()
        sickrage.app.showlist = [show]

        sickrage.app.name_cache.put('show name', 3)
        self.post_processor = PostProcessor(self.FILEPATH, process_method='move')
        self.post_processor._log = _log
        self.assertTrue(self.post_processor.process)
開發者ID:SiCKRAGETV,項目名稱:SiCKRAGE,代碼行數:11,代碼來源:test_pp.py

示例4: AnimeTests

class AnimeTests(tests.SiCKRAGETestDBCase):
    def setUp(self):
        super(AnimeTests, self).setUp()
        self.show = TVShow(1, 1, 'en')
        self.show.anime = True
        self.show.save_to_db()

    def _test_names(self, np, section, transform=None, verbose=False):
        """
        Performs a test

        :param name_parser: to use for test
        :param section:
        :param transform:
        :param verbose:
        :return:
        """
        if VERBOSE or verbose:
            print()
            print('Running', section, 'tests')
        for cur_test_base in anime_test_cases[section]:
            if transform:
                cur_test = transform(cur_test_base)
                np.file_name = cur_test
            else:
                cur_test = cur_test_base
            if VERBOSE or verbose:
                print('Testing', cur_test)

            result = anime_test_cases[section][cur_test_base]
            np.showObj.name = result.series_name if result else None
            if not result:
                self.assertRaises(InvalidNameException, np.parse, cur_test)
                return
            else:
                result.which_regex = {section}
                test_result = np.parse(cur_test)

            if DEBUG or verbose:
                print('air_by_date:', test_result.is_air_by_date, 'air_date:', test_result.air_date)
                print('anime:', test_result.is_anime, 'ab_episode_numbers:', test_result.ab_episode_numbers)
                print(test_result)
                print(result)

            self.assertEqual(test_result.which_regex, {section},
                             '{} : {} != {}'.format(cur_test, test_result.which_regex, {section}))
            self.assertEqual(test_result, result, '{} : {} != {}'.format(cur_test, test_result, result))

    def test_anime_sxxexx_file_names(self):
        """
        Test anime SxxExx file names
        """
        np = NameParser(showObj=self.show, validate_show=False)
        self._test_names(np, 'anime_SxxExx', lambda x: x + '.avi')
開發者ID:SiCKRAGETV,項目名稱:SiCKRAGE,代碼行數:54,代碼來源:test_name_parser.py

示例5: load_shows

    def load_shows(self):
        """
        Populates the showlist with shows from the database
        """

        for dbData in [x['doc'] for x in self.main_db.db.all('tv_shows', with_doc=True)]:
            try:
                self.log.debug("Loading data for show: [{}]".format(dbData['show_name']))
                show = TVShow(int(dbData['indexer']), int(dbData['indexer_id']))
                show.nextEpisode()
                self.showlist += [show]
            except Exception as e:
                self.log.error("Show error in [%s]: %s" % (dbData['location'], e.message))
開發者ID:gborri,項目名稱:SiCKRAGE,代碼行數:13,代碼來源:__init__.py

示例6: loadFromDB

    def loadFromDB(self):
        """
        Populates the showList with shows from the database
        """

        for s in [s['doc'] for s in sickrage.srCore.mainDB.db.all('tv_shows', with_doc=True)]:
            try:
                curShow = TVShow(int(s["indexer"]), int(s["indexer_id"]))
                curShow.saveToDB()
                curShow.loadFromDB(skipNFO=True)
                sickrage.srCore.SHOWLIST.append(curShow)
            except Exception as e:
                print "There was an error creating the show"
開發者ID:djenniex,項目名稱:SickBeard-TVRage,代碼行數:13,代碼來源:test_xem.py

示例7: test_process

    def test_process(self):
        show = TVShow(1, 3)
        show.name = SHOWNAME
        show.location = SHOWDIR
        show.saveToDB()

        sickrage.showList = [show]
        ep = TVEpisode(show, SEASON, EPISODE)
        ep.name = "some ep name"
        ep.saveToDB()

        sickrage.NAMECACHE.addNameToCache("show name", 3)
        self.pp = PostProcessor(FILEPATH, process_method="move")
        self.assertTrue(self.pp.process)
開發者ID:TATUMTOT,項目名稱:SickRage,代碼行數:14,代碼來源:test_pp.py

示例8: test_isGoodName

    def test_isGoodName(self):
        list_of_cases = [('Show.Name.S01E02.Test-Test', 'Show/Name'),
                         ('Show.Name.S01E02.Test-Test', 'Show. Name'),
                         ('Show.Name.S01E02.Test-Test', 'Show- Name'),
                         ('Show.Name.Part.IV.Test-Test', 'Show Name'),
                         ('Show.Name.S01.Test-Test', 'Show Name'),
                         ('Show.Name.E02.Test-Test', 'Show: Name'),
                         ('Show Name Season 2 Test', 'Show: Name')]

        for testCase in list_of_cases:
            scene_name, show_name = testCase
            s = TVShow(1, 0)
            s.name = show_name
            s.save_to_db()
            self._test_isGoodName(scene_name, s)
開發者ID:SiCKRAGETV,項目名稱:SiCKRAGE,代碼行數:15,代碼來源:test_scene_helpers.py

示例9: loadFromDB

    def loadFromDB(self):
        """
        Populates the showList with shows from the database
        """

        sqlResults = main_db.MainDB().select("SELECT * FROM tv_shows")

        for sqlShow in sqlResults:
            try:
                curShow = TVShow(int(sqlShow["indexer"]), int(sqlShow["indexer_id"]))
                curShow.saveToDB()
                curShow.loadFromDB(skipNFO=True)
                sickrage.srCore.SHOWLIST.append(curShow)
            except Exception as e:
                print "There was an error creating the show"
開發者ID:afctim,項目名稱:SiCKRAGE,代碼行數:15,代碼來源:test_xem.py

示例10: __init__

 def __init__(self, something):
     super(UnicodeTests, self).__init__(something)
     self.setUp()
     self.show = TVShow(1, 1, "en")
     self.show.name = "The Big Bang Theory"
     self.show.saveToDB()
     self.show.loadFromDB(skipNFO=True)
開發者ID:thomas-burggraeve,項目名稱:SiCKRAGE,代碼行數:7,代碼來源:test_name_parser.py

示例11: load_shows

    def load_shows(self):
        """
        Populates the showlist with shows from the database
        """

        for sqlShow in main_db.MainDB().select("SELECT * FROM tv_shows"):
            try:
                curshow = TVShow(int(sqlShow["indexer"]), int(sqlShow["indexer_id"]))
                self.srLogger.debug("Loading data for show: [{}]".format(curshow.name))
                #self.NAMECACHE.buildNameCache(curshow)
                curshow.nextEpisode()
                self.SHOWLIST += [curshow]
            except Exception as e:
                self.srLogger.error(
                    "There was an error creating the show in {}: {}".format(sqlShow["location"], e.message))
                self.srLogger.debug(traceback.format_exc())
開發者ID:afctim,項目名稱:SiCKRAGE,代碼行數:16,代碼來源:__init__.py

示例12: UnicodeTests

class UnicodeTests(tests.SiCKRAGETestDBCase):
    def setUp(self):
        super(UnicodeTests, self).setUp()
        self.show = TVShow(1, 1, 'en')
        self.show.name = "The Big Bang Theory"
        self.show.save_to_db()

    def _test_unicode(self, name, result):
        np = NameParser(True, showObj=self.show, validate_show=False)
        parse_result = np.parse(name)

        # this shouldn't raise an exception
        repr(str(parse_result))
        self.assertEqual(parse_result.extra_info, result.extra_info)

    def test_unicode(self):
        for (name, result) in unicode_test_cases:
            self._test_unicode(name, result)
開發者ID:SiCKRAGETV,項目名稱:SiCKRAGE,代碼行數:18,代碼來源:test_name_parser.py

示例13: test

    def test(self):
        global searchItems
        searchItems = curData[b"i"]
        show = TVShow(1, tvdbdid)
        show.name = show_name
        show.quality = curData[b"q"]
        show.saveToDB()
        sickrage.showList.append(show)
        episode = None

        for epNumber in curData[b"e"]:
            episode = TVEpisode(show, curData[b"s"], epNumber)
            episode.status = WANTED
            episode.saveToDB()

        bestResult = searchProviders(show, episode.episode, forceSearch)
        if not bestResult:
            self.assertEqual(curData[b"b"], bestResult)
        self.assertEqual(curData[b"b"], bestResult.name)  # first is expected, second is choosen one
開發者ID:TATUMTOT,項目名稱:SickRage,代碼行數:19,代碼來源:test_snatching.py

示例14: load_shows

def load_shows():
    """
    Populates the showlist with shows from the database
    """

    showlist = []
    for sqlShow in main_db.MainDB().select("SELECT * FROM tv_shows"):
        try:
            curshow = TVShow(int(sqlShow[b"indexer"]), int(sqlShow[b"indexer_id"]))
            sickrage.LOGGER.debug("Loading data for show: [{}]".format(curshow.name))
            sickrage.NAMECACHE.buildNameCache(curshow)
            curshow.nextEpisode()
            showlist += [curshow]
        except Exception as e:
            sickrage.LOGGER.error("There was an error creating the show in {}: {}".format(sqlShow[b"location"], e))
            sickrage.LOGGER.debug(traceback.format_exc())
            continue

    return showlist
開發者ID:TATUMTOT,項目名稱:SickRage,代碼行數:19,代碼來源:__init__.py

示例15: UnicodeTests

class UnicodeTests(SiCKRAGETestDBCase):
    def __init__(self, something):
        super(UnicodeTests, self).__init__(something)
        self.setUp()
        self.show = TVShow(1, 1, "en")
        self.show.name = "The Big Bang Theory"
        self.show.saveToDB()
        self.show.loadFromDB(skipNFO=True)

    def _test_unicode(self, name, result):
        np = NameParser(True, showObj=self.show)
        parse_result = np.parse(name)

        # this shouldn't raise an exception
        repr(str(parse_result))
        self.assertEqual(parse_result.extra_info, result.extra_info)

    def test_unicode(self):
        for (name, result) in unicode_test_cases:
            self._test_unicode(name, result)
開發者ID:thomas-burggraeve,項目名稱:SiCKRAGE,代碼行數:20,代碼來源:test_name_parser.py


注:本文中的sickrage.core.tv.show.TVShow類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。