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


Python SearchModule.performSearch方法代码示例

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


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

示例1: generate_tvserie_nabresponse

# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import performSearch [as 别名]
	def generate_tvserie_nabresponse(self,tvrage_show ):
		#~ compile string
		season_num = self.args.get('season',-1, type=int)
		relaxed_seasonmatch = 0
		serie_search_str = SearchModule.sanitize_strings(tvrage_show['showtitle'])
		if(self.args.has_key('ep')):
			ep_num = self.args.get('ep',-1, type=int)
			serie_search_str = serie_search_str + '.s%02d' % season_num + 'e%02d' % ep_num
		else:
			serie_search_str = serie_search_str + '.s%02d' % season_num
			relaxed_seasonmatch = 1

		self.typesearch = 1
		self.searchstring = serie_search_str
		#~ compile results
		results = SearchModule.performSearch(serie_search_str, self.cfg , self.cfg_ds )

		cleaned_results = []
		if(relaxed_seasonmatch):
			#~ no cleaning just flatten in one array
			for provid in xrange(len(results)):
				if(results[provid] is not None):
					for z in xrange(len(results[provid])):
						cleaned_results.append(results[provid][z])
		else:
			#~ flatten and summarize them
			cleaned_results = megasearch.summary_results(results,serie_search_str)

		#~ render XML
		return self.cleanUpResultsXML(cleaned_results)
开发者ID:cytec,项目名称:usntssearch,代码行数:32,代码来源:ApiModule.py

示例2: dosearch

# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import performSearch [as 别名]
	def dosearch(self, args):
		#~ restore originals
		self.cfg = copy.deepcopy(self.cfg_cpy)
		
		if('q' not in args):
			self.results = []
			return self.results
		nuqry = args['q'] + ' ' + self.cgen['searchaddontxt']
		self.logic_items = self.logic_expr.findall(nuqry)
		self.qry_nologic = self.logic_expr.sub(" ",nuqry)
		if('selcat' in args):
			if(args['selcat'] != ""):
				self.qry_nologic += " " + args['selcat']

		#~ speed class
		speed_class_sel = 1	
		if('tm' in args):
			speed_class_sel = int(args['tm'])
		
		#~ speed class deepsearch
		self.ds.set_timeout_speedclass(speed_class_sel)
		#~ speed class Nabbased	
		for conf in self.cfg :
			if ( (conf['speed_class'] <=  speed_class_sel) and (conf['valid'])):
				conf['timeout']  = self.cgen['timeout_class'][ speed_class_sel ]
				#~ print conf['type'] + " " + str(conf['timeout'] ) + ' ' + str(speed_class_sel )
			else:
				conf['valid']  = 0
		 
					
		if( len(args['q']) == 0 ):
			if('selcat' in args):
				if(len(args['selcat'])==0):
					self.results = []
					return self.results
			else:
				self.results = []
				return self.results
		if(self.qry_nologic.replace(" ", "") == ""):
			self.results = []
			return self.results
						
		self.cleancache()
		#~ cache hit, no server report
		self.returncode_fine['code'] = 2
		self.resultsraw = self.chkforcache(self.wrp.chash64_encode(SearchModule.sanitize_strings(self.qry_nologic)), speed_class_sel)
		if( self.resultsraw is None):
			self.resultsraw = SearchModule.performSearch(self.qry_nologic, self.cfg, self.ds )
			self.prepareretcode();
			
		if( self.cgen['smartsearch'] == 1):
			#~ smartsearch
			self.results = summary_results(self.resultsraw, self.qry_nologic, self.logic_items)
		else:
			#~ no cleaning just flatten in one array
			self.results = []
			for provid in xrange(len(self.resultsraw)):
				for z in xrange(len(self.resultsraw[provid])):
					if (self.resultsraw[provid][z]['title'] != None):
						self.results.append(self.resultsraw[provid][z])
开发者ID:PeterBeard,项目名称:usntssearch,代码行数:62,代码来源:megasearch.py

示例3: generate_tsearch_nabresponse

# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import performSearch [as 别名]
	def generate_tsearch_nabresponse(self):

		if(self.args.has_key('q')):
			freesearch_str = SearchModule.sanitize_strings(self.args['q'])
			self.searchstring = freesearch_str
			self.typesearch = 2
			#~ compile results
			results = SearchModule.performSearch(freesearch_str, self.cfg, self.cfg_ds )
			#~ flatten and summarize them
			cleaned_results = megasearch.summary_results(results, freesearch_str)
			#~ render XML
			return self.cleanUpResultsXML(cleaned_results)
开发者ID:cytec,项目名称:usntssearch,代码行数:14,代码来源:ApiModule.py

示例4: generate_movie_nabresponse

# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import performSearch [as 别名]
	def generate_movie_nabresponse(self,imdb_show ):

		movie_search_str = imdb_show['movietitle'].lower().replace("'", "").replace("-", " ").replace(":", " ")
		movie_search_str = " ".join(movie_search_str.split()).replace(" ", ".") + '.' +imdb_show['year']

		#~ print movie_search_str
		self.searchstring = movie_search_str
		self.typesearch = 0
		#~ compile results
		results = SearchModule.performSearch(movie_search_str, self.cfg , self.cfg_ds )
		#~ flatten and summarize them
		cleaned_results = megasearch.summary_results(results,movie_search_str)
		#~ render XML
		return self.cleanUpResultsXML(cleaned_results)
开发者ID:cytec,项目名称:usntssearch,代码行数:16,代码来源:ApiModule.py

示例5: generate_tvserie_nabresponse_broadcast

# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import performSearch [as 别名]
    def generate_tvserie_nabresponse_broadcast(self):

        addparams = dict(age="1500", t="tvsearch", cat="5040,5030")

        rawResults = SearchModule.performSearch("", self.cfg, self.cfg_ds, addparams)
        # ~ rawResults = SearchModule.performSearch('', self.cfg, None, addparams)
        results = []
        # ~ no cleaning just flatten in one array
        for provid in xrange(len(rawResults)):
            for z in xrange(len(rawResults[provid])):
                results.append(rawResults[provid][z])

        self.searchstring = ""
        self.typesearch = 1
        return self.cleanUpResultsXML(results)
开发者ID:cauchy49,项目名称:usntssearch,代码行数:17,代码来源:ApiModule.py

示例6: generate_tvserie_nabresponse_broadcast

# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import performSearch [as 别名]
	def generate_tvserie_nabresponse_broadcast(self):
		
		addparams = dict(
						age= '1500',
						t='tvsearch',
						cat='5040,5030')
		
		rawResults = SearchModule.performSearch('', self.cfg, None, addparams)
		results = []
		#~ no cleaning just flatten in one array
		for provid in xrange(len(rawResults)):
			for z in xrange(len(rawResults[provid])):
 				results.append(rawResults[provid][z])

		self.searchstring = ''
		return self.cleanUpResultsXML(results)
开发者ID:dissan,项目名称:usntssearch,代码行数:18,代码来源:ApiModule.py

示例7: generate_tvserie_nabresponse

# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import performSearch [as 别名]
	def generate_tvserie_nabresponse(self,tvrage_show ):
		#~ compile string
		season_num = self.args.get('season',-1, type=int)
		serie_search_str = SearchModule.sanitize_strings(tvrage_show['showtitle'])
		if(self.args.has_key('ep')):
			ep_num = self.args.get('ep',-1, type=int)			
			serie_search_str = serie_search_str + '.s%02d' % season_num + 'e%02d' % ep_num
		else:	
			serie_search_str = serie_search_str + '.s%02d' % season_num 
		self.typesearch = 1
		self.searchstring = serie_search_str
		#~ compile results				
		results = SearchModule.performSearch(serie_search_str, self.cfg )		
		#~ flatten and summarize them
		cleaned_results = megasearch.summary_results(results,serie_search_str)
		#~ render XML
		return self.cleanUpResultsXML(cleaned_results)
开发者ID:carterjl2,项目名称:usntssearch,代码行数:19,代码来源:ApiModule.py

示例8: dosearch

# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import performSearch [as 别名]
    def dosearch(self, args):
        # ~ restore originals
        self.cfg = copy.deepcopy(self.cfg_cpy)

        if "q" not in args:
            self.results = []
            return self.results

        self.logic_items = self.logic_expr.findall(args["q"])
        self.qry_nologic = self.logic_expr.sub(" ", args["q"])
        if "selcat" in args:
            self.qry_nologic += " " + args["selcat"]

            # ~ speed class
        speed_class_sel = 1
        if "tm" in args:
            speed_class_sel = int(args["tm"])

            # ~ speed class deepsearch
        self.ds.set_timeout_speedclass(speed_class_sel)
        # ~ speed class Nabbased
        for conf in self.cfg:
            if (conf["speed_class"] <= speed_class_sel) and (conf["valid"]):
                conf["timeout"] = self.cgen["timeout_class"][speed_class_sel]
                # ~ print conf['type'] + " " + str(conf['timeout'] ) + ' ' + str(speed_class_sel )
            else:
                conf["valid"] = 0

        if len(args["q"]) == 0:
            if "selcat" in args:
                if len(args["selcat"]) == 0:
                    self.results = []
                    return self.results
            else:
                self.results = []
                return self.results
        if self.qry_nologic.replace(" ", "") == "":
            self.results = []
            return self.results

        self.logic_items = self.logic_expr.findall(args["q"])
        results = SearchModule.performSearch(self.qry_nologic, self.cfg, self.ds)
        self.results = summary_results(results, self.qry_nologic, self.logic_items)
开发者ID:rocksie67,项目名称:usntssearch,代码行数:45,代码来源:megasearch.py

示例9: dosearch_rss

# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import performSearch [as 别名]
    def dosearch_rss(self, arguments, hname):
        self.args = arguments
        self.rqurl = hname.scheme + "://" + hname.netloc
        addparams = dict(age="1500", limit="20000", t="search", cat="1000,2000,3000,4000,5000,6000,7000")

        if "cat" in self.args:
            addparams["cat"] = self.args["cat"]

        rawResults = SearchModule.performSearch("", self.cfg, self.cfg_ds, addparams)
        results = []
        # ~ no cleaning just flatten in one array
        for provid in xrange(len(rawResults)):
            if rawResults[provid] is not None:
                for z in xrange(len(rawResults[provid])):
                    results.append(rawResults[provid][z])

        self.searchstring = ""
        self.typesearch = 3

        return self.cleanUpResultsXML(results)
开发者ID:cauchy49,项目名称:usntssearch,代码行数:22,代码来源:ApiModule.py

示例10: dosearch_rss

# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import performSearch [as 别名]
	def dosearch_rss(self, arguments, hname):
		self.args = arguments
		self.rqurl = hname.scheme+'://'+hname.netloc
		addparams = dict(
						age= '1500',
						limit='20000',
						t='search',
						cat='1000,2000,3000,4000,5000,6000,7000')

		if('cat' in self.args):
			addparams['cat'] = self.args['cat']

		rawResults = SearchModule.performSearch('', self.cfg, self.cfg_ds, addparams)
		results = []
		#~ no cleaning just flatten in one array
		for provid in xrange(len(rawResults)):
			if(rawResults[provid] is not None):
				for z in xrange(len(rawResults[provid])):
					results.append(rawResults[provid][z])

		self.searchstring = ''
		self.typesearch = 3

		return self.cleanUpResultsXML(results)
开发者ID:cytec,项目名称:usntssearch,代码行数:26,代码来源:ApiModule.py

示例11: dosearch

# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import performSearch [as 别名]
    def dosearch(self, args):
        # ~ restore originals
        self.cfg = copy.deepcopy(self.cfg_cpy)

        if ('q' not in args):
            self.results = []
            return self.results
        nuqry = args['q'] + ' ' + self.cgen['searchaddontxt']
        self.logic_items = self.logic_expr.findall(nuqry)
        self.qry_nologic = self.logic_expr.sub(" ", nuqry)
        if ('selcat' in args):
            if (args['selcat'] != ""):
                self.qry_nologic += " " + args['selcat']

        # ~ speed class
        speed_class_sel = 1
        if ('tm' in args):
            speed_class_sel = int(args['tm'])

        # ~ speed class deepsearch
        self.ds.set_extraopt(speed_class_sel, 'manual')
        # ~ speed class Nabbased
        self.set_timeout_speedclass(speed_class_sel)
        # ~ manual search Nabbased
        self.set_extraopt()

        if (len(args['q']) == 0):
            if ('selcat' in args):
                if (len(args['selcat']) == 0):
                    self.results = []
                    return self.results
            else:
                self.results = []
                return self.results
        if (self.qry_nologic.replace(" ", "") == ""):
            self.results = []
            return self.results

        log.info('TYPE OF SEARCH: ' + str(speed_class_sel))

        self.cleancache()
        # ~ cache hit, no server report
        cachehit = True
        self.returncode_fine['code'] = 2
        self.resultsraw = self.chkforcache(self.wrp.chash64_encode(SearchModule.sanitize_strings(self.qry_nologic)),
                                           speed_class_sel)
        if (self.resultsraw is None):
            self.resultsraw = SearchModule.performSearch(self.qry_nologic, self.cfg, self.ds)
            cachehit = False

        if (self.cgen['smartsearch'] == 1):
            # ~ smartsearch
            self.res_results = {}
            self.results = summary_results(self.resultsraw, self.qry_nologic, self.logic_items, self.res_results)
        else:
            # ~ no cleaning just flatten in one array
            self.results = []
            self.res_results = {}
            for provid in xrange(len(self.resultsraw)):
                if (len(self.resultsraw[provid])):
                    self.res_results[str(self.resultsraw[provid][0]['providertitle'])] = [len(self.resultsraw[provid]),
                                                                                          0]
            for provid in xrange(len(self.resultsraw)):
                for z in xrange(len(self.resultsraw[provid])):
                    if (self.resultsraw[provid][z]['title'] != None):
                        self.results.append(self.resultsraw[provid][z])

        # ~ server status output
        if (cachehit == False):
            self.prepareretcode();
开发者ID:etomm,项目名称:usntssearch,代码行数:72,代码来源:megasearch.py


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