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


Python Quality.sceneQuality方法代码示例

本文整理汇总了Python中sickbeard.common.Quality.sceneQuality方法的典型用法代码示例。如果您正苦于以下问题:Python Quality.sceneQuality方法的具体用法?Python Quality.sceneQuality怎么用?Python Quality.sceneQuality使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sickbeard.common.Quality的用法示例。


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

示例1: _find_season_quality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
    def _find_season_quality(self, title, torrent_id, ep_number):
        """ Return the modified title of a Season Torrent with the quality found inspecting torrent file list """

        mediaExtensions = ['avi', 'mkv', 'wmv', 'divx',
                           'vob', 'dvr-ms', 'wtv', 'ts'
                                                   'ogv', 'rar', 'zip', 'mp4']

        quality = Quality.UNKNOWN

        fileName = None

        fileURL = self.proxy._buildURL(self.url + 'ajax_details_filelist.php?id=' + str(torrent_id))

        data = self.getURL(fileURL)
        if not data:
            return None

        filesList = re.findall('<td.+>(.*?)</td>', data)

        if not filesList:
            logger.log(u"Unable to get the torrent file list for " + title, logger.ERROR)

        videoFiles = filter(lambda x: x.rpartition(".")[2].lower() in mediaExtensions, filesList)

        #Filtering SingleEpisode/MultiSeason Torrent
        if len(videoFiles) < ep_number or len(videoFiles) > float(ep_number * 1.1):
            logger.log(
                u"Result " + title + " have " + str(ep_number) + " episode and episodes retrived in torrent are " + str(
                    len(videoFiles)), logger.DEBUG)
            logger.log(u"Result " + title + " Seem to be a Single Episode or MultiSeason torrent, skipping result...",
                       logger.DEBUG)
            return None

        if Quality.sceneQuality(title) != Quality.UNKNOWN:
            return title

        for fileName in videoFiles:
            quality = Quality.sceneQuality(os.path.basename(fileName))
            if quality != Quality.UNKNOWN: break

        if fileName is not None and quality == Quality.UNKNOWN:
            quality = Quality.assumeQuality(os.path.basename(fileName))

        if quality == Quality.UNKNOWN:
            logger.log(u"Unable to obtain a Season Quality for " + title, logger.DEBUG)
            return None

        try:
            myParser = NameParser()
            parse_result = myParser.parse(fileName)
        except InvalidNameException:
            return None

        logger.log(u"Season quality for " + title + " is " + Quality.qualityStrings[quality], logger.DEBUG)

        if parse_result.series_name and parse_result.season_number:
            title = parse_result.series_name + ' S%02d' % int(parse_result.season_number) + ' ' + self._reverseQuality(
                quality)

        return title
开发者ID:sgtwtf,项目名称:SickRage,代码行数:62,代码来源:thepiratebay.py

示例2: _find_season_quality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
    def _find_season_quality(self, title, torrent_link, ep_number):
        """ Return the modified title of a Season Torrent with the quality found inspecting torrent file list """

        quality = Quality.UNKNOWN

        file_name = None

        data = self.get_url(torrent_link)
        if not data:
            return None

        try:
            with BS4Parser(data, features=['html5lib', 'permissive']) as soup:
                file_table = soup.find('table', attrs={'class': 'torrentFileList'})

                if not file_table:
                    return None

                files = [x.text for x in file_table.find_all('td', attrs={'class': 'torFileName'})]
                video_files = filter(lambda i: i.rpartition('.')[2].lower() in mediaExtensions, files)

                # Filtering SingleEpisode/MultiSeason Torrent
                if len(video_files) < ep_number or len(video_files) > float(ep_number * 1.1):
                    logger.log(u'Result %s lists %s episodes with %s episodes retrieved in torrent'
                               % (title, ep_number, len(video_files)), logger.DEBUG)
                    logger.log(u'Result %s seem to be a single episode or multi-season torrent, skipping result...'
                               % title, logger.DEBUG)
                    return None

                if Quality.UNKNOWN != Quality.sceneQuality(title):
                    return title

                for file_name in video_files:
                    quality = Quality.sceneQuality(os.path.basename(file_name))
                    if Quality.UNKNOWN != quality:
                        break

                if None is not file_name and Quality.UNKNOWN == quality:
                    quality = Quality.assumeQuality(os.path.basename(file_name))

                if Quality.UNKNOWN == quality:
                    logger.log(u'Unable to obtain a Season Quality for ' + title, logger.DEBUG)
                    return None

                try:
                    my_parser = NameParser(showObj=self.show)
                    parse_result = my_parser.parse(file_name)
                except (InvalidNameException, InvalidShowException):
                    return None

                logger.log(u'Season quality for %s is %s' % (title, Quality.qualityStrings[quality]), logger.DEBUG)

                if parse_result.series_name and parse_result.season_number:
                    title = parse_result.series_name + ' S%02d %s' % (int(parse_result.season_number),
                                                                      self._reverse_quality(quality))
                return title

        except Exception:
            logger.log(u'Failed to quality parse ' + self.name + ' Traceback: ' + traceback.format_exc(), logger.ERROR)
开发者ID:Apocrathia,项目名称:SickGear,代码行数:61,代码来源:kat.py

示例3: _find_season_quality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
    def _find_season_quality(self, title, torrent_id, ep_number):
        """ Return the modified title of a Season Torrent with the quality found inspecting torrent file list """

        if not self.url:
            return False

        quality = Quality.UNKNOWN
        file_name = None
        data = self.get_url('%sajax_details_filelist.php?id=%s' % (self.url, torrent_id))
        if self.should_skip() or not data:
            return None

        files_list = re.findall('<td.+>(.*?)</td>', data)

        if not files_list:
            logger.log(u'Unable to get the torrent file list for ' + title, logger.ERROR)

        video_files = filter(lambda x: x.rpartition('.')[2].lower() in mediaExtensions, files_list)

        # Filtering SingleEpisode/MultiSeason Torrent
        if ep_number > len(video_files) or float(ep_number * 1.1) < len(video_files):
            logger.log(u'Result %s has episode %s and total episodes retrieved in torrent are %s'
                       % (title, str(ep_number), str(len(video_files))), logger.DEBUG)
            logger.log(u'Result %s seems to be a single episode or multiseason torrent, skipping result...'
                       % title, logger.DEBUG)
            return None

        if Quality.UNKNOWN != Quality.sceneQuality(title):
            return title

        for file_name in video_files:
            quality = Quality.sceneQuality(os.path.basename(file_name))
            if Quality.UNKNOWN != quality:
                break

        if None is not file_name and Quality.UNKNOWN == quality:
            quality = Quality.assumeQuality(os.path.basename(file_name))

        if Quality.UNKNOWN == quality:
            logger.log(u'Unable to obtain a Season Quality for ' + title, logger.DEBUG)
            return None

        try:
            my_parser = NameParser(showObj=self.show, indexer_lookup=False)
            parse_result = my_parser.parse(file_name)
        except (InvalidNameException, InvalidShowException):
            return None

        logger.log(u'Season quality for %s is %s' % (title, Quality.qualityStrings[quality]), logger.DEBUG)

        if parse_result.series_name and parse_result.season_number:
            title = '%s S%02d %s' % (parse_result.series_name,
                                     int(parse_result.season_number),
                                     self._reverse_quality(quality))

        return title
开发者ID:JackDandy,项目名称:SickGear,代码行数:58,代码来源:thepiratebay.py

示例4: getQuality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
 def getQuality(self, item, anime=False):
     if 'quality' in item:
         if item.get('quality') == "480p":
             return Quality.SDTV
         elif item.get('quality') == "720p":
             return Quality.HDWEBDL
         elif item.get('quality') == "1080p":
             return Quality.FULLHDWEBDL
         else:
             return Quality.sceneQuality(item.get('title'), anime)
     else:
         return Quality.sceneQuality(item.get('title'), anime)
开发者ID:abetancort,项目名称:SickRage,代码行数:14,代码来源:eztv.py

示例5: getQuality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
    def getQuality(self, item, anime=False):

        try:
            quality = Quality.sceneQuality(item.filename, anime)
        except:
            quality = Quality.UNKNOWN

        return quality
开发者ID:Bonekicker,项目名称:SickRage,代码行数:10,代码来源:ezrss.py

示例6: _addCacheEntry

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
    def _addCacheEntry(self, name, url, quality=None):

        cacheDB = self._getDB()
        season = None
        episodes = None

        # if we don't have complete info then parse the filename to get it
        try:
            myParser = NameParser(0)
            parse_result = myParser.parse(name).convert()
        except InvalidNameException:
            logger.log(u"Unable to parse the filename " + name + " into a valid episode", logger.DEBUG)
            return None

        if not parse_result:
            logger.log(u"Giving up because I'm unable to parse this name: " + name, logger.DEBUG)
            return None

        if not parse_result.series_name:
            logger.log(u"No series name retrieved from " + name + ", unable to cache it", logger.DEBUG)
            return None

        if not parse_result.show:
            logger.log(u"Couldn't find a show in our databases matching " + name + ", unable to cache it", logger.DEBUG)
            return None

        try:
            myDB = db.DBConnection()
            if parse_result.show.air_by_date:
                airdate = parse_result.sports_event_date.toordinal() if parse_result.show.sports else parse_result.air_date.toordinal()
                sql_results = myDB.select("SELECT season, episode FROM tv_episodes WHERE showid = ? AND airdate = ?",
                                          [parse_result.show.indexerid, airdate])
                if sql_results > 0:
                    season = int(sql_results[0]["season"])
                    episodes = [int(sql_results[0]["episode"])]
            else:
                season = parse_result.season_number
                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
                if quality is None:
                    quality = Quality.sceneQuality(name)

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

                cacheDB.action(
                    "INSERT INTO [" + self.providerID + "] (name, season, episodes, indexerid, url, time, quality) VALUES (?,?,?,?,?,?,?)",
                    [name, season, episodeText, parse_result.show.indexerid, url, curTimestamp, quality])
        except:
            return
开发者ID:WoLpH,项目名称:SickBeard-TVRage,代码行数:60,代码来源:tvcache.py

示例7: getQuality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
    def getQuality(self, item):
        
        torrent_node = item.getElementsByTagName('torrent')[0]
        filename_node = torrent_node.getElementsByTagName('fileName')[0]
        filename = get_xml_text(filename_node)

        quality = Quality.sceneQuality(filename)
        
        return quality
开发者ID:fldc,项目名称:Sick-Beard,代码行数:11,代码来源:ezrss.py

示例8: _find_season_quality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
    def _find_season_quality(self,title, torrent_link, ep_number):
        """ Return the modified title of a Season Torrent with the quality found inspecting torrent file list """

        mediaExtensions = ['avi', 'mkv', 'wmv', 'divx',
                           'vob', 'dvr-ms', 'wtv', 'ts'
                           'ogv', 'rar', 'zip', 'mp4'] 
        
        quality = Quality.UNKNOWN        
        
        fileName = None

        data = self.getURL(torrent_link)
        
        if not data:
            return None
        
        try: 
            soup = BeautifulSoup(data, features=["html5lib", "permissive"])
            file_table = soup.find('table', attrs = {'class': 'torrentFileList'})

            if not file_table:
                return None
            
            files = [x.text for x in file_table.find_all('td', attrs = {'class' : 'torFileName'} )]
            videoFiles = filter(lambda x: x.rpartition(".")[2].lower() in mediaExtensions, files)

            #Filtering SingleEpisode/MultiSeason Torrent
            if len(videoFiles) < ep_number or len(videoFiles) > float(ep_number * 1.1 ):
                logger.log(u"Result " + title + " Seem to be a Single Episode or MultiSeason torrent, skipping result...", logger.DEBUG)
                return None

            for fileName in videoFiles:
                quality = Quality.sceneQuality(os.path.basename(fileName))
                if quality != Quality.UNKNOWN: break
    
            if fileName!=None and quality == Quality.UNKNOWN:
                quality = Quality.assumeQuality(os.path.basename(fileName))            
    
            if quality == Quality.UNKNOWN:
                logger.log(u"Unable to obtain a Season Quality for " + title, logger.DEBUG)
                return None
    
            try:
                myParser = NameParser()
                parse_result = myParser.parse(fileName)
            except InvalidNameException:
                return None
            
            logger.log(u"Season quality for "+title+" is "+Quality.qualityStrings[quality], logger.DEBUG)
            
            if parse_result.series_name and parse_result.season_number: 
                title = parse_result.series_name+' S%02d' % int(parse_result.season_number)+' '+self._reverseQuality(quality)
            
            return title
            
        except Exception, e:
            logger.log(u"Failed parsing " + self.name + " Traceback: "  + traceback.format_exc(), logger.ERROR)
开发者ID:fldc,项目名称:Sick-Beard,代码行数:59,代码来源:kat.py

示例9: get_quality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
    def get_quality(self, item, anime=False):

        if isinstance(item, tuple):
            name = item[0]
        elif isinstance(item, dict):
            name, url = self._get_title_and_url(item)
        else:
            name = item.title
        return Quality.sceneQuality(name, anime)
开发者ID:joshguerette,项目名称:SickGear,代码行数:11,代码来源:generic.py

示例10: _doSearch

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
    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(unidecode(search_string)))) 
        
                logger.log(u"Search string: " + searchURL, logger.DEBUG)
        
                data = self.getURL(searchURL)
                if not data:
                    continue
        
                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:
                        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.sceneQuality(title) == Quality.UNKNOWN:     
                        ep_number = int(len(search_params['Episode']) / len(allPossibleShowNames(self.show)))
                        title = self._find_season_quality(title,id, ep_number)

                    if not title:
                        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:fldc,项目名称:Sick-Beard,代码行数:57,代码来源:thepiratebay.py

示例11: getQuality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
 def getQuality(self, item):
     """
     Figures out the quality of the given RSS item node
     
     item: An xml.dom.minidom.Node representing the <item> tag of the RSS feed
     
     Returns a Quality value obtained from the node's data 
     """
     (title, url) = self._get_title_and_url(item) #@UnusedVariable
     quality = Quality.sceneQuality(title)
     return quality
开发者ID:fldc,项目名称:Sick-Beard,代码行数:13,代码来源:generic.py

示例12: getQuality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
    def getQuality(self, item, anime=False):
        """
        Figures out the quality of the given RSS item node

        item: An elementtree.ElementTree element representing the <item> tag of the RSS feed

        Returns a Quality value obtained from the node's data
        """
        (title, url) = self._get_title_and_url(item)
        quality = Quality.sceneQuality(title, anime)
        return quality
开发者ID:hernandito,项目名称:SickRage,代码行数:13,代码来源:generic.py

示例13: _addCacheEntry

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
    def _addCacheEntry(self, name, url, quality=None):

        try:
            myParser = NameParser(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

        season = episodes = None
        if parse_result.air_by_date or parse_result.sports:
            airdate = parse_result.air_date.toordinal() if parse_result.air_date else parse_result.sports_event_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 != None 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
            if quality is None:
                quality = Quality.sceneQuality(name, parse_result.is_anime)

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

            # 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:dhellwich,项目名称:SickBeard-SickRage,代码行数:54,代码来源:tvcache.py

示例14: getQuality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
    def getQuality(self, item, anime=False):
        """
        Figures out the quality of the given RSS item node

        item: An elementtree.ElementTree element representing the <item> tag of the RSS feed

        Returns a Quality value obtained from the node's data
        """
        (title, url) = self._get_title_and_url(item)
        quality = Quality.sceneQuality(title, anime)
        height=""
        if quality == Quality.FULLHDTV or quality == Quality.FULLHDWEBDL or quality == Quality.FULLHDBLURAY:
            height="1080p"
        elif quality == Quality.HDTV or quality == Quality.HDWEBDL or quality == Quality.HDBLURAY:
            height="720p"
        if height != "":
            rlsSize = self._get_size(item)
            if rlsSize > -1:
                rlsCodec = Quality.sceneQualityFromName(title,quality)
                if rlsCodec == "":
                    rlsCodec = "x264"
                    
                if "265" in rlsCodec or rlsCodec== "hevc":
                    if self.show.runtime > 30:
                        if (height=="1080p" and rlsSize <= 400000000) or (height=="720p" and rlsSize <= 200000000):
                            quality = Quality.UNKNOWN
                    else:
                        if (height=="1080p" and rlsSize <= 200000000) or (height=="720p" and rlsSize <= 100000000):
                            quality = Quality.UNKNOWN
                elif "264" in rlsCodec or rlsCodec== "avc":
                    if self.show.runtime > 30:
                        if (height=="1080p" and rlsSize <= 1000000000) or (height=="720p" and rlsSize <= 800000000):
                            quality = Quality.UNKNOWN
                    else:
                        if (height=="1080p" and rlsSize <= 700000000) or (height=="720p" and rlsSize <= 500000000):
                            quality = Quality.UNKNOWN

                
        return quality
开发者ID:Maximilian-Reuter,项目名称:SickRage,代码行数:41,代码来源:generic.py

示例15: getQuality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import sceneQuality [as 别名]
 def getQuality(self, item, anime=False):
     self.debug()
     title = item.title
     quality = Quality.sceneQuality(title)
     return quality
开发者ID:Wizkidje,项目名称:SickBeard-TVRage,代码行数:7,代码来源:nyaatorrents.py


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