added alfred_do_get_week.py to handle XML conversion to Alfred
This commit is contained in:
parent
9eb80cf402
commit
532bcd527f
26
alfred_do_get_week.py
Executable file
26
alfred_do_get_week.py
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import sys
|
||||||
|
import get_week
|
||||||
|
from workflow import Workflow
|
||||||
|
from requests.exceptions import ConnectionError
|
||||||
|
|
||||||
|
|
||||||
|
def main(wf):
|
||||||
|
num = None
|
||||||
|
subtt = u''
|
||||||
|
try:
|
||||||
|
num = str(get_week.get_week())
|
||||||
|
title = u'Épp {}.'.format(num)
|
||||||
|
subtt = u'hét van!'
|
||||||
|
except ConnectionError:
|
||||||
|
title = u'Nincs internet!'
|
||||||
|
except (IndexError, RuntimeError):
|
||||||
|
title = u'A KTH összebarmolta a honlapját!'
|
||||||
|
except EnvironmentError:
|
||||||
|
title = u'Nyár van, nyugi!'
|
||||||
|
wf.add_item(title=title, subtitle=subtt, arg=num, valid=True)
|
||||||
|
wf.send_feedback()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
wf = Workflow()
|
||||||
|
sys.exit(wf.run(main))
|
Loading…
Reference in New Issue
Block a user