-
Notifications
You must be signed in to change notification settings - Fork 0
/
org.albert.extension.external.banking.py
executable file
·86 lines (64 loc) · 2 KB
/
org.albert.extension.external.banking.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env python
import os
import sys
import json
albert_op = os.environ.get("ALBERT_OP")
if albert_op == "METADATA":
metadata="""{
"iid":"org.albert.extension.external/v2.0",
"name":"Banking",
"version":"1.0",
"author":"Manuel Schneider",
"dependencies":[],
"trigger":"bank"
}"""
print(metadata)
sys.exit(0)
elif albert_op == "NAME":
print(IBAN)
sys.exit(0)
elif albert_op == "INITIALIZE":
sys.exit(0)
elif albert_op == "FINALIZE":
sys.exit(0)
elif albert_op == "SETUPSESSION":
sys.exit(0)
elif albert_op == "SETUPSESSION":
sys.exit(0)
elif albert_op == "TEARDOWNSESSION":
sys.exit(0)
elif albert_op == "QUERY":
albert_query = os.environ.get("ALBERT_QUERY")
class Object(object):
pass
items = []
#--------------------------- ADJUST THIS BLOCK -----------------------------
item = Object()
item.id = "bank_account"
item.name = "Bank account"
item.description = "Bank account (78788098)"
item.icon = "accessories-calculator"
item.actions = []
# The things you want the action to copy to cb
actionData = {
"IBAN":"DE0587857857857856785557",
"BIC":"GENODE5867867867ko58",
"KNR":"586785678567",
"BLZ":"5856785" }
for key, value in actionData.items():
action = Object()
action.command = "sh"
action.name = "Copy {} to clipboard".format(key)
action.arguments = ["-c", 'echo -n "{0}" | xclip -i; echo -n "{0}" | xclip -i -selection clipboard;'.format(value)]
item.actions.append(action)
items.append(item)
# You can add furter accounts here, just copy the block above
#---------------------------------------------------------------------------
results = []
for it in items:
results += [json.dumps(item, default=lambda o: o.__dict__)]
print('{"items": [' + ", ".join(results) + "]}")
sys.exit(0)
elif albert_op == "COPYTOCLIPBOARD":
clipboard.copy(sys.argv[1])
sys.exit(0)