Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit 7d58914

Browse files
Adpot APIv0.4 changes
1 parent 674fcff commit 7d58914

49 files changed

Lines changed: 387 additions & 621 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.archive/bitfinex/__init__.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
from collections import namedtuple
1616
from threading import Thread, Event
1717

18-
__iid__ = "PythonInterface/v0.1"
19-
__prettyname__ = "BitFinex"
20-
__version__ = "1.0"
21-
__trigger__ = "bfx "
22-
__author__ = "Manuel Schneider"
23-
__dependencies__ = []
18+
__title__ = "BitFinex"
19+
__version__ = "0.4.0"
20+
__triggers__ = "bfx "
21+
__authors__ = "manuelschneid3r"
2422

2523
iconPath = os.path.dirname(__file__) + "/Bitfinex.svg"
2624
symbolsEndpoint = "https://api.bitfinex.com/v1/symbols"
@@ -74,11 +72,11 @@ def finalize():
7472
def makeItem(market):
7573
url = tradeUrl % (market.base, market.quote)
7674
return Item(
77-
id="%s_%s%s" % (__prettyname__, market.base, market.quote),
75+
id="%s_%s%s" % (__title__, market.base, market.quote),
7876
icon=iconPath,
7977
text="%s/%s" % (market.base, market.quote),
8078
subtext="Open the %s/%s market on bitfinex.com" % (market.base, market.quote),
81-
completion="%s%s%s" % (__trigger__, market.base, market.quote),
79+
completion="%s%s%s" % (__trigger_s_, market.base, market.quote),
8280
actions=[
8381
UrlAction("Show market in browser", url),
8482
ClipAction('Copy URL to clipboard', url)

.archive/coinmarketcap/__init__.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
import os
1717
import json
1818

19-
__iid__ = "PythonInterface/v0.2"
20-
__prettyname__ = "CoinMarketCap"
21-
__version__ = "1.4"
22-
__trigger__ = "cmc "
23-
__author__ = "Manuel Schneider"
24-
__dependencies__ = []
19+
__title__ = "CoinMarketCap"
20+
__version__ = "0.4.4"
21+
__triggers__ = "cmc "
22+
__authors__ = "manuelschneid3r"
2523

2624
iconPath = os.path.dirname(__file__)+"/emblem-money.svg"
2725
thread = None
@@ -124,7 +122,7 @@ def handleQuery(query):
124122
if coin.name.lower().startswith(stripped) or coin.symbol.lower().startswith(stripped):
125123
url = "https://coinmarketcap.com/currencies/%s/" % coin.identifier
126124
items.append(Item(
127-
id=__prettyname__,
125+
id=__title__,
128126
icon=iconPath,
129127
text="#%s %s <i>(%s) <b>%s$</b></i>" % (coin.rank, pattern.sub(lambda m: "<u>%s</u>" % m.group(0), coin.name),
130128
pattern.sub(lambda m: "<u>%s</u>" % m.group(0), coin.symbol), coin.price),
@@ -139,7 +137,7 @@ def handleQuery(query):
139137
for coin in coins:
140138
url = "https://coinmarketcap.com/currencies/%s/" % coin.identifier
141139
items.append(Item(
142-
id=__prettyname__,
140+
id=__title__,
143141
icon=iconPath,
144142
text="#%s %s <i>(%s) <b>%s$</b></i>" % (coin.rank, coin.name, coin.symbol, coin.price),
145143
subtext="Change: <i>%s/%s/%s</i>, Cap: <i>%s</i>, Volume: <i>%s</i>" % (coin.change_hour, coin.change_day, coin.change_week, coin.cap, coin.vol),

.archive/dango_emoji/__init__.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@
1717
from urllib.parse import urlencode
1818

1919

20-
__iid__ = "PythonInterface/v0.2"
21-
__prettyname__ = "Dango Emoji"
22-
__version__ = "1.1"
23-
__trigger__ = ":"
24-
__author__ = "David Britt"
25-
__dependencies__ = []
20+
__title__ = "Dango Emoji"
21+
__version__ = "0.4.1"
22+
__triggers__ = ":"
23+
__authors__ = "David Britt"
2624

2725

2826
iconPath = os.path.dirname(__file__) + "/dangoemoji.png"
@@ -35,11 +33,9 @@ def handleQuery(query):
3533
if query.isTriggered:
3634

3735
item = Item(
38-
id=__prettyname__,
36+
id=__title__,
3937
icon=icon_path,
40-
completion=query.rawString,
41-
text=__prettyname__,
42-
actions=[]
38+
text=__title__
4339
)
4440

4541
if len(query.string) >= 2:
@@ -58,7 +54,7 @@ def handleQuery(query):
5854
string_emojis = ''.join(all_emojis)
5955

6056
results.append(Item(
61-
id=__prettyname__,
57+
id=__title__,
6258
icon=icon_path,
6359
text=string_emojis,
6460
subtext="Score > 0.025",
@@ -70,7 +66,7 @@ def handleQuery(query):
7066

7167
for emoj in json_data["results"]:
7268
results.append(Item(
73-
id=__prettyname__,
69+
id=__title__,
7470
icon=icon_path,
7571
text=str(emoj["text"]),
7672
subtext=str(emoj["score"]),

.archive/dango_kao/__init__.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
from urllib.request import urlopen, Request
1515
from urllib.parse import urlencode
1616

17-
__iid__ = "PythonInterface/v0.2"
18-
__prettyname__ = "Dango Kaomoji"
19-
__version__ = "1.0"
20-
__trigger__ = "kao "
21-
__author__ = "David Britt"
22-
__dependencies__ = []
17+
__title__ = "Dango Kaomoji"
18+
__version__ = "0.4.0"
19+
__triggers__ = "kao "
20+
__authors__ = "David Britt"
2321

2422
icon_path = os.path.dirname(__file__) + "/kaoicon.svg"
2523
dangoUrl = "https://customer.getdango.com/dango/api/query/kaomoji"
@@ -31,11 +29,9 @@ def handleQuery(query):
3129
if query.isTriggered:
3230

3331
item = Item(
34-
id=__prettyname__,
32+
id=__title__,
3533
icon=icon_path,
36-
completion=query.rawString,
37-
text=__prettyname__,
38-
actions=[]
34+
text=__title__,
3935
)
4036

4137
if len(query.string) >= 2:
@@ -45,7 +41,7 @@ def handleQuery(query):
4541
json_data = json.loads(response.read().decode())
4642
for emoj in json_data["items"]:
4743
results.append(Item(
48-
id=__prettyname__,
44+
id=__title__,
4945
icon=icon_path,
5046
text=emoj["text"],
5147
actions=[

api_test/__init__.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
from time import sleep
1515

1616

17-
__iid__ = "PythonInterface/v0.1"
18-
__prettyname__ = "Api Test"
19-
__version__ = "1.0"
20-
__trigger__ = "test "
21-
__author__ = "Manuel Schneider"
22-
__dependencies__ = ["whatever"]
17+
__title__ = "Api Test"
18+
__version__ = "0.4.2"
19+
__triggers__ = "test "
20+
__authors__ = "manuelschneid3r"
21+
#__exec_deps__ = ["whatever"]
2322

2423
iconPath = iconLookup("albert")
2524

@@ -45,7 +44,7 @@ def handleQuery(query):
4544

4645
if query.string.startswith("delay"):
4746
sleep(2)
48-
return Item(id=__prettyname__,
47+
return Item(id=__title__,
4948
icon=os.path.dirname(__file__)+"/plugin.svg",
5049
text="Delayed test item",
5150
subtext="Query string: %s" % query.string)
@@ -71,7 +70,7 @@ def handleQuery(query):
7170
item.icon = iconPath
7271
item.text = 'Python item containing %s' % query.string
7372
item.subtext = 'Python description'
74-
item.completion = __trigger__ + 'Completion Harharhar'
73+
item.completion = __triggers__ + 'Completion Harharhar'
7574
item.urgency = ItemBase.Notification # Alert, Normal
7675
info(item.icon)
7776
info(item.text)
@@ -83,11 +82,11 @@ def function(): info(query.string)
8382
item.addAction(FuncAction("Print warning", lambda: warning(query.string)))
8483
results.append(item)
8584

86-
item = Item(id=__prettyname__,
85+
item = Item(id=__title__,
8786
icon=os.path.dirname(__file__)+"/plugin.svg",
8887
text="This is the primary text",
8988
subtext="This is the subtext, some kind of description",
90-
completion=__trigger__ + 'Hellooohooo!',
89+
completion=__triggers__ + 'Hellooohooo!',
9190
urgency=ItemBase.Alert,
9291
actions=[
9392
FuncAction(text="FuncAction",
@@ -98,10 +97,14 @@ def function(): info(query.string)
9897
url="https://www.google.de"),
9998
ProcAction(text="ProcAction",
10099
commandline=["espeak", "hello"],
101-
cwd="~"), # optional
100+
cwd="~"),
102101
TermAction(text="TermAction",
103102
commandline=["sleep", "5"],
104-
cwd="~/git") # optional
103+
cwd="~/git"),
104+
TermAction(text="TermAction",
105+
script="[ -e issue ] && cat issue | echo /etc/issue not found.",
106+
behavior=TermAction.CloseBehavior.DoNotClose,
107+
cwd="/etc")
105108
])
106109
results.append(item)
107110

arch_wiki/__init__.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,10 @@
99
import json
1010
import os
1111

12-
__iid__ = "PythonInterface/v0.3"
13-
__prettyname__ = "Arch Wiki"
14-
__version__ = "1.1"
15-
__trigger__ = "awiki "
16-
__author__ = "Manuel Schneider"
17-
__dependencies__ = []
12+
__title__ = "Arch Wiki"
13+
__version__ = "0.4.1"
14+
__triggers__ = "awiki "
15+
__authors__ = "manuelschneid3r"
1816

1917
iconPath = os.path.dirname(__file__) + "/ArchWiki.svg"
2018
baseurl = 'https://wiki.archlinux.org/api.php'
@@ -48,7 +46,7 @@ def handleQuery(query):
4846
summary = data[2][i]
4947
url = data[3][i]
5048

51-
results.append(Item(id=__prettyname__,
49+
results.append(Item(id=__title__,
5250
icon=iconPath,
5351
text=title,
5452
subtext=summary if summary else url,
@@ -60,16 +58,14 @@ def handleQuery(query):
6058
if results:
6159
return results
6260

63-
return Item(id=__prettyname__,
61+
return Item(id=__title__,
6462
icon=iconPath,
6563
text="Search '%s'" % query.string,
6664
subtext="No results. Start a online search on Arch Wiki",
67-
completion=query.rawString,
6865
actions=[UrlAction("Open search", "https://wiki.archlinux.org/index.php?search=%s" % query.string)])
6966

7067
else:
71-
return Item(id=__prettyname__,
68+
return Item(id=__title__,
7269
icon=iconPath,
73-
text=__prettyname__,
74-
subtext="Enter a query to search on the Arch Wiki",
75-
completion=query.rawString)
70+
text=__title__,
71+
subtext="Enter a query to search on the Arch Wiki")

atom_projects/__init__.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,19 @@
88
import re
99
import time
1010
from pathlib import Path
11-
from shutil import which
1211

1312
import cson
1413

1514
from albert import *
1615

17-
__iid__ = "PythonInterface/v0.1"
18-
__prettyname__ = "Atom Projects"
19-
__version__ = "1.0"
20-
__trigger__ = "atom "
21-
__author__ = "Manuel Schneider"
22-
__dependencies__ = ["python-cson"]
16+
__title__ = "Atom Projects"
17+
__version__ = "0.4.0"
18+
__triggers__ = "atom "
19+
__authors__ = "manuelschneid3r"
20+
__exec_deps__ = ["atom"]
21+
__py_deps__ = ["cson"]
2322

2423
projects_file = str(Path.home()) + "/.atom/projects.cson"
25-
26-
if which("atom") is None:
27-
raise Exception("'atom' is not in $PATH.")
28-
2924
iconPath = iconLookup('atom')
3025
mtime = 0
3126
projects = []
@@ -55,11 +50,10 @@ def handleQuery(query):
5550
items = []
5651
for project in projects:
5752
if re.search(stripped, project['title'], re.IGNORECASE):
58-
items.append(Item(id=__prettyname__ + project['title'],
53+
items.append(Item(id=__title__ + project['title'],
5954
icon=iconPath,
6055
text=project['title'],
6156
subtext="Group: %s" % (project['group'] if 'group' in project else "None"),
62-
completion=query.rawString,
6357
actions=[
6458
ProcAction(text="Open project in Atom",
6559
commandline=["atom"] + project['paths'])

aur/__init__.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@
1010
from albert import *
1111
from shutil import which
1212
from datetime import datetime
13-
from shlex import split
1413
from urllib import request, parse
1514
import json
1615
import os
1716
import re
1817

19-
__iid__ = "PythonInterface/v0.3"
20-
__prettyname__ = "Archlinux User Repository"
21-
__version__ = "1.3"
22-
__trigger__ = "aur "
23-
__author__ = "manuelschneid3r"
24-
__dependencies__ = []
18+
__title__ = "Archlinux User Repository"
19+
__version__ = "0.4.3"
20+
__triggers__ = "aur "
21+
__authors__ = "manuelschneid3r"
2522

2623
iconPath = os.path.dirname(__file__)+"/arch.svg"
2724
baseurl = 'https://aur.archlinux.org/rpc/'
@@ -56,11 +53,10 @@ def handleQuery(query):
5653
data = json.loads(response.read().decode())
5754
if data['type'] == "error":
5855
return Item(
59-
id=__prettyname__,
56+
id=__title__,
6057
icon=iconPath,
6158
text="Error",
62-
subtext=data['error'],
63-
completion=query.rawString
59+
subtext=data['error']
6460
)
6561
else:
6662
results = []
@@ -72,10 +68,10 @@ def handleQuery(query):
7268
for entry in results_json:
7369
name = entry['Name']
7470
item = Item(
75-
id = __prettyname__,
71+
id = __title__,
7672
icon = iconPath,
7773
text = "<b>%s</b> <i>%s</i> (%s)" % (pattern.sub(lambda m: "<u>%s</u>" % m.group(0), name), entry['Version'], entry['NumVotes']),
78-
completion = "%s%s" % (__trigger__, name)
74+
completion = "%s%s" % (__triggers__, name)
7975
)
8076
subtext = entry['Description'] if entry['Description'] else "[No description]"
8177
if entry['OutOfDate']:
@@ -85,9 +81,11 @@ def handleQuery(query):
8581
item.subtext = subtext
8682

8783
if install_cmdline:
88-
tokens = split(install_cmdline % name)
89-
item.addAction(TermAction("Install with %s" % tokens[0], tokens))
90-
item.addAction(TermAction("Install with %s (noconfirm)" % tokens[0], tokens + ["--noconfirm"]))
84+
pkgmgr = install_cmdline.split(" ", 1)
85+
item.actions = [
86+
TermAction("Install using %s" % pkgmgr[0], install_cmdline % name),
87+
TermAction("Install using %s (noconfirm)" % pkgmgr[0], install_cmdline % name + " --noconfirm")
88+
]
9189

9290
item.addAction(UrlAction("Open AUR website", "https://aur.archlinux.org/packages/%s/" % name))
9391

@@ -97,9 +95,8 @@ def handleQuery(query):
9795
results.append(item)
9896
return results
9997
else:
100-
return Item(id=__prettyname__,
98+
return Item(id=__title__,
10199
icon=iconPath,
102-
text=__prettyname__,
100+
text=__title__,
103101
subtext="Enter a query to search the AUR",
104-
completion=query.rawString,
105102
actions=[UrlAction("Open AUR packages website", "https://aur.archlinux.org/packages/")])

0 commit comments

Comments
 (0)