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


Python Quality.nameQuality方法代码示例

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


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

示例1: _parseItem

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [as 别名]
	def _parseItem(self, item):

		if item.findtext('title') != None and item.findtext('title') == "You must be logged in to view this feed":
			raise exceptions.AuthException("TVBinz authentication details are incorrect, check your config")

		if item.findtext('title') == None or item.findtext('link') == None:
			logger.log(u"The XML returned from the TVBinz RSS feed is incomplete, this result is unusable: "+str(item), logger.ERROR)
			return

		title = item.findtext('title')
		url = item.findtext('link').replace('&', '&')

		sInfo = item.find('{http://tvbinz.net/rss/tvb/}seriesInfo')
		if sInfo == None:
			logger.log(u"No series info, this is some kind of non-standard release, ignoring it", logger.DEBUG)
			return

		logger.log(u"Adding item from RSS to cache: "+title, logger.DEBUG)

		quality = Quality.nameQuality(title)

		if sInfo.findtext('{http://tvbinz.net/rss/tvb/}tvrID') == None:
			tvrid = 0
		else:
			tvrid = int(sInfo.findtext('{http://tvbinz.net/rss/tvb/}tvrID'))

		# since TVBinz normalizes the scene names it's more reliable to parse the episodes out myself
		# than to rely on it, because it doesn't support multi-episode numbers in the feed
		self._addCacheEntry(title, url, tvrage_id=tvrid, quality=quality)
开发者ID:kacy,项目名称:Sick-Beard,代码行数:31,代码来源:tvbinz.py

示例2: _doSearch

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [as 别名]
    def _doSearch(self, searchString, show=None, season=None, french=None):
        if not self.login_done:
            self._doLogin(sickbeard.SOTORRENT_USERNAME, sickbeard.SOTORRENT_PASSWORD)

        results = []

        search_url = "{0}/sphinx.php?{1}".format(self.url, searchString.replace('!',''))
        req = self.opener.open(search_url)
        page = BeautifulSoup(req)

        torrent_table = page.find("table", {"id" : "torrent_list"})
        if torrent_table:
            logger.log(u"So-torrent found shows ! " , logger.DEBUG)  
            torrent_rows = torrent_table.findAll("tr", {"id" : "infos_sphinx"})

            for row in torrent_rows:
                release = row.strong.string
                id_search = row.find("img", {"alt" : "+"})
                id_torrent = id_search['id'].replace('expandoGif', '')
                download_url = "https://so-torrent.com/get.php?id={0}".format(id_search['id'].replace('expandoGif', ''))
                id_quality = Quality.nameQuality(release)

                if show and french==None:
                       results.append(SOTORRENTSearchResult(self.opener, release, download_url, id_quality, str(show.audio_lang)))
                elif show and french:
                   results.append(SOTORRENTSearchResult(self.opener, release, download_url, id_quality, 'fr'))
                else:
                    results.append(SOTORRENTSearchResult(self.opener, release, download_url, id_quality))

        else:
            logger.log(u"No table founded.", logger.DEBUG)
            self.login_done = False             
        return results
开发者ID:darkvadehors,项目名称:Sick-Beard,代码行数:35,代码来源:sotorrent.py

示例3: _doSearch

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [as 别名]
    def _doSearch(self, searchString, show=None, season=None, french=None):
        
        if not self.login_done:
            self._doLogin( sickbeard.T411_USERNAME, sickbeard.T411_PASSWORD )

        results = []
        searchUrl = self.url + '/torrents/search/?' + searchString.replace('!','')
        logger.log(u"Search string: " + searchUrl, logger.DEBUG)
        
        r = self.opener.open( searchUrl )
        soup = BeautifulSoup( r, "html.parser" )
        resultsTable = soup.find("table", { "class" : "results" })
        if resultsTable:
            rows = resultsTable.find("tbody").findAll("tr")
    
            for row in rows:
                link = row.find("a", title=True)
                title = link['title']
                id = row.find_all('td')[2].find_all('a')[0]['href'][1:].replace('torrents/nfo/?id=','')
                downloadURL = ('http://www.t411.io/torrents/download/?id=%s' % id)
                
                quality = Quality.nameQuality( title )
                if quality==Quality.UNKNOWN and title:
                    if '720p' not in title.lower() and '1080p' not in title.lower():
                        quality=Quality.SDTV
                if show and french==None:
                    results.append( T411SearchResult( self.opener, link['title'], downloadURL, quality, str(show.audio_lang) ) )
                elif show and french:
                    results.append( T411SearchResult( self.opener, link['title'], downloadURL, quality, 'fr' ) )
                else:
                    results.append( T411SearchResult( self.opener, link['title'], downloadURL, quality ) )
                
        return results
开发者ID:MrRaph,项目名称:docker-sickbeardfr,代码行数:35,代码来源:t411.py

示例4: getQuality

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

        filename = helpers.get_xml_text(
            item.find('{http://xmlns.ezrss.it/0.1/}torrent/{http://xmlns.ezrss.it/0.1/}fileName'))
        quality = Quality.nameQuality(filename)

        return quality
开发者ID:coach0742,项目名称:SickBeard-TVRage,代码行数:9,代码来源:ezrss.py

示例5: query

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [as 别名]
    def query(self, filepath, languages, keywords, series, season, episode):

        logger.debug(u'Getting subtitles for %s season %d episode %d with languages %r' % (series, season, episode, languages))
        self.init_cache()
        try:
            series = series.lower().replace('(','').replace(')','')
            series_id = self.get_series_id(series)
        except KeyError:
            logger.debug(u'Could not find series id for %s' % series)
            return []
        
        episode_id = self.get_episode_id(series, series_id, season, episode, Quality.nameQuality(filepath))
        if not episode_id:
            logger.debug(u'Could not find subtitle for series %s' % series)
            return []

        r = self.session.get(self.server_url + 'index.php?option=com_remository&Itemid=6&func=fileinfo&id=' + episode_id)
        soup = BeautifulSoup(r.content)

        sub_link = soup.find('div', attrs = {'id' : 'remositoryfileinfo'}).find(href=re.compile('func=download'))['href']
        sub_language = self.get_language('it')
        path = get_subtitle_path(filepath, sub_language, self.config.multi)
        subtitle = ResultSubtitle(path, sub_language, self.__class__.__name__.lower(), sub_link)
        
        return [subtitle]
开发者ID:13111,项目名称:SickRage,代码行数:27,代码来源:itasa.py

示例6: _doSearch

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [as 别名]
    def _doSearch(self, searchString, show=None, season=None, french=None):

        
        if not self.login_done:
            self._doLogin( sickbeard.LIBERTALIA_USERNAME, sickbeard.LIBERTALIA_PASSWORD )

        results = []
        
        searchUrl = self.url + '/torrents.php?' + searchString.replace('!','')
 
        logger.log(u"Search string: " + searchUrl, logger.DEBUG)
        
        r = self.opener.open( searchUrl )
        soup = BeautifulSoup( r)

        resultsTable = soup.find("table", { "class" : "torrent_table"  })
        if resultsTable:
            logger.log(u"LIBERTALIA found resulttable ! " , logger.DEBUG)  
            rows = resultsTable.findAll("tr" ,  {"class" : "torrent_row  new  "}  )  # torrent_row new
            
            for row in rows:
                           
                #bypass first row because title only  
                columns = row.find('td', {"class" : "torrent_name"} )                            
                logger.log(u"LIBERTALIA found rows ! " , logger.DEBUG) 
                isvfclass = row.find('td', {"class" : "sprite-vf"} )
                isvostfrclass = row.find('td', {"class" : "sprite-vostfr"} ) 
                link = columns.find("a",  href=re.compile("torrents"))  
                if link: 
                  if isvostfrclass and str(show.audio_lang)=='fr':
                    logger.log(u"LIBERTALIA found VOSTFR et demande *"+str(show.audio_lang)+"* je skip ! " + link.text , logger.DEBUG)
                    link = columns.find("a",  href=re.compile("nepastrouver"))                     
                if link:     
                  if isvfclass  and  str(show.audio_lang)!='fr'  :                     
                    logger.log(u"LIBERTALIA found VF et demande *"+str(show.audio_lang)+"* je skip ! " + link.text , logger.DEBUG)
                    link = columns.find("a",  href=re.compile("nepastrouver"))     
                if link:               
                    title = link.text
                    recherched=searchUrl.split("&[PARAMSTR]=")[1]
                    recherched=recherched.replace(".","(.*)").replace(" ","(.*)").replace("'","(.*)")
                    logger.log(u"LIBERTALIA TITLE : " + title, logger.DEBUG)  
                    logger.log(u"LIBERTALIA CHECK MATCH : " + recherched, logger.DEBUG)                                        
                    #downloadURL =  self.url + "/" + row.find("a",href=re.compile("torrent_pass"))['href']
                    if re.match(recherched,title , re.IGNORECASE):              
                        downloadURL =  row.find("a",href=re.compile("torrent_pass"))['href']                
                        quality = Quality.nameQuality( title )
                        if quality==Quality.UNKNOWN and title:
                            if '720p' not in title.lower() and '1080p' not in title.lower():
                                quality=Quality.SDTV
                        if show and french==None:
                            results.append( LIBERTALIASearchResult( self.opener, title, downloadURL, quality, str(show.audio_lang) ) )
                        elif show and french:
                            results.append( LIBERTALIASearchResult( self.opener, title, downloadURL, quality, 'fr' ) )
                        else:
                            results.append( LIBERTALIASearchResult( self.opener, title, downloadURL, quality ) )
        else:
            logger.log(u"Pas de table trouvée ! je délogue", logger.DEBUG)
            self.login_done = False             
        return results
开发者ID:darkvadehors,项目名称:Sick-Beard,代码行数:61,代码来源:libertalia.py

示例7: getQuality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [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.nameQuality(filename)
        
        return quality
开发者ID:haveaguess,项目名称:Sick-Beard,代码行数:11,代码来源:ezrss.py

示例8: _find_season_quality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [as 别名]
    def _find_season_quality(self, title, torrent_id):
        """ Rewrite the 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"]

        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)

        #        for fileName in filter(lambda x: x.rpartition(".")[2].lower() in mediaExtensions, filesList):
        #            quality = Quality.nameQuality(os.path.basename(fileName))
        #            if quality != Quality.UNKNOWN: break

        for fileName in filesList:
            sepFile = fileName.rpartition(".")
            if fileName.rpartition(".")[2].lower() in mediaExtensions:
                quality = Quality.nameQuality(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"No 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:majello,项目名称:Sick-Beard-Majello,代码行数:58,代码来源:thepiratebay.py

示例9: _doSearch

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [as 别名]
    def _doSearch(self, searchString, show=None, season=None, french=None):
        results = []
        searchUrl = self.url+'rdirect.php?type=search&'+searchString.replace('!','')
        logger.log(u"Search URL: " + searchUrl, logger.DEBUG)
        
        data = self.getURL(searchUrl)
        if "bad key" in str(data).lower() :
            logger.log(u"GKS key invalid, check your config", logger.ERROR)
            return []

        parsedXML = parseString(data)
        channel = parsedXML.getElementsByTagName('channel')[0]
        description = channel.getElementsByTagName('description')[0]
        description_text = helpers.get_xml_text(description).lower()
        
        if "user can't be found" in description_text:
            logger.log(u"GKS invalid digest, check your config", logger.ERROR)
            return []
        elif "invalid hash" in description_text:
            logger.log(u"GKS invalid hash, check your config", logger.ERROR)
            return []
        else :
            items = channel.getElementsByTagName('item')
            for item in items:
                title = helpers.get_xml_text(item.getElementsByTagName('title')[0])
                if "aucun resultat" in title.lower() :
                    logger.log(u"No results found in " + searchUrl, logger.DEBUG)
                    return []
                count=1
                if season:
                    count=0
                    if show:
                        if show.audio_lang=='fr' or french:
                            for frword in['french', 'truefrench', 'multi']:
                                if frword in title.lower():
                                    count+=1
                        else:
                            count +=1
                    else:
                        count +=1
                if count==0:
                    continue                                
                else :
                    downloadURL = helpers.get_xml_text(item.getElementsByTagName('link')[0])
                    quality = Quality.nameQuality(title)
                    if quality==Quality.UNKNOWN and title:
                        if '720p' not in title.lower() and '1080p' not in title.lower():
                            quality=Quality.SDTV
                    if show and french==None:
                        results.append( GksSearchResult( self.opener, title, downloadURL, quality, str(show.audio_lang) ) )
                    elif show and french:
                        results.append( GksSearchResult( self.opener, title, downloadURL, quality, 'fr' ) )
                    else:
                        results.append( GksSearchResult( self.opener, title, downloadURL, quality ) )
        return results
开发者ID:Arakmar,项目名称:Sick-Beard,代码行数:57,代码来源:gks.py

示例10: getQuality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [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.nameQuality(title)
     return quality
开发者ID:gboudreau,项目名称:Sick-Beard,代码行数:13,代码来源:generic.py

示例11: getQuality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [as 别名]
 def getQuality(self, item, anime=False):
     """
     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
     logger.log(u"geting quality for:" + title+ " anime: "+str(anime),logger.DEBUG)
     quality = Quality.nameQuality(title, anime)
     return quality
开发者ID:Pakoach,项目名称:Sick-Beard-Animes,代码行数:14,代码来源:generic.py

示例12: _doSearch

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [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(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,代码行数:54,代码来源:thepiratebay.py

示例13: getQuality

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [as 别名]
    def getQuality(self, item):
        
        #torrent_node = item.getElementsByTagName('torrent')[0]
        #filename_node = torrent_node.getElementsByTagName('title')[0]
        #filename = get_xml_text(filename_node)
        
        # I think the only place we can get anything resembing the filename is in 
        # the title
        filename = helpers.get_xml_text(item.getElementsByTagName('title')[0])

        quality = Quality.nameQuality(filename)
        
        return quality
开发者ID:Guilde,项目名称:Sick-Beard,代码行数:15,代码来源:kat.py

示例14: _doSearch

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [as 别名]
	def _doSearch(self, searchString, show=None, season=None, french=None):

		
		if not self.login_done:
			self._doLogin( sickbeard.XTHOR_USERNAME, sickbeard.XTHOR_PASSWORD )

		results = []
	   
		searchUrl = self.url + '/browse.php?' + searchString.replace('!','')

		logger.log(u"Search string: " + searchUrl, logger.DEBUG)
		
		r = self.opener.open( searchUrl )

		soup = BeautifulSoup( r)

		resultsTable = soup.find("table", { "class" : "table2"  })
		if resultsTable:

			rows = resultsTable.findAll("tr")
		   
			for row in rows:
			
				link = row.find("a",href=re.compile("details.php"))                                                           
								  
				if link:               
					title = link.text
					recherched=searchUrl.split("&search=")[1]
					recherched=recherched.replace(" ","(.*)")
					recherched= recherched + "(.*)"
					logger.log(u"XTHOR TITLE : " + title, logger.DEBUG)
					logger.log(u"XTHOR CHECK MATCH : " + recherched, logger.DEBUG)                                        
					if re.match(recherched,title , re.IGNORECASE):                                        
						downloadURL =  row.find("a",href=re.compile("download.php"))['href']
						downloadURL = self.url + '/'+ downloadURL
						logger.log(u"XTHOR DOWNLOAD URL : " + downloadURL, logger.DEBUG) 
					else:
						continue
					quality = Quality.nameQuality( title )
					if quality==Quality.UNKNOWN and title:
						if '720p' not in title.lower() and '1080p' not in title.lower():
							quality=Quality.SDTV
					if show and french==None:
						results.append( XTHORSearchResult( self.opener, title, downloadURL, quality, str(show.audio_lang) ) )
					elif show and french:
						results.append( XTHORSearchResult( self.opener, title, downloadURL, quality, 'fr' ) )
					else:
						results.append( XTHORSearchResult( self.opener, title, downloadURL, quality ) )
		
		return results
开发者ID:darkvadehors,项目名称:Sick-Beard,代码行数:52,代码来源:xthor.py

示例15: _doSearch

# 需要导入模块: from sickbeard.common import Quality [as 别名]
# 或者: from sickbeard.common.Quality import nameQuality [as 别名]
    def _doSearch(self, searchString, show=None, season=None, french=None):

        
        if not self.login_done:
            self._doLogin( sickbeard.ADDICT_USERNAME, sickbeard.ADDICT_PASSWORD )

        results = []
        
        searchUrl = self.url + '/index.php?page=torrents&active=1&options=0&' + searchString.replace('!','')
 
        logger.log(u"Search string: " + searchUrl, logger.DEBUG)
        
        r = self.opener.open( searchUrl )

        soupfull = BeautifulSoup( r)
        delbegin=str(soupfull.prettify).split('<table width="100%">')[1]
        restable=delbegin[delbegin.find('<table'):delbegin.find('table>')+6]
        soup=BeautifulSoup(restable)
        resultsTable = soup.find("table")

        if resultsTable:

            rows = resultsTable.findAll("tr")
            x=0
            for row in rows:
                x=x+1
                if (x > 1): 
                #bypass first row because title only
                    if 'Liste des torrents' in str(row) :
                        continue                           
                 
                    link = row.findAll('td')[1].find("a",  href=re.compile("torrent-details")) 
                    if link:               
                        title = link.text
                        logger.log(u"ADDICT TITLE TEMP: " + title, logger.DEBUG)                   
                        downloadURL =  self.url + "/" + row.find("a",href=re.compile("\.torrent"))['href']              
                
                        quality = Quality.nameQuality( title )
                        if quality==Quality.UNKNOWN and title:
                            if '720p' not in title.lower() and '1080p' not in title.lower():
                                quality=Quality.SDTV
                        if show and french==None:
                            results.append( ADDICTSearchResult( self.opener, title, downloadURL, quality, str(show.audio_lang) ) )
                        elif show and french:
                            results.append( ADDICTSearchResult( self.opener, title, downloadURL, quality, 'fr' ) )
                        else:
                            results.append( ADDICTSearchResult( self.opener, title, downloadURL, quality ) )
        
        return results
开发者ID:ClubSoundZ,项目名称:Sick-Beard,代码行数:51,代码来源:addict.py


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