コード例 #1
0
ファイル: ApiModule.py プロジェクト: myobboym/usntssearch
	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)
コード例 #2
0
ファイル: ApiModule.py プロジェクト: cytec/usntssearch
	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)
コード例 #3
0
ファイル: megasearch.py プロジェクト: PeterBeard/usntssearch
	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])
コード例 #4
0
    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()
        self.resultsraw = self.chkforcache(
            self.wrp.chash64_encode(self.qry_nologic), speed_class_sel)
        if (self.resultsraw is None):
            self.resultsraw = SearchModule.performSearch(
                self.qry_nologic, self.cfg, self.ds)

        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])
コード例 #5
0
ファイル: ApiModule.py プロジェクト: myobboym/usntssearch
	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)
コード例 #6
0
ファイル: ApiModule.py プロジェクト: cytec/usntssearch
	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)
コード例 #7
0
ファイル: ApiModule.py プロジェクト: cytec/usntssearch
	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)
コード例 #8
0
ファイル: ApiModule.py プロジェクト: myobboym/usntssearch
	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)
コード例 #9
0
ファイル: ApiModule.py プロジェクト: cauchy49/usntssearch
    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)
コード例 #10
0
    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)
コード例 #11
0
ファイル: ApiModule.py プロジェクト: dissan/usntssearch
	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)
コード例 #12
0
ファイル: ApiModule.py プロジェクト: carterjl2/usntssearch
	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)
コード例 #13
0
	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)
コード例 #14
0
ファイル: megasearch.py プロジェクト: mwilborne/usntssearch
    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)
コード例 #15
0
ファイル: megasearch.py プロジェクト: rocksie67/usntssearch
    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)
コード例 #16
0
ファイル: ApiModule.py プロジェクト: cauchy49/usntssearch
    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)
コード例 #17
0
ファイル: ApiModule.py プロジェクト: cytec/usntssearch
	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)
コード例 #18
0
ファイル: ApiModule.py プロジェクト: myobboym/usntssearch
	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)
コード例 #19
0
ファイル: megasearch.py プロジェクト: etomm/usntssearch
    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();
コード例 #20
0
ファイル: megasearch.py プロジェクト: JnrnZEDb/NZBMegaSearch
    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()