Created
May 19, 2014 18:02
-
-
Save fractaledmind/b58ff306a75a62e2af11 to your computer and use it in GitHub Desktop.
Alfred, check for workflow by name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# encoding: utf-8 | |
import os | |
import plistlib | |
def check_for_workflow(name): | |
"""Check if specified workflow name exists""" | |
workflows_dir = os.path.dirname(os.getcwd()) | |
all_wfs = os.walk(workflows_dir).next()[1] | |
found = False | |
for wf in all_wfs: | |
plist = workflows_dir + "/" + wf + "/info.plist" | |
if os.path.isfile(plist): | |
plist_info = plistlib.readPlist(plist) | |
wf_name = plist_info['name'].lower() | |
if wf_name == name.lower(): | |
found = True | |
break | |
return found |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment