-
Notifications
You must be signed in to change notification settings - Fork 1
/
diff.txt
119 lines (103 loc) · 11 KB
/
diff.txt
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
diff --git a/.gitignore b/.gitignore
index 93f10d1..6457894 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,3 +20,5 @@ tmp/
# ╨Ж╨│╨╜╨╛╤А╤Г╨▓╨░╤В╨╕ Python cache
/__pycache__
+
+diff.txt
\ No newline at end of file
diff --git a/archive_handler.py b/archive_handler.py
index af466fd..30063a1 100644
--- a/archive_handler.py
+++ b/archive_handler.py
@@ -35,6 +35,7 @@ def handle_archive(archive_path, local_filename, github_filename, temp_folder='g
if not os.path.exists(temp_folder):
os.makedirs(temp_folder)
+ print(f'Extracting {archive_path} to {temp_folder}')
shutil.unpack_archive(archive_path, temp_folder)
if os.path.exists(custom_packs_temp_path):
diff --git a/checker.py b/checker.py
index 37d3ff8..8d606d2 100644
--- a/checker.py
+++ b/checker.py
@@ -27,11 +27,12 @@ def main():
filename_from_url = os.path.splitext(os.path.basename(url))[0]
archive_output_dir = (filename + '_output')
comparison_results_file = os.path.join(archive_output_dir, 'comparison_results.json')
- archive_name = os.path.join(archive_output_dir, filename)
+ archive_name = os.path.join(archive_output_dir, filename_from_url)
+ archive_name_for_tg = os.path.join(archive_output_dir, filename)
status_file = os.path.join(archive_output_dir, 'status.json')
archive_file = os.path.join(archive_name + '.zip')
- changes = process_archive(archive)
is_folder_exist = True if os.path.exists(archive_output_dir) else False
+ changes = process_archive(archive)
if (changes):
print(f"{archive['filename']}: Archive processed.")
@@ -52,7 +53,6 @@ def main():
with open(comparison_results_file, 'r') as f:
comparison_results = json.load(f)
-
last_modified = status["last_archive_modification"]
if (is_folder_exist):
@@ -62,12 +62,11 @@ def main():
else:
# If not found, print a message and you may continue with the next iteration or assign a placeholder to result
print(f"{archive_output_dir} was NOT exist")
- result = "Added new archive."
+ result = "<code>New archive was added.</code>"
- if (telegram):
- if "4BRICK" not in archive_name:
- # print(f'INCOMING:\n----------\n\narchive_file: {archive_file}\narchive_name: {archive_name}\nresult: {result}\n\n-------------------\n\n')
- asyncio.run(send_to_tg(result, archive_file, archive_name))
+ if telegram:
+ if all(keyword not in archive_name for keyword in ["4BRICK", "AIO", "AIOB", "Refresh", "Placebo"]) and result:
+ asyncio.run(send_to_tg(result, archive_file, archive_name_for_tg))
print("Report sent to Telegram.")
html_report_content += f'<h2>Archive Comparison Report for <b>{archive["filename"]}</b></h2>'
diff --git a/diff.txt b/diff.txt
index 63004e8..e69de29 100644
Binary files a/diff.txt and b/diff.txt differ
diff --git a/report.py b/report.py
index 7067358..9b3f1a3 100644
--- a/report.py
+++ b/report.py
@@ -9,6 +9,10 @@ bot_token, chat_id, message_thread_id = TELEGRAM_BOT_TOKEN, YOUR_CHAT_ID, TOPIC_
def create_html_report(results, last_modified):
report_content = ''
+
+ if all(not items for items in results.values()):
+ return report_content
+
# report_content += f'<h2>Archive Comparison Report for <b>{archive_filename}</b></h2>\n\n'
formatted_last_modified = datetime.fromisoformat(last_modified).strftime('%d.%m.%Y %H:%M')
report_content += f'<b>Last archive modification date:</b> {formatted_last_modified}<hr>\n\n'
@@ -46,14 +50,14 @@ def render_tree(tree, level=1, last_child=False):
is_last_child = index == len(tree) - 1
if isinstance(value, str) and "(" in value and ")" in value:
- file_name, checksum = value.split(' ', 1)
+ file_name, checksum = value.split('(')
checksum_short = checksum[1:8]
# ╨п╨║╤Й╨╛ ╨╜╨░╨╖╨▓╨░ ╤Д╨░╨╣╨╗╤Г ╨┤╨╛╨▓╤И╨░ ╨╖╨░ 42 ╤Б╨╕╨╝╨▓╨╛╨╗╨╕, ╤В╨╛╨┤╤Ц ╨╛╨▒╤А╤Ц╨╖╨░╤Ф╨╝╨╛ ╤Ч╤Ч
if len(file_name) > 30:
file_name = file_name[:15] + "..." + file_name[-15:]
- tree_str += f"{prefix}{file_name} ({checksum_short})\n"
+ tree_str += f"{prefix}{file_name}({checksum_short})\n"
elif isinstance(value, dict):
tree_str += f"{prefix}{key}\n"
@@ -65,14 +69,14 @@ def render_tree(tree, level=1, last_child=False):
is_last_child = index == len(items_list[-7:]) - 1
if isinstance(value, str) and "(" in value and ")" in value:
- file_name, checksum = value.split(' ')
+ file_name, checksum = value.split('(')
checksum_short = checksum[1:8]
# ╨п╨║╤Й╨╛ ╨╜╨░╨╖╨▓╨░ ╤Д╨░╨╣╨╗╤Г ╨┤╨╛╨▓╤И╨░ ╨╖╨░ 42 ╤Б╨╕╨╝╨▓╨╛╨╗╨╕, ╤В╨╛╨┤╤Ц ╨╛╨▒╤А╤Ц╨╖╨░╤Ф╨╝╨╛ ╤Ч╤Ч
if len(file_name) > 42:
file_name = file_name[:10] + "..." + file_name[-10:]
- tree_str += f"{prefix}{file_name} ({checksum_short})\n"
+ tree_str += f"{prefix}{file_name}({checksum_short})\n"
elif isinstance(value, dict):
tree_str += f"{prefix}{key}\n"
tree_str += render_tree(value, level + 1, is_last_child)