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

Python search.snatchEpisode函数代码示例

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

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



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


示例16: execute

    def execute(self):

        generic_queue.QueueItem.execute(self)

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

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

        logger.log(u"Finished searching for episodes from " + self.show.name + " season " + str(self.segment))
        self.finish()
开发者ID:PermaNulled,项目名称:SickBeard-XG,代码行数:14,代码来源:search_queue.py


示例17: execute

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

        for season, episode in self.segment.iteritems():
            epObj = self.show.getEpisode(season, episode)

            (release, provider) = failed_history.findRelease(self.show, season, episode)
            if release:
                logger.log(u"Marking release as bad: " + release)
                failed_history.markFailed(self.show, season, episode)
                failed_history.logFailed(release)
                history.logFailed(self.show.indexerid, season, episode, epObj.status, release, provider)

            failed_history.revertEpisode(self.show, season, episode)

        for season, episode in self.segment.iteritems():
            epObj = self.show.getEpisode(season, episode)

            if self.show.air_by_date:
                results = search.findSeason(self.show, str(epObj.airdate)[:7])
            else:
                results = search.findSeason(self.show, season)

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

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


示例18: execute

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

        foundResults = []
        didSearch = False

        providers = [x for x in sickbeard.providers.sortedProviderList() if x.isActive()]

        try:
            with futures.ThreadPoolExecutor(sickbeard.NUM_OF_THREADS) as executor:
                foundResults = list(executor.map(self.process,providers))
            didSearch = True
        except:
            pass

        if not didSearch:
            logger.log(
                u"No NZB/Torrent providers found or enabled in the sickbeard config. Please check your settings.",
                logger.ERROR)

        if len(foundResults):
            for curResult in [item for sublist in foundResults for item in sublist]:
                time.sleep(0.01)

                result = search.snatchEpisode(curResult)

                # duplicate snatch detected due to multithreading
                if result == 2:
                    continue

        else:
            logger.log(u"Backlog search found nothing to snatch ...")

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


示例19: snatch_item

 def snatch_item(self, item):
     for result in item.results:
         # just use the first result for now
         logger.log(u"Downloading " + result.name + " from " + result.provider.name)
         status =  search.snatchEpisode(result)
         item.success = status
         generic_queue.QueueItem.finish(item)
开发者ID:EchelonFour,项目名称:SickRage,代码行数:7,代码来源:search_queue.py


示例20: run

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

        try:
            logging.info("Beginning daily search for new episodes")
            foundResults = search.searchForNeededEpisodes()

            if not len(foundResults):
                logging.info("No needed episodes found")
            else:
                for result in foundResults:
                    # just use the first result for now
                    logging.info("Downloading " + result.name + " from " + result.provider.name)
                    self.success = search.snatchEpisode(result)

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

            generic_queue.QueueItem.finish(self)
        except Exception:
            logging.debug(traceback.format_exc())

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

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python show_name_helpers.allPossibleShowNames函数代码示例发布时间:2022-05-27
下一篇:
Python search.searchProviders函数代码示例发布时间: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