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

Python show_name_helpers.filterBadReleases函数代码示例

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

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



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

示例1: _get_release_name

    def _get_release_name(self):
        """Try to find a valid-looking release name"""

        if self.nzb_name is not None:
            self._log(u"Using self.nzb_name for release name.")
            return re.sub(r'\.nzb$', '', self.nzb_name, flags=re.IGNORECASE)

        # try to get the release name from nzb/nfo
        self._log(u"No self.nzb_name given. Trying to guess release name.")
        file_types = ["*.nzb", "*.nfo"]
        for search in file_types:
            search_path = ek.ek(os.path.join, self.dir_name, search)
            results = ek.ek(glob, search_path)
            if len(results) == 1:
                found_file = ek.ek(os.path.basename, results[0])
                found_file = re.sub(r'\.nzb$', '', found_file, flags=re.IGNORECASE)
                if show_name_helpers.filterBadReleases(found_file, self._show_obj):
                    self._log(u"Release name (" + found_file + ") found from file (" + results[0] + ")")
                    return found_file

        # If that fails, we try the folder
        folder = ek.ek(os.path.basename, self.dir_name)
        if show_name_helpers.filterBadReleases(folder, self._show_obj):
            # NOTE: Multiple failed downloads will change the folder name.
            # (e.g., appending #s)
            # Should we handle that?
            self._log(u"Folder name (" + folder + ") appears to be a valid release name. Using it.")
            return folder

        return None
开发者ID:Gr33nOpo55um,项目名称:Sick-Beard,代码行数:30,代码来源:failedProcessor.py


示例2: findSeason

def findSeason(show, season):

    logger.log(u"Searching for stuff we need from " + show.name + " season " + str(season))

    foundResults = {}

    didSearch = False

    for curProvider in providers.sortedProviderList():

        if not curProvider.isActive():
            continue

        try:
            curResults = curProvider.findSeasonResults(show, season)

            # make a list of all the results for this provider
            for curEp in curResults:

                # skip non-tv crap
                curResults[curEp] = filter(lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name, show), curResults[curEp])

                if curEp in foundResults:
                    foundResults[curEp] += curResults[curEp]
                else:
                    foundResults[curEp] = curResults[curEp]

        except exceptions.AuthException, e:
            logger.log(u"Authentication error: " + ex(e), logger.ERROR)
            continue
        except Exception, e:
            logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR)
            logger.log(traceback.format_exc(), logger.DEBUG)
            continue
开发者ID:DanaMcCarthy,项目名称:Sick-Beard,代码行数:34,代码来源:search.py


示例3: findSeason

def findSeason(show, season):

    myDB = db.DBConnection()
    allEps = [int(x["episode"]) for x in myDB.select("SELECT episode FROM tv_episodes WHERE showid = ? AND season = ?", [show.tvdbid, season])]
    logger.log(u"Episode list: "+str(allEps), logger.DEBUG)

    
    reallywanted=[]
    notwanted=[]
    finalResults = []
    for curEpNum in allEps:
        sqlResults = myDB.select("SELECT status FROM tv_episodes WHERE showid = ? AND season = ? AND episode = ?", [show.tvdbid, season, curEpNum])
        epStatus = int(sqlResults[0]["status"])
        if epStatus ==3:
            reallywanted.append(curEpNum)
        else:
            notwanted.append(curEpNum)
    if notwanted != []:
        for EpNum in reallywanted:
            showObj = sickbeard.helpers.findCertainShow(sickbeard.showList, show.tvdbid)
            episode = showObj.getEpisode(season, EpNum)
            res=findEpisode(episode, manualSearch=True)
            snatchEpisode(res)
        return
    else:
        logger.log(u"Searching for stuff we need from "+show.name+" season "+str(season))
    
        foundResults = {}
    
        didSearch = False
    
        for curProvider in providers.sortedProviderList():
    
            if not curProvider.isActive():
                continue
    
            try:
                curResults = curProvider.findSeasonResults(show, season)
    
                # make a list of all the results for this provider
                for curEp in curResults:
    
                    # skip non-tv crap
                    curResults[curEp] = filter(lambda x:  show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name, show), curResults[curEp])
    
                    if curEp in foundResults:
                        foundResults[curEp] += curResults[curEp]
                    else:
                        foundResults[curEp] = curResults[curEp]
    
            except exceptions.AuthException, e:
                logger.log(u"Authentication error: "+ex(e), logger.ERROR)
                continue
            except Exception, e:
                logger.log(u"Error while searching "+curProvider.name+", skipping: "+ex(e), logger.DEBUG)
                logger.log(traceback.format_exc(), logger.DEBUG)
                continue
    
            didSearch = True
开发者ID:ClubSoundZ,项目名称:Sick-Beard,代码行数:59,代码来源:search.py


示例4: _doSearch

    def _doSearch(self, search_params, show=None):
    
        results = []
        items = {'Season': [], 'Episode': []}
        
        if not self._doLogin():
            return 
        
        for mode in search_params.keys():
            for search_string in search_params[mode]:
                
                searchURL = self.urls['search'] % (search_string, self.categories)

                logger.log(u"Search string: " + searchURL, logger.DEBUG)
        
                data = self.getURL(searchURL)
                if not data:
                    return []

                html = BeautifulSoup(data)
                
                try:
                    torrent_table = html.find('table', attrs = {'id' : 'torrenttable'})
                    
                    if not torrent_table:
                        logger.log(u"No results found for: " + search_string + "(" + searchURL + ")", logger.DEBUG)
                        return []

                    for result in torrent_table.find_all('tr')[1:]:

                        link = result.find('td', attrs = {'class' : 'name'}).find('a')
                        url = result.find('td', attrs = {'class' : 'quickdownload'}).find('a')

                        title = link.string
                        download_url = self.urls['download'] % url['href']
                        id = int(link['href'].replace('/torrent/', ''))
                        seeders = int(result.find('td', attrs = {'class' : 'seeders'}).string)
                        leechers = int(result.find('td', attrs = {'class' : 'leechers'}).string)

                        #Filter unseeded torrent
                        if seeders == 0 or not title \
                        or not show_name_helpers.filterBadReleases(title):
                            continue 

                        item = title, download_url, id, seeders, leechers
                        logger.log(u"Found result: " + title + "(" + searchURL + ")", logger.DEBUG)

                        items[mode].append(item)

                except:
                    logger.log(u"Failed to parsing " + self.name + " page url: " + searchURL, logger.ERROR)

            #For each search mode sort all the items by seeders
            items[mode].sort(key=lambda tup: tup[3], reverse=True)        

            results += items[mode]  
                
        return results
开发者ID:ChemicalCrunch,项目名称:Mr-Orange-Sick-Beard,代码行数:58,代码来源:torrentleech.py


示例5: _test_filter_bad_releases

    def _test_filter_bad_releases(self, name, expected):
        """
        Test filter of bad releases

        :param name:
        :param expected:
        :return:
        """
        result = show_name_helpers.filterBadReleases(name)
        self.assertEqual(result, expected)
开发者ID:feld,项目名称:SickRage,代码行数:10,代码来源:scene_helpers_tests.py


示例6: _doSearch

    def _doSearch(self, search_params, show=None):
    
        results = []
        items = {'Season': [], 'Episode': []}

        for mode in search_params.keys():
            for search_string in search_params[mode]:

                searchURL = self.proxy._buildURL(self.searchurl %(urllib.quote(search_string)))    
        
                logger.log(u"Search string: " + searchURL, logger.DEBUG)
        
                data = self.getURL(searchURL)
                if not data:
                    return []
        
                re_title_url = self.proxy._buildRE(self.re_title_url)
                
                #Extracting torrent information from data returned by searchURL                   
                match = re.compile(re_title_url, re.DOTALL ).finditer(urllib.unquote(data))
                for torrent in match:

                    title = torrent.group('title').replace('_','.')#Do not know why but SickBeard skip release with '_' in name
                    url = torrent.group('url')
                    id = int(torrent.group('id'))
                    seeders = int(torrent.group('seeders'))
                    leechers = int(torrent.group('leechers'))

                    #Filter unseeded torrent
                    if seeders == 0 or not title \
                    or not show_name_helpers.filterBadReleases(title):
                        continue 
                   
                    #Accept Torrent only from Good People for every Episode Search
                    if sickbeard.THEPIRATEBAY_TRUSTED and re.search('(VIP|Trusted|Helper)',torrent.group(0))== None:
                        logger.log(u"ThePirateBay Provider found result "+torrent.group('title')+" but that doesn't seem like a trusted result so I'm ignoring it",logger.DEBUG)
                        continue

                    #Try to find the real Quality for full season torrent analyzing files in torrent 
                    if mode == 'Season' and Quality.nameQuality(title) == Quality.UNKNOWN:     
                        if not self._find_season_quality(title,id): continue
                        
                    item = title, url, id, seeders, leechers
                    
                    items[mode].append(item)    

            #For each search mode sort all the items by seeders
            items[mode].sort(key=lambda tup: tup[3], reverse=True)        

            results += items[mode]  
                
        return results
开发者ID:ChemicalCrunch,项目名称:Mr-Orange-Sick-Beard,代码行数:52,代码来源:thepiratebay.py


示例7: filterSearchResults

def filterSearchResults(show, season, results):
    foundResults = {}

    # make a list of all the results for this provider
    for curEp in results:
        # skip non-tv crap
        results[curEp] = filter(
            lambda x: show_name_helpers.filterBadReleases(x.name) and x.show == show,results[curEp])

        if curEp in foundResults:
            foundResults[curEp] += results[curEp]
        else:
            foundResults[curEp] = results[curEp]

    return foundResults
开发者ID:aelveborn,项目名称:SickRage,代码行数:15,代码来源:search.py


示例8: searchProviders

def searchProviders(show, season, episode=None, manualSearch=False):
    logger.log(u"Searching for stuff we need from " + show.name + " season " + str(season))

    foundResults = {}

    didSearch = False
    seasonSearch = False

    # gather all episodes for season and then pick out the wanted episodes and compare to determin if we want whole season or just a few episodes
    if episode is None:
        seasonEps = show.getAllEpisodes(season)
        wantedEps = [x for x in seasonEps if show.getOverview(x.status) in (Overview.WANTED, Overview.QUAL)]
        if len(seasonEps) == len(wantedEps):
            seasonSearch = True
    else:
        ep_obj = show.getEpisode(season, episode)
        wantedEps = [ep_obj]

    for curProvider in providers.sortedProviderList():

        if not curProvider.isActive():
            continue

        try:
            curResults = curProvider.getSearchResults(show, season, wantedEps, seasonSearch, manualSearch)

            # make a list of all the results for this provider
            for curEp in curResults:

                # skip non-tv crap
                curResults[curEp] = filter(
                    lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name,
                                                                                                             show),
                    curResults[curEp])

                if curEp in foundResults:
                    foundResults[curEp] += curResults[curEp]
                else:
                    foundResults[curEp] = curResults[curEp]

        except exceptions.AuthException, e:
            logger.log(u"Authentication error: " + ex(e), logger.ERROR)
            continue
        except Exception, e:
            logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR)
            logger.log(traceback.format_exc(), logger.DEBUG)
            continue
开发者ID:jfrmn,项目名称:SickBeard-TVRage,代码行数:47,代码来源:search.py


示例9: filterSearchResults

def filterSearchResults(show, results):
    foundResults = {}

    # make a list of all the results for this provider
    for curEp in results.keys():
        # skip non-tv crap
        results[curEp] = filter(
            lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name, show),
            results[curEp])

        if len(results[curEp]):
            if curEp in foundResults:
                foundResults[curEp] += results[curEp]
            else:
                foundResults[curEp] = results[curEp]

    return foundResults
开发者ID:Weiry,项目名称:SickRage,代码行数:17,代码来源:search.py


示例10: findNeededEpisodes

    def findNeededEpisodes(self, episode, manualSearch=False, downCurQuality=False):
        neededEps = {}
        cl = []

        myDB = self._getDB()
        if not episode:
            sqlResults = myDB.select("SELECT * FROM [" + self.providerID + "]")
        elif type(episode) != list:
            sqlResults = myDB.select(
                "SELECT * FROM [" + self.providerID + "] WHERE indexerid = ? AND season = ? AND episodes LIKE ?",
                [episode.show.indexerid, episode.season, "%|" + str(episode.episode) + "|%"])
        else:
            for epObj in episode:
                cl.append([
                    "SELECT * FROM [" + self.providerID + "] WHERE indexerid = ? AND season = ? AND episodes LIKE ? AND quality IN (" + ",".join(
                        [str(x) for x in epObj.wantedQuality]) + ")",
                    [epObj.show.indexerid, epObj.season, "%|" + str(epObj.episode) + "|%"]])

            sqlResults = myDB.mass_action(cl, fetchall=True)
            sqlResults = list(itertools.chain(*sqlResults))

        # for each cache entry
        for curResult in sqlResults:
            # ignored/required words, and non-tv junk
            if not show_name_helpers.filterBadReleases(curResult["name"]):
                continue

            # get the show object, or if it's not one of our shows then ignore it
            showObj = Show.find(sickbeard.showList, int(curResult["indexerid"]))
            if not showObj:
                continue

            # skip if provider is anime only and show is not anime
            if self.provider.anime_only and not showObj.is_anime:
                logger.log(u"" + str(showObj.name) + " is not an anime, skiping", logger.DEBUG)
                continue

            # get season and ep data (ignoring multi-eps for now)
            curSeason = int(curResult["season"])
            if curSeason == -1:
                continue

            curEp = curResult["episodes"].split("|")[1]
            if not curEp:
                continue

            curEp = int(curEp)

            curQuality = int(curResult["quality"])
            curReleaseGroup = curResult["release_group"]
            curVersion = curResult["version"]

            # if the show says we want that episode then add it to the list
            if not showObj.wantEpisode(curSeason, curEp, curQuality, manualSearch, downCurQuality):
                logger.log(u"Skipping " + curResult["name"], logger.DEBUG)
                continue

            epObj = showObj.getEpisode(curSeason, curEp)

            # build a result object
            title = curResult["name"]
            url = curResult["url"]

            logger.log(u"Found result " + title + " at " + url)

            result = self.provider.get_result([epObj])
            result.show = showObj
            result.url = url
            result.name = title
            result.quality = curQuality
            result.release_group = curReleaseGroup
            result.version = curVersion
            result.content = None

            # add it to the list
            if epObj not in neededEps:
                neededEps[epObj] = [result]
            else:
                neededEps[epObj].append(result)

        # datetime stamp this search so cache gets cleared
        self.setLastSearch()

        return neededEps
开发者ID:madtrix74,项目名称:SickRage,代码行数:84,代码来源:tvcache.py


示例11: ex

                break
            except Exception, e:
                logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR)
                logger.log(traceback.format_exc(), logger.DEBUG)
                break
            finally:
                threading.currentThread().name = origThreadName

            didSearch = True

            if len(searchResults):
                # make a list of all the results for this provider
                for curEp in searchResults:
                    # skip non-tv crap
                    searchResults[curEp] = filter(
                        lambda x: show_name_helpers.filterBadReleases(x.name, parse=False) and x.show == show, searchResults[curEp])

                    if curEp in foundResults:
                        foundResults[curProvider.name][curEp] += searchResults[curEp]
                    else:
                        foundResults[curProvider.name][curEp] = searchResults[curEp]

                break
            elif not curProvider.search_fallback or searchCount == 2:
                break

            if search_mode == 'sponly':
                logger.log(u"FALLBACK EPISODE SEARCH INITIATED ...")
                search_mode = 'eponly'
            else:
                logger.log(u"FALLBACK SEASON PACK SEARCH INITIATED ...")
开发者ID:inakiabt,项目名称:SickRage,代码行数:31,代码来源:search.py


示例12: ex

        try:
            curFoundResults = curProvider.findEpisode(episode, manualSearch=manualSearch)
        except exceptions.AuthException, e:
            logger.log(u"Authentication error: " + ex(e), logger.ERROR)
            continue
        except Exception, e:
            logger.log(u"Error while searching " + curProvider.name + ", skipping: " + ex(e), logger.ERROR)
            logger.log(traceback.format_exc(), logger.DEBUG)
            continue

        didSearch = True

        # skip non-tv crap
        curFoundResults = filter(
            lambda x: show_name_helpers.filterBadReleases(x.name)
            and show_name_helpers.isGoodResult(x.name, episode.show),
            curFoundResults,
        )

        # loop all results and see if any of them are good enough that we can stop searching
        done_searching = False
        for cur_result in curFoundResults:
            done_searching = isFinalResult(cur_result)
            logger.log(
                u"Should we stop searching after finding " + cur_result.name + ": " + str(done_searching), logger.DEBUG
            )
            if done_searching:
                break

        foundResults += curFoundResults
开发者ID:obashir,项目名称:Sick-Beard,代码行数:30,代码来源:search.py


示例13: findNeededEpisodes

    def findNeededEpisodes(self, episode = None, manualSearch=False):
        neededEps = {}

        if episode:
            neededEps[episode] = []

        myDB = self._getDB()

        if not episode:
            sqlResults = myDB.select("SELECT * FROM "+self.providerID)
        else:
            sqlResults = myDB.select("SELECT * FROM "+self.providerID+" WHERE tvdbid = ? AND season = ? AND episodes LIKE ?", [episode.show.tvdbid, episode.season, "|"+str(episode.episode)+"|"])

        # for each cache entry
        for curResult in sqlResults:

            # skip non-tv crap (but allow them for Newzbin cause we assume it's filtered well)
            if self.providerID != 'newzbin' and not show_name_helpers.filterBadReleases(curResult["name"]):
                continue

            # get the show object, or if it's not one of our shows then ignore it
            showObj = helpers.findCertainShow(sickbeard.showList, int(curResult["tvdbid"]))
            if not showObj:
                continue

            # get season and ep data (ignoring multi-eps for now)
            curSeason = int(curResult["season"])
            if curSeason == -1:
                continue
            curEp = curResult["episodes"].split("|")[1]
            if not curEp:
                continue
            curEp = int(curEp)
            curQuality = int(curResult["quality"])

            # if the show says we want that episode then add it to the list
            if not showObj.wantEpisode(curSeason, curEp, curQuality, manualSearch):
                logger.log(u"Skipping "+curResult["name"]+" because we don't want an episode that's "+Quality.qualityStrings[curQuality], logger.DEBUG)

            else:

                if episode:
                    epObj = episode
                else:
                    epObj = showObj.getEpisode(curSeason, curEp)

                # build a result object
                title = curResult["name"]
                url = curResult["url"]

                logger.log(u"Found result " + title + " at " + url)

                result = self.provider.getResult([epObj])
                result.url = url
                result.name = title
                result.quality = curQuality

                # add it to the list
                if epObj not in neededEps:
                    neededEps[epObj] = [result]
                else:
                    neededEps[epObj].append(result)

        return neededEps
开发者ID:jesseward,项目名称:Sick-Beard,代码行数:64,代码来源:tvcache.py


示例14: filter

                epObjs.append(show.getEpisode(season, curEpNum))
            bestSeasonNZB.episodes = epObjs
            return [bestSeasonNZB]

        elif not anyWanted:
            logger.log(u"No eps from this season are wanted at this quality, ignoring the result of "+bestSeasonNZB.name, logger.DEBUG)

        else:
            
            if bestSeasonNZB.provider.providerType == GenericProvider.NZB:
                logger.log(u"Breaking apart the NZB and adding the individual ones to our results", logger.DEBUG)
                
                # if not, break it apart and add them as the lowest priority results
                individualResults = nzbSplitter.splitResult(bestSeasonNZB)

                individualResults = filter(lambda x:  show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name, show, season=season), individualResults)

                for curResult in individualResults:
                    if len(curResult.episodes) == 1:
                        epNum = curResult.episodes[0].episode
                    elif len(curResult.episodes) > 1:
                        epNum = MULTI_EP_RESULT

                    if epNum in foundResults:
                        foundResults[epNum].append(curResult)
                    else:
                        foundResults[epNum] = [curResult]

            # If this is a torrent all we can do is leech the entire torrent, user will have to select which eps not do download in his torrent client
            else:
                
开发者ID:stephanehenry27,项目名称:Sickbeard-anime,代码行数:30,代码来源:search.py


示例15: searchProviders

def searchProviders(show, season, episodes, manualSearch=False):
    foundResults = {}
    finalResults = []

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

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

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

    origThreadName = threading.currentThread().name
    for providerNum, provider in enumerate(providers):
        if provider.anime_only and not show.is_anime:
            logger.log(u"" + str(show.name) + " is not an anime skiping ...")
            continue

        threading.currentThread().name = origThreadName + " :: [" + provider.name + "]"
        foundResults.setdefault(provider.name, {})
        searchCount = 0

        search_mode = "eponly"
        if seasonSearch and provider.search_mode == "sponly":
            search_mode = provider.search_mode

        while True:
            searchCount += 1

            if search_mode == "sponly":
                logger.log(u"Searching for " + show.name + " Season " + str(season) + " pack")
            else:
                logger.log(u"Searching for episodes we need from " + show.name + " Season " + str(season))

            try:
                searchResults = provider.findSearchResults(show, season, episodes, search_mode, manualSearch)
            except exceptions.AuthException, e:
                logger.log(u"Authentication error: " + ex(e), logger.ERROR)
                break
            except Exception, e:
                logger.log(u"Error while searching " + provider.name + ", skipping: " + ex(e), logger.ERROR)
                break

            if len(searchResults):
                # make a list of all the results for this provider
                for curEp in searchResults:
                    # skip non-tv crap
                    searchResults[curEp] = filter(
                        lambda x: show_name_helpers.filterBadReleases(x.name)
                        and show_name_helpers.isGoodResult(x.name, show, season=season),
                        searchResults[curEp],
                    )

                    if curEp in foundResults:
                        foundResults[provider.name][curEp] += searchResults[curEp]
                    else:
                        foundResults[provider.name][curEp] = searchResults[curEp]

                break
            elif not provider.search_fallback or searchCount == 2:
                break

            if search_mode == "sponly":
                logger.log(u"FALLBACK EPISODE SEARCH INITIATED ...")
                search_mode = "eponly"
            else:
                logger.log(u"FALLBACK SEASON PACK SEARCH INITIATED ...")
                search_mode = "sponly"
开发者ID:undertow25,项目名称:SickRage,代码行数:76,代码来源:search.py


示例16: _getProperList

    def _getProperList(self):

        propers = {}

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

            if not curProvider.isActive():
                continue

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

            logger.log(u"Searching for any new PROPER releases from "+curProvider.name)
            curPropers = curProvider.findPropers(date)

            # if they haven't been added by a different provider than add the proper to the list
            for x in curPropers:
                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

        # take the list of unique propers and get it sorted by
        sortedPropers = sorted(propers.values(), key=operator.attrgetter('date'), reverse=True)
        finalPropers = []

        for curProper in sortedPropers:

            # parse the file name
            try:
                myParser = NameParser(False)
                parse_result = myParser.parse(curProper.name)
            except InvalidNameException:
                logger.log(u"Unable to parse the filename "+curProper.name+" into a valid episode", logger.DEBUG)
                continue

            if not parse_result.episode_numbers:
                logger.log(u"Ignoring "+curProper.name+" because it's for a full season rather than specific episode", logger.DEBUG)
                continue

            # populate our Proper instance
            if parse_result.air_by_date:
                curProper.season = -1
                curProper.episode = parse_result.air_date
            else:
                curProper.season = parse_result.season_number if parse_result.season_number != None else 1
                curProper.episode = parse_result.episode_numbers[0]
            curProper.quality = Quality.nameQuality(curProper.name)

            # for each show in our list
            for curShow in sickbeard.showList:

                genericName = self._genericName(parse_result.series_name)

                # get the scene name masks
                sceneNames = set(show_name_helpers.makeSceneShowSearchStrings(curShow))

                # for each scene name mask
                for curSceneName in sceneNames:

                    # if it matches
                    if genericName == self._genericName(curSceneName):
                        logger.log(u"Successful match! Result "+parse_result.series_name+" matched to show "+curShow.name, logger.DEBUG)

                        # set the tvdbid in the db to the show's tvdbid
                        curProper.tvdbid = curShow.tvdbid

                        # since we found it, break out
                        break

                # if we found something in the inner for loop break out of this one
                if curProper.tvdbid != -1:
                    break

            if curProper.tvdbid == -1:
                continue
            
            if not show_name_helpers.filterBadReleases(curProper.name):
                logger.log(u"Proper "+curProper.name+" isn't a valid scene release that we want, igoring it", logger.DEBUG)
                continue

            # if we have an air-by-date show then get the real season/episode numbers
            if curProper.season == -1 and curProper.tvdbid:
                showObj = helpers.findCertainShow(sickbeard.showList, curProper.tvdbid)
                if not showObj:
                    logger.log(u"This should never have happened, post a bug about this!", logger.ERROR)
                    raise Exception("BAD STUFF HAPPENED")

                tvdb_lang = showObj.lang
                # There's gotta be a better way of doing this but we don't wanna
                # change the language value elsewhere
                ltvdb_api_parms = sickbeard.TVDB_API_PARMS.copy()

                if tvdb_lang and not tvdb_lang == 'en':
                    ltvdb_api_parms['language'] = tvdb_lang

                try:
                    t = tvdb_api.Tvdb(**ltvdb_api_parms)
#.........这里部分代码省略.........
开发者ID:Adrellias,项目名称:Sick-Beard,代码行数:101,代码来源:properFinder.py


示例17: findEpisode

def findEpisode(episode, manualSearch=False):

    logger.log(u"Searching for " + episode.prettyName(True))

    foundResults = []

    didSearch = False

    for curProvider in providers.sortedProviderList():

        if not curProvider.isActive():
            continue

        # we check our results after every search string
        # this is done because in the future we will have a ordered list of all show aliases and release_group aliases
        # ordered by success rate ...

        # lets get all search strings
        # we use the method from the curProvider to accommodate for the internal join functions
        # this way we do not break the special abilities of the providers e.g. nzbmatrix
        searchStrings = curProvider.get_episode_search_strings(episode)
        logger.log("All search string permutations (" + curProvider.name + "):" + str(searchStrings))
        """
        try:
            searchStrings = list(set(searchStrings))
        except TypeError:
            pass
        """
        done_searching = False
        for searchString in searchStrings:
            try:
                curFoundResults = curProvider.findEpisode(episode, manualSearch=manualSearch, searchString=searchString)
            except exceptions.AuthException, e:
                logger.log(u"Authentication error: "+ex(e), logger.ERROR)
                break # break the while loop
            except Exception, e:
                logger.log(u"Error while searching "+curProvider.name+", skipping: "+ex(e), logger.ERROR)
                logger.log(traceback.format_exc(), logger.DEBUG)
                break # break the while loop

            didSearch = True

            # skip non-tv crap
            curFoundResults = filter(lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name, episode.show, season=episode.season), curFoundResults)

            # loop all results and see if any of them are good enough that we can stop searching
            for cur_result in curFoundResults:
                done_searching = isFinalResult(cur_result)
                logger.log(u"Should we stop searching after finding "+cur_result.name+": "+str(done_searching), logger.DEBUG)
                if done_searching:
                    break

            # if we are searching an anime we are a little more loose
            # this means we check every turn for a possible result
            # in contrast the isFinalResultlooks function looks for a perfect result (best quality)
            # but this will accept any result that would have been picked in the end -> pickBestResult
            # and then stop and use that
            if episode.show.is_anime:
                logger.log(u"We are searching an anime. i am checking if we got a good result with search provider "+curProvider.name, logger.DEBUG)
                bestResult = pickBestResult(curFoundResults, show=episode.show)
                if bestResult:
                    return bestResult

            foundResults += curFoundResults
            # if we did find a result that's good enough to stop then don't continue
            # this breaks the turn loop
            if done_searching:
                break
开发者ID:stephanehenry27,项目名称:Sickbeard-anime,代码行数:68,代码来源:search.py


示例18: filter

        elif not anyWanted:
            logger.log(
                u"No eps from this season are wanted at this quality, ignoring the result of " + bestSeasonNZB.name,
                logger.DEBUG)

        else:

            if bestSeasonNZB.provider.providerType == GenericProvider.NZB:
                logger.log(u"Breaking apart the NZB and adding the individual ones to our results", logger.DEBUG)

                # if not, break it apart and add them as the lowest priority results
                individualResults = nzbSplitter.splitResult(bestSeasonNZB)

                individualResults = filter(
                    lambda x: show_name_helpers.filterBadReleases(x.name) and show_name_helpers.isGoodResult(x.name,
                                                                                                             show),
                    individualResults)

                for curResult in individualResults:
                    if len(curResult.episodes) == 1:
                        epNum = curResult.episodes[0].episode
                    elif len(curResult.episodes) > 1:
                        epNum = MULTI_EP_RESULT

                    if epNum in foundResults:
                        foundResults[epNum].append(curResult)
                    else:
                        foundResults[epNum] = [curResult]

            # If this is a torrent all we can do is leech the entire torrent, user will have to select which eps not do download in his torrent client
开发者ID:jValdron,项目名称:SickBeard-TVRage,代码行数:30,代码来源:search.py


示例19:

            # populate our Proper instance
            curProper.show = parse_result.show
            curProper.season = parse_result.season_number if parse_result.season_number is not None else 1
            curProper.episode = parse_result.episode_numbers[0]
            curProper.release_group = parse_result.release_group
            curProper.version = parse_result.version
            curProper.quality = Quality.nameQuality(curProper.name, parse_result.is_anime)

            # only get anime proper if it has release group and version
            if parse_result.is_anime:
                if not curProper.release_group and curProper.version == -1:
                    logger.log(u"Proper " + curProper.name + " doesn't have a release group and version, ignoring it",
                               logger.DEBUG)
                    continue

            if not show_name_helpers.filterBadReleases(curProper.name, parse=False):
                logger.log(u"Proper " + curProper.name + " isn't a valid scene release that we want, ignoring it",
                           logger.DEBUG)
                continue

            if parse_result.show.rls_ignore_words and search.filter_release_name(curProper.name,
                                                                                 parse_result.show.rls_ignore_words):
                logger.log(
                    u"Ignoring " + cur 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

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