Skip to content

Commit

Permalink
Merge pull request #10 from slowmove/master
Browse files Browse the repository at this point in the history
IMDB plugin and Yelp plugin
  • Loading branch information
nate-parrott committed Nov 12, 2014
2 parents ba964b5 + 1ef616f commit c378131
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 0 deletions.
1 change: 1 addition & 0 deletions PluginDirectories/1/imdb.bundle/examples.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
imdb ~imdbquery(query here)
5 changes: 5 additions & 0 deletions PluginDirectories/1/imdb.bundle/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "imdb",
"displayName": "IMDB",
"examples": ["imdb Phantom of the opera"]
}
26 changes: 26 additions & 0 deletions PluginDirectories/1/imdb.bundle/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import urllib, json

def results(parsed, original_query):
search_specs = [
["IMDB", "~imdbquery", "http://m.imdb.com/find?q="]
]
for name, key, url in search_specs:
if key in parsed:
search_url = url + urllib.quote_plus(parsed[key])
return {
"title": "Search {0} for '{1}'".format(name, parsed[key]),
"run_args": [search_url],
"html": """
<script>
setTimeout(function() {
window.location = %s
}, 100);
</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
}

def run(url):
import os
os.system('open "{0}"'.format(url))
Binary file added PluginDirectories/1/imdb.bundle/plugin.pyc
Binary file not shown.
1 change: 1 addition & 0 deletions PluginDirectories/1/yelp.bundle/examples.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yelp ~yelpquery(query here)
5 changes: 5 additions & 0 deletions PluginDirectories/1/yelp.bundle/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "yelp",
"displayName": "Yelp",
"examples": ["yelp pizza"]
}
26 changes: 26 additions & 0 deletions PluginDirectories/1/yelp.bundle/plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import urllib, json

def results(parsed, original_query):
search_specs = [
["Yelp", "~yelpquery", "http://m.yelp.com/search?find_desc="]
]
for name, key, url in search_specs:
if key in parsed:
search_url = url + urllib.quote_plus(parsed[key])
return {
"title": "Search {0} for '{1}'".format(name, parsed[key]),
"run_args": [search_url],
"html": """
<script>
setTimeout(function() {
window.location = %s
}, 100);
</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
}

def run(url):
import os
os.system('open "{0}"'.format(url))
Binary file added PluginDirectories/1/yelp.bundle/plugin.pyc
Binary file not shown.

0 comments on commit c378131

Please sign in to comment.