Beispiel #1
0
def results(parsed, original_query):
    search_specs = [[
        "tvdb", "~tvdbquery",
        "http://thetvdb.com/?searchseriesid=&tab=listseries&function=Search&string="
    ]]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = url + urllib.quote_plus(parsed[key].encode('utf-8'))
            return {
                "title":
                i18n.localstr("Search {0} for '{1}'").format(
                    name, parsed[key].encode('utf-8')),
                "run_args": [search_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser":
                True
            }
Beispiel #2
0
def results(parsed, original_query):
    #Wi-Fi
    if ("wifi_on" in parsed):
        return {
            "title": i18n.localstr('Turn Wi-Fi On'),
            "run_args": ["networksetup -setairportpower en0 on"]
        }

    if ("wifi_off" in parsed):
        return {
            "title": i18n.localstr('Turn Wi-Fi Off'),
            "run_args": ["networksetup -setairportpower en0 off"]
        }

    #Bluetooth
    if ("bluetooth_on" in parsed):
        return {
            "title": i18n.localstr('Turn Bluetooth On'),
            "run_args": ["./blueutil on"]
        }

    if ("bluetooth_off" in parsed):
        return {
            "title": i18n.localstr('Turn Bluetooth Off'),
            "run_args": ["./blueutil off"]
        }
Beispiel #3
0
def results(parsed, original_query):
    search_specs = [[
        "Taobao", "~taobaoquery", "http://s.m.taobao.com/h5?q=",
        "http://s.taobao.com/search?q="
    ]]
    for name, key, h5url, weburl in search_specs:
        if key in parsed:
            msg = parsed[key].encode('utf-8')
            search_url = i18n.localstr(h5url) + urllib.quote_plus(msg)
            web_url = i18n.localstr(weburl) + urllib.quote_plus(msg)
            return {
                "title":
                i18n.localstr("Search {0} for '{1}'").format(name, msg),
                "run_args": [web_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser":
                True
            }
Beispiel #4
0
def results(parsed, original_query):

    search_specs = [[
        "Docker", "~dockerquery", "https://registry.hub.docker.com/search?q="
    ]]
    for name, key, url in search_specs:
        if key in parsed:
            localizedurl = i18n.localstr(url)
            search_url = localizedurl + urllib.quote_plus(
                parsed[key].encode('UTF-8'))
            title = i18n.localstr("Search {0} for '{1}'").format(
                name, parsed[key].encode('UTF-8'))
            return {
                "title":
                title,
                "run_args": [search_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_links_open_in_browser":
                True
            }
Beispiel #5
0
def results(parsed, original_query):
    search_specs = [
        ["Amazon", "~amazonquery", "http://www.amazon.com/s/ref=nb_sb_noss?field-keywords="],
        ["Amazon", "~amazonqueryde", "http://www.amazon.de/s/ref=nb_sb_noss?field-keywords="],
        ["Alibaba", "~alibabaquery", "http://m.alibaba.com/trade/search?SearchText="],
        ["AliExpress", "~aliexpressquery", "http://m.aliexpress.com/search.htm?keywords="],
        ["eBay", "~ebayquery", "http://www.ebay.com/sch/i.html?_nkw="],
        ["eBay", "~ebayqueryde", "http://www.ebay.de/sch/i.html?_nkw="],
        ["JD", "~jdquery", "http://m.jd.com/ware/search.action?keyword="],
        ["Taobao", "~taobaoquery", "http://s.m.taobao.com/h5?q="],
        ["YHD", "~yhdquery", "http://m.yhd.com/search/?req.keyword="],
        ["YiXun", "~yixunquery", "http://m.51buy.com/t/list/?keyword="],
        ["1688", "~ylbbquery", "http://m.1688.com/page/search.html?type=offer&keywords="]
    ]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = url + urllib.quote_plus(parsed[key])
            return {
                "title": i18n.localstr("Search {0} for '{1}'").format(name, parsed[key]),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """%(json.dumps(search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #6
0
def results(parsed, original_query):
    if '~location' in parsed:
        location = parsed['~location'].lower()
    else:
        import json
        settings = json.load(open('preferences.json'))
        if 'default_location' not in settings:
            return
        location = settings['default_location']

    keys = list(filter(lambda l: l.startswith(location), locations.keys()))

    if len(keys) == 1:
        location = locations[keys[0]]
        url = 'http://sx9.jp/weather/{0}.html'.format(location)
        html = """
        <script>
        setTimeout(function () {
            window.location = '""" + url + """';
        }, 500);
        </script>
        """
        return {
            "title": i18n.localstr("Ninetan @{0}").format(
                i18n.localstr(location.capitalize())),
            "run_args": [url],
            "html": html,
            "webview_links_open_in_browser": True
        }
    else:
        return {
            "title": i18n.localstr("Ninetan location not found"),
            "run_args": [None]
        }
Beispiel #7
0
def results(parsed, original_query):
    name = "Namu Wiki"
    key = '~namuquery'
    url = 'https://namu.wiki/w/'

    if key not in parsed:
        return

    # Managing hangul. 'ㅎㅏㄴㄱㅡㄹ' -> '한글'
    query = unicodedata.normalize('NFC', parsed[key])

    search_url = i18n.localstr(url) + urllib.quote(query.encode('utf-8'))
    title = i18n.localstr(
        "Search {0} for '{1}'").format(name, parsed[key].encode('UTF-8'))
    return {
        "title": title,
        "run_args": [search_url],
        "html": """
        <script>
        setTimeout(function() {
        window.location = %s
        }, 500);
        </script>
        """ % (json.dumps(search_url)),
        "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
        "webview_links_open_in_browser": True
    }
Beispiel #8
0
def results(parsed, original_query):

    search_specs = [["Bing", "~bingquery", "http://www.bing.com/search?q="]]
    for name, key, url in search_specs:
        if key in parsed:
            localizedurl = i18n.localstr(url)
            search_url = localizedurl + urllib.quote_plus(parsed[key])
            title = i18n.localstr("Search {0} for '{1}'").format(
                name, parsed[key])
            return {
                "title":
                title,
                "run_args": [search_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser":
                True
            }
Beispiel #9
0
def results(parsed, original_query):
    #Wi-Fi
    if ("wifi_on" in parsed):
        return {
            "title": i18n.localstr('Turn Wi-Fi On'),
            "run_args": ["networksetup -setairportpower en0 on"]
        }

    if ("wifi_off" in parsed):
        return {
            "title": i18n.localstr('Turn Wi-Fi Off'),
            "run_args": ["networksetup -setairportpower en0 off"]
        }

    #Bluetooth
    if ("bluetooth_on" in parsed):
        os.system(
            "chmod +x blueutil")  # it'll be un-executable after unzipping
        return {
            "title": i18n.localstr('Turn Bluetooth On'),
            "run_args": ["./blueutil on"]
        }

    if ("bluetooth_off" in parsed):
        return {
            "title": i18n.localstr('Turn Bluetooth Off'),
            "run_args": ["./blueutil off"]
        }
Beispiel #10
0
def results(parsed, original_query):

    search_specs = [
         ["Google", "~googlequery", "localizedgoogleurl"],
         ["Duck Duck Go", "~duckduckgoquery", "https://duckduckgo.com/?q="],
         ["Google Images", "~googleimagequery", "localizedgoogleimageurl"],
         ["Baidu", "~baiduquery", "http://www.baidu.com/s?wd="],
         ["Bing", "~bingquery", "http://www.bing.com/search?q="],
         ["Yahoo", "~yahooquery", "https://sg.search.yahoo.com/search?p="],
         ["Twitter", "~twitterquery", "https://mobile.twitter.com/search?q="],
         ["Reddit", "~redditquery", "https://www.reddit.com/search?q="],
         ["Google Maps", "~googlemapsquery", "localizedgooglemapsurl"]
    ]
    for name, key, url in search_specs:
        if key in parsed:
            localizedurl = i18n.localstr(url)
            search_url = localizedurl + urllib.quote_plus(parsed[key])
            title = i18n.localstr("Search {0} for '{1}'").format(name, parsed[key]);
            return {
                "title": title,
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """%(json.dumps(search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #11
0
def results(parsed, original_query):
    name = "Namu Wiki"
    key = '~namuquery'
    url = 'https://namu.wiki/w/'

    if key not in parsed:
        return

    # Managing hangul. 'ㅎㅏㄴㄱㅡㄹ' -> '한글'
    query = unicodedata.normalize('NFC', parsed[key])

    search_url = i18n.localstr(url) + urllib.quote(query.encode('utf-8'))
    title = i18n.localstr("Search {0} for '{1}'").format(
        name, parsed[key].encode('UTF-8'))
    return {
        "title":
        title,
        "run_args": [search_url],
        "html":
        """
        <script>
        setTimeout(function() {
        window.location = %s
        }, 500);
        </script>
        """ % (json.dumps(search_url)),
        "webview_user_agent":
        "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
        "webview_links_open_in_browser":
        True
    }
Beispiel #12
0
def results(parsed, original_query):
	#Wi-Fi
	if ("wifi_on" in parsed):
		return {
			"title": i18n.localstr('Turn Wi-Fi On'),
			"run_args": ["networksetup -setairportpower en0 on"]
		}

	if ("wifi_off" in parsed):
		return {
			"title": i18n.localstr('Turn Wi-Fi Off'),
			"run_args": ["networksetup -setairportpower en0 off"]
		}

	#Bluetooth
	if ("bluetooth_on" in parsed):
		os.system("chmod +x blueutil") # it'll be un-executable after unzipping
		return {
			"title": i18n.localstr('Turn Bluetooth On'),
			"run_args": ["./blueutil on"]
		}

	if ("bluetooth_off" in parsed):
		return {
			"title": i18n.localstr('Turn Bluetooth Off'),
			"run_args": ["./blueutil off"]
		}
Beispiel #13
0
def results(parsed, original_query):

    search_specs = [[
        "Duck Duck Go", "~duckduckgoquery", "https://duckduckgo.com/?q="
    ]]
    user_agent = ("Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) " +
                  "AppleWebKit/537.51.1 (KHTML, like Gecko) " +
                  "Version/7.0 Mobile/11A465 Safari/9537.53")
    for name, key, url in search_specs:
        if key in parsed:
            search_item = parsed[key].encode('utf_8')
            localizedurl = i18n.localstr(url)
            search_url = localizedurl + urllib.quote_plus(search_item)
            title = i18n.localstr("Search {0} for '{1}'").format(
                name, search_item)

            return {
                "title":
                title,
                "run_args": [search_url],
                "html":
                """<script>
                        setTimeout(function() {
                            window.location = %s
                        }, 500);
                        </script>""" % (json.dumps(search_url)),
                "webview_user_agent":
                user_agent,
                "webview_links_open_in_browser":
                True
            }
Beispiel #14
0
def results(parsed, original_query):
    search_specs = [[
        "Allocine", "~allocinequery",
        "http://mobile.allocine.fr/recherche/default.html?motcle=",
        "http://www.allocine.fr/recherche/?q="
    ]]
    for name, key, mobile_url, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = i18n.localstr(url) + urllib.quote_plus(
                parsed[key].encode('utf-8'))
            return {
                "title":
                i18n.localstr("Search {0} for '{1}'").format(
                    name, parsed[key]),
                "run_args": [search_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser":
                True
            }
Beispiel #15
0
def results(parsed, original_query):
    search_specs = [
        ["Amazon", "~amazonquery", "localizedamazonurl"],
        ["Alibaba", "~alibabaquery", "http://m.alibaba.com/trade/search?SearchText="],
        ["AliExpress", "~aliexpressquery", "http://m.aliexpress.com/search.htm?keywords="],
        ["eBay", "~ebayquery", "localizedebayurl"],
        ["JD", "~jdquery", "http://m.jd.com/ware/search.action?keyword="],
        ["Taobao", "~taobaoquery", "http://s.m.taobao.com/h5?q="],
        ["YHD", "~yhdquery", "http://m.yhd.com/search/?req.keyword="],
        ["YiXun", "~yixunquery", "http://m.51buy.com/t/list/?keyword="],
        ["1688", "~ylbbquery", "http://m.1688.com/page/search.html?type=offer&keywords="]
    ]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = url + urllib.quote_plus(parsed[key])
            return {
                "title": i18n.localstr("Search {0} for '{1}'").format(name, parsed[key]),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """%(json.dumps(search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #16
0
def results(parsed, original_query):

    search_specs = [[
        "Google Maps", "~googlemapsquery", "https://www.google.com/maps/place/"
    ]]
    for name, key, url in search_specs:
        if key in parsed:
            localizedurl = i18n.localstr(url)
            search_url = localizedurl + urllib.quote_plus(
                parsed[key].encode('UTF-8'))
            title = i18n.localstr("Search {0} for '{1}'").format(
                name, parsed[key].encode('UTF-8'))
            return {
                "title":
                title,
                "run_args": [search_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 200);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)",
                "webview_links_open_in_browser":
                True
            }
Beispiel #17
0
def results(parsed, original_query):
    search_specs = [[
        "idealo.de", "~idealoquery",
        "http://mobil.idealo.de/preisvergleich/MainSearchProductCategory.html?q="
    ]]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = url + urllib.quote_plus(parsed[key].encode('utf-8'))
            return {
                "title":
                i18n.localstr("Suche nach '{0}'").format(
                    parsed[key].encode('utf-8')),
                "run_args": [search_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser":
                True
            }
Beispiel #18
0
def results(parsed, original_query):
    search_specs = [[
        "DHL", "~dhlquery",
        "http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&rfn=&extendedSearch=true&idc="
    ]]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = url + urllib.quote_plus(parsed[key].encode('utf-8'))
            return {
                "title":
                i18n.localstr("Suche nach Paketnummer '{1}'").format(
                    name, parsed[key].encode('utf-8')),
                "run_args": [search_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser":
                True
            }
Beispiel #19
0
def results(parsed, original_query):
    search_specs = [
        ["Colissimo", "~frParcelnumber", "http://www.colissimo.fr/portail_colissimo/suivreResultat.do?parcelnumber="],
        ["Colissimo", "~enParcelnumber", "http://www.colissimo.fr/portail_colissimo/suivreResultat.do?language=en_GB&parcelnumber="],
        ["Colissimo", "~deParcelnumber", "http://www.colissimo.fr/portail_colissimo/suivreResultat.do?language=de_DE&parcelnumber="],
        ["Colissimo", "~itParcelnumber", "http://www.colissimo.fr/portail_colissimo/suivreResultat.do?language=it_IT&parcelnumber="],
        ["Colissimo", "~nlParcelnumber", "http://www.colissimo.fr/portail_colissimo/suivreResultat.do?language=nl_NL&parcelnumber="],
        ["Colissimo", "~esParcelnumber", "http://www.colissimo.fr/portail_colissimo/suivreResultat.do?language=es_ES&parcelnumber="]
    ]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = i18n.localstr(url) + urllib.quote_plus(parsed[key].encode('utf-8'))
            return {
                "title": i18n.localstr("Search {0} for parcel number '{1}'").format(name, parsed[key]),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #20
0
def results(parsed, original_query):
    settings = json.load(open('preferences.json'))
    country = settings.get('country')
    category = settings.get('category')
    sale = settings.get('sale')
    sale_filter = ""
    if sale:
        sale_filter = "order=sale"
    prepareurl = "https://m.zalando.%s/%s?%s&q=" % (country, category, sale_filter)

    search_specs = [
        ["Zalando", "~zalandoquery", prepareurl]
    ]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_key = parsed[key].encode('utf-8')
            search_url = url + urllib.quote_plus(search_key)
            if "sale" in search_key:
                search_key = search_key.replace("sale", "")
                search_url = url + urllib.quote_plus(search_key) + "&order=sale"

            return {
                "title": i18n.localstr("Suche nach '{0}' in {1}").format(search_key, category.title()),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """%(json.dumps(search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #21
0
def results(parsed, original_query):
    search_specs = [[
        "RubyGems", "~query", "https://rubygems.org/search?query="
    ]]
    for name, key, url in search_specs:
        if key in parsed:
            localizedurl = i18n.localstr(url)
            search_url = localizedurl + urllib.quote_plus(
                parsed[key].encode('UTF-8'))
            title = i18n.localstr("Search {0} for '{1}'").format(
                name, parsed[key].encode('UTF-8'))
            return {
                "title":
                title,
                "run_args": [search_url],
                "html":
                """
                    <script>
                    setTimeout(function() {
                        window.location = %s
                    }, 500);
                    </script>
                    """ % (json.dumps(search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Safari/600.1.4",
                "webview_links_open_in_browser":
                True
            }
Beispiel #22
0
def results(parsed, original_query):

    search_specs = [
        ["Duck Duck Go", "~duckduckgoquery", "https://duckduckgo.com/?q="]
    ]
    user_agent = ("Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) " +
                  "AppleWebKit/537.51.1 (KHTML, like Gecko) " +
                  "Version/7.0 Mobile/11A465 Safari/9537.53")
    for name, key, url in search_specs:
        if key in parsed:
            search_item = parsed[key].encode('utf_8')
            localizedurl = i18n.localstr(url)
            search_url = localizedurl + urllib.quote_plus(search_item)
            title = i18n.localstr("Search {0} for '{1}'").format(name,
                                                                 search_item)

            return {
                "title": title,
                "run_args": [search_url],
                "html": """<script>
                        setTimeout(function() {
                            window.location = %s
                        }, 500);
                        </script>""" % (json.dumps(search_url)),
                "webview_user_agent": user_agent,
                "webview_links_open_in_browser": True
            }
Beispiel #23
0
def results(parsed, original_query):

    search_specs = [[
        "fontawesome", "~fontawesome", "http://glyphsearch.com/?query="
    ]]
    for name, key, url in search_specs:
        if key in parsed:
            localizedurl = i18n.localstr(url)
            search_url = localizedurl + urllib.quote_plus(
                parsed[key].encode('UTF-8'))
            title = i18n.localstr("Search {0} for '{1}'").format(
                name, parsed[key].encode('UTF-8'))
            return {
                "title":
                title,
                "run_args": [search_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 300);
                </script>
                """ % (json.dumps(search_url))
            }
Beispiel #24
0
def results(parsed, query):
  from centered_text import centered_text
  return {
    "title": i18n.localstr("Large Text"),
    "html": centered_text(parsed['~text'], hint_text=i18n.localstr("Press enter to show full-screen")),
    "webview_transparent_background": True,
    "run_args": [parsed['~text']]
  }
Beispiel #25
0
def results(parsed, query):
    from centered_text import centered_text
    return {
        "title":
        i18n.localstr("Large Text"),
        "html":
        centered_text(
            parsed['~text'],
            hint_text=i18n.localstr("Press enter to show full-screen")),
        "webview_transparent_background":
        True,
        "run_args": [parsed['~text']]
    }
Beispiel #26
0
def results(parsed, original_query):

    location = parsed['~location']
    if '~now' in parsed:
        if parsed['~now'] == i18n.localstr('now'):
            time = 'now'
        else:
            time = 'later'
    else:
        time = 'later'

    # Used for debugging
    # print >> sys.stderr, 'Original query: ' + original_query
    # print >> sys.stderr, 'Interpreted the time as: ' + time
    # print >> sys.stderr, 'Interpreted the location as: ' + location

    # title = i18n.localstr('"{0}" weather').format(location)
    # html = (
    #     open(i18n.find_localized_path("weather.html")).read().decode('utf-8')
    #     .replace("<!--LOCATION-->", location)
    #     .replace("<!--UNITS-->", "metric" if use_metric() else "imperial")
    #     .replace("<!--APPEARANCE-->", "dark" if dark_mode() else "light")
    #     .replace("<!--TIME-->", time)
    # )

    title = i18n.localstr('"{0}" weather').format(location)
    html = (open("weather.html").read(
    ).decode('utf-8').replace("<!--LOCATION-->", location).replace(
        "<!--UNITS-->", "metric" if use_metric() else "imperial"
    ).replace(
        "<!--APPEARANCE-->",
        "dark"
        if dark_mode()
        else "light"
    ).replace(
        "<!--TIME-->", time
    ).replace(
        "\"<!--WEEKDAYS-->\"",
        i18n
        .localstr(
            '[\'Sunday\', \'Monday\', \'Tuesday\', \'Wednesday\', \'Thursday\', \'Friday\', \'Saturday\']'
        )).replace("\"<!--NOW-->\"",
                   i18n.localstr('[\'Now\', \'Today\']')).replace(
                       "<!--LOCALE-->", i18n.localstr("locale")))

    return {
        "title": title,
        "html": html,
        "webview_transparent_background": True,
        "run_args": [location]
    }
Beispiel #27
0
def results(parsed, original_query):
    search_specs = [
        [
            "Colissimo", "~frParcelnumber",
            "http://www.colissimo.fr/portail_colissimo/suivreResultat.do?parcelnumber="
        ],
        [
            "Colissimo", "~enParcelnumber",
            "http://www.colissimo.fr/portail_colissimo/suivreResultat.do?language=en_GB&parcelnumber="
        ],
        [
            "Colissimo", "~deParcelnumber",
            "http://www.colissimo.fr/portail_colissimo/suivreResultat.do?language=de_DE&parcelnumber="
        ],
        [
            "Colissimo", "~itParcelnumber",
            "http://www.colissimo.fr/portail_colissimo/suivreResultat.do?language=it_IT&parcelnumber="
        ],
        [
            "Colissimo", "~nlParcelnumber",
            "http://www.colissimo.fr/portail_colissimo/suivreResultat.do?language=nl_NL&parcelnumber="
        ],
        [
            "Colissimo", "~esParcelnumber",
            "http://www.colissimo.fr/portail_colissimo/suivreResultat.do?language=es_ES&parcelnumber="
        ]
    ]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = i18n.localstr(url) + urllib.quote_plus(
                parsed[key].encode('utf-8'))
            return {
                "title":
                i18n.localstr("Search {0} for parcel number '{1}'").format(
                    name, parsed[key]),
                "run_args": [search_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser":
                True
            }
Beispiel #28
0
def results(parsed, original_query):
    search_specs = [
          ["Wikipedia", "~deWiki", "https://de.m.wikipedia.org/w/index.php?search=", "https://de.wikipedia.org/w/index.php?search="],
          ["English Wikipedia", "~enWiki", "https://en.m.wikipedia.org/w/index.php?search=", "https://en.wikipedia.org/w/index.php?search="],
          ["French Wikipedia", "~frWiki", "https://fr.m.wikipedia.org/w/index.php?search=", "https://fr.wikipedia.org/w/index.php?search="],
          ["Italian Wikipedia", "~itWiki", "https://it.m.wikipedia.org/w/index.php?search=", "https://it.wikipedia.org/w/index.php?search="],
          ["Wikipedia", "~jaWiki", "https://ja.m.wikipedia.org/w/index.php?search=", "https://ja.wikipedia.org/w/index.php?search="],
          ["Nederlandse Wikipedia", "~nlWiki", "https://nl.m.wikipedia.org/w/index.php?search=", "https://nl.wikipedia.org/w/index.php?search="],
          ["polskiej Wikipedii", "~plWiki", "https://pl.m.wikipedia.org/w/index.php?search=", "https://pl.wikipedia.org/w/index.php?search="]
    ]
    for name, key, mobile_url, url in search_specs:
        if key in parsed:
            quoted_url = urllib.quote_plus(parsed[key].encode('utf-8'))
            mobile_search_url = mobile_url + quoted_url
            search_url = url + quoted_url
            return {
                "title": i18n.localstr("Search {0} for '{1}'").format(name, parsed[key]),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """%(json.dumps(mobile_search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #29
0
def results(parsed, original_query):
    search_specs = [
          ["Wikipedia", "~deWiki", "https://de.m.wikipedia.org/w/index.php?search=", "https://de.wikipedia.org/w/index.php?search="],
          ["English Wikipedia", "~enWiki", "https://en.m.wikipedia.org/w/index.php?search=", "https://en.wikipedia.org/w/index.php?search="],
          ["French Wikipedia", "~frWiki", "https://fr.m.wikipedia.org/w/index.php?search=", "https://fr.wikipedia.org/w/index.php?search="],
          ["Italian Wikipedia", "~itWiki", "https://it.m.wikipedia.org/w/index.php?search=", "https://it.wikipedia.org/w/index.php?search="],
          ["Wikipedia", "~jaWiki", "https://ja.m.wikipedia.org/w/index.php?search=", "https://ja.wikipedia.org/w/index.php?search="],
          ["Nederlandse Wikipedia", "~nlWiki", "https://nl.m.wikipedia.org/w/index.php?search=", "https://nl.wikipedia.org/w/index.php?search="]
    ]
    for name, key, mobile_url, url in search_specs:
        if key in parsed:
            quoted_url = urllib.quote_plus(parsed[key].encode('utf-8'))
            mobile_search_url = mobile_url + quoted_url
            search_url = url + quoted_url
            return {
                "title": i18n.localstr("Search {0} for '{1}'").format(name, parsed[key]),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """%(json.dumps(mobile_search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #30
0
def results(parsed, original_query):
    benzine = "yes"
    query = "~dieselquery"

    if (parsed.get('~benzinequery', "nobenzin") != "nobenzin"):
        if parsed["~benzinequery"]:
            benzine = "benzine"
            query = "~benzinequery"
        elif parsed["~dieselquery"]:
            benzine = "diesel"
    elif parsed["~dieselquery"]:
        benzine = "diesel"

    title = i18n.localstr("Gas Price for '{0}'").format(parsed[query])
    return {
        "title":
        title,
        "html":
        open(i18n.find_localized_path("mehrtanken.html")).read().replace(
            "SEARCHQUERY",
            parsed[query]).replace("FUELSETTING", benzine).replace(
                "light-mode", "dark-mode" if dark_mode() else "light-mode"),
        "webview_transparent_background":
        True
    }
Beispiel #31
0
def results(parsed, original_query):
    search_specs = [
        [
            "CocoaPods", "~query", "http://cocoapods.org/?q=",
            "http://cocoapods.org/?q=edcolor"
        ],
    ]
    for name, key, mobile_url, url in search_specs:
        if key in parsed:
            mobile_search_url = mobile_url + urllib.quote_plus(parsed[key])
            search_url = url + urllib.quote_plus(parsed[key])
            return {
                "title":
                i18n.localstr("Search {0} for '{1}'").format(
                    name, parsed[key]),
                "run_args": [search_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(mobile_search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser":
                True
            }
Beispiel #32
0
def results(fields, original_query):

    if ('eject all' in original_query or "ejectall" in original_query
            or "ejecall" in original_query or "ejall" in original_query
            or "ej all" in original_query):
        return {
            "title":
            i18n.localstr('Eject All Volumes'),
            "run_args": [
                "osascript -e 'tell application \"Finder\" to eject (every disk whose ejectable is true)';find /Volumes -maxdepth 1 -not -user root -a -not -name '.*' -print0 | xargs -0 umount"
            ]
        }

    if ('eject' in original_query or 'ej' in original_query):
        command = getvolumes(fields)
        if len(command) > 0:
            return {
                "title":
                "Eject " + command.replace("/Volumes/", ""),
                "run_args": [
                    "umount " + command.replace(" ", "\ ") +
                    ";diskutil eject " + command.replace(" ", "\ ")
                ]
            }
        else:
            return None
Beispiel #33
0
def results(parsed, original_query):
    search_specs = [
        [
            "YouTube", "~youtubequery",
            "https://www.youtube.com/results?search_query="
        ],
    ]
    for name, key, url in search_specs:
        if key in parsed:
            search_url = url + urllib.quote_plus(parsed[key])
            return {
                "title":
                i18n.localstr("Search {0} for '{1}'").format(
                    name, parsed[key]),
                "run_args": [
                    search_url if name is not 'IMDB' else search_url.replace(
                        "m.imdb", "imdb")
                ],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser":
                True
            }
Beispiel #34
0
def results(parsed, original_query):

    angular_specs = [["~query", "http://docs-angular.herokuapp.com/#/<query>"]]
    for key, url in angular_specs:
        if key in parsed:
            search_query = parsed[key].encode('UTF-8')
            title = i18n.localstr("Search in Angular Docs for '{0}'").format(
                search_query)
            search_url = url.replace("<query>", urllib.quote(search_query))
            return {
                "title":
                title,
                "run_args": [search_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser":
                True
            }
Beispiel #35
0
def results(fields, original_query):
    html = open(i18n.find_localized_path('unicode.html')).read().decode('utf-8')
    if("~emoji" in fields):
        query = fields['~emoji']
        html = html.replace("%query%", query).replace("%type%", "emojis")
        title = i18n.localstr('Search emojis for \'{0}\'').format(query)
    else:
        query = fields['~query']
        html = html.replace("%query%", query).replace("%type%", "characters")
        title = i18n.localstr('Search unicode characters for \'{0}\'').format(query)
    return {
        "title": title,
        "html": html,
        "webview_transparent_background": True,
				"run_args": [],
				"pass_result_of_output_function_as_first_run_arg": True
    }
Beispiel #36
0
def results(fields, original_query):
    html = open(
        i18n.find_localized_path('unicode.html')).read().decode('utf-8')
    if ("~emoji" in fields):
        query = fields['~emoji']
        html = html.replace("%query%", query).replace("%type%", "emojis")
        title = i18n.localstr('Search emojis for \'{0}\'').format(query)
    else:
        query = fields['~query']
        html = html.replace("%query%", query).replace("%type%", "characters")
        title = i18n.localstr('Search unicode characters for \'{0}\'').format(
            query)
    return {
        "title": title,
        "html": html,
        "webview_transparent_background": True
    }
Beispiel #37
0
def results(parsed, original):
  import json
  return {
    "title": i18n.localstr("Yes or no?!"),
    "html": open(i18n.find_localized_path("yesno.html")).read(),
    "pass_result_of_output_function_as_first_run_arg": True,
    "webview_transparent_background": True
  }
Beispiel #38
0
def results(parsed, original_query):
    icon_file = i18n.find_localized_path("Icon.png")
    return {
        "title": i18n.localstr("Open AirDrop"),
        "run_args": [],
        "html": html_template.format(icon_file),
        "webview_transparent_background": True
    }
Beispiel #39
0
def results(parsed, original):
  import json
  return {
    "title": i18n.localstr("External IP Address / Useragent"),
    "html": open(i18n.find_localized_path("ipuseragent.html")).read().replace("light-mode", "dark-mode" if dark_mode() else "light-mode"),
    "pass_result_of_output_function_as_first_run_arg": True,
    "webview_transparent_background": True
  }
Beispiel #40
0
def results(parsed, original):
    import json
    return {
        "title": i18n.localstr("Yes or no?!"),
        "html": open(i18n.find_localized_path("yesno.html")).read(),
        "pass_result_of_output_function_as_first_run_arg": True,
        "webview_transparent_background": True
    }
Beispiel #41
0
def results(parsed, original_query):
    icon_file = i18n.find_localized_path("Icon.png")
    return {
        "title": i18n.localstr("Open AirDrop"),
        "run_args": [],
        "html": html_template.format(icon_file),
        "webview_transparent_background": True
    }
Beispiel #42
0
def results(parsed, original_query):

    location = parsed['~location']
    if '~now' in parsed:
        if parsed['~now'] == i18n.localstr('now'):
            time = 'now'
        else:
            time = 'later'
    else:
        time = 'later'

    # Used for debugging
    # print >> sys.stderr, 'Original query: ' + original_query
    # print >> sys.stderr, 'Interpreted the time as: ' + time
    # print >> sys.stderr, 'Interpreted the location as: ' + location

    # title = i18n.localstr('"{0}" weather').format(location)
    # html = (
    #     open(i18n.find_localized_path("weather.html")).read().decode('utf-8')
    #     .replace("<!--LOCATION-->", location)
    #     .replace("<!--UNITS-->", "metric" if use_metric() else "imperial")
    #     .replace("<!--APPEARANCE-->", "dark" if dark_mode() else "light")
    #     .replace("<!--TIME-->", time)
    # )

    title = i18n.localstr('"{0}" weather').format(location)
    html = (
        open("weather.html").read().decode('utf-8')
        .replace("<!--LOCATION-->", location)
        .replace("<!--UNITS-->", "metric" if use_metric() else "imperial")
        .replace("<!--APPEARANCE-->", "dark" if dark_mode() else "light")
        .replace("<!--TIME-->", time)
        .replace("\"<!--WEEKDAYS-->\"", i18n.localstr('[\'Sunday\', \'Monday\', \'Tuesday\', \'Wednesday\', \'Thursday\', \'Friday\', \'Saturday\']'))
        .replace("\"<!--NOW-->\"", i18n.localstr('[\'Now\', \'Today\']'))
        .replace("<!--LOCALE-->", i18n.localstr("locale"))
    )

    

    return {
        "title": title,
        "html": html,
        "webview_transparent_background": True,
        "run_args": [location]
    }
Beispiel #43
0
def results(fields, original_query):
    query = fields['~query']
    title = i18n.localstr('Search Unicode characters for \'{0}\'').format(query)
    html = open(i18n.find_localized_path('unicode.html')).read().decode('utf-8').replace("%query%", query)
    return {
        "title": title,
        "html": html,
        "webview_transparent_background": True
    }
Beispiel #44
0
def results(parsed, original_query):
    return {
        "title": i18n.localstr("Excuse"),
        "run_args": ['http://www.programmerexcuses.com'],
        "html" : open(i18n.find_localized_path("excuse.html")).read(),
        "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
        "webview_links_open_in_browser": True,
        "webview_transparent_background": True
    }
Beispiel #45
0
def results(parsed, original_query):
    location = parsed['~location']
    title = i18n.localstr('"{0}" weather').format(location)
    html = open(i18n.find_localized_path("weather.html")).read().replace("<!--LOCATION-->", location).replace("<!--UNITS-->", "metric" if use_metric() else "imperial").replace("<!--APPEARANCE-->", "dark" if dark_mode() else "light")
    return {
        "title": title,
        "html": html,
        "webview_transparent_background": True,
        "run_args": location
    }
Beispiel #46
0
def results(parsed, original_query):
    return {
        "title": i18n.localstr("Excuse"),
        "run_args": ['http://www.programmerexcuses.com'],
        "html": open(i18n.find_localized_path("excuse.html")).read(),
        "webview_user_agent":
        "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
        "webview_links_open_in_browser": True,
        "webview_transparent_background": True
    }
Beispiel #47
0
def results(parsed, original):
  import json
  return {
    "title": i18n.localstr("External IP Address / Useragent"),
    "html": open(i18n.find_localized_path("ipuseragent.html")).read()
	    .replace("light-mode", "dark-mode" if dark_mode() else "light-mode")
	    .replace("#{local-ip}", socket.gethostbyname(socket.gethostname())),
    "pass_result_of_output_function_as_first_run_arg": True,
    "webview_transparent_background": True
  }
Beispiel #48
0
def results(parsed, original_query):
    settings = json.load(open('preferences.json'))
    catgory_mapping = json.load(open('category-mapping.json'))

    country = settings.get('country')
    category = catgory_mapping[country][settings.get('category')]
    sale = settings.get('sale')
    sale_filter = ""
    if sale:
        sale_filter = "order=sale"
    prepareurl = "https://m.zalando.%s/%s?%s&q=" % (country, category,
                                                    sale_filter)

    search_specs = [["Zalando", "~zalandoquery", prepareurl]]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_key = parsed[key].encode('utf-8')
            search_url = url + urllib.quote_plus(search_key)
            if "sale" in search_key:
                search_key = search_key.replace("sale", "")
                search_url = url + urllib.quote_plus(
                    search_key) + "&order=sale"

            return {
                "title":
                i18n.localstr("Suche nach '{0}' in {1}").format(
                    search_key, category.title()),
                "run_args": [search_url],
                "html":
                """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent":
                "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser":
                True
            }
Beispiel #49
0
def results(parsed, original_query):
    location = parsed['~location']
    title = i18n.localstr("Time in '{0}'").format(location)
    
    html = open(i18n.find_localized_path("timezone.html")).read().replace("[PLACEHOLDER]", location).replace("light-mode", "dark-mode" if dark_mode() else "light-mode")
    return {
        "title": title,
        "html": html,
        "webview_transparent_background": True,
        "run_args": location
    }
Beispiel #50
0
def results(parsed, original_query):
    location = parsed['~location']
    title = i18n.localstr('Time in "{0}"').format(location)
    
    html = open(i18n.find_localized_path("timezone.html")).read().replace("[PLACEHOLDER]", location)
    return {
        "title": title,
        "html": html,
        "webview_transparent_background": True,
        "run_args": location
    }
Beispiel #51
0
def results(parsed, original_query):
    search_specs = [
        ["drive.google.com", "~drivequery", "https://drive.google.com/drive/mobile#search?sort=7&direction=d&q="]
    ]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = url + urllib.quote_plus(parsed[key].encode('utf-8'))
            return {
                "title": i18n.localstr("Suche nach '{0}'").format(parsed[key].encode('utf-8')),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """%(json.dumps(search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #52
0
def results(parsed, original_query):
    location = parsed['~site']
    location = location.split('://')[-1] # strip protocol
    title = i18n.localstr("Is '{0}' up?").format(location)
    
    html = open(i18n.find_localized_path("wrapper.html")).read().replace("[PLACEHOLDER]", location).replace("light-mode", "dark-mode" if dark_mode() else "light-mode")
    return {
        "title": title,
        "html": html,
        "webview_transparent_background": True,
        "run_args": location
    }
Beispiel #53
0
def results(parsed, original_query):
    search_specs = [
        ["Amazon", "~amazonquery", "http://www.amazon.com/s/ref=nb_sb_noss?field-keywords="]
    ]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = i18n.localstr(url) + urllib.quote_plus(parsed[key])
            return {
                "title": i18n.localstr("Search {0} for '{1}'").format(name, parsed[key]),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """%(json.dumps(search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #54
0
def results(parsed, original_query):
    search_specs = [
        ["Allocine", "~allocinequery", "http://mobile.allocine.fr/recherche/default.html?motcle=", "http://www.allocine.fr/recherche/?q="]
    ]
    for name, key, mobile_url, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = i18n.localstr(url) + urllib.quote_plus(parsed[key].encode('utf-8'))
            return {
                "title": i18n.localstr("Search {0} for '{1}'").format(name, parsed[key]),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """ % (json.dumps(search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #55
0
def results(parsed, original_query):
    search_specs = [
        ["DHL", "~dhlquery", "http://nolp.dhl.de/nextt-online-public/set_identcodes.do?lang=de&rfn=&extendedSearch=true&idc="]
    ]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = url + urllib.quote_plus(parsed[key].encode('utf-8'))
            return {
                "title": i18n.localstr("Suche nach Paketnummer '{1}'").format(name, parsed[key].encode('utf-8')),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """%(json.dumps(search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #56
0
def results(parsed, original_query):
    search_specs = [
        ["fedex.com", "~fedexquery", "https://www.fedex.com/apps/fedextrack/?action=track&cntry_code=us&trackingnumber="]
    ]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = url + urllib.quote_plus(parsed[key].encode('utf-8'))
            return {
                "title": i18n.localstr("Search for '{0}'").format(parsed[key].encode('utf-8')),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """%(json.dumps(search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #57
0
def results(parsed, original_query):
    search_specs = [
        ["1688", "~ylbbquery", "http://m.1688.com/page/search.html?type=offer&keywords="]
    ]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = url + urllib.quote_plus(parsed[key].encode('utf-8'))
            return {
                "title": i18n.localstr("Search {0} for '{1}'").format(name, parsed[key].encode('utf-8')),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() { 
                    window.location = %s
                }, 500);
                </script>
                """%(json.dumps(search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #58
0
def results(parsed, original):
  import json
  path = "gifbot.html";
  html = open(i18n.find_localized_path(path)).read().replace("var nullValue = null;", "var nullValue = \"{0}\";").replace('{0}', parsed['~query']).replace("light-mode", "dark-mode" if dark_mode() else "light-mode")
  return {
    "title": i18n.localstr(u"\"{0}\" GIFs (Press cmd + c to copy link)").format(parsed['~query']),
    "html": html,
    "pass_result_of_output_function_as_first_run_arg": True,
    "run_args": ["abc"],
    "webview_transparent_background": True,
    "webview_links_open_in_browser": True
  }
Beispiel #59
0
def results(parsed, original_query):
    search_specs = [
        ["idealo.de", "~idealoquery", "http://mobil.idealo.de/preisvergleich/MainSearchProductCategory.html?q="]
    ]
    for name, key, url in search_specs:
        if key in parsed:
            url = i18n.localstr(url)
            search_url = url + urllib.quote_plus(parsed[key].encode('utf-8'))
            return {
                "title": i18n.localstr("Suche nach '{0}'").format(parsed[key].encode('utf-8')),
                "run_args": [search_url],
                "html": """
                <script>
                setTimeout(function() {
                    window.location = %s
                }, 500);
                </script>
                """%(json.dumps(search_url)),
                "webview_user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
                "webview_links_open_in_browser": True
            }
Beispiel #60
0
def results(parsed, original_query):
    if ("lock_command" in parsed):
        return {
            "title": i18n.localstr('Lock Mac'),
            "run_args": ["",True] # **kwargs doesn't work so use argument positions.
        }

    if ("switch_user_command" in parsed):
        return {
            "title": i18n.localstr('Switch User'),
            "run_args": ["/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"]
        }

    if ('restart_command' in parsed):
        return {
            "title": i18n.localstr('Restart Mac'),
            "run_args": ["osascript -e 'tell app \"System Events\" to restart'"]
        }

    if ('sleep_command' in parsed):
        title = i18n.localstr('Put Mac to sleep')
        return {
            "title": title,
            "run_args": ["osascript -e 'tell app \"System Events\" to sleep'"]
        }

    if ('shutdown_command' in parsed):
        return {
            "title": i18n.localstr('Shut down Mac'),
            "run_args": ["osascript -e 'tell app \"System Events\" to shut down'"]
        }

    if ('logout_command' in parsed):
        return {
            "title": i18n.localstr('Log out'),
            "run_args": ["osascript -e 'tell app \"System Events\" to log out'"]
        }

    if ('empty_trash_command' in parsed):
        return {
            "title": i18n.localstr('Empty the Trash'),
            "run_args": ["osascript -e 'tell app \"Finder\" to empty the trash'"]
        }

    if('screen_saver' in parsed):
        return {
            "title": i18n.localstr('Turn on Screen Saver'),
            "run_args": ["open -a /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app"]
        }