Skip to content

Commit

Permalink
files!
Browse files Browse the repository at this point in the history
  • Loading branch information
invious committed Sep 15, 2016
1 parent 09eb31f commit 5bf3f3d
Show file tree
Hide file tree
Showing 22 changed files with 5,389 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Alfred_Workflow-1.21.1-py2.7.egg-info
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# alfred3-gmaps-place-search
A simple workflow to convert clipboard text to an address returned by Google Maps Search

### Installation

grab the latest `.alfredworkflow` file here

##### Planned Features

Workflow script filter to return results to queries like

`CVS near 1600 Pennsylvania Ave NW, Washington, DC 20500` as a list

##### Tutorial Video

I made this for my girlfriend, who I am introducing to programming, and thought why not share it. It shows me writing the script, obtaining an API key for Google Places, and using postman to submit and view results of HTTP GET requests, generating the python code, and creating the Alfred workflow.

<video src="https://youtu.be/-v3M6gI4hkA" poster="http://i.imgur.com/q6w1sK8.jpg" width="320" height="200" controls preload></video>
Binary file added gmapsplacesearch.alfredworkflow
Binary file not shown.
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
188 changes: 188 additions & 0 deletions info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>com.invious.gmaps.placesearch</string>
<key>connections</key>
<dict>
<key>03DCD9A0-786E-460C-A734-DEB7F0C88D96</key>
<array>
<dict>
<key>destinationuid</key>
<string>74355592-AF60-4FCA-AC56-EBF4476AD5DA</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
<key>74355592-AF60-4FCA-AC56-EBF4476AD5DA</key>
<array>
<dict>
<key>destinationuid</key>
<string>B51D4FB5-F97E-40E6-A135-6046DED947CD</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
<dict>
<key>destinationuid</key>
<string>CF6B026C-8865-48DB-BFEF-75F77568B379</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Aymon Fournier</string>
<key>description</key>
<string>simple workflow to take selected or clipboard text and return an address</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>Google Maps Place Search</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>lastpathcomponent</key>
<false/>
<key>onlyshowifquerypopulated</key>
<true/>
<key>removeextension</key>
<false/>
<key>text</key>
<string>Your address result has been copied to your clipboard.</string>
<key>title</key>
<string>Google Maps Places API Search</string>
</dict>
<key>type</key>
<string>alfred.workflow.output.notification</string>
<key>uid</key>
<string>B51D4FB5-F97E-40E6-A135-6046DED947CD</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>0</integer>
<key>keyword</key>
<string>gmapsearch</string>
<key>subtext</key>
<string>Ener query liek you would on GMaps</string>
<key>text</key>
<string>Search places API, get address</string>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>03DCD9A0-786E-460C-A734-DEB7F0C88D96</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>68</integer>
<key>script</key>
<string>import requests
url = "https://maps.googleapis.com/maps/api/place/textsearch/json"
querystring = {"query": "{query}",
"key": "AIzaSyC0r4UxnX_COKvG10vK_NBjon-4CNKJeCI"}
headers = {
'cache-control': "no-cache",
}
response = requests.request("GET", url, headers=headers, params=querystring)
print response.json()['results'][0]['formatted_address']</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>3</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>74355592-AF60-4FCA-AC56-EBF4476AD5DA</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>autopaste</key>
<false/>
<key>clipboardtext</key>
<string>{query}</string>
<key>transient</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.output.clipboard</string>
<key>uid</key>
<string>CF6B026C-8865-48DB-BFEF-75F77568B379</string>
<key>version</key>
<integer>2</integer>
</dict>
</array>
<key>readme</key>
<string></string>
<key>uidata</key>
<dict>
<key>03DCD9A0-786E-460C-A734-DEB7F0C88D96</key>
<dict>
<key>xpos</key>
<integer>30</integer>
<key>ypos</key>
<integer>30</integer>
</dict>
<key>74355592-AF60-4FCA-AC56-EBF4476AD5DA</key>
<dict>
<key>xpos</key>
<integer>250</integer>
<key>ypos</key>
<integer>30</integer>
</dict>
<key>B51D4FB5-F97E-40E6-A135-6046DED947CD</key>
<dict>
<key>xpos</key>
<integer>570</integer>
<key>ypos</key>
<integer>20</integer>
</dict>
<key>CF6B026C-8865-48DB-BFEF-75F77568B379</key>
<dict>
<key>xpos</key>
<integer>560</integer>
<key>ypos</key>
<integer>150</integer>
</dict>
</dict>
<key>webaddress</key>
<string>invio.us</string>
</dict>
</plist>
14 changes: 14 additions & 0 deletions script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import requests

url = "https://maps.googleapis.com/maps/api/place/textsearch/json"

querystring = {"query": "Van Dyke Technology Group",
"key": "AIzaSyC0r4UxnX_COKvG10vK_NBjon-4CNKJeCI"}

headers = {
'cache-control': "no-cache",
}

response = requests.request("GET", url, headers=headers, params=querystring)

print response.json()['results'][0]['formatted_address']
Binary file added workflow/Notify.tgz
Binary file not shown.
107 changes: 107 additions & 0 deletions workflow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2014 Dean Jackson <[email protected]>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2014-02-15
#

"""A helper library for `Alfred <http://www.alfredapp.com/>`_ workflows."""

import os

# Workflow objects
from .workflow import Workflow, manager
from .workflow3 import Workflow3

# Exceptions
from .workflow import PasswordNotFound, KeychainError

# Icons
from .workflow import (
ICON_ACCOUNT,
ICON_BURN,
ICON_CLOCK,
ICON_COLOR,
ICON_COLOUR,
ICON_EJECT,
ICON_ERROR,
ICON_FAVORITE,
ICON_FAVOURITE,
ICON_GROUP,
ICON_HELP,
ICON_HOME,
ICON_INFO,
ICON_NETWORK,
ICON_NOTE,
ICON_SETTINGS,
ICON_SWIRL,
ICON_SWITCH,
ICON_SYNC,
ICON_TRASH,
ICON_USER,
ICON_WARNING,
ICON_WEB,
)

# Filter matching rules
from .workflow import (
MATCH_ALL,
MATCH_ALLCHARS,
MATCH_ATOM,
MATCH_CAPITALS,
MATCH_INITIALS,
MATCH_INITIALS_CONTAIN,
MATCH_INITIALS_STARTSWITH,
MATCH_STARTSWITH,
MATCH_SUBSTRING,
)


__title__ = 'Alfred-Workflow'
__version__ = open(os.path.join(os.path.dirname(__file__), 'version')).read()
__author__ = 'Dean Jackson'
__licence__ = 'MIT'
__copyright__ = 'Copyright 2014 Dean Jackson'

__all__ = [
'Workflow',
'Workflow3',
'manager',
'PasswordNotFound',
'KeychainError',
'ICON_ACCOUNT',
'ICON_BURN',
'ICON_CLOCK',
'ICON_COLOR',
'ICON_COLOUR',
'ICON_EJECT',
'ICON_ERROR',
'ICON_FAVORITE',
'ICON_FAVOURITE',
'ICON_GROUP',
'ICON_HELP',
'ICON_HOME',
'ICON_INFO',
'ICON_NETWORK',
'ICON_NOTE',
'ICON_SETTINGS',
'ICON_SWIRL',
'ICON_SWITCH',
'ICON_SYNC',
'ICON_TRASH',
'ICON_USER',
'ICON_WARNING',
'ICON_WEB',
'MATCH_ALL',
'MATCH_ALLCHARS',
'MATCH_ATOM',
'MATCH_CAPITALS',
'MATCH_INITIALS',
'MATCH_INITIALS_CONTAIN',
'MATCH_INITIALS_STARTSWITH',
'MATCH_STARTSWITH',
'MATCH_SUBSTRING',
]
Binary file added workflow/__init__.pyc
Binary file not shown.
Loading

0 comments on commit 5bf3f3d

Please sign in to comment.