当前位置: 首页>>代码示例>>Python>>正文


Python tv.TVShow类代码示例

本文整理汇总了Python中sickbeard.tv.TVShow的典型用法代码示例。如果您正苦于以下问题:Python TVShow类的具体用法?Python TVShow怎么用?Python TVShow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TVShow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: execute

    def execute(self):

        ShowQueueItem.execute(self)

        logger.log(u"Starting to add show "+self.showDir)

        try:
            # make sure the tvdb ids are valid
            try:
                ltvdb_api_parms = sickbeard.TVDB_API_PARMS.copy()
                if self.lang:
                    ltvdb_api_parms['language'] = self.lang
        
                t = tvdb_api.Tvdb(**ltvdb_api_parms)
                s = t[self.tvdb_id]
                if not s or not s['seriesname']:
                    ui.flash.error("Unable to add show", "Show in "+str(self.showDir)+" has no name on TVDB, probably the wrong language. Delete .nfo and add manually in the correct language.")
                    self._finishEarly()
                    return
            except tvdb_exceptions.tvdb_exception, e:
                ui.flash.error("Unable to add show", "Unable to look up the show in "+str(self.showDir)+" on TVDB, not using the NFO. Delete .nfo and add manually in the correct language.")
                self._finishEarly()
                return

            newShow = TVShow(self.tvdb_id, self.lang)
            newShow.loadFromTVDB()

            self.show = newShow

            # set up initial values
            self.show.location = self.showDir
            self.show.quality = self.quality if self.quality else sickbeard.QUALITY_DEFAULT
            self.show.seasonfolders = self.season_folders if self.season_folders != None else sickbeard.SEASON_FOLDERS_DEFAULT
            self.show.paused = False
开发者ID:AWilco,项目名称:Sick-Beard,代码行数:34,代码来源:show_queue+(MOU-CDQT5R1's+conflicted+copy+2012-04-11).py

示例2: execute

    def execute(self):

        ShowQueueItem.execute(self)

        logger.log(u"Starting to add show "+self.showDir)

        try:
            newShow = TVShow(self.tvdb_id, self.lang)
            newShow.loadFromTVDB()

            self.show = newShow

            # set up initial values
            self.show.location = self.showDir
            self.show.quality = sickbeard.QUALITY_DEFAULT
            self.show.seasonfolders = sickbeard.SEASON_FOLDERS_DEFAULT
            self.show.paused = False

        except tvdb_exceptions.tvdb_exception, e:
            logger.log(u"Unable to add show due to an error with TVDB: "+str(e).decode('utf-8'), logger.ERROR)
            if self.show:
                ui.flash.error("Unable to add "+str(self.show.name)+" due to an error with TVDB")
            else:
                ui.flash.error("Unable to add show due to an error with TVDB")
            self._finishEarly()
            return
开发者ID:Hydrokugal,项目名称:Sick-Beard,代码行数:26,代码来源:show_queue.py

示例3: loadShowsFromDB

    def loadShowsFromDB():
        """
        Populates the showList with shows from the database
        """
        logging.debug("Loading initial show list")

        myDB = db.DBConnection()
        sqlResults = myDB.select("SELECT * FROM tv_shows")

        sickbeard.showList = []
        for sqlShow in sqlResults:
            try:
                curShow = TVShow(int(sqlShow[b"indexer"]), int(sqlShow[b"indexer_id"]))

                # Build internal name cache for show
                name_cache.buildNameCache(curShow)

                # get next episode info
                curShow.nextEpisode()

                # add show to internal show list
                sickbeard.showList.append(curShow)
            except Exception as e:
                logging.error(
                        "There was an error creating the show in " + sqlShow[b"location"] + ": " + str(e).decode(
                                'utf-8'))
                logging.debug(traceback.format_exc())
开发者ID:coderbone,项目名称:SickRage,代码行数:27,代码来源:SickBeard.py

示例4: execute

    def execute(self):

        ShowQueueItem.execute(self)

        logger.log(u"Starting to add show " + self.showDir)

        try:
            # make sure the tvdb ids are valid
            try:
                ltvdb_api_parms = sickbeard.TVDB_API_PARMS.copy()
                if self.lang:
                    ltvdb_api_parms["language"] = self.lang

                logger.log(u"TVDB: " + repr(ltvdb_api_parms))

                t = tvdb_api.Tvdb(**ltvdb_api_parms)
                s = t[self.tvdb_id]

                # this usually only happens if they have an NFO in their show dir which gave us a TVDB ID that has no
                # proper english version of the show
                if not s or not s["seriesname"]:
                    ui.notifications.error(
                        "Unable to add show",
                        "Show in "
                        + self.showDir
                        + " has no name on TVDB, probably the wrong language. Delete .nfo and add manually in the correct language.",
                    )
                    self._finishEarly()
                    return
            except tvdb_exceptions.tvdb_exception, e:
                logger.log(u"Error contacting TVDB: " + ex(e), logger.ERROR)
                ui.notifications.error(
                    "Unable to add show",
                    "Unable to look up the show in "
                    + self.showDir
                    + " on TVDB, not using the NFO. Delete .nfo and add manually in the correct language.",
                )
                self._finishEarly()
                return

            # clear the name cache
            name_cache.clearCache()

            newShow = TVShow(self.tvdb_id, self.lang)
            newShow.loadFromTVDB()

            self.show = newShow

            # set up initial values
            self.show.location = self.showDir
            self.show.quality = self.quality if self.quality else sickbeard.QUALITY_DEFAULT
            self.show.flatten_folders = (
                self.flatten_folders if self.flatten_folders != None else sickbeard.FLATTEN_FOLDERS_DEFAULT
            )
            self.show.paused = False

            # be smartish about this
            if self.show.genre and "talk show" in self.show.genre.lower():
                self.show.air_by_date = 1
开发者ID:NeuralBlade,项目名称:Sick-Beard,代码行数:59,代码来源:show_queue.py

示例5: QueueItemAdd

class QueueItemAdd(QueueItem):
    def __init__(self, show=None):

        self.showDir = show

        # if we can't create the dir, bail
        if not os.path.isdir(self.showDir):
            if not helpers.makeDir(self.showDir):
                raise exceptions.NoNFOException("Unable to create the show dir " + self.showDir)

        if not os.path.isfile(os.path.join(self.showDir, "tvshow.nfo")):
            raise exceptions.NoNFOException("No tvshow.nfo found")

        # this will initialize self.show to None
        QueueItem.__init__(self, QueueActions.ADD)

        self.initialShow = TVShow(self.showDir)

    def _getName(self):
        if self.show == None:
            return self.showDir
        return self.show.name

    name = property(_getName)

    def _isLoading(self):
        if self.show == None:
            return True
        return False

    isLoading = property(_isLoading)

    def execute(self):

        QueueItem.execute(self)

        logger.log("Starting to add show "+self.showDir)

        otherShow = helpers.findCertainShow(sickbeard.showList, self.initialShow.tvdbid)
        if otherShow != None:
            logger.log("Show is already in your list, not adding it again")
            self.finish()
            return

        try:
            self.initialShow.getImages()
            self.initialShow.loadFromTVDB()
            
        except tvdb_exceptions.tvdb_exception, e:
            logger.log("Unable to add show due to an error with TVDB: "+str(e), logger.ERROR)
            webserve.flash.error("Unable to add "+str(self.initialShow.name)+" due to an error with TVDB")
            self._finishEarly()
            return
            
        except exceptions.NoNFOException:
            logger.log("Unable to load show from NFO", logger.ERROR)
            webserve.flash.error("Unable to add "+str(self.initialShow.name)+" from NFO, skipping")
            self._finishEarly()
            return
开发者ID:basti1,项目名称:Sick-Beard,代码行数:59,代码来源:queue.py

示例6: setUpClass

    def setUpClass(cls):
        cls.shows = []

        show = TVShow(1, 121361)
        show.name = "Italian Works"
        show.episodes = []
        episode = TVEpisode(show, 05, 10)
        episode.name = "Pines of Rome"
        episode.scene_season = 5
        episode.scene_episode = 10
        show.episodes.append(episode)
        cls.shows.append(show)
开发者ID:gondalez,项目名称:SickRage,代码行数:12,代码来源:torrent_tests.py

示例7: QueueItemAdd

class QueueItemAdd(QueueItem):
    def __init__(self, show=None):

        self.showDir = show

        # if we can't create the dir, bail
        if not os.path.isdir(self.showDir):
            if not helpers.makeDir(self.showDir):
                raise exceptions.NoNFOException("Unable to create the show dir " + self.showDir)

        if not os.path.isfile(os.path.join(self.showDir, "tvshow.nfo")):
            raise exceptions.NoNFOException("No tvshow.nfo found")

        # this will initialize self.show to None
        QueueItem.__init__(self, QueueActions.ADD)

        self.initialShow = TVShow(self.showDir)

    def _getName(self):
        if self.show == None:
            return self.showDir
        return self.show.name

    name = property(_getName)

    def _isLoading(self):
        if self.show == None:
            return True
        return False

    isLoading = property(_isLoading)

    def execute(self):

        QueueItem.execute(self)

        logger.log("Starting to add show "+self.showDir)

        try:
            self.initialShow.getImages()
            self.initialShow.loadFromTVDB()
            
        except tvdb_exceptions.tvdb_exception, e:
            logger.log("Unable to add show due to an error with TVDB: "+str(e), logger.ERROR)
            self.finish()
            return
            
        except exceptions.NoNFOException:
            logger.log("Unable to load show from NFO", logger.ERROR)
            # take the show out of the loading list
            self.finish()
            return
开发者ID:mattsch,项目名称:Sickbeard,代码行数:52,代码来源:queue.py

示例8: test_process

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

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

        pp = PostProcessor(test.FILEPATH)
        self.assertTrue(pp.process())
开发者ID:089git,项目名称:Sick-Beard,代码行数:13,代码来源:pp_tests.py

示例9: test

 def test(self):
     show = TVShow(tvdb_id)
     show.name = data[0]
     if data[1]:
         show.anime = 1
     show.saveToDB()
     showList = [show]
     sceneName = data[2]
     result = helpers.get_show_by_name(sceneName, showList, False)
     if not result:
         self.assertEqual(False, show.tvdbid)
         return False
     self.assertEqual(result.tvdbid, show.tvdbid)
开发者ID:Pakoach,项目名称:Sick-Beard-Animes,代码行数:13,代码来源:helpers_test.py

示例10: test_process

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

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

        addNameToCache('show name', 3)
        self.pp = PostProcessor(FILEPATH, process_method='move')
        self.assertTrue(self.pp.process())
开发者ID:coderbone,项目名称:SickRage,代码行数:14,代码来源:test_pp.py

示例11: loadShowsFromDB

def loadShowsFromDB():

	myDB = db.DBConnection()
	sqlResults = myDB.select("SELECT * FROM tv_shows")
	
	myShowList = []
	
	for sqlShow in sqlResults:
		try:
			curShow = TVShow(sqlShow["location"])
			curShow.saveToDB()
			sickbeard.showList.append(curShow)
		except Exception, e:
			logger.log("There was an error creating the show in "+sqlShow["location"]+": "+str(e), logger.ERROR)
			logger.log(traceback.format_exc(), logger.DEBUG)
开发者ID:icybluesmile,项目名称:Sick-Beard,代码行数:15,代码来源:SickBeard.py

示例12: test_process

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

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

        addNameToCache('show name', 3)
        sickbeard.PROCESS_METHOD = 'move'

        pp = PostProcessor(test.FILEPATH)
        self.assertTrue(pp.process())
开发者ID:Boobahbaggins27,项目名称:SickRage,代码行数:16,代码来源:pp_tests.py

示例13: test

    def test(self):
        global searchItems
        searchItems = curData["i"]
        show = TVShow(tvdbdid)
        show.name = show_name
        show.quality = curData["q"]
        show.saveToDB()
        sickbeard.showList.append(show)

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

        bestResult = search.findEpisode(episode, forceSearch)
        if not bestResult:
            self.assertEqual(curData["b"], bestResult)
        self.assertEqual(curData["b"], bestResult.name) #first is expected, second is choosen one
开发者ID:070499,项目名称:Sick-Beard,代码行数:18,代码来源:snatch_tests.py

示例14: load_shows_from_db

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

        logger.log(u'Loading initial show list')

        my_db = db.DBConnection()
        sql_results = my_db.select('SELECT * FROM tv_shows')

        sickbeard.showList = []
        for sqlShow in sql_results:
            try:
                cur_show = TVShow(int(sqlShow['indexer']), int(sqlShow['indexer_id']))
                cur_show.nextEpisode()
                sickbeard.showList.append(cur_show)
            except Exception as er:
                logger.log('There was an error creating the show in %s: %s' % (
                    sqlShow['location'], str(er).decode('utf-8', 'replace')), logger.ERROR)
开发者ID:JackDandy,项目名称:SickGear,代码行数:19,代码来源:sickgear.py

示例15: test

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

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

        bestResult = search.search_providers(show, episode.season, episode.episode, forceSearch)
        if not bestResult:
            self.assertEqual(curData['b'], bestResult)
        self.assertEqual(curData['b'], bestResult.name) #first is expected, second is choosen one
开发者ID:Apocrathia,项目名称:SickGear,代码行数:19,代码来源:snatch_tests.py


注:本文中的sickbeard.tv.TVShow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。