Example #1
0
def test_main(entries, inp, capfd):
    main()
    out, _ = capfd.readouterr()

    output = [line for line in out.split("\n") if line.strip()]
    expected = [
        "0 entries matched",
        "Twitter Digest 2018 Week 08",
        "1 entry matched",
        "Copy and Paste with Pyperclip",
        "Twitter Digest 2018 Week 08",
        "2 entries matched",
        "0 entries matched",
        "Copy and Paste with Pyperclip",
        "Twitter Digest 2018 Week 08",
        "2 entries matched",
        "Twitter Digest 2018 Week 08",
        "1 entry matched",
        "Twitter Digest 2018 Week 08",
        "1 entry matched",
        "Please provide a search term",
        "Bye",
    ]
    for line, exp in zip(output, expected):
        assert exp in line
Example #2
0
def go():
    while True:
        opt.flag.wait()
        goParams.reset()
        parseParams(goParams, task.get())
        search.main(goParams, opt)
        opt.flag.clear()
Example #3
0
def do(speech):

     factory = ChatterBotFactory()

     bot1 = factory.create(ChatterBotType.CLEVERBOT)
     bot1session = bot1.create_session()

     bot2 = factory.create(ChatterBotType.PANDORABOTS, 'b0dafd24ee35a477')
     bot2session = bot2.create_session()

     while(speech!="bye bye"):

        if speech.find("search twitter for")!=-1:
             speech=speech.replace("search twitter for",'')
             search.main(speech)
        elif speech.find("show twitter trend")!=-1:
             trending.main()
        elif speech.find("tell the weather")!=-1:
             weather.main()
        elif speech.find('show my e-mail')!=-1:
             mailtest.main()
        elif speech.find('send email')!=-1:
             mailtest2.main()
        elif speech.find('search bing for')!=-1:
             speech=speech.replace('search bing for','')
             bingsearch.main(speech)
        else:
             s = bot2session.think(speech);
             print 'yam> ' + s
             talks.main(s) 
            

        speech=listen()
        speech=speech.lower()     
Example #4
0
def main(p):
    # actions called using context menu must return, otherwise 'last-url' would get updated
    if p == {}:
        xbmc.executebuiltin("RunPlugin(plugin://script.usage.tracker/?do=reg&cond=31000&id=%s)" % __scriptid__)
        root()
    if "kino" in p.keys():
        kino(p)
    if "show-cinema" in p.keys():
        return show_cinema(p)
    if "top" in p.keys():
        top(p)
    if "dvd" in p.keys():
        dvd(p)
    if "fav" in p.keys():
        favourites(p)
    if "filmoteka" in p.keys():
        filmoteka(p)
    if "artists" in p.keys():
        artists(p)
    if "search-plugin" in p.keys():
        search_plugin(p["search-plugin"], p["url"], p["action"])
    if "item" in p.keys():
        item(p)
    if "person" in p.keys():
        person(p)
    if "preload-refresh" in p.keys():
        return preload_refresh()
    if "play" in p.keys():
        play(p["play"])
    search.main(__addon__, "search_history_movies", p, _search_movie_cb, "s", "movie")
    search.main(__addon__, "search_history_persons", p, _search_person_cb, "s", "person")
    __addon__.setSetting("last-url", sys.argv[2])
def test_script_search():
    idx_dir = os.path.join(TMP_DIR, TEST_INDEX_SUBDIR)
    search.main(idx_dir, ['GOOD', '&', 'MORNING'], False, 3)
    search.main(idx_dir, ['GOOD', '|', 'MORNING'], False, 3)
    search.main(idx_dir, ['UNITED STATES', '\\', 'DONALD TRUMP'], False, 3)
    search.main(idx_dir, ['[STATES]'], False, 3)
    search.main(idx_dir, ['[FIGHT]', '&', '[STATES]'], False, 3)
Example #6
0
def main():
    parse.main()
    wait_enter()

    search.main()
    wait_enter()

    test.main()
    wait_enter()

    summary.main()
Example #7
0
def pickMode(mode):  #mode is user input string selecting create or search
    call = False
    while call == False:  #keep asking for input until correct input is found
        if (mode[0] == "c"):
            create.main()
            call = True  #stop looping
        elif (mode[0] == "s"):
            search.main()
            call = True  #stop looping
        else:
            #incorrect input, ask for new input
            mode = input(
                'Unknown Input\nType "c" for create or "s" for search: ')
Example #8
0
def main(path):

    # 模拟登陆
    browser = login.main()

    # 读取excel文件想要搜索的关键词
    seachKeys = fetchKeywords.main()

    # 循环返回主页
    # 查找搜索按钮
    # 传入词组批量爬取
    search.main(browser, seachKeys, path)

    return
Example #9
0
def run():

    try:
        keyword = input("Insert the keyword (e.g. eclipse; main): ")
        extension = input("Insert the extension (e.g. mtl; ecore; java): ")
        search.main(keyword, extension)
        search.update()
        dictionaryManager.main()
        modelCreator.main_model_creator()
    except:
        search.update()
        search.update()
        dictionaryManager.main()
        modelCreator.main_model_creator()
        return 0
Example #10
0
	def processMenuSelection(self, menuItem, splashScreen):
		if(menuItem ==1):
			flightsList = search.main(self.connectionString)
			if len(flightsList) > 0:
				book = booking.Booking(self.connectionString)
				book.bookFromSearchResults(self.email,flightsList)
			return True
		elif(menuItem ==2):
			book = booking.Booking(self.connectionString)
			book.makeBooking(self.email)
			return True
		elif(menuItem ==3):
			book = booking.Booking(self.connectionString)
			book.listExistingBookings(self.email)
			return True
		elif(menuItem ==4):
			book = booking.Booking(self.connectionString)
			book.cancelBooking(self.email)
			return True
		elif(menuItem ==5):
			updateTime.updateTime(self.connectionString, "Departure")
			return True
		elif(menuItem ==6):
			updateTime.updateTime(self.connectionString, "Arrival")
			return True
		#LOUTOUT
		elif(menuItem ==9):
			print("\nThank you for using our airline ticket program "+self.email+".")
			self.logout(splashScreen)
			return False
Example #11
0
def test_main(entries, inp, capfd):
    main()
    out, _ = capfd.readouterr()

    output = [line for line in out.split('\n') if line.strip()]
    expected = [
        '0 entries matched', 'Twitter Digest 2018 Week 08', '1 entry matched',
        'Copy and Paste with Pyperclip', 'Twitter Digest 2018 Week 08',
        '2 entries matched', '0 entries matched',
        'Copy and Paste with Pyperclip', 'Twitter Digest 2018 Week 08',
        '2 entries matched', 'Twitter Digest 2018 Week 08', '1 entry matched',
        'Twitter Digest 2018 Week 08', '1 entry matched',
        'Please provide a search term', 'Bye'
    ]
    for line, exp in zip(output, expected):
        assert exp in line
Example #12
0
def test():
    urll = []
    if request.method == 'POST':
        question = request.get_json()
        # print(question["Site"])
        site = question["Site"]
        # habitat = question["Habitat"]
        year = question["Year"]
        data_type = question["DataType"]
        # folder = "Arable_Data"
        service = main()
        folder_id = find_top_folder(service, "Arable_Data")
        # print(folder_id)
        fn = find_file(service, site, year, data_type)
        # print(fn)
        for match in fn.keys():
            url = fn[match]["Link"]
            # print(url)
            url_avoid_cors = {
                "URL": str(url)
            }  # f"https://cors-anywhere.herokuapp.com/{url}"}
            urll.append(url_avoid_cors)
            return url_avoid_cors
        # return redirect(f"https://cors-anywhere.herokuapp.com/{url}", code = 302)
        return ""

    elif request.method == 'GET':
        url_avoid_cors = urll[0]
        return url_avoid_cors
Example #13
0
def AbstractPool(request, review_name_slug):
    review = Review.objects.get(user=request.user, slug=review_name_slug)
    if request.method == "POST":
        if request.POST.get('results') == None:
            q = request.POST.get('queryField')
            s = request.POST.get('sortType')
            n = request.POST.get('noResults')
            abstractList = search.main(q, s, n)
            for document in abstractList:
                documentURL = document.get("url")
                if Paper.objects.filter(paper_url=documentURL,
                                        review=review).exists():
                    abstractList.remove(document)
        else:
            abstractList = eval(request.POST.get('results'))
            q = request.POST.get('queryField')
        relevant = "Unchecked"
        if request.POST.get("relevanceField") == "relevant":
            relevant = "Relevant"
        else:
            if request.POST.get("relevanceField") == "irrelevant":
                relevant = "Not Relevant"
        if relevant != "Unchecked":
            print "traceA"
            compareCount_value = int(request.POST.get("hiddenCompareCount"))
            for s in abstractList:
                if s.get('compareCount') == compareCount_value:
                    currentDoc = s
                    paper = Paper(review=review,
                                  title=currentDoc["title"],
                                  paper_url=currentDoc["url"],
                                  full_text=currentDoc['fullText'],
                                  abstract=currentDoc["abstract"],
                                  authors=currentDoc["author"],
                                  abstract_relevance=relevant)
                    paper.save()
            if len(abstractList) > 1:
                for abstract in abstractList:
                    if int(abstract.get(
                            'compareCount')) > compareCount_value - 1:
                        abstract['compareCount'] -= 1
                del abstractList[compareCount_value - 1]
            else:
                abstractList = []
                #for abstract in abstractList:
                #if int(abstract.get('compareCount')) > compareCount_value:
                #abstract['compareCount'] -= 1
                #del abstractList[compareCount_value]
        return render(
            request, 'ultimatereview/AbstractPool.html', {
                "Abstracts": abstractList,
                'query': q,
                'review': review.title,
                'slug': review_name_slug
            })
Example #14
0
def index():
    global inverted_index
    if request.method == "GET":
        return render_template("index.html")
    if request.method == "POST":
        recipe_name, processed_dislike_list, dislike_list, processed_list = handle(
            request)
        context = search.main(inverted_index, recipe_name,
                              processed_dislike_list, dislike_list,
                              processed_list)
        return render_template("results.html", context=context)
Example #15
0
def create_card_response(verb_noun_string, verb_list, noun_list, event_message, user_name):
    """Creates a card response based on the message sent in Hangouts Chat.
    """
    question_from_user = event_message.encode('utf-8')

    parsed_key_words = verb_noun_string.encode('utf-8')

    pre_defined_question = check_pre_defined_questions(question_from_user, user_name, parsed_key_words)

    if pre_defined_question is not None:
        return pre_defined_question

    else:
        related_questions_list=[]
        related_questions_list, search_used, group = search.main(parsed_key_words, question_from_user)

        if (len(related_questions_list)==0):
            database_logger.logging_to_database(user_name, question_from_user,"NOT FOUND",parsed_key_words, "Null", "Null")
            return search.google_search(question_from_user)

        elif (len(related_questions_list)==1): 
            for each_list in related_questions_list:
                question = each_list[0]
                index = each_list[1]
            theAnswer = search.getTheAns(index, None)
            database_logger.logging_to_database(user_name, question_from_user,related_questions_list,parsed_key_words, search_used, group)
            return theAnswer

        else:
            response = dict()
            cards = list()
            widgets = list()
            header = {
                'header': {
                'title': 'Answers for '+ question_from_user,
                'subtitle': 'City of Edmonton chatbot',
                'imageUrl': 'http://www.gwcl.ca/wp-content/uploads/2014/01/IMG_4371.png',
                'imageStyle': 'IMAGE'
                }
            }
            cards.append(header)
            
            for each_list in related_questions_list:
                question = each_list[0]
                index = each_list[1]
                widgets.append(
                {'buttons': [{'textButton': {'text': question,'onClick': {'action': {'actionMethodName': INTERACTIVE_TEXT_BUTTON_ACTION,'parameters': [{'key': INTERACTIVE_BUTTON_PARAMETER_KEY,'value': index}]}}}}]
                })
            cards.append({ 'sections': [{ 'widgets': widgets }]})
            response['cards'] = cards
            database_logger.logging_to_database(user_name, question_from_user,related_questions_list,parsed_key_words, search_used, group)
            return response
Example #16
0
def main():
    client_credentials_manager = SpotifyClientCredentials(
        client_id="318bd146dc0b46bd9e41e990bbe4ce2a",
        client_secret="c56fe1ad00454247b966648148405c19",
        proxies=None,
        requests_timeout=None)
    sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)

    # Turn this to TRUE to see all the HTTP exchanges between us and the API
    # Turn this to False for pretty output
    sp.trace = False
    search_string = str(input("What would you like to search for?"))
    search_type = str(input("Is this an artist, song, album, playlist?"))

    # For seeing how long each call takes
    start = time.time()

    search.main(sp, search_string, search_type)
    # audio_features.print_json(search_string)

    delta = time.time() - start
    print("Data retrieved in %.2f seconds" % (delta, ))
Example #17
0
def home(request):
    c = {}
    coord = []
    num = 5
    query = None # our query function (from a python file)
    if request.method == 'GET':
        form = SearchForm(request.GET)
        # Check if it's valid
        if form.is_valid():
            # convert form data to an args dictiionary
            args = {}
            if form.cleaned_data['search']:
                args['terms'] = form.cleaned_data['search']
            if form.cleaned_data['num_bars']:
                args['num_bars'] = form.cleaned_data['num_bars']
                num = args['num_bars']
            if form.cleaned_data['prices']:
                args['price'] = form.cleaned_data['prices']
                args['price'] = int(args['price'][0])
            neighbor = form.cleaned_data['neighborhood']
            if neighbor:
                args['distance'] = neighbor[0]
                args['neighbor'] = neighbor[1]
                coord = get_origin_coord(NEIGHBOR_COOR, args['neighbor'])
           
            if len(coord) == 0:
                query = None 
            else:
                query = main(args, coord[0], coord[1])
    else:
        form = SearchForm()
    if query is None:
        c['result'] = None
    else:
        # list of tuples [(name, lon, lat, weight, distance),..]
        if len(query) < num:
            num = len(query)
        result = query[:num]
        c['result'] = result
        # parameters for starting location/js
        c['origin_lat'] = coord[0]
        c['origin_lon'] = coord[1]
        # parameters for directions
        c['lat_list'] = get_lat(result, num)
        c['lon_list'] = get_lon(result, num) 
        c['name_list'] = mark_safe(get_names(result, num))
    
    c['form'] = form

    return render(request, 'index.html', c)
Example #18
0
def main(state, playerIL):
    result = search.main(state, 1, playerIL)
    move = result[0][-1]
    if move == 1:
        print("Player : Up is played")
    elif move == 2:
        print("Player : Down is played")
    elif move == 3:
        print("Player : Left is played")
    elif move == 4:
        print("Player : Right is played")
    else:
        print(move)
    return result[0]
Example #19
0
 def test_type_of_terms(self):
     '''Assert that the main method in search module
     get the correct input type of data'''
     with self.assertRaises(TypeError):
         search.main([])
     with self.assertRaises(TypeError):
         search.main(1)
     with self.assertRaises(TypeError):
         search.main(dict())
Example #20
0
def AbstractPool(request, review_name_slug):
    review = Review.objects.get(user=request.user, slug=review_name_slug)
    if request.method == "POST":
        if request.POST.get('results') == None:
            q = request.POST.get('queryField')
            s = request.POST.get('sortType')
            n = request.POST.get('noResults')
            abstractList = search.main(q,s, n)
            for document in abstractList:
                documentURL = document.get("url")
                if Paper.objects.filter(paper_url= documentURL, review= review).exists():
                    abstractList.remove(document)
        else:
            abstractList = eval(request.POST.get('results'))
            q = request.POST.get('queryField')
        relevant="Unchecked"
        if request.POST.get("relevanceField") == "relevant":
            relevant="Relevant"
        else:
            if request.POST.get("relevanceField") == "irrelevant":
                relevant="Not Relevant"
        if relevant!="Unchecked":
            print "traceA"
            compareCount_value = int(request.POST.get("hiddenCompareCount"))
            for s in abstractList:
                if s.get('compareCount') == compareCount_value:
                        currentDoc = s
                        paper = Paper(review=review, title=currentDoc["title"], paper_url=currentDoc["url"], full_text=currentDoc['fullText'], abstract=currentDoc["abstract"], authors=currentDoc["author"], abstract_relevance=relevant)
                        paper.save()
            if len(abstractList)>1:
                for abstract in abstractList:
                    if int(abstract.get('compareCount')) > compareCount_value-1:
                        abstract['compareCount'] -= 1
                del abstractList[compareCount_value-1]
            else:
                abstractList = []
                #for abstract in abstractList:
                     #if int(abstract.get('compareCount')) > compareCount_value:
                            #abstract['compareCount'] -= 1
                #del abstractList[compareCount_value]
        return render(request, 'ultimatereview/AbstractPool.html', {"Abstracts": abstractList, 'query': q, 'review':review.title,'slug': review_name_slug})
Example #21
0
def indexQueried(request):
    if request.method == "POST":
        query = request.POST["queryField"]
        abstractList = search.main(query, "relevance", "5")
        return render(request, 'ultimatereview/quickquery.html',
                      {"abstracts": abstractList})
Example #22
0
			'vip':'0',
			'keep-searches':__settings__('webshare_keep-searches')
	}
	extra.update(settings)
	providers[p.name] = xbmcprovider.XBMCLoginOptionalContentProvider(p,extra,__addon__)


def icon(provider):
	icon_file = os.path.join(__addon__.getAddonInfo('path'),'resources','icons',provider+'.png')
	if not os.path.isfile(icon_file):
		return 'DefaultFolder.png'
	return icon_file

def root():
	search.item()
	xbmcutil.add_local_dir(xbmcutil.__lang__(30006),settings['downloads'],xbmcutil.icon('download.png'))
	for provider in providers.keys():
		xbmcutil.add_dir(provider,{'cp':provider},icon(provider))
	return xbmcplugin.endOfDirectory(int(sys.argv[1]))

params = util.params()
if params=={}:
	xbmcutil.init_usage_reporting( __scriptid__)
	root()
elif 'cp' in params.keys():
	cp = params['cp']
	if cp in providers.keys():
		providers[cp].run(params)
else:
	search.main(__addon__,'search_history',params,search_cb)
Example #23
0
def doSearch(query):
    return search.main(jumble.jumble(query))
Example #24
0
def main(state, generatorIL):
    result = search.main(state, 0, generatorIL)
    print("Generator : 2 is put into position ", result[0][-1])
    return result[0]
Example #25
0
 def test_results_for_walt_disney(self):
     '''Results for walt disney must match example 
     provided'''
     search.process()
     self.assertEqual(len(search.main("walt disney")), 53)
Example #26
0
	if stream:
		util.reportUsage(__scriptid__,__scriptid__+'/download')
		if len(stream) > 1:
			index=0
			for st in stream:
				index+=1
				filename = name+'_part'+str(index)
				if index == len(stream)-1:
					util.download(__addon__,filename,st,os.path.join(downloads,filename+'.mp4'))
				else:
					util.download(__addon__,filename,st,os.path.join(downloads,filename+'.mp4'),notifyFinishDialog=False)
		else:
			util.download(__addon__,name,stream[0],os.path.join(downloads,name+'.mp4'))

p = util.params()
letters = ['A','B','C','Č','D','Ď','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','Ř','S','Š','T','Ť','U','V','W','X','Y','Z','Ž']
if p=={}:
	xbmc.executebuiltin('RunPlugin(plugin://script.usage.tracker/?do=reg&cond=31000&id=%s)' % __scriptid__)
	categories()
if 'list-all' in p.keys():
	list_all()
if 'list' in p.keys():
	list_letter(p['list'])
if 'tale' in p.keys():
	list_page(p['tale'])
if 'play' in p.keys():
	play(p['play'])
if 'download' in p.keys():
	download(p['download'],p['name'])
search.main(__addon__,'search_history',p,_search_cb)
Example #27
0
import sys
from search import main

if __name__ == "__main__":
    main()
Example #28
0
    sys.exit(0)

GPIO.setmode(GPIO.BCM)

while but.button_1() or but.button_2():
    pass
while True:
    if irsens.ir():  # buzzer high
        pass
        
    if but.button_1():
        mButPressed()
        time.sleep(0.5)
    else:
        time.sleep(0.05)
        display.lcd_display_string("Put Finger", 1)
        finalOutput = search.main()
        if finalOutput[0] == 0:
            display.lcd_clear()
            display.lcd_display_string("Access Granted", 1)
            lockOutput.main()
            time.sleep(1)
            display.lcd_clear()
            
            # GPIO.setup(n, GPIO.IN) #n is the relay pin output
        if finalOutput == [304]:
            display.lcd_clear()
            display.lcd_display_string("Access Denied", 1)
            time.sleep(1)
            display.lcd_clear()
Example #29
0
    providers[p.name] = XBMCWebshareContentProvider(p, extra, __addon__)


def icon(provider):
    icon_file = os.path.join(__addon__.getAddonInfo('path'), 'resources',
                             'icons', provider + '.png')
    if not os.path.isfile(icon_file):
        return 'DefaultFolder.png'
    return icon_file


def root():
    search.item()
    xbmcutil.add_local_dir(xbmcutil.__lang__(30006), settings['downloads'],
                           xbmcutil.icon('download.png'))
    for provider in providers.keys():
        xbmcutil.add_dir(provider, {'cp': provider}, icon(provider))
    return xbmcplugin.endOfDirectory(int(sys.argv[1]))


params = util.params()
if params == {}:
    xbmcutil.init_usage_reporting(__scriptid__)
    root()
elif 'cp' in params.keys():
    cp = params['cp']
    if cp in providers.keys():
        providers[cp].run(params)
else:
    search.main(__addon__, 'search_history', params, search_cb)
Example #30
0
def indexQueried(request):
    if request.method == "POST":
        query = request.POST["queryField"]
        abstractList = search.main(query,"relevance","5")
        return render(request, 'ultimatereview/quickquery.html', {"abstracts": abstractList})
 def test_search(self):
 	command = './search'
     status_code = search.main()
     self.assertEcho('A python is a constricting snake belonging to the Python (genus) , or, more generally, any snake in the family Pythonidae (containing the Python genus).')
Example #32
0
def VSM(q):
    postings = p_load("postingsDump.txt")
    ranking = search.main(postings, q)
    return ranking
Example #33
0
import search
import index
from sys import argv
import os

if __name__ == "__main__":
    if len(argv) < 2:
        raise ValueError('Expected at least one command line argument.')
    if argv[1] == 'index':  # построение индекса
        if len(argv) > 2:
            index.main(['index.py', argv[2]])
        else:
            index.main(['index.py'])
    elif argv[1] == 'search':  # булев поиск
        search.main()
    elif argv[1] == 'clean':  # очистка временныъ данных
        path = 'temp_dumps/' if len(argv) < 3 else argv[2]
        if path[-1] != '/':
            path += '/'
        flag = False
        for file in ('reversed_index.gz', 'word_to_id.gz', 'id_to_url.gz',
                     'url_to_id.gz'):
            if os.path.exists(f'{path}{file}'):
                os.system(f'rm {path}{file}')
                flag = True
        if not flag:
            raise ValueError('The directory does not contain temporary files.')
    else:
        raise ValueError('Unexpected command line argument.')
Example #34
0
def search():
	search_results = ourSearch.main(request.args['data'],request.args['exact'], '')
	jsonified = json.dumps(search_results)
	return jsonified
Example #35
0
def main(item_code, item_name, price):
    search.main(item_code, item_name, price)
def indexQueried(request):
    if request.method == "POST":
        query = request.POST["queryField"]
        abstractList = search.main(query,"relevance","5")
        return HttpResponse(abstractList)
Example #37
0
import search
import webbrowser
strings = ["bleeding gums", "death", "full blown aids", "cancer", "test",
            "help me I'm dying", "shit it's done", "blood"]
#strings = ["bleeding gums","help me I'm dying"]

#strings = ["help me I'm dying"]

for s in strings:
    webbrowser.open(search.main(s,"relevance","1")[0].get('fullText'))

Example #38
0
def runSearch(params):
    old_stdout = sys.stdout
    sys.stdout = mystdout = StringIO()
    search.main(params)
    sys.stdout = old_stdout
    return mystdout.getvalue()
Example #39
0
 def test_execution_time(self):
     '''Execution time must be less than 0.01ms'''
     start = datetime.datetime.now()
     search.main("disney walt")
     end = datetime.datetime.now()
     self.assertTrue((start - end).total_seconds() < 0.01)
	
if __settings__('webshare_enabled'):
	p = webshare.WebshareContentProvider(username='', password='',filter=webshare_filter)
	extra = {
			'vip':'0',
			'keep-searches':__settings__('webshare_keep-searches')
	}
	extra.update(settings)
	providers[p.name] = xbmcprovider.XBMCLoginOptionalContentProvider(p,extra,__addon__, session)

def icon(provider):
	icon_file = os.path.join(__addon__.get_info('path'), 'resources', 'icons', provider + '.png')
	if not os.path.isfile(icon_file):
		return 'DefaultFolder.png'
	return icon_file

def root():
	search.item()
	for provider in providers.keys():
		xbmcutil.add_dir(provider, {'cp':provider}, icon(provider))
	return

if params == {}:
	root()
elif 'cp' in params.keys():
	cp = params['cp']
	if cp in providers.keys():
		providers[cp].run(params)
else:
	search.main(session, __addon__, 'search_history', params, search_cb)
Example #41
0
        'keep-searches': __settings__('webshare_keep-searches')
    }
    extra.update(settings)
    providers[p.name] = xbmcprovider.XBMCLoginOptionalContentProvider(
        p, extra, __addon__, session)


def icon(provider):
    icon_file = os.path.join(__addon__.get_info('path'), 'resources', 'icons',
                             provider + '.png')
    if not os.path.isfile(icon_file):
        return 'DefaultFolder.png'
    return icon_file


def root():
    search.item()
    for provider in providers.keys():
        xbmcutil.add_dir(provider, {'cp': provider}, icon(provider))
    return


if params == {}:
    root()
elif 'cp' in params.keys():
    cp = params['cp']
    if cp in providers.keys():
        providers[cp].run(params)
else:
    search.main(session, __addon__, 'search_history', params, search_cb)
Example #42
0
 def setUp(self):
     from search import main
     app = main({})
     from webtest import TestApp
     self.testapp = TestApp(app)
Example #43
0
import search

keywords = [
    'emergencial', '"estado de Emergência de Saúde Pública"',
    '"Dispensa de licitação"', '"Equipamentos de Proteção Individual"', 'EPI',
    '"ventiladores pulmonares"', '"ventilador pulmonar"',
    'Demanda Emergencial Covid-19', '"teste rápido"', 'RT-PCR',
    '"Hospital de Campanha"'
]

for keyword in keywords:
    search.main(keyword)