Jump to content

quinoa42

Member
  • Posts

    1
  • Joined

  • Last visited

Everything posted by quinoa42

  1. Hi deanishe, I'm new here and I'm trying to write a workflow for http://bgm.tv, based on the tutorial, and here's my code: #!/usr/bin/env python # -*- coding: utf-8 -*- import sys from workflow import ICON_WEB, Workflow3, web def get_search_result(query): """TODO: Docstring for get_search_result. :query: TODO :returns: TODO """ url = u'https://api.bgm.tv/search/subject/' + query params = {'responseGroup': 'simple', 'max_results': '11', 'start': '0'} r = web.get(url, params) r.raise_for_status() result = r.json() return result['list'] def main(wf): query = wf.args[0] items = wf.cached_data( 'result:' + query, lambda: get_search_result(query), max_age=600 ) for item in items: wf.add_item( title=item['name'], subtitle=item['name_cn'], arg=item['url'], valid=True, icon=ICON_WEB ) wf.send_feedback() if __name__ == u"__main__": wf = Workflow3() logger = wf.logger sys.exit(wf.run(main)) It works pretty well in my terminal when I call things like /bin/bash python bangumi.py "銀魂" However, every time I try call it in Alfred, I received these messages in the log: [2017-09-14 20:53:20][input.scriptfilter] Queuing argument '銀魂' [2017-09-14 20:53:20][input.scriptfilter] Script with argument '(null)' finished Could you help me please? And is there a way to log things to the log console in Alfred? I tried logging to wf.logger but nothing shows there. ------------------------------------------------------------ UPDATE: Nevermind, I just noticed that since I used sync utility, the path to the directory of my workflows has changed, but I was still editing in the previous location. Thanks for this great package anyway!
×
×
  • Create New...