Skip to content

Commit 05a94dd

Browse files
authored
new stuff (#1251)
* scripts: proper dollar sign escaping * new icon: OneBit Adventure * icon update: Beeline * new icon: NF (Народный фронт) * new icon: Termux Fingerprint * new icon: Neftmagistral * new icon: BAZAR * requests_parser: show 100% match entry if package id from request's compinfo matches appfilter.xml entry) * add compinfos by new matching feature
1 parent f4b752d commit 05a94dd

File tree

19 files changed

+367
-17
lines changed

19 files changed

+367
-17
lines changed

.github/scripts/add_icons.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ def verb(text=False, code=0):
248248
appfilter_entries = []
249249
for compinfo in compinfos:
250250
appfilter_entry = f'<item component="ComponentInfo{{{compinfo}}}" drawable="{name}" />'
251-
if not re.search(appfilter_entry, content):
251+
compinfo_pattern = appfilter_entry.replace('$', '\\$')
252+
if not re.search(compinfo_pattern, content):
252253
appfilter_entries.append(appfilter_entry)
253254
replace += f'\t{appfilter_entry}\n'
254255
if appfilter_entries:

.github/scripts/add_icons_wrapper.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
icons = [(key, value) for key, value in icons_yml.items()]
6363

6464

65-
command_base = f'python {add_icons} -P {delta_dir} -aidI'
65+
command_base = f"python '{add_icons}' -P '{delta_dir}' -aidI"
6666

6767
if options.dry_run: command_base += ' -D'
6868

@@ -90,19 +90,19 @@
9090
exit(2)
9191

9292

93-
command = f'{command_base} -n {name}'
93+
command = f"{command_base} -n '{name}'"
9494

9595
if compinfos:
96-
command += ' -c ' + ' '.join(compinfos)
9796
for compinfo in compinfos:
97+
command += f" -c '{compinfo}'"
9898
if compinfo in requests:
9999
requests.pop(compinfo)
100100
else:
101101
if re.match('^.*_alt_[0-9]+$', name):
102102
category = 'Alts'
103103

104-
if category: command += f' -C {quote(category)}'
105-
104+
if category: command += f" -C '{quote(category)}'"
105+
print(command)
106106

107107
print(f'[icon] {name}')
108108
status = execute(f'{command}')

.github/scripts/requests_parser.py

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import xml.etree.ElementTree as ET
55
from datetime import datetime
66
from difflib import SequenceMatcher
7+
from copy import deepcopy as copy
78

89
import yaml
910
from natsort import natsorted as sorted
@@ -35,6 +36,10 @@ def increase_indent(self, flow=False, indentless=False):
3536
help=f'remove existing compinfos from {filename}',
3637
default=False,
3738
action=argparse.BooleanOptionalAction)
39+
parser.add_argument('-R', '--ratio',
40+
dest='ratio',
41+
help=f'custom ratio from 0.5 to 1.0',
42+
default=0.75)
3843
parser.add_argument('-s', '--sort',
3944
dest='sort',
4045
help='sort by specific value',
@@ -70,27 +75,37 @@ def write(path, data):
7075

7176
def main():
7277
requests = read(paths['requests'])
78+
requests_copy = copy(requests)
79+
7380
updatable = {}
7481

82+
RATIO = float(args.ratio) if 0.5 <= float(args.ratio) <= 1.0 else 0.75
83+
7584
with open(paths['appfilter'][0], 'r') as file:
7685
appfilter = ET.ElementTree(ET.fromstring(file.read())).getroot()
7786

7887
for item in appfilter:
7988
try:
8089
compinfo = re.search('ComponentInfo{(.*)}', item.attrib['component']).group(1)
81-
id = compinfo.split('/')[0]
90+
id, activity = compinfo.split('/')
8291
name = item.attrib['drawable']
8392

84-
for request in requests:
93+
for request in requests_copy:
8594
if id not in request: continue
86-
diff = SequenceMatcher(None, request, compinfo).ratio()
87-
ratio = round(diff, 2)
8895

89-
if ratio == 1.0:
90-
requests.pop(compinfo)
91-
continue
96+
ratio = 0.0
97+
98+
if request.startswith(id + '/'):
99+
ratio = 1.0
100+
else:
101+
diff = SequenceMatcher(None, request, compinfo).ratio()
102+
ratio = round(diff, 2)
103+
104+
if ratio >= RATIO:
105+
106+
if ratio == 1.0:
107+
requests.pop(request)
92108

93-
if ratio >= 0.75:
94109
if request in updatable:
95110
if updatable[request]['ratio'] < ratio:
96111
ratio = updatable[request]['ratio']
@@ -100,6 +115,7 @@ def main():
100115
'ratio': ratio,
101116
'request': request
102117
}
118+
103119
except:
104120
continue
105121

app/src/main/assets/drawable.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
<item drawable="bbc_sounds_alt_1" />
200200
<item drawable="bbc_sport_alt_1" />
201201
<item drawable="bbc_weather_alt_1" />
202+
<item drawable="beeline_alt_1" />
202203
<item drawable="bergfex_alt_1" />
203204
<item drawable="bilibili_alt_1" />
204205
<item drawable="binance_alt_1" />
@@ -3446,7 +3447,6 @@
34463447
<item drawable="beautyxt" />
34473448
<item drawable="becu" />
34483449
<item drawable="beebom" />
3449-
<item drawable="beeline" />
34503450
<item drawable="beem_it" />
34513451
<item drawable="beep" />
34523452
<item drawable="beeper" />
File renamed without changes.

app/src/main/res/xml/drawable.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
<item drawable="bbc_sounds_alt_1" />
200200
<item drawable="bbc_sport_alt_1" />
201201
<item drawable="bbc_weather_alt_1" />
202+
<item drawable="beeline_alt_1" />
202203
<item drawable="bergfex_alt_1" />
203204
<item drawable="bilibili_alt_1" />
204205
<item drawable="binance_alt_1" />
@@ -3446,7 +3447,6 @@
34463447
<item drawable="beautyxt" />
34473448
<item drawable="becu" />
34483449
<item drawable="beebom" />
3449-
<item drawable="beeline" />
34503450
<item drawable="beem_it" />
34513451
<item drawable="beep" />
34523452
<item drawable="beeper" />

0 commit comments

Comments
 (0)