Skip to content

Commit 815cb0d

Browse files
authored
new stuff (#923)
* new icons by johnmaneca; add missing and fix others * .gitignore: add *.aab * build.gradle: change output filename * build.gradle: bump CandyBar versions to 3.20.2 * update contributed icons * a lot scripts changes
1 parent fb340f4 commit 815cb0d

File tree

108 files changed

+1612
-369
lines changed

Some content is hidden

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

108 files changed

+1612
-369
lines changed

.github/scripts/add_icons_wrapper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from os import system as execute
44
from os import name as platform
5-
from os.path import abspath, basename, dirname, realpath
5+
from os.path import basename
66

77
from natsort import natsorted as sorted
88
from yaml import safe_load as yaml

.github/scripts/bump_version.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
#!/usr/bin/env python3
1+
#! /usr/bin/env python
22

33
import argparse, re
44

5+
from os.path import join
6+
57
from resolve_paths import paths
68

79

810
argparser = argparse.ArgumentParser(description='Bump release version')
9-
argparser.add_argument('-t', dest='type',
10-
help='type of release [beta|prod]',
11-
default='beta')
11+
argparser.add_argument('-t', '--type',
12+
dest='type',
13+
help='type of release [beta|prod]',
14+
default='beta')
15+
argparser.add_argument('-p', '--print',
16+
dest='print',
17+
help='print variables for shell exporting',
18+
default=False,
19+
action=argparse.BooleanOptionalAction)
1220
args = argparser.parse_args()
1321

1422

15-
target = paths['root'] + '/app/build.gradle'
23+
target = join(paths['root'], 'app/build.gradle')
1624

1725
regexp_version_code = re.compile('versionCode (\d+)')
1826
regexp_version_name = re.compile('versionName "((\d+\.\d+\.\d+)(-beta(\d+))?)"')
@@ -62,6 +70,7 @@
6270
file.write(content)
6371
file.truncate()
6472

73+
if args.print:
6574
print(f'is_beta={is_beta}')
6675
print(f'filename=delta-v{version_name}')
6776
print(f'version=v{version_name}')

.github/scripts/email_dumper.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,37 @@
44

55
from datetime import datetime
66
from os import mkdir
7-
from os.path import dirname, exists, realpath
7+
from os.path import exists
88

99
from redbox import EmailBox as redbox
1010

1111

1212
parser = argparse.ArgumentParser(description='Dump a IMAP folder into .eml files')
13-
parser.add_argument('-s',
13+
parser.add_argument('-s', '--host',
1414
dest='host',
1515
help='IMAP host',
1616
default='imap.gmail.com')
17-
parser.add_argument('-P',
17+
parser.add_argument('-P', '--port',
1818
dest='port',
1919
help='IMAP port',
2020
default=993)
21-
parser.add_argument('-u',
21+
parser.add_argument('-u', '--username',
2222
dest='username',
2323
help='IMAP username',
2424
required=True)
25-
parser.add_argument('-p',
25+
parser.add_argument('-p', '--password',
2626
dest='password',
2727
help='IMAP password',
2828
required=True)
29-
parser.add_argument('-r',
29+
parser.add_argument('-r', '--remote',
3030
dest='remote',
3131
help='Remote folder to download',
3232
default='INBOX')
33-
parser.add_argument('-l',
33+
parser.add_argument('-l', '--local',
3434
dest='local',
3535
help='Local folder where to save .eml files',
3636
default=f'emails')
37-
parser.add_argument('-U',
37+
parser.add_argument('-U', '--unread',
3838
dest='unread',
3939
help='Keep emails unread in the inbox',
4040
default=False,

.github/scripts/email_parser.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
#!/usr/bin/env python3
22

3-
import argparse
43
import base64
54
import copy
65
import io
76
import re
87
import os
98

10-
from datetime import datetime, timedelta
9+
from datetime import datetime
1110
from hashlib import sha1
1211
from zipfile import ZipFile
1312

.github/scripts/find_updatable.py

-84
This file was deleted.

.github/scripts/requests_parser.py

+96-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#!/usr/bin/env python3
22

3+
import argparse, re, sys
4+
import xml.etree.ElementTree as ET
35
from datetime import datetime
6+
from difflib import SequenceMatcher
47

58
import yaml
6-
79
from natsort import natsorted as sorted
810

11+
from resolve_paths import paths
12+
913

10-
class CustomDumper(yaml.SafeDumper):
14+
class YamlNewLines(yaml.SafeDumper):
1115
# https://github.com/yaml/pyyaml/issues/127#issuecomment-525800484
1216
def write_line_break(self, data=None):
1317
super().write_line_break(data)
@@ -17,6 +21,31 @@ def write_line_break(self, data=None):
1721
def increase_indent(self, flow=False, indentless=False):
1822
return super().increase_indent(flow, False)
1923

24+
filename = 'requests.yml'
25+
26+
27+
parser = argparse.ArgumentParser(description=f'parse {filename}')
28+
29+
parser.add_argument('-f', '--format',
30+
dest='format',
31+
choices=['xml', 'yml'],
32+
help='output in specific format')
33+
parser.add_argument('-r', '--remove',
34+
dest='remove',
35+
help=f'remove existing compinfos from {filename}',
36+
default=False,
37+
action=argparse.BooleanOptionalAction)
38+
parser.add_argument('-s', '--sort',
39+
dest='sort',
40+
help='sort by specific value',
41+
choices=['name', 'ratio', 'request'],
42+
default='ratio')
43+
parser.add_argument('-H', '--hide-ratios',
44+
dest='hide_ratios',
45+
help='hide ratios in output',
46+
default=False,
47+
action=argparse.BooleanOptionalAction)
48+
2049

2150
def read(path):
2251
with open(path, 'r+') as file:
@@ -34,7 +63,71 @@ def write(path, data):
3463
# header message with total number of requested icons and last time update
3564
header = (f"# {len(data)} requested apps pending \n"
3665
f"# updated {datetime.today().strftime('%Y-%m-%d %H:%M:%S')}\n\n")
37-
dump = yaml.dump(data, Dumper=CustomDumper, allow_unicode=True, indent=4, sort_keys=False)
66+
dump = yaml.dump(data, Dumper=YamlNewLines, allow_unicode=True, indent=4, sort_keys=False)
3867
file.seek(0)
3968
file.write(header + dump)
4069
file.truncate()
70+
71+
def main():
72+
requests = read(paths['requests'])
73+
updatable = {}
74+
75+
with open(paths['appfilter'][0], 'r') as file:
76+
appfilter = ET.ElementTree(ET.fromstring(file.read())).getroot()
77+
78+
for item in appfilter:
79+
try:
80+
compinfo = re.search('ComponentInfo{(.*)}', item.attrib['component']).group(1)
81+
id = compinfo.split('/')[0]
82+
name = item.attrib['drawable']
83+
84+
for request in requests:
85+
if id not in request: continue
86+
diff = SequenceMatcher(None, request, compinfo).ratio()
87+
ratio = round(diff, 2)
88+
89+
if ratio == 1.0:
90+
requests.pop(compinfo)
91+
continue
92+
93+
if ratio >= 0.75:
94+
if request in updatable:
95+
if updatable[request]['ratio'] < ratio:
96+
ratio = updatable[request]['ratio']
97+
98+
updatable[request] = {
99+
'name': name,
100+
'ratio': ratio,
101+
'request': request
102+
}
103+
except:
104+
continue
105+
106+
updatable = dict(sorted(updatable.items(), key=lambda x: x[1][args.sort]))
107+
108+
if args.remove:
109+
write(paths['requests'], requests)
110+
111+
for [key, value] in updatable.items():
112+
name = value['name']
113+
ratio = int(value['ratio'] * 100)
114+
115+
match args.format:
116+
case 'xml':
117+
ratios = f'<!-- {ratio}% --> ' if not args.hide_ratios else ''
118+
print(ratios + f'<item component="ComponentInfo{{{key}}}" drawable="{name}" />')
119+
case 'yml':
120+
ratios = f' # {ratio}%' if not args.hide_ratios else ''
121+
print(f'{name}:'+ ratios)
122+
print(f' - {key}\n')
123+
case _:
124+
ratios = f'[{ratio}%] ' if not args.hide_ratios else ''
125+
print(ratios + f'{name} -> {key}')
126+
127+
if __name__ == '__main__':
128+
if len(sys.argv) > 1:
129+
args = parser.parse_args()
130+
else:
131+
parser.print_help()
132+
sys.exit(1)
133+
main()

0 commit comments

Comments
 (0)