Example #1
0
                "Turn automatic checks for updates on.",
                arg="workflow:autoupdate",
                autocomplete="workflow:autoupdate",
                icon=ICON_INFO)
    wf.add_item("workflow:prereleases",
                "Enable updating the workflow to pre-release versions.",
                arg="workflow:prereleases",
                autocomplete="workflow:prereleases",
                icon=ICON_INFO)
    wf.add_item(
        "workflow:noprereleases",
        "Disable updating the workflow to pre-release versions (default).",
        arg="workflow:noprereleases",
        autocomplete="workflow:noprereleases",
        icon=ICON_INFO)

    wf.send_feedback()


UPDATE_SETTINGS = {'github_slug': 'jeeftor/alfredToday'}
HELP_URL = 'https://github.com/jeeftor/alfredToday/blob/master/README.md'

if __name__ == '__main__':
    wf = Workflow3(libraries=['./lib'],
                   help_url=HELP_URL,
                   update_settings={
                       'github_slug': 'jeeftor/alfredToday',
                       'frequency': 7
                   })
    log = wf.logger
    wf.run(main)
Example #2
0
        if history:
            historyWifiDevices = pickle.loads(history)

        for item in items:
            itemInDB = False
        
            for historyWifiDevice in historyWifiDevices:
                if item.title == historyWifiDevice.title and item.subtitle == historyWifiDevice.subtitle:
                    itemInDB = True
                    break

            if not itemInDB and not "[OFFLINE]" in item.title:

                if not hasattr(item, "mask"):
                    cmd_ip = adb_path + ' -s ' + item.variables['serial'] + " shell ip -f inet addr show wlan0 | grep inet | tr -s ' ' |  awk '{print $2}'"
                    ip = subprocess.check_output(cmd_ip,
                                        stderr=subprocess.STDOUT,
                                        shell=True)
                    if ip:
                        item.mask = ip.split('/')[1].split("\n")[0]
                historyWifiDevices.append(item)
                
        if historyWifiDevices:
            wf.store_data("wifi_history", pickle.dumps(historyWifiDevices))


if __name__ == '__main__':
    wf = Workflow3()
    log = wf.logger
    sys.exit(wf.run(main))
                    icon=ICON_INFO)

    if not wf.cached_data_fresh('handlers', max_age=600):
        cmd = ['/usr/bin/python', wf.workflowfile('update.py')]
        run_in_background('update', cmd)

    if is_running('update'):
        wf.add_item('Refreshing installed browsers',
                    valid=False,
                    icon=ICON_INFO)

    for b in sorted(browsers):
        it = wf.add_item(
            title='Open in ' + b,
            subtitle=browsers[b],
            arg=url,
            icon=browsers[b],
            icontype='fileicon',
            valid=True,
        )
        it.setvar('browser', browsers[b])
        it.setvar('url', url)

    wf.send_feedback()


if __name__ == '__main__':
    wf = Workflow3(
        update_settings={'github_slug': 'demonbane/alfred-browser-choice'})
    sys.exit(wf.run(main))

def main(wf):
    if wf.update_available:
        wf.add_item('Update available for Bluetooth Connector!',
                    autocomplete='workflow:update',
                    valid=False)

    query = wf.args[0] if len(wf.args) else None
    devices = _read_devices()

    filtered_devices = wf.filter(query, devices, key=lambda k: k['title'])

    for device in filtered_devices:
        item = wf.add_item(type=device['type'],
                           title=device['title'],
                           subtitle=device['subtitle'],
                           arg=device['arg'],
                           icon=device['icon'],
                           valid=True)

        item.setvar('title', device['title'])

    wf.send_feedback()


if __name__ == '__main__':
    wf = Workflow3(update_settings={'github_slug': GITHUB_SLUG})
    log = wf.logger
    sys.exit(wf.run(main))
Example #5
0
        wf.rerun = 0.5

    # If script was passed a query, use it to filter projects
    if query and projects:
        projects = wf.filter(query, projects, key=search_for_project, min_score=20)

    if not projects:  # we have no data to show, so show a warning and stop
        wf.add_item('No projects found', icon=ICON_WARNING)
        wf.send_feedback()
        return 0

    # Loop through the returned posts and add an item for each to
    # the list of results for Alfred
    for project in projects:
        wf.add_item(title=project['name_with_namespace'],
                    subtitle=project['path_with_namespace'],
                    arg=project['web_url'],
                    valid=True,
                    icon=None,
                    uid=project['id'])

    # Send the results to Alfred as XML
    wf.send_feedback()


if __name__ == u"__main__":
    wf = Workflow3(update_settings={
        'github_slug': 'lukewaite/alfred-gitlab',
    })
    log = wf.logger
    sys.exit(wf.run(main))
Example #6
0
			icon = ICON_WARNING
		)
		wf3.send_feedback()

	# Extract different parts from input
	inputName = getNameFromInput(query)
	inputContent = getContentFromInput(query)
	inputTags = getTagsFromInput(query)
	inputDue = getDueFromInput(query)
	inputList = getListFromInput(query)
	inputPriority = getPriorityFromInput(query)

	# Show 'Create Task' if user has completed their input - and no previous list item has been generated (JSON garbage).
	inputEndsWithCommand = query[-2:] == ' #' or query[-2:] == ' !' or query[-2:] == ' +'
	# log.debug('createListItemNotification - conditions: ')
	# log.debug('inputEndsWithCommand: ' + str(inputEndsWithCommand))
	# log.debug('doNotDisplayCreate: ' + str(isDoNotDisplayCreate))
	# log.debug('hasFoundMatch: ' + str(hasFoundMatch))
	# log.debug('isCustomTagEntered: ' + str(isCustomTagEntered))
	if not inputEndsWithCommand and not isDoNotDisplayCreate and (not hasFoundMatch or isCustomTagEntered):
		addCreateTaskItem(inputName, inputContent, inputDue, inputPriority, inputTags, inputList)
		checkUpdates(wf3) # Output *after* 'Create Task', so user is not pestered by the notiifcation when trying to create a task
		wf3.send_feedback()


if __name__ == "__main__":
	wf = Workflow(update_settings = UPDATE_SETTINGS)
	wf3 = Workflow3(update_settings = UPDATE_SETTINGS)
	log = wf.logger
	sys.exit(wf.run(main))
                arg=full_pw)
    wf.add_item('%d character password (no special characters)' %
                password_length,
                alnum_pw,
                valid=True,
                arg=alnum_pw)
    wf.add_item('XKCD Password (3 words)', xkcd_3, valid=True, arg=xkcd_3)
    wf.add_item('XKCD Password (4 words)', xkcd_4, valid=True, arg=xkcd_4)

    # Send output to Alfred.
    wf.send_feedback()
    return 0


if __name__ == '__main__':
    # Create a global `Workflow` object
    workflow3 = Workflow(
        libraries=['./lib'],
        update_settings={
            'github_slug': 'otherguy/alfred-passwords-workflow',
            'frequency': 1,  # every day
        },
        help_url='https://github.com/otherguy/alfred-passwords-workflow')

    workflow3.magic_prefix = 'wf:'

    # Call your entry function via `Workflow.run()` to enable its helper
    # functions, like exception catching, ARGV normalization, magic
    # arguments etc.
    sys.exit(workflow3.run(main))
Example #8
0
            if len(actions) > 0:
                for action in actions:
                    wf.add_item(action['name'],
                                action['description'],
                                uid=action['name'],
                                autocomplete=action['autocomplete'],
                                arg=action['arg'],
                                valid=action['valid'],
                                icon=helpers.get_icon(wf, 'chevron-right'))
            else:
                wf.add_item('No action found for "%s"' % query,
                            autocomplete='',
                            icon=helpers.get_icon(wf, 'info'))

        if len(wf._items) == 0:
            query_name = query[query.find(' ') + 1:]
            wf.add_item('No formula found for "%s"' % query_name,
                        autocomplete='%s ' % query[:query.find(' ')],
                        icon=helpers.get_icon(wf, 'info'))

    wf.send_feedback()

    # refresh cache
    cmd = ['/usr/bin/python', wf.workflowfile('brew_refresh.py')]
    run_in_background('brew_refresh', cmd)


if __name__ == '__main__':
    wf = Workflow(update_settings={'github_slug': GITHUB_SLUG})
    sys.exit(wf.run(main))
Example #9
0
            subtitle = u'{} ✕ e.g. "{}"'.format(count, example)

        it = wf.add_item(name,
                         subtitle,
                         arg=data,
                         autocomplete=u'{} {} '.format(name, DELIMITER),
                         valid=True,
                         largetext=data,
                         copytext=data)

        it.setvar('title', 'Copied to Clipboard')
        it.setvar('text', data)

        if SNIPPET_MODE:
            it.setvar('paste', 1)
        else:
            mod = it.add_modifier('cmd', 'Paste to frontmost application')
            mod.setvar('paste', 1)
            mod.setvar('SHOW_NOTIFICATIONS', 0)

    wf.send_feedback()


if __name__ == '__main__':
    wf = Workflow3(default_settings=DEFAULT_SETTINGS,
                   update_settings=UPDATE_SETTINGS,
                   help_url=ISSUE_URL,
                   libraries=['./libs'])
    log = wf.logger
    sys.exit(wf.run(main))
Example #10
0
    # Send output to Alfred. You can only call this once.
    # Well, you *can* call it multiple times, but subsequent calls
    # are ignored (otherwise the JSON sent to Alfred would be invalid).
    wf.send_feedback()


if __name__ == '__main__':
    # Create a global `Workflow3` object
    github_slug = 'lsgrep/mldocs'
    help_url = 'https://github.com/' + github_slug
    wf = Workflow3(update_settings={
        'github_slug': github_slug,
        'frequency': 7,
        help_url: help_url
    },
                   libraries=[
                       os.path.abspath(
                           os.path.join(os.path.dirname(__file__), 'libs'))
                   ])
    if wf.update_available:
        # Add a notification to top of Script Filter results
        wf.add_item('New version available',
                    'Upgrade mldocs workflow',
                    autocomplete='workflow:update',
                    icon=ICON_INFO)

    # Call your entry function via `Workflow3.run()` to enable its
    # helper functions, like exception catching, ARGV normalization,
    # magic arguments etc.
    sys.exit(wf.run(main))
Example #11
0
                for i in range(0, min(len(result), 25)):
                    add_vocab_item(wf, result[i])
            # if vocab word doesnt exist in dictionary, then display error message
            else:
                error_msg = "No results found for '%s'" % (query)
                wf.add_item(error_msg, arg=query, valid=True)

    except:
        error_msg = "There was an issue retrieving Jisho results"
        wf.add_item(error_msg, valid=True)

    # Send output to Alfred. You can only call this once.
    wf.send_feedback()


if __name__ == '__main__':
    # Create a global `Workflow3` object
    wf = Workflow3(
        update_settings={
            'github_slug': 'justindeocampo/Alfred-JapaneseTranslator',
            'version': __version__,
            'frequency': 7
        })

    if wf.update_available:
        wf.start_update()
    # Call your entry function via `Workflow3.run()` to enable its
    # helper functions, like exception catching, ARGV normalization,
    # magic arguments etc.
    sys.exit(wf.run(main))
import os
import sys

from shuangpin import convert_layout, matching_sequence
from workflow import Workflow3


def convert(workflow):
    """Convert input pattern"""
    sequence = "".join(workflow.args)
    results = matching_sequence(sequence)
    layout_main = os.getenv("MAIN_LAYOUT", "xiaohe")
    layout_secondary = os.getenv("SECONDARY_LAYOUT", "zhuyin")
    xiaohes = convert_layout(results, layout_main)
    zhuyins = convert_layout(results, layout_secondary)
    for zhuyin, xiaohe in zip(zhuyins, xiaohes):
        workflow.add_item(title=xiaohe, subtitle=zhuyin)
    workflow.send_feedback()


if __name__ == "__main__":
    WF = Workflow3(
        default_settings={},
        update_settings={
            "github_slug": "tomy0000000/Alfred-ShuangPin-Convert",
            "frequency": 7,
        },
        help_url="https://git.io/JfjXg",
    )
    sys.exit(WF.run(convert))
Example #13
0
        newPosts = wf.cached_data('new-what-if', get_latest, 3600)
        for item in posts:
            if item not in newPosts:
                newPosts.append(item)
        posts = newPosts
    
    # Loop through the returned posts and add an item for each to
    # the list of results for Alfred
    for post in posts:
        wf.add_item(title=("%d - %s" % (post['num'], post['title'])),
                # subtitle=post['alt'],
                arg="https://what-if.xkcd.com/%d" % post['num'],
                valid=True,
                # quicklookurl=post['img'],
                autocomplete=post['title'],
                icon=ICON_WEB)

    # Send the results to Alfred as XML
    wf.send_feedback()

if __name__ == u"__main__":
    update_settings = {'github_slug': GITHUB_SLUG, 'version': VERSION}
    wf = Workflow3(update_settings=update_settings)
    log = wf.logger
    if wf.update_available:
        wf.add_item(u'New version available',
                    u'Action this item to install the update',
                    autocomplete=u'workflow:update',
                    icon=ICON_INFO)
    sys.exit(wf.run(main))
Example #14
0
    """Run workflow."""
    from docopt import docopt
    args = docopt(USAGE, wf.args, version=wf.version)
    log.debug('args=%r', args)

    if not wf.cached_data_fresh(SITES_KEY, 86400) and not is_running('sites'):
        log.debug(u'Updating list of sites…')
        run_in_background('sites', ('/usr/bin/python', 'so.py', 'cache-sites'))

    if args['search']:
        return do_search(args)

    if args['sites']:
        return do_sites(args)

    if args['cache-sites']:
        return do_cache_sites(args)

    if args['reveal-icon']:
        return do_reveal_icon(args)

    if args['set-default']:
        return do_set_default(args)


if __name__ == '__main__':
    wf = Workflow3(help_url=HELP_URL,
                   update_settings=UPDATE_SETTINGS)
    log = wf.logger
    sys.exit(wf.run(main))
Example #15
0
    def wrapper():
        return lookup(query)

    key = md5(query.encode('utf-8')).hexdigest()

    results = wf.cached_data(key, wrapper, max_age=MAX_CACHE_AGE)

    if not len(results):
        wf.add_item('Nothing found',
                    'Try a different query',
                    icon=ICON_WARNING)

    for d in results:
        it = wf.add_item(d['term'],
                         d['description'],
                         uid=d['url'],
                         arg=d['url'],
                         valid=True,
                         icon='icon.png')

        it.add_modifier('cmd', subtitle=d['url'])

    wf.send_feedback()


if __name__ == '__main__':
    wf = Workflow3(update_settings=UPDATE_SETTINGS, libraries=['./lib'])
    log = wf.logger
    sys.exit(wf.run(main))
Example #16
0
        self.blocks = []
        for d in lst:
            assert len(d) == 1, "Invalid config file"
            try:
                for class_name, args in d.items():
                    self.blocks.append(globals()[class_name](**args))
            except ValueError:
                assert False, "Invalid config arguments"

    def pwgen(self):
        return ''.join([block.pwgen() for block in self.blocks])


def main(wf):
    import requests

    pwgen = Password()
    for _ in range(5):
        pw = pwgen.pwgen()
        wf.add_item(title=pw, arg=pw, subtitle='Copy to clipboard', valid=True)
    wf.add_item(title='Edit config',
                arg="REVEALCONFIGFILE",
                subtitle='Reveal "config.json" in Finder',
                valid=True)
    wf.send_feedback()


if __name__ == '__main__':
    workflow = Workflow3(libraries=['./libs'])
    sys.exit(workflow.run(main))
Example #17
0
                'title': names[v['mode']],
                'subtitle': 'Enabled' if v['enabled'] == 1 else 'Disabled',
                'icon': icons[v['mode']],
                'arg': json.dumps({
                    'command': 'changeMode',
                    'mode': v['mode']
                }),  # noqa
                'valid': True
            }),
            modes)
        self.__out(res)

    @staticmethod
    def exe(argv):
        try:
            s = socket.socket(socket.AF_UNIX)

            s.settimeout(1)
            s.connect(SOCKET_FILENAME)

            flush(s)
            s.sendall(argv)
        except Exception as e:
            print e
        finally:
            s.close()


if __name__ == '__main__':
    Controller(Workflow3()).showMenu()
Example #18
0
    # Show appropriate warning/info message if there are no repos to
    # show/search
    # ------------------------------------------------------------------
    if not repos:
        if is_running('update'):
            wf.add_item(u'Updating list of repos…',
                        'Should be done in a few seconds',
                        icon=ICON_INFO)
            wf.rerun = 0.5
        else:
            wf.add_item('No git repos found',
                        'Check your settings with `reposettings`',
                        icon=ICON_WARNING)
        wf.send_feedback()
        return 0

    # Reload results if `update` is running
    if is_running('update'):
        wf.rerun = 0.5

    return do_search(repos, opts)


if __name__ == '__main__':
    wf = Workflow3(default_settings=DEFAULT_SETTINGS,
                   update_settings=UPDATE_SETTINGS,
                   help_url=HELP_URL)
    log = wf.logger
    sys.exit(wf.run(main))
Example #19
0
# -*- coding: utf-8 -*-
"""Script for Default keyword"""
import sys
import coinc
from workflow import Workflow3
from workflow.util import reload_workflow


def main(workflow):
    """The main workflow entry function"""
    method = str(workflow.args.pop(0))
    if coinc.utils.manual_update_patch(workflow):
        reload_workflow()
        workflow.logger.info("Workflow Reloaded")
    if method in coinc.__all__:
        workflow.run(getattr(coinc, method))
    else:
        workflow.run(coinc.help_me)


if __name__ == "__main__":
    WF = Workflow3(
        default_settings={"favorites": ["EUR", "CNY", "JPY", "GBP"]},
        update_settings={
            "github_slug": "tomy0000000/Coinc",
            "frequency": 7
        },
        help_url="https://git.io/JfjXg")
    sys.exit(WF.run(main))
Example #20
0
    if not is_running('notifier'):
        cmd = ['/usr/bin/python', wf.workflowfile('notifier.py')]
        run_in_background('notifier', cmd)


if __name__ == '__main__':

    icon_active = 'active.png'
    icon_paused = 'paused.png'
    icon_waiting = 'waiting.png'
    icon_complete = 'complete.png'
    icon_deleted = 'deleted.png'
    icon_removed = 'removed.png'
    icon_error = 'error.png'
    icon_download = 'download.png'
    icon_upload = 'upload.png'
    icon_stopped = 'stopped.png'

    defaults = {'rpc_path': 'http://localhost:6800/rpc', 'secret': ''}
    update_settings = {'github_slug': 'Wildog/Ariafred', 'frequency': 1}

    wf = Workflow3(default_settings=defaults, update_settings=update_settings)

    server = None

    if 'secret' not in wf.settings:
        wf.settings['secret'] = ''
    secret = 'token:' + wf.settings['secret']
    wf.rerun = 5
    sys.exit(wf.run(main))
Example #21
0
def main():
    if os.getenv('BY_ALFRED'):
        wf = Workflow3()
        sys.exit(wf.run(main_search_rfc))
    else:
        sys.exit(main_cli())
#!/usr/bin/python

import os, sys
from workflow import Workflow3


def main(wf):
    if sys.argv[1] != '':
        selected_speaker = str(sys.argv[1])
        wf.store_data('speaker_name', selected_speaker)


if __name__ == '__main__':
    wf = Workflow3(libraries=['./lib'])
    sys.exit(wf.run(main))
Example #23
0
                        arg=arg,
                        valid=True,
                        icon=ICON_ERROR)

        elif errorCode == "0":
            isEnglish = check_English(query)
            get_translation(query, isEnglish, rt)
            get_phonetic(query, isEnglish, rt)
            get_explains(query, isEnglish, rt)
            get_web_translation(query, isEnglish, rt)

        else:
            title = '有道也翻译不出来了'
            subtitle = '尝试一下去网站搜索'
            arg = [query, ' ', ' ', ' ']
            arg = '$%'.join(arg)
            wf.add_item(title=title,
                        subtitle=subtitle,
                        arg=arg,
                        valid=True,
                        icon=ICON_DEFAULT)
    wf.send_feedback()


if __name__ == '__main__':
    wf = Workflow3(update_settings={
        'github_slug': 'liszd/whyliam.workflows.youdao',
        'frequency': 7
    })
    sys.exit(wf.run(main))
Example #24
0
 def setUp(self):
     self.wf = Workflow3()
     self.keychain = DummyKeyChain()
     self._stdout = StringIO()
     self._original_stdout = sys.stdout
     sys.stdout = self._stdout
Example #25
0
#!/usr/bin/env python
# coding: utf-8

import asana
from workflow import Workflow3

try:
    personal_access_token = Workflow3().get_password('asana')
    client = asana.Client.access_token(personal_access_token)
    me = client.users.me()
    workspace_id = me['workspaces'][0]['id']
    tasks = {'assignee': 'me', 'workspace': workspace_id}
    fields = ['assignee_status', 'name', 'completed', 'notes']

    i = 0
    for task in client.tasks.find_all(tasks, fields=fields):
        should_show = task['assignee_status'] == 'today'
        should_show &= not task['completed']
        should_show &= not task['name'].endswith(':')
        if should_show:
            if i == 0:
                print task['name']
                print "---"
            i += 1
            print "{}|href=https://app.asana.com/0/1/{}".format(
                task['name'], task['id'])
except:
    print "🤔"
    print "---"
    print "Sorry, something went wrong!"
Example #26
0
def _test_default_directories(data, cache):
    wf3 = Workflow3()
    assert wf3.datadir.startswith(data), "unexpected data directory"
    assert wf3.cachedir.startswith(cache), "unexpected cache directory"
Example #27
0
    file_object = todo_files(arg)

    for filename, file_obj in file_object.todos.items():
        for todo in file_obj['todos']:
            if re.search(r'\[@(\d*.*)\]$', todo):
                todo, todo_time = re.findall(r'(.+)\[@(.*)\]$', todo)[0]
            else:
                todo_time = 'has no record yet.'
            wf.add_item(title=todo,
                        subtitle='{filename} create at: {todo_time}'.format(
                            filename=filename, todo_time=todo_time),
                        arg='{filename}{split}{todo}'.format(filename=filename,
                                                             split=SPLIT,
                                                             todo=todo),
                        icon='new_todo.png',
                        valid=True)

    wf.send_feedback()


if __name__ == '__main__':
    wf = Workflow3(update_settings={
        'github_slug': 'ecmadao/Alfred-TodoList',
        'frequency': 4
    })
    logger = wf.logger
    sys.exit(wf.run(todo_filter))
    if wf.update_available:
        wf.start_update()
Example #28
0
    return
    data = get_cache_weather(workflow)
    if data is not None:
        if "ok" == data["status"]:
            # 显示地址,减少重复显示
            location = ""
            for index in ["admin_area", "parent_city", "location"]:
                if data["basic"][index] not in location:
                    location = "%s-%s" % (location, data["basic"][index])
            location = location.lstrip("-")
            # 当前天气
            today = data["now"]
            title = r"%s 现在 %s" % (location, today["cond_txt"])
            subtitle = r"温度 %s℃ | 湿度 %s%% | 能见度 %sKm | %s %s" % (today["tmp"], today["hum"], today["vis"], today["wind_dir"], today["wind_sc"])
            icon = r"icons/%s.png" % today["cond_code"]
            workflow.add_item(title=title, subtitle=subtitle, valid=False, icon=icon)
            # 未来天气
            for item in data["daily_forecast"]:
                week = get_week(datetime.weekday(datetime.strptime(item["date"], "%Y-%m-%d")))
                title = r"%s %s 白天-%s 夜间-%s" % (location, week, item["cond_txt_d"], item["cond_txt_n"])
                subtitle = r"温度 %s℃~%s℃ | 湿度 %s%% | 能见度 %sKm | %s %s" % (item["tmp_max"], item["tmp_min"], item["hum"], item["vis"], item["wind_dir"], item["wind_sc"])
                icon = r"icons/%s.png" % item["cond_code_d"]
                workflow.add_item(title=title, subtitle=subtitle, valid=False, icon=icon)
        else:
            workflow.add_item(r"暂没有 '%s' 的信息" % search, icon=ICON_ERROR)
    workflow.send_feedback()

if __name__ == "__main__":
    workflow = Workflow3()
    sys.exit(workflow.run(main))
Example #29
0
    receiver = eiscp.eISCP(workflow.settings['receiver_host'])

    if action in ['off', 'on']:
        receiver.command('power %s' % action)

    elif action == 'net':
        if value in ['pause', 'play']:
            receiver.command('network-usb %s' % value)
        elif value == 'next-track':
            receiver.command('network-usb trup')
        elif value == 'previous-track':
            receiver.command('network-usb trdn')

    elif action == 'source':
        receiver.command('source %s' % value)

    elif action == 'volume':
        if value.isdigit():
            receiver.command('volume %d' % int(value))
        elif value in ['down', 'up']:
            receiver.command('volume level-%s' % value)
        elif value == 'mute':
            receiver.command('audio-muting toggle')

    receiver.disconnect()


if __name__ == '__main__':
    workflow = Workflow()
    sys.exit(workflow.run(main))
			results = loadSearchResults(query)

			if results is not None:
				parseSearchResults(results)
		else:
			suggestions = loadSuggestions(query)

			wf.add_item(
				title=query,
				arg=query,
				valid=True,
				icon="blank.png"
			)

			if (suggestions is not None and len(suggestions[1])):
				parseSuggestions(suggestions)

	wf.send_feedback()

if __name__ == u"__main__":
	wf = Workflow3(update_settings={"github_slug": "snewman205/audisearch-for-alfred"})
	coverArtDir = wf.cachedir + "/coverart/"
	if wf.update_available:
		wf.add_item(
			title="New version available",
			subtitle="Click to install the update now.",
			autocomplete="workflow:update",
			icon=ICON_INFO
		)

	sys.exit(wf.run(main))
Example #31
0
      autocomplete='workflow:update',
      icon=ICON_INFO
    )

  # Add password items
  wf.add_item('%d character password' % password_length, full_pw, valid=True, arg=full_pw)
  wf.add_item('%d character password (no special characters)' % password_length, alnum_pw, valid=True, arg=alnum_pw)
  wf.add_item('XKCD Password (3 words)', xkcd_3, valid=True, arg=xkcd_3)
  wf.add_item('XKCD Password (4 words)', xkcd_4, valid=True, arg=xkcd_4)

  # Send output to Alfred.
  wf.send_feedback()
  return 0

if __name__ == '__main__':
  # Create a global `Workflow` object
  workflow3 = Workflow(
    libraries=['./lib'], update_settings={
      'github_slug': 'otherguy/alfred-passwords-workflow',
      'frequency': 1, # every day
    },
    help_url='https://github.com/otherguy/alfred-passwords-workflow'
  )

  workflow3.magic_prefix = 'wf:'

  # Call your entry function via `Workflow.run()` to enable its helper
  # functions, like exception catching, ARGV normalization, magic
  # arguments etc.
  sys.exit(workflow3.run(main))