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


Python search.snatchEpisode函数代码示例

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


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

示例1: run

    def run(self):

        generic_queue.QueueItem.run(self)

        try:

            logger.log("Beginning daily search for [" + self.show.name + "]")
            foundResults = search.searchForNeededEpisodes(self.show, self.segment)

            if not len(foundResults):
                logger.log(u"No needed episodes found during daily search for [" + self.show.name + "]")
            else:
                for result in foundResults:
                    # just use the first result for now
                    logger.log(u"Downloading " + result.name + " from " + result.provider.name)
                    search.snatchEpisode(result)

                    # give the CPU a break
                    time.sleep(common.cpu_presets[sickbeard.CPU_PRESET])

            generic_queue.QueueItem.finish(self)
        except Exception:
            logger.log(traceback.format_exc(), logger.DEBUG)

        self.finish()
开发者ID:FlorentChamault,项目名称:SickRage,代码行数:25,代码来源:search_queue.py

示例2: run

    def run(self):
        generic_queue.QueueItem.run(self)

        try:
            logger.log(u"Marking episode as bad: [" + self.segment.prettyName() + "]")
            failed_history.markFailed(self.segment)

            (release, provider) = failed_history.findRelease(self.segment)
            if release:
                failed_history.logFailed(release)
                history.logFailed(self.segment, release, provider)

            failed_history.revertEpisode(self.segment)
            logger.log("Beginning failed download search for [" + self.segment.prettyName() + "]")

            searchResult = search.searchProviders(self.show, [self.segment], True)

            if searchResult:
                for result in searchResult:
                    # just use the first result for now
                    logger.log(u"Downloading " + result.name + " from " + result.provider.name)
                    search.snatchEpisode(result)

                    # give the CPU a break
                    time.sleep(common.cpu_presets[sickbeard.CPU_PRESET])
            else:
                logger.log(u"No valid episode found to retry for [" + self.segment.prettyName() + "]")
        except Exception:
            logger.log(traceback.format_exc(), logger.DEBUG)

        if self.success is None:
            self.success = False

        self.finish()
开发者ID:elliotlock,项目名称:SickRage,代码行数:34,代码来源:search_queue.py

示例3: execute

    def execute(self):
        generic_queue.QueueItem.execute(self)

        for season, episodes in self.segment.items():
            for epObj in episodes:
                logger.log(u"Marking episode as bad: [" + epObj.prettyName() + "]")
                failed_history.markFailed(epObj)

                (release, provider) = failed_history.findRelease(epObj)
                if release:
                    failed_history.logFailed(release)
                    history.logFailed(epObj, release, provider)

                failed_history.revertEpisode(epObj)
                logger.log("Beginning failed download search for [" + epObj.prettyName() + "]")

                try:
                    searchResult = search.searchProviders(self.show, season, [epObj], True)

                    # reset thread back to original name
                    threading.currentThread().name = self.thread_name

                    if searchResult:
                        for result in searchResult:
                            # just use the first result for now
                            logger.log(u"Downloading " + result.name + " from " + result.provider.name)
                            search.snatchEpisode(result)

                            # give the CPU a break
                            time.sleep(common.cpu_presets[sickbeard.CPU_PRESET])

                    else:
                        logger.log(u"No valid episode found to retry for [" + epObj.prettyName() + "]")
                except Exception, e:
                    logger.log(traceback.format_exc(), logger.DEBUG)
开发者ID:Davejje,项目名称:SickRage,代码行数:35,代码来源:search_queue.py

示例4: execute

    def execute(self):

        generic_queue.QueueItem.execute(self)

        # check if we want to search for season packs instead of just season/episode
        seasonSearch = False
        seasonEps = self.show.getAllEpisodes(self.segment)
        if len(seasonEps) == len(self.wantedEpisodes):
            seasonSearch = True

        # convert indexer numbering to scene numbering for searches
        for i, epObj in enumerate(self.wantedEpisodes):
            (self.wantedEpisodes[i].scene_season,
             self.wantedEpisodes[i].scene_episode) = sickbeard.scene_numbering.get_scene_numbering(self.show.indexerid,
                                                                                                   self.show.indexer,
                                                                                                   epObj.season,
                                                                                                   epObj.episode)
            logger.log(
                "Beginning backlog search for " + self.wantedEpisodes[i].prettyName() + ' as ' + self.wantedEpisodes[
                    i].prettySceneName())

        # search for our wanted items and return the results
        results = search.searchProviders(self.show, self.segment, self.wantedEpisodes, seasonSearch=seasonSearch)

        # download whatever we find
        for curResult in results:
            search.snatchEpisode(curResult)
            time.sleep(5)

        self.finish()
开发者ID:Bespatter,项目名称:SickRage,代码行数:30,代码来源:search_queue.py

示例5: searchForTodaysEpisodes

    def searchForTodaysEpisodes(self):

        self.amActive = True

        self._changeMissingEpisodes()

        # make sure our lists are up to date
        sickbeard.updateAiringList()
        sickbeard.updateComingList()

        with self.lock:
            
            logger.log("Beginning search for new episodes on RSS")

            foundResults = search.searchForNeededEpisodes()
            
            if not len(foundResults):
                logger.log("No needed episodes found on the RSS feeds")
            else:
                for curResult in foundResults:
                    search.snatchEpisode(curResult)
                    time.sleep(2)
                

        # update our lists to reflect any changes we just made
        sickbeard.updateAiringList()
        sickbeard.updateComingList()

        self.amActive = False
开发者ID:dny238,项目名称:Sick-Beard,代码行数:29,代码来源:searchCurrent.py

示例6: execute

    def execute(self):
        generic_queue.QueueItem.execute(self)

        if self.ep_obj:

            failed_history.revertEpisodes(self.show, self.ep_obj.season, [self.ep_obj.episode])
            failed_history.logFailed(self.ep_obj.release_name)

            foundEpisode = search.findEpisode(self.ep_obj, manualSearch=True)
            result = False

            if not foundEpisode:
                ui.notifications.message('No downloads were found', "Couldn't find a download for <i>%s</i>" % self.ep_obj.prettyName())
                logger.log(u"Unable to find a download for " + self.ep_obj.prettyName())
            else:
                # just use the first result for now
                logger.log(u"Downloading episode from " + foundEpisode.url)
                result = search.snatchEpisode(foundEpisode)
                providerModule = foundEpisode.provider
                if not result:
                    ui.notifications.error('Error while attempting to snatch ' + foundEpisode.name+', check your logs')
                elif providerModule == None:
                    ui.notifications.error('Provider is configured incorrectly, unable to download')
    
            self.success = result

        else:    
    
            results = []
            myDB = db.DBConnection()
    
            if not self.show.air_by_date:
                sqlResults = myDB.select("SELECT episode, release_name FROM tv_episodes WHERE showid = ? AND season = ? AND status IN (" + ",".join([str(x) for x in common.Quality.FAILED]) + ")", [self.show.tvdbid, self.segment])
            else:
                segment_year, segment_month = map(int, self.segment.split('-'))
                min_date = datetime.date(segment_year, segment_month, 1)
    
                # it's easier to just hard code this than to worry about rolling the year over or making a month length map
                if segment_month == 12:
                    max_date = datetime.date(segment_year, 12, 31)
                else:
                    max_date = datetime.date(segment_year, segment_month + 1, 1) - datetime.timedelta(days=1)
    
                sqlResults = myDB.select("SELECT episode, release_name FROM tv_episodes WHERE showid = ? AND airdate >= ? AND airdate <= ? AND status IN (" + ",".join([str(x) for x in common.Quality.FAILED]) + ")",
                                            [self.show.tvdbid, min_date.toordinal(), max_date.toordinal()])
            
            for result in sqlResults:
                failed_history.revertEpisodes(self.show, self.segment, [result["episode"]])
                failed_history.logFailed(result["release_name"])

                results = search.findSeason(self.show, self.segment)

            # download whatever we find
            for curResult in results:
                search.snatchEpisode(curResult)
                time.sleep(5)

        self.finish()
开发者ID:meza,项目名称:Sick-Beard-TPB,代码行数:58,代码来源:search_queue.py

示例7: _downloadPropers

    def _downloadPropers(self, properList):
        """
        Download proper (snatch it)

        :param properList:
        """

        for curProper in properList:

            historyLimit = datetime.datetime.today() - datetime.timedelta(days=30)

            # make sure the episode has been downloaded before
            myDB = db.DBConnection()
            historyResults = myDB.select(
                "SELECT resource FROM history " +
                "WHERE showid = ? AND season = ? AND episode = ? AND quality = ? AND date >= ? " +
                "AND action IN (" + ",".join([str(x) for x in Quality.SNATCHED + Quality.DOWNLOADED]) + ")",
                [curProper.indexerid, curProper.season, curProper.episode, curProper.quality,
                 historyLimit.strftime(History.date_format)])

            # if we didn't download this episode in the first place we don't know what quality to use for the proper so we can't do it
            if len(historyResults) == 0:
                logger.log(
                    u"Unable to find an original history entry for proper " + curProper.name + " so I'm not downloading it.")
                continue

            else:

                # make sure that none of the existing history downloads are the same proper we're trying to download
                clean_proper_name = self._genericName(helpers.remove_non_release_groups(curProper.name))
                isSame = False
                for curResult in historyResults:
                    # if the result exists in history already we need to skip it
                    if self._genericName(helpers.remove_non_release_groups(curResult["resource"])) == clean_proper_name:
                        isSame = True
                        break
                if isSame:
                    logger.log(u"This proper is already in history, skipping it", logger.DEBUG)
                    continue

                # get the episode object
                epObj = curProper.show.getEpisode(curProper.season, curProper.episode)

                # make the result object
                result = curProper.provider.getResult([epObj])
                result.show = curProper.show
                result.url = curProper.url
                result.name = curProper.name
                result.quality = curProper.quality
                result.release_group = curProper.release_group
                result.version = curProper.version
                result.content = curProper.content

                # snatch it
                snatchEpisode(result, SNATCHED_PROPER)
                time.sleep(cpu_presets[sickbeard.CPU_PRESET])
开发者ID:hernandito,项目名称:SickRage,代码行数:56,代码来源:properFinder.py

示例8: _searchBacklogForEp

 def _searchBacklogForEp(self, curEp):
 
     foundResult = search.findEpisode(curEp)
     
     if not foundResult:
         logger.log("Unable to find NZB for " + curEp.prettyName(True))
     
     else:
         # just use the first result for now
         search.snatchEpisode(foundResult)
开发者ID:icybluesmile,项目名称:Sick-Beard,代码行数:10,代码来源:searchBacklog.py

示例9: _downloadPropers

def _downloadPropers(properList):

    for curProper in properList:

        historyLimit = datetime.datetime.today() - datetime.timedelta(days=30)

        # make sure the episode has been downloaded before
        myDB = db.DBConnection()
        historyResults = myDB.select(
            'SELECT resource FROM history '
            'WHERE showid = ? AND season = ? AND episode = ? AND quality = ? AND date >= ? '
            'AND action IN (' + ','.join([str(x) for x in Quality.SNATCHED]) + ')',
            [curProper.indexerid, curProper.season, curProper.episode, curProper.quality,
             historyLimit.strftime(history.dateFormat)])

        # if we didn't download this episode in the first place we don't know what quality to use for the proper so we can't do it
        if len(historyResults) == 0:
            logger.log(
                u'Unable to find an original history entry for proper ' + curProper.name + ' so I\'m not downloading it.')
            continue

        else:

            # make sure that none of the existing history downloads are the same proper we're trying to download
            clean_proper_name = _genericName(helpers.remove_non_release_groups(curProper.name))
            isSame = False
            for curResult in historyResults:
                # if the result exists in history already we need to skip it
                if _genericName(helpers.remove_non_release_groups(curResult['resource'])) == clean_proper_name:
                    isSame = True
                    break
            if isSame:
                logger.log(u'This proper is already in history, skipping it', logger.DEBUG)
                continue

            # get the episode object
            showObj = helpers.findCertainShow(sickbeard.showList, curProper.indexerid)
            if showObj == None:
                logger.log(u'Unable to find the show with indexerid ' + str(
                    curProper.indexerid) + ' so unable to download the proper', logger.ERROR)
                continue
            epObj = showObj.getEpisode(curProper.season, curProper.episode)

            # make the result object
            result = curProper.provider.get_result([epObj], curProper.url)
            if None is result:
                continue
            result.name = curProper.name
            result.quality = curProper.quality
            result.version = curProper.version

            # snatch it
            search.snatchEpisode(result, SNATCHED_PROPER)
开发者ID:joshguerette,项目名称:SickGear,代码行数:53,代码来源:properFinder.py

示例10: execute

    def execute(self):

        generic_queue.QueueItem.execute(self)

        results = search.findSeason(self.show, self.segment)

        # download whatever we find
        for curResult in results:
            search.snatchEpisode(curResult, download_dir=self.show._location)
            time.sleep(5)

        self.finish()
开发者ID:ikkemaniac,项目名称:Sick-Beard,代码行数:12,代码来源:search_queue.py

示例11: execute

    def execute(self):

        generic_queue.QueueItem.execute(self)

        results = search.searchProviders(self.show, self.segment, self.wantedEpisodes)

        # download whatever we find
        for curResult in results:
            search.snatchEpisode(curResult)
            time.sleep(5)

        self.finish()
开发者ID:BobWatson,项目名称:SickBeard-TVRage,代码行数:12,代码来源:search_queue.py

示例12: execute

    def execute(self):
        
        generic_queue.QueueItem.execute(self)

        results = search.findSeason(self.show, self.segment, self.scene)

        # download whatever we find
        if results:
            for curResult in results:
                search.snatchEpisode(curResult)
                time.sleep(5)

        self.finish()
开发者ID:Pakoach,项目名称:Sick-Beard-Animes,代码行数:13,代码来源:search_queue.py

示例13: searchBacklog

    def searchBacklog(self):
        
        if self.amActive == True:
            logger.log("Backlog is still running, not starting it again", logger.DEBUG)
            return
        
        self.amActive = True
        
        self._get_lastBacklog()
        
        curDate = datetime.date.today().toordinal()
        
        if curDate - self._lastBacklog >= self.cycleTime:
            
            logger.log("Searching the database for a list of backlogged episodes to download")
            
            myDB = db.DBConnection()
            sqlResults = myDB.select("SELECT * FROM tv_episodes WHERE status IN (" + str(BACKLOG) + ", " + str(DISCBACKLOG) + ")")
            
            if sqlResults == None or len(sqlResults) == 0:
                logger.log("No episodes were found in the backlog")
                self._set_lastBacklog(curDate)
                self.amActive = False
                return
            
            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"], logger.ERROR) 
                    continue

                curEp = show.getEpisode(sqlEp["season"], sqlEp["episode"])
                
                logger.log("Found backlog episode: " + curEp.prettyName(True), logger.DEBUG)
            
                foundNZBs = search.findEpisode(curEp)
                
                if len(foundNZBs) == 0:
                    logger.log("Unable to find NZB for " + curEp.prettyName(True))
                
                else:
                    # just use the first result for now
                    search.snatchEpisode(foundNZBs[0])

                time.sleep(10)
                    
            self._set_lastBacklog(curDate)
            
        self.amActive = False
开发者ID:mattsch,项目名称:Sickbeard,代码行数:51,代码来源:searchBacklog.py

示例14: run

    def run(self):
        self.amActive = True
        self._changeUnairedEpisodes()

        logger.log(u"Searching for todays new releases ...")
        foundResults = self.searchForNeededEpisodes()

        if not len(foundResults):
            logger.log(u"No needed episodes found on the RSS feeds")
        else:
            for curResult in foundResults:
                snatchEpisode(curResult)

        self.amActive = False
开发者ID:EchelonFour,项目名称:SickRage,代码行数:14,代码来源:dailysearcher.py

示例15: _downloadPropers

    def _downloadPropers(self, properList):

        for curProper in properList:

            historyLimit = datetime.datetime.today() - datetime.timedelta(days=30)

            # make sure the episode has been downloaded before
            myDB = db.DBConnection()
            historyResults = myDB.select(
                "SELECT resource FROM history "
                "WHERE showid = ? AND season = ? AND episode = ? AND quality = ? AND date >= ? "
                "AND action IN (" + ",".join([str(x) for x in Quality.SNATCHED]) + ")",
                [curProper.indexerid, curProper.season, curProper.episode, curProper.quality,
                 historyLimit.strftime(history.dateFormat)])

            # if we didn't download this episode in the first place we don't know what quality to use for the proper so we can't do it
            if len(historyResults) == 0:
                logger.log(
                    u"Unable to find an original history entry for proper " + curProper.name + " so I'm not downloading it.")
                continue

            else:

                # make sure that none of the existing history downloads are the same proper we're trying to download
                isSame = False
                for curResult in historyResults:
                    # if the result exists in history already we need to skip it
                    if self._genericName(curResult["resource"]) == self._genericName(curProper.name):
                        isSame = True
                        break
                if isSame:
                    logger.log(u"This proper is already in history, skipping it", logger.DEBUG)
                    continue

                # get the episode object
                showObj = helpers.findCertainShow(sickbeard.showList, curProper.indexerid)
                if showObj == None:
                    logger.log(u"Unable to find the show with indexerid " + str(
                        curProper                                      .indexerid) + " so unable to download the proper", logger.ERROR)
                    continue
                epObj = showObj.getEpisode(curProper.season, curProper.episode)

                # make the result object
                result = curProper.provider.getResult([epObj])
                result.url = curProper.url
                result.name = curProper.name
                result.quality = curProper.quality

                # snatch it
                search.snatchEpisode(result, SNATCHED_PROPER)
开发者ID:Bespatter,项目名称:SickRage,代码行数:50,代码来源:properFinder.py


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