• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python helpers.findCertainShow函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: updateShows

    def updateShows(self):
        logger.log(u"Starting trakt show watchlist check", logger.DEBUG)
        watchlist = TraktCall("user/watchlist/shows.json/%API%/" + sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD)
        if watchlist is None:
            logger.log(u"Could not connect to trakt service, aborting watchlist update", logger.DEBUG)
            return
        for show in watchlist:
            if int(sickbeard.TRAKT_METHOD_ADD) != 2:
                self.addDefaultShow(show["tvdb_id"], show["title"], SKIPPED)
            else:
                self.addDefaultShow(show["tvdb_id"], show["title"], WANTED)

            if int(sickbeard.TRAKT_METHOD_ADD) == 1:
                newShow = helpers.findCertainShow(sickbeard.showList, int(show["tvdb_id"]))
                if newShow is not None:
                    self.setEpisodeToWanted(newShow, 1, 1)
                    self.startBacklog(newShow)
                else:
                    self.todoWanted.append((int(show["tvdb_id"]), 1, 1))
            if int(sickbeard.TRAKT_METHOD_ADD) == 3:
                newShow = helpers.findCertainShow(sickbeard.showList, int(show["tvdb_id"]))
                
                if newShow is not None:
                    for ep in range(1,4):
                        self.setEpisodeToWanted(newShow, 1, ep)
                    self.startBacklog(newShow)
                else:
                    for ep in range(1,4):
                        self.todoWanted.append((int(show["tvdb_id"]), 1, ep))
开发者ID:Araldwenn,项目名称:Sick-Beard,代码行数:29,代码来源:traktWatchListChecker.py


示例2: updateEpisodes

    def updateEpisodes(self):
        """
        Sets episodes to wanted that are in trakt watchlist
        """
        logger.log(u"Starting trakt episode watchlist check", logger.DEBUG)

        if not len(self.EpisodeWatchlist):
            logger.log(u"No episode found in your watchlist, aborting episode update", logger.DEBUG)
            return

        managed_show = []
        for show in self.EpisodeWatchlist:
            indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER)
            if indexer == 2:
                indexer_id = int(show["show"]["ids"]["tvrage"])
            else:
                indexer_id = int(show["show"]["ids"]["tvdb"])

            newShow = helpers.findCertainShow(sickbeard.showList, indexer_id)
            try:
                if newShow is None:
                    if indexer_id not in managed_show:
                        self.addDefaultShow(indexer, indexer_id, show["show"]["title"], SKIPPED)
                        managed_show.append(indexer_id)
                    self.todoWanted.append((indexer_id, show['episode']['season'], show['episode']['number']))
                else:
                    if newShow.indexer == indexer:
                        self.setEpisodeToWanted(newShow, show['episode']['season'], show['episode']['number'])
            except TypeError:
                logger.log(u"Could not parse the output from trakt for " + show["show"]["title"], logger.DEBUG)
开发者ID:zezineustaquio,项目名称:SickRage,代码行数:30,代码来源:traktChecker.py


示例3: findPropers

    def findPropers(self, search_date=datetime.datetime.today()):

        results = []

        sqlResults = db.DBConnection().select(
            "SELECT s.show_name, e.showid, e.season, e.episode, e.status, e.airdate FROM tv_episodes AS e"
            + " INNER JOIN tv_shows AS s ON (e.showid = s.indexer_id)"
            + " WHERE e.airdate >= "
            + str(search_date.toordinal())
            + " AND (e.status IN ("
            + ",".join([str(x) for x in Quality.DOWNLOADED])
            + ")"
            + " OR (e.status IN ("
            + ",".join([str(x) for x in Quality.SNATCHED])
            + ")))"
        )
        if not sqlResults:
            return []

        for sqlShow in sqlResults:
            curShow = helpers.findCertainShow(sickbeard.showList, int(sqlShow["showid"]))
            curEp = curShow.getEpisode(int(sqlShow["season"]), int(sqlShow["episode"]))
            searchString = self._get_episode_search_strings(curEp, add_string="PROPER|REPACK")

            for item in self._doSearch(searchString[0]):
                title, url = self._get_title_and_url(item)
                results.append(classes.Proper(title, url, datetime.datetime.today()))

        return results
开发者ID:jfrmn,项目名称:SickBeard-TVRage,代码行数:29,代码来源:torrentleech.py


示例4: find_xem_numbering

def find_xem_numbering(indexer_id, season, episode):
    """
    Returns the scene numbering, as retrieved from xem.
    Refreshes/Loads as needed.
    
    @param indexer_id: int
    @param season: int
    @param episode: int
    @return: (int, int) a tuple of scene_season, scene_episode, or None if there is no special mapping.
    """
    if indexer_id is None or season is None or episode is None:
        return None

    showObj = helpers.findCertainShow(sickbeard.showList, indexer_id)
    if showObj is None: return None
    indexer = showObj.indexer

    if _xem_refresh_needed(indexer_id):
        _xem_refresh(indexer_id)

    cacheDB = db.DBConnection('cache.db')
    rows = cacheDB.select(
        "SELECT scene_season, scene_episode FROM xem_numbering WHERE indexer = ? and indexer_id = ? and season = ? and episode = ?",
        [indexer, indexer_id, season, episode])
    if rows:
        return (int(rows[0]["scene_season"]), int(rows[0]["scene_episode"]))
    else:
        return None
开发者ID:coach0742,项目名称:SickBeard-TVRage,代码行数:28,代码来源:scene_numbering.py


示例5: get_xem_numbering_for_season

def get_xem_numbering_for_season(indexer_id, season):
    """
    Returns a dict of (season, episode) : (sceneSeason, sceneEpisode) mappings
    for an entire show.  Both the keys and values of the dict are tuples.
    Will be empty if there are no scene numbers set
    """
    if indexer_id is None or season is None:
        return {}

    showObj = helpers.findCertainShow(sickbeard.showList, indexer_id)
    if showObj is None: return {}
    indexer = showObj.indexer

    if _xem_refresh_needed(indexer_id):
        _xem_refresh(indexer_id)

    cacheDB = db.DBConnection('cache.db')

    rows = cacheDB.select(
        'SELECT season, scene_season FROM xem_numbering WHERE indexer = ? and indexer_id = ? AND season = ? ORDER BY season, [indexer, indexer_id, season]')

    result = {}
    if rows:
        for row in rows:
            result.setdefault(int(row['season']), []).append(int(row['scene_season']))
    else:
        result.setdefault(int(season), []).append(int(season))

    return result
开发者ID:coach0742,项目名称:SickBeard-TVRage,代码行数:29,代码来源:scene_numbering.py


示例6: addDefaultShow

    def addDefaultShow(self, indexer, indexer_id, name, status):
        """
        Adds a new show with the default settings
        """
        if not helpers.findCertainShow(sickbeard.showList, int(indexer_id)):
            logger.log(u"Adding show " + str(indexer_id))
            root_dirs = sickbeard.ROOT_DIRS.split('|')

            try:
                location = root_dirs[int(root_dirs[0]) + 1]
            except:
                location = None

            if location:
                showPath = ek(os.path.join, location, helpers.sanitizeFileName(name))
                dir_exists = helpers.makeDir(showPath)
                if not dir_exists:
                    logger.log(u"Unable to create the folder %s , can't add the show" % showPath, logger.WARNING)
                    return
                else:
                    helpers.chmodAsParent(showPath)

                sickbeard.showQueueScheduler.action.addShow(int(indexer), int(indexer_id), showPath,
                                                            default_status=status,
                                                            quality=int(sickbeard.QUALITY_DEFAULT),
                                                            flatten_folders=int(sickbeard.FLATTEN_FOLDERS_DEFAULT),
                                                            paused=sickbeard.TRAKT_START_PAUSED,
                                                            default_status_after=status,
                                                            archive=sickbeard.ARCHIVE_DEFAULT)
            else:
                logger.log(u"There was an error creating the show, no root directory setting found", logger.WARNING)
                return
开发者ID:BreizhCat,项目名称:SickRage,代码行数:32,代码来源:traktChecker.py


示例7: updateAiringList

def updateAiringList():
    
    logger.log("Searching DB and building list of airing episodes")
    
    curDate = datetime.date.today().toordinal()

    myDB = db.DBConnection()
    sqlResults = myDB.select("SELECT * FROM tv_episodes WHERE status == " + str(UNAIRED) + " AND airdate <= " + str(curDate))
    
    epList = []

    for sqlEp in sqlResults:
        
        try:
            show = helpers.findCertainShow (sickbeard.showList, int(sqlEp["showid"]))
        except exceptions.MultipleShowObjectsException:
            logger.log("ERROR: expected to find a single show matching " + sqlEp["showid"]) 
            return None
        except exceptions.SickBeardException, e:
            logger.log("Unexpected exception: "+str(e), logger.ERROR)
            continue

        # we aren't ever downloading specials
        if int(sqlEp["season"]) == 0:
            continue
        
        if show == None:
            continue
        
        ep = show.getEpisode(sqlEp["season"], sqlEp["episode"])
        
        if ep == None:
            logger.log("Somehow "+show.name+" - "+str(sqlEp["season"])+"x"+str(sqlEp["episode"])+" is None", logger.ERROR)
        else:
            epList.append(ep)
开发者ID:Orbi,项目名称:Sick-Beard,代码行数:35,代码来源:__init__.py


示例8: updateMissingList

def updateMissingList():

    logger.log("Searching DB and building list of MISSED episodes")

    myDB = db.DBConnection()
    sqlResults = myDB.select("SELECT * FROM tv_episodes WHERE status=" + str(MISSED))

    epList = []

    for sqlEp in sqlResults:

        try:
            show = helpers.findCertainShow(sickbeard.showList, int(sqlEp["showid"]))
        except exceptions.MultipleShowObjectsException:
            logger.log("ERROR: expected to find a single show matching " + sqlEp["showid"])
            return None

        # we aren't ever downloading specials
        if int(sqlEp["season"]) == 0:
            continue

        if show == None:
            continue

        ep = show.getEpisode(sqlEp["season"], sqlEp["episode"])

        if ep == None:
            logger.log(
                "Somehow " + show.name + " - " + str(sqlEp["season"]) + "x" + str(sqlEp["episode"]) + " is None",
                logger.ERROR,
            )
        else:
            epList.append(ep)

    sickbeard.missingList = epList
开发者ID:evanburns,项目名称:Sick-Beard,代码行数:35,代码来源:__init__.py


示例9: _getProperList

    def _getProperList(self):

        propers = {}

        # for each provider get a list of the propers
        for curProvider in providers.sortedProviderList():

            if not curProvider.isActive():
                continue

            search_date = datetime.datetime.today() - datetime.timedelta(days=2)

            logger.log(u"Searching for any new PROPER releases from " + curProvider.name)
            try:
                curPropers = curProvider.findPropers(search_date)
            except exceptions.AuthException, e:
                logger.log(u"Authentication error: " + ex(e), logger.ERROR)
                continue

            # if they haven't been added by a different provider than add the proper to the list
            for x in curPropers:
                showObj = helpers.findCertainShow(sickbeard.showList, x.indexerid)
                if not showObj:
                    logger.log(u"Unable to find the show in our watch list " + str(x.name), logger.DEBUG)
                    continue

                name = self._genericName(x.name)

                if not name in propers:
                    logger.log(u"Found new proper: " + x.name, logger.DEBUG)
                    x.provider = curProvider
                    propers[name] = x
开发者ID:Dahlgren,项目名称:SickRage,代码行数:32,代码来源:properFinder.py


示例10: updateEpisodes

    def updateEpisodes(self):
        """
        Sets episodes to wanted that are in trakt watchlist
        """
        logger.log(u"Starting trakt episode watchlist check", logger.DEBUG)

        try:
            watchlist = self.trakt_api.traktRequest("sync/watchlist/episodes")
        except (traktException, traktAuthException, traktServerBusy) as e:
            logger.log(u"Could not connect to Trakt service: %s" % ex(e), logger.WARNING)
            return

        if not len(watchlist):
            logger.log(u"No shows found in your watchlist, aborting watchlist update", logger.DEBUG)
            return

        for show in watchlist:
            indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER)
            if indexer == 2:
                indexer_id = int(show["show"]["ids"]["tvrage"])
            else:
                indexer_id = int(show["show"]["ids"]["tvdb"])

            self.addDefaultShow(indexer, indexer_id, show["show"]["title"], SKIPPED)
            newShow = helpers.findCertainShow(sickbeard.showList, indexer_id)

            try:
                if newShow and newShow.indexer == indexer:
                    for episode in show["episode"]:
                        if newShow is not None:
                            self.setEpisodeToWanted(newShow, episode["season"], episode["number"])
                        else:
                            self.todoWanted.append((indexer_id, episode["season"], episode["number"]))
            except TypeError:
                logger.log(u"Could not parse the output from trakt for " + show["show"]["title"], logger.DEBUG)
开发者ID:mclarkin9681,项目名称:SickRage,代码行数:35,代码来源:traktChecker.py


示例11: _addCacheEntry

    def _addCacheEntry(self, name, url, season=None, episodes=None, tvdb_id=0, tvrage_id=0, quality=None, extraNames=[]):
        """Return False|None
        Parse the name and try to get as much info out of it as we can
        Will use anime regex's if this is called from fanzub
        On a succesfull parse it will add the parsed infos into the cache.db
        This dosen't mean the parsed result is usefull
        """
        myDB = self._getDB()
        show = None
        if tvdb_id:
            show = helpers.findCertainShow(sickbeard.showList, tvdb_id)
        # if we don't have complete info then parse the filename to get it
        for curName in [name] + extraNames:
            cp = CompleteParser(show=show)
            cpr = cp.parse(curName)
            if cpr.sxxexx and cpr.parse_result:
                break
        else:
            return False

        episodeText = "|"+"|".join(map(str, cpr.episodes))+"|"
        # get the current timestamp
        curTimestamp = int(time.mktime(datetime.datetime.today().timetuple()))
        myDB.action("INSERT INTO "+self.providerID+" (name, season, episodes, tvrid, tvdbid, url, time, quality, release_group, proper) VALUES (?,?,?,?,?,?,?,?,?,?)",
                    [name, cpr.season, episodeText, 0, cpr.tvdbid, url, curTimestamp, cpr.quality, cpr.release_group, int(cpr.is_proper)])
开发者ID:Pakoach,项目名称:Sick-Beard-Animes,代码行数:25,代码来源:tvcache.py


示例12: updateShows

    def updateShows(self):
        logger.log(u"Starting trakt show watchlist check", logger.DEBUG)

        try:
            watchlist = self.trakt_api.traktRequest("sync/watchlist/shows")
        except (traktException, traktAuthException, traktServerBusy) as e:
            logger.log(u"Could not connect to Trakt service: %s" % ex(e), logger.WARNING)
            return

        if not len(watchlist):
            logger.log(u"No shows found in your watchlist, aborting watchlist update", logger.DEBUG)
            return

        for show in watchlist:
            indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER)
            if indexer == 2:
                indexer_id = int(show["show"]["ids"]["tvrage"])
            else:
                indexer_id = int(show["show"]["ids"]["tvdb"])

            if int(sickbeard.TRAKT_METHOD_ADD) != 2:
                self.addDefaultShow(indexer, indexer_id, show["show"]["title"], SKIPPED)
            else:
                self.addDefaultShow(indexer, indexer_id, show["show"]["title"], WANTED)

            if int(sickbeard.TRAKT_METHOD_ADD) == 1:
                newShow = helpers.findCertainShow(sickbeard.showList, indexer_id)
                if newShow is not None:
                    self.setEpisodeToWanted(newShow, 1, 1)
                else:
                    self.todoWanted.append((indexer_id, 1, 1))
开发者ID:mclarkin9681,项目名称:SickRage,代码行数:31,代码来源:traktChecker.py


示例13: find_propers

    def find_propers(self, **kwargs):
        """
        Search for releases of type PROPER
        :return: list of Proper objects
        """
        results = []

        search_terms = getattr(self, 'proper_search_terms', ['proper', 'repack'])
        if not isinstance(search_terms, list):
            if None is search_terms:
                search_terms = 'proper|repack'
            search_terms = [search_terms]

        items = self._search_provider({'Propers': search_terms})

        clean_term = re.compile(r'(?i)[^a-z1-9\|\.]+')
        for proper_term in search_terms:

            proper_check = re.compile(r'(?i)(?:%s)' % clean_term.sub('', proper_term))
            for item in items:
                title, url = self._title_and_url(item)
                if proper_check.search(title):
                    results.append(classes.Proper(title, url, datetime.datetime.today(),
                                                  helpers.findCertainShow(sickbeard.showList, None)))
        return results
开发者ID:Apocrathia,项目名称:SickGear,代码行数:25,代码来源:generic.py


示例14: massEdit

    def massEdit(self, toEdit=None):

        t = PageTemplate(file="manage_massEdit.tmpl")
        t.submenu = ManageMenu

        if not toEdit:
            redirect("/manage")

        showIDs = toEdit.split("|")
        showList = []
        for curID in showIDs:
            curID = int(curID)
            showObj = helpers.findCertainShow(sickbeard.showList, curID)
            if showObj:
                showList.append(showObj)

        season_folders_all_same = True
        last_season_folders = None

        paused_all_same = True
        last_paused = None

        quality_all_same = True
        last_quality = None

        root_dir_list = []

        for curShow in showList:
            
            cur_root_dir = ek.ek(os.path.dirname, curShow._location)
            if cur_root_dir not in root_dir_list:
                root_dir_list.append(cur_root_dir) 
            
            # if we know they're not all the same then no point even bothering
            if paused_all_same:
                # if we had a value already and this value is different then they're not all the same
                if last_paused not in (curShow.paused, None):
                    paused_all_same = False
                else:
                    last_paused = curShow.paused

            if season_folders_all_same:
                if last_season_folders not in (None, curShow.seasonfolders):
                    season_folders_all_same = False
                else:
                    last_season_folders = curShow.seasonfolders

            if quality_all_same:
                if last_quality not in (None, curShow.quality):
                    quality_all_same = False
                else:
                    last_quality = curShow.quality

        t.showList = toEdit
        t.paused_value = last_paused if paused_all_same else None
        t.season_folders_value = last_season_folders if season_folders_all_same else None
        t.quality_value = last_quality if quality_all_same else None
        t.root_dir_list = root_dir_list

        return _munge(t)
开发者ID:natem345,项目名称:Sick-Beard,代码行数:60,代码来源:webserve_manage.py


示例15: _load_saved_torrents

def _load_saved_torrents(deleteSaveFile=True):
    torrent_save_file = _get_running_torrents_pickle_path(False)
    if os.path.isfile(torrent_save_file):
        try:
            data_from_pickle = pickle.load(open(torrent_save_file, "rb"))
            for td in data_from_pickle:
                if 'episodes' not in td:  # older pickles won't have these...
                    td['episodes'] = []
                if 'originalTorrentUrl' not in td:
                    td['originalTorrentUrl'] = None
                if 'blacklistOrigUrlOnFailure' not in td:
                    td['blacklistOrigUrlOnFailure'] = False

                tvEpObjs = []
                for ep in td['episodes']:
                    shw = helpers.findCertainShow(sickbeard.showList, ep['tvdbid'])
                    tvEpObjs.append(TVEpisode(show=shw, season=ep['season'], episode=ep['episode']))
                download_from_torrent(torrent=td['torrent'],
                                      postProcessingDone=td['post_processed'],
                                      start_time=td['start_time'],
                                      key=td['key'],
                                      episodes=tvEpObjs,
                                      originalTorrentUrl=td['originalTorrentUrl'],
                                      blacklistOrigUrlOnFailure=td['blacklistOrigUrlOnFailure'])
        except Exception, e:
            logger.log(u'Failure while reloading running torrents: %s' % (ex(e)), logger.ERROR)
        if deleteSaveFile:
            os.remove(torrent_save_file)
开发者ID:eagleamon,项目名称:Sick-Beard,代码行数:28,代码来源:downloader.py


示例16: _addCacheEntry

    def _addCacheEntry(self, name, url, parse_result=None, indexer_id=0):

        # check if we passed in a parsed result or should we try and create one
        if not parse_result:

            # create showObj from indexer_id if available
            showObj=None
            if indexer_id:
                showObj = helpers.findCertainShow(sickbeard.showList, indexer_id)

            try:
                myParser = NameParser(showObj=showObj, convert=True)
                parse_result = myParser.parse(name)
            except InvalidNameException:
                logger.log(u"Unable to parse the filename " + name + " into a valid episode", logger.DEBUG)
                return None
            except InvalidShowException:
                logger.log(u"Unable to parse the filename " + name + " into a valid show", logger.DEBUG)
                return None

            if not parse_result or not parse_result.series_name:
                return None

        # if we made it this far then lets add the parsed result to cache for usager later on
        season = episodes = None
        if parse_result.is_air_by_date or parse_result.is_sports:
            airdate = parse_result.air_date.toordinal() if parse_result.air_date else parse_result.sports_air_date.toordinal()

            myDB = db.DBConnection()
            sql_results = myDB.select(
                "SELECT season, episode FROM tv_episodes WHERE showid = ? AND indexer = ? AND airdate = ?",
                [parse_result.show.indexerid, parse_result.show.indexer, airdate])
            if sql_results > 0:
                season = int(sql_results[0]["season"])
                episodes = [int(sql_results[0]["episode"])]
        else:
            season = parse_result.season_number if parse_result.season_number else 1
            episodes = parse_result.episode_numbers

        if season and episodes:
            # store episodes as a seperated string
            episodeText = "|" + "|".join(map(str, episodes)) + "|"

            # get the current timestamp
            curTimestamp = int(time.mktime(datetime.datetime.today().timetuple()))

            # get quality of release
            quality = parse_result.quality

            if not isinstance(name, unicode):
                name = unicode(name, 'utf-8', 'replace')

            # get release group
            release_group = parse_result.release_group

            logger.log(u"Added RSS item: [" + name + "] to cache: [" + self.providerID + "]", logger.DEBUG)

            return [
                "INSERT OR IGNORE INTO [" + self.providerID + "] (name, season, episodes, indexerid, url, time, quality, release_group) VALUES (?,?,?,?,?,?,?,?)",
                [name, season, episodeText, parse_result.show.indexerid, url, curTimestamp, quality, release_group]]
开发者ID:Halibutt,项目名称:SickRage,代码行数:60,代码来源:tvcache.py


示例17: updateShows

    def updateShows(self):
        logger.log(u"SHOW_WATCHLIST::CHECK::START - Trakt Show Watchlist", logger.DEBUG)

        if not len(self.ShowWatchlist):
            logger.log(u"No shows found in your watchlist, aborting watchlist update", logger.DEBUG)
            return

        indexer = int(sickbeard.TRAKT_DEFAULT_INDEXER)
        trakt_id = sickbeard.indexerApi(indexer).config['trakt_id']
        for show_el in self.ShowWatchlist[trakt_id]:
            indexer_id = int(str(show_el))
            show = self.ShowWatchlist[trakt_id][show_el]

            #logger.log(u"Checking Show: %s %s %s" % (trakt_id, indexer_id, show['title']),logger.DEBUG)
            if int(sickbeard.TRAKT_METHOD_ADD) != 2:
                self.addDefaultShow(indexer, indexer_id, show['title'], SKIPPED)
            else:
                self.addDefaultShow(indexer, indexer_id, show['title'], WANTED)

            if int(sickbeard.TRAKT_METHOD_ADD) == 1:
                newShow = helpers.findCertainShow(sickbeard.showList, indexer_id)
                if newShow is not None:
                    setEpisodeToWanted(newShow, 1, 1)
                else:
                    self.todoWanted.append((indexer_id, 1, 1))
        logger.log(u"SHOW_WATCHLIST::CHECK::FINISH - Trakt Show Watchlist", logger.DEBUG)
开发者ID:BreizhCat,项目名称:SickRage,代码行数:26,代码来源:traktChecker.py


示例18: _change_missing_episodes

    def _change_missing_episodes():
        if not network_timezones.network_dict:
            network_timezones.update_network_dict()

        if network_timezones.network_dict:
            cur_date = (datetime.date.today() + datetime.timedelta(days=1)).toordinal()
        else:
            cur_date = (datetime.date.today() - datetime.timedelta(days=2)).toordinal()

        cur_time = datetime.datetime.now(network_timezones.sb_timezone)

        my_db = db.DBConnection()
        sql_results = my_db.select(
            'SELECT * FROM tv_episodes'
            ' WHERE status = ? AND season > 0 AND airdate <= ? AND airdate > 1'
            ' ORDER BY showid', [common.UNAIRED, cur_date])

        sql_l = []
        show = None
        wanted = False

        for sqlEp in sql_results:
            try:
                if not show or show.indexerid != int(sqlEp['showid']):
                    show = helpers.findCertainShow(sickbeard.showList, int(sqlEp['showid']))

                # for when there is orphaned series in the database but not loaded into our showlist
                if not show:
                    continue

            except exceptions.MultipleShowObjectsException:
                logger.log(u'ERROR: expected to find a single show matching %s' % sqlEp['showid'])
                continue

            try:
                end_time = (network_timezones.parse_date_time(sqlEp['airdate'], show.airs, show.network) +
                            datetime.timedelta(minutes=helpers.tryInt(show.runtime, 60)))
                # filter out any episodes that haven't aired yet
                if end_time > cur_time:
                    continue
            except (StandardError, Exception):
                # if an error occurred assume the episode hasn't aired yet
                continue

            ep = show.getEpisode(int(sqlEp['season']), int(sqlEp['episode']))
            with ep.lock:
                # Now that it is time, change state of UNAIRED show into expected or skipped
                ep.status = (common.WANTED, common.SKIPPED)[ep.show.paused]
                result = ep.get_sql()
                if None is not result:
                    sql_l.append(result)
                    wanted |= (False, True)[common.WANTED == ep.status]
        else:
            logger.log(u'No unaired episodes marked wanted')

        if 0 < len(sql_l):
            my_db = db.DBConnection()
            my_db.mass_action(sql_l)
            if wanted:
                logger.log(u'Found new episodes marked wanted')
开发者ID:JackDandy,项目名称:SickGear,代码行数:60,代码来源:search_queue.py


示例19: _get_ep_obj

    def _get_ep_obj(self, tvdb_id, season, episodes):

        show_obj = None

        self._log(u"Loading show object for tvdb_id "+str(tvdb_id), logger.DEBUG)
        # find the show in the showlist
        try:
            show_obj = helpers.findCertainShow(sickbeard.showList, tvdb_id)
        except exceptions.MultipleShowObjectsException:
            raise #TODO: later I'll just log this, for now I want to know about it ASAP

        if not show_obj:
            self._log(u"This show isn't in your list, you need to add it to SB before post-processing an episode", logger.ERROR)
            raise exceptions.PostProcessingFailed()

        root_ep = None
        for cur_episode in episodes:
            episode = int(cur_episode)
    
            self._log(u"Retrieving episode object for " + str(season) + "x" + str(episode), logger.DEBUG)
    
            # now that we've figured out which episode this file is just load it manually
            try:
                curEp = show_obj.getEpisode(season, episode)
            except exceptions.EpisodeNotFoundException, e:
                self._log(u"Unable to create episode: "+ex(e), logger.DEBUG)
                raise exceptions.PostProcessingFailed()
    
            if root_ep == None:
                root_ep = curEp
                root_ep.relatedEps = []
            else:
                root_ep.relatedEps.append(curEp)
开发者ID:cytec,项目名称:pyEncoder,代码行数:33,代码来源:postProcessor.py


示例20: findPropers

    def findPropers(self, search_date=datetime.datetime.today()):

        results = []

        myDB = db.DBConnection()
        sqlResults = myDB.select(
            "SELECT s.show_name, e.showid, e.season, e.episode, e.status, e.airdate FROM tv_episodes AS e"
            + " INNER JOIN tv_shows AS s ON (e.showid = s.indexer_id)"
            + " WHERE e.airdate >= "
            + str(search_date.toordinal())
            + " AND e.status IN ("
            + ",".join([str(x) for x in Quality.DOWNLOADED + Quality.SNATCHED + Quality.SNATCHED_BEST])
            + ")"
        )

        for sqlshow in sqlResults or []:
            show = helpers.findCertainShow(sickbeard.showList, int(sqlshow["showid"]))
            if show:
                curEp = show.getEpisode(int(sqlshow["season"]), int(sqlshow["episode"]))
                for term in self.proper_strings:
                    searchString = self._get_episode_search_strings(curEp, add_string=term)

                    for item in self._doSearch(searchString[0]):
                        title, url = self._get_title_and_url(item)
                        results.append(classes.Proper(title, url, datetime.datetime.today(), show))

        return results
开发者ID:zeroX-tj,项目名称:SickRage,代码行数:27,代码来源:generic.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python helpers.getURL函数代码示例发布时间:2022-05-27
下一篇:
Python helpers.encrypt函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap