sticker-convert 2.13.3.0__py3-none-any.whl → 2.17.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sticker_convert/__main__.py +24 -27
- sticker_convert/auth/__init__.py +0 -0
- sticker_convert/auth/auth_base.py +19 -0
- sticker_convert/{utils/auth/get_discord_auth.py → auth/auth_discord.py} +149 -118
- sticker_convert/{utils/auth/get_kakao_auth.py → auth/auth_kakao_android_login.py} +331 -330
- sticker_convert/auth/auth_kakao_desktop_login.py +327 -0
- sticker_convert/{utils/auth/get_kakao_desktop_auth.py → auth/auth_kakao_desktop_memdump.py} +281 -263
- sticker_convert/{utils/auth/get_line_auth.py → auth/auth_line.py} +98 -80
- sticker_convert/{utils/auth/get_signal_auth.py → auth/auth_signal.py} +139 -135
- sticker_convert/auth/auth_telethon.py +161 -0
- sticker_convert/{utils/auth/get_viber_auth.py → auth/auth_viber.py} +250 -235
- sticker_convert/{utils/auth → auth}/telegram_api.py +736 -675
- sticker_convert/cli.py +623 -608
- sticker_convert/converter.py +1093 -1084
- sticker_convert/definitions.py +4 -0
- sticker_convert/downloaders/download_band.py +111 -110
- sticker_convert/downloaders/download_base.py +171 -166
- sticker_convert/downloaders/download_discord.py +92 -91
- sticker_convert/downloaders/download_kakao.py +417 -404
- sticker_convert/downloaders/download_line.py +484 -475
- sticker_convert/downloaders/download_ogq.py +80 -79
- sticker_convert/downloaders/download_signal.py +108 -105
- sticker_convert/downloaders/download_telegram.py +56 -55
- sticker_convert/downloaders/download_viber.py +121 -120
- sticker_convert/gui.py +788 -873
- sticker_convert/gui_components/frames/comp_frame.py +180 -166
- sticker_convert/gui_components/frames/config_frame.py +156 -113
- sticker_convert/gui_components/frames/control_frame.py +32 -30
- sticker_convert/gui_components/frames/cred_frame.py +232 -233
- sticker_convert/gui_components/frames/input_frame.py +139 -137
- sticker_convert/gui_components/frames/output_frame.py +112 -110
- sticker_convert/gui_components/frames/right_clicker.py +25 -23
- sticker_convert/gui_components/windows/advanced_compression_window.py +757 -757
- sticker_convert/gui_components/windows/base_window.py +7 -2
- sticker_convert/gui_components/windows/discord_get_auth_window.py +79 -82
- sticker_convert/gui_components/windows/kakao_get_auth_window.py +511 -321
- sticker_convert/gui_components/windows/line_get_auth_window.py +94 -102
- sticker_convert/gui_components/windows/signal_get_auth_window.py +84 -89
- sticker_convert/gui_components/windows/viber_get_auth_window.py +168 -168
- sticker_convert/ios-message-stickers-template/.github/FUNDING.yml +3 -3
- sticker_convert/ios-message-stickers-template/README.md +10 -10
- sticker_convert/ios-message-stickers-template/stickers/Info.plist +43 -43
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Info.plist +31 -31
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Contents.json +6 -6
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Contents.json +20 -20
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 1.sticker/Contents.json +9 -9
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 2.sticker/Contents.json +9 -9
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 3.sticker/Contents.json +9 -9
- sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Contents.json +91 -91
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.pbxproj +364 -364
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -7
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
- sticker_convert/ios-message-stickers-template/stickers.xcodeproj/xcuserdata/niklaspeterson.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
- sticker_convert/job.py +166 -130
- sticker_convert/job_option.py +1 -0
- sticker_convert/locales/en_US/LC_MESSAGES/base.mo +0 -0
- sticker_convert/locales/ja_JP/LC_MESSAGES/base.mo +0 -0
- sticker_convert/locales/zh_CN/LC_MESSAGES/base.mo +0 -0
- sticker_convert/locales/zh_TW/LC_MESSAGES/base.mo +0 -0
- sticker_convert/py.typed +0 -0
- sticker_convert/resources/NotoColorEmoji.ttf +0 -0
- sticker_convert/resources/help.ja_JP.json +88 -0
- sticker_convert/resources/help.json +10 -7
- sticker_convert/resources/help.zh_CN.json +88 -0
- sticker_convert/resources/help.zh_TW.json +88 -0
- sticker_convert/resources/input.ja_JP.json +74 -0
- sticker_convert/resources/input.json +121 -121
- sticker_convert/resources/input.zh_CN.json +74 -0
- sticker_convert/resources/input.zh_TW.json +74 -0
- sticker_convert/resources/output.ja_JP.json +38 -0
- sticker_convert/resources/output.zh_CN.json +38 -0
- sticker_convert/resources/output.zh_TW.json +38 -0
- sticker_convert/uploaders/compress_wastickers.py +186 -177
- sticker_convert/uploaders/upload_base.py +44 -35
- sticker_convert/uploaders/upload_signal.py +218 -203
- sticker_convert/uploaders/upload_telegram.py +353 -338
- sticker_convert/uploaders/upload_viber.py +178 -169
- sticker_convert/uploaders/xcode_imessage.py +295 -286
- sticker_convert/utils/callback.py +238 -6
- sticker_convert/utils/emoji.py +16 -4
- sticker_convert/utils/files/json_resources_loader.py +24 -19
- sticker_convert/utils/files/metadata_handler.py +3 -3
- sticker_convert/utils/translate.py +108 -0
- sticker_convert/utils/url_detect.py +40 -37
- sticker_convert/version.py +1 -1
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/METADATA +89 -74
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/RECORD +91 -74
- sticker_convert/utils/auth/telethon_setup.py +0 -97
- sticker_convert/utils/singletons.py +0 -18
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/WHEEL +0 -0
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/entry_points.txt +0 -0
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/licenses/LICENSE +0 -0
- {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/top_level.txt +0 -0
sticker_convert/gui.py
CHANGED
|
@@ -1,873 +1,788 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from
|
|
13
|
-
|
|
14
|
-
from
|
|
15
|
-
|
|
16
|
-
from
|
|
17
|
-
|
|
18
|
-
from
|
|
19
|
-
from
|
|
20
|
-
|
|
21
|
-
from sticker_convert.
|
|
22
|
-
from sticker_convert.gui_components.frames.
|
|
23
|
-
from sticker_convert.gui_components.frames.
|
|
24
|
-
from sticker_convert.gui_components.frames.
|
|
25
|
-
from sticker_convert.gui_components.frames.
|
|
26
|
-
from sticker_convert.gui_components.
|
|
27
|
-
from sticker_convert.
|
|
28
|
-
from sticker_convert.
|
|
29
|
-
from sticker_convert.
|
|
30
|
-
from sticker_convert.
|
|
31
|
-
from sticker_convert.
|
|
32
|
-
from sticker_convert.utils.files.
|
|
33
|
-
from sticker_convert.utils.
|
|
34
|
-
from sticker_convert.utils.url_detect import UrlDetect
|
|
35
|
-
from sticker_convert.version import __version__
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class GUI(Window):
|
|
39
|
-
def __init__(self) -> None:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
self.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
self.
|
|
67
|
-
self.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
self.
|
|
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
|
-
self.
|
|
108
|
-
self.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
self.
|
|
114
|
-
|
|
115
|
-
self.
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
self.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
self.
|
|
125
|
-
self.
|
|
126
|
-
|
|
127
|
-
self.
|
|
128
|
-
self.
|
|
129
|
-
self.
|
|
130
|
-
self.
|
|
131
|
-
self.
|
|
132
|
-
self.
|
|
133
|
-
self.
|
|
134
|
-
|
|
135
|
-
self.
|
|
136
|
-
self.
|
|
137
|
-
self.
|
|
138
|
-
self.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
self.
|
|
143
|
-
self.
|
|
144
|
-
self.
|
|
145
|
-
self.
|
|
146
|
-
|
|
147
|
-
#
|
|
148
|
-
self.
|
|
149
|
-
self.
|
|
150
|
-
self.
|
|
151
|
-
self.
|
|
152
|
-
self.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
self.
|
|
156
|
-
self.
|
|
157
|
-
self.
|
|
158
|
-
self.
|
|
159
|
-
self.
|
|
160
|
-
self.
|
|
161
|
-
self.
|
|
162
|
-
self.
|
|
163
|
-
self.
|
|
164
|
-
self.
|
|
165
|
-
self.
|
|
166
|
-
self.
|
|
167
|
-
self.
|
|
168
|
-
self.
|
|
169
|
-
self.
|
|
170
|
-
self.
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
self.
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
self.
|
|
177
|
-
self.
|
|
178
|
-
self.
|
|
179
|
-
self.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
self.
|
|
183
|
-
|
|
184
|
-
)
|
|
185
|
-
self.
|
|
186
|
-
|
|
187
|
-
)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
)
|
|
191
|
-
self.
|
|
192
|
-
|
|
193
|
-
)
|
|
194
|
-
self.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
self.
|
|
198
|
-
|
|
199
|
-
)
|
|
200
|
-
self.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
self.
|
|
204
|
-
self.
|
|
205
|
-
self.
|
|
206
|
-
self.
|
|
207
|
-
self.
|
|
208
|
-
self.
|
|
209
|
-
|
|
210
|
-
)
|
|
211
|
-
self.
|
|
212
|
-
|
|
213
|
-
)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
)
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
self.
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
self.creds
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
if
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
self.
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
comp_custom["format"]["
|
|
312
|
-
|
|
313
|
-
del comp_custom["
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
"
|
|
324
|
-
|
|
325
|
-
"
|
|
326
|
-
"
|
|
327
|
-
"
|
|
328
|
-
"
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
"
|
|
332
|
-
"
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
)
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
self.
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
self.
|
|
363
|
-
self.
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
)
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
self.
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
self.
|
|
416
|
-
self.
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
self.
|
|
422
|
-
self.
|
|
423
|
-
self.
|
|
424
|
-
self.
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
)
|
|
430
|
-
self.
|
|
431
|
-
self.
|
|
432
|
-
self.
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
self.job
|
|
611
|
-
|
|
612
|
-
self.
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
self.
|
|
629
|
-
self.
|
|
630
|
-
self.
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
self.
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
)
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
self.
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
self.
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
else:
|
|
754
|
-
self.
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
)
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
self.output_frame.
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
if (
|
|
791
|
-
MetadataHandler.check_metadata_required(output_option, "title")
|
|
792
|
-
and not MetadataHandler.check_metadata_provided(
|
|
793
|
-
Path(self.input_setdir_var.get()), input_option, "title"
|
|
794
|
-
)
|
|
795
|
-
and not self.title_var.get()
|
|
796
|
-
):
|
|
797
|
-
self.output_frame.title_entry.config(bootstyle="warning") # type: ignore
|
|
798
|
-
else:
|
|
799
|
-
self.output_frame.title_entry.config(bootstyle="default") # type: ignore
|
|
800
|
-
|
|
801
|
-
if (
|
|
802
|
-
MetadataHandler.check_metadata_required(output_option, "author")
|
|
803
|
-
and not MetadataHandler.check_metadata_provided(
|
|
804
|
-
Path(self.input_setdir_var.get()), input_option, "author"
|
|
805
|
-
)
|
|
806
|
-
and not self.author_var.get()
|
|
807
|
-
):
|
|
808
|
-
self.output_frame.author_entry.config(bootstyle="warning") # type: ignore
|
|
809
|
-
else:
|
|
810
|
-
self.output_frame.author_entry.config(bootstyle="default") # type: ignore
|
|
811
|
-
|
|
812
|
-
if self.comp_preset_var.get() == "auto":
|
|
813
|
-
if output_option == "local":
|
|
814
|
-
self.no_compress_var.set(True)
|
|
815
|
-
else:
|
|
816
|
-
self.no_compress_var.set(False)
|
|
817
|
-
self.comp_frame.cb_no_compress()
|
|
818
|
-
|
|
819
|
-
# Credentials
|
|
820
|
-
if output_option == "signal" and not self.signal_uuid_var.get():
|
|
821
|
-
self.cred_frame.signal_uuid_entry.config(bootstyle="warning") # type: ignore
|
|
822
|
-
else:
|
|
823
|
-
self.cred_frame.signal_uuid_entry.config(bootstyle="default") # type: ignore
|
|
824
|
-
|
|
825
|
-
if output_option == "signal" and not self.signal_password_var.get():
|
|
826
|
-
self.cred_frame.signal_password_entry.config(bootstyle="warning") # type: ignore
|
|
827
|
-
else:
|
|
828
|
-
self.cred_frame.signal_password_entry.config(bootstyle="default") # type: ignore
|
|
829
|
-
|
|
830
|
-
if (
|
|
831
|
-
input_option == "telegram" or output_option == "telegram"
|
|
832
|
-
) and not self.telegram_token_var.get():
|
|
833
|
-
self.cred_frame.telegram_token_entry.config(bootstyle="warning") # type: ignore
|
|
834
|
-
else:
|
|
835
|
-
self.cred_frame.telegram_token_entry.config(bootstyle="default") # type: ignore
|
|
836
|
-
|
|
837
|
-
if output_option == "telegram" and not self.telegram_userid_var.get():
|
|
838
|
-
self.cred_frame.telegram_userid_entry.config(bootstyle="warning") # type: ignore
|
|
839
|
-
else:
|
|
840
|
-
self.cred_frame.telegram_userid_entry.config(bootstyle="default") # type: ignore
|
|
841
|
-
|
|
842
|
-
if output_option == "viber" and not self.viber_auth_var.get():
|
|
843
|
-
self.cred_frame.viber_auth_entry.config(bootstyle="warning") # type: ignore
|
|
844
|
-
else:
|
|
845
|
-
self.cred_frame.viber_auth_entry.config(bootstyle="default") # type: ignore
|
|
846
|
-
|
|
847
|
-
if (
|
|
848
|
-
urlparse(url).netloc == "e.kakao.com"
|
|
849
|
-
and not self.kakao_auth_token_var.get()
|
|
850
|
-
):
|
|
851
|
-
self.cred_frame.kakao_auth_token_entry.config(bootstyle="warning") # type: ignore
|
|
852
|
-
else:
|
|
853
|
-
self.cred_frame.kakao_auth_token_entry.config(bootstyle="default") # type: ignore
|
|
854
|
-
|
|
855
|
-
if input_option.startswith("discord") and not self.discord_token_var.get():
|
|
856
|
-
self.cred_frame.discord_token_entry.config(bootstyle="warning") # type: ignore
|
|
857
|
-
else:
|
|
858
|
-
self.cred_frame.discord_token_entry.config(bootstyle="default") # type: ignore
|
|
859
|
-
|
|
860
|
-
# Check for Input and Compression mismatch
|
|
861
|
-
if (
|
|
862
|
-
not self.no_compress_var.get()
|
|
863
|
-
and self.get_output_name() != "local"
|
|
864
|
-
and self.comp_preset_var.get() not in ("auto", "custom")
|
|
865
|
-
and self.get_output_name() not in self.comp_preset_var.get()
|
|
866
|
-
):
|
|
867
|
-
self.comp_frame.comp_preset_opt.config(bootstyle="warning") # type: ignore
|
|
868
|
-
self.output_frame.output_option_opt.config(bootstyle="warning") # type: ignore
|
|
869
|
-
else:
|
|
870
|
-
self.comp_frame.comp_preset_opt.config(bootstyle="secondary") # type: ignore
|
|
871
|
-
self.output_frame.output_option_opt.config(bootstyle="secondary") # type: ignore
|
|
872
|
-
|
|
873
|
-
return True
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
import os
|
|
3
|
+
import platform
|
|
4
|
+
import signal
|
|
5
|
+
import sys
|
|
6
|
+
from json.decoder import JSONDecodeError
|
|
7
|
+
from math import ceil
|
|
8
|
+
from multiprocessing import Event, cpu_count
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from threading import Thread
|
|
11
|
+
from typing import Any, Callable, Dict, Optional
|
|
12
|
+
from urllib.parse import urlparse
|
|
13
|
+
|
|
14
|
+
from mergedeep import merge # type: ignore
|
|
15
|
+
from PIL import ImageFont
|
|
16
|
+
from ttkbootstrap import BooleanVar, DoubleVar, IntVar, StringVar, Window # type: ignore
|
|
17
|
+
|
|
18
|
+
from sticker_convert.definitions import CONFIG_DIR, DEFAULT_DIR, ROOT_DIR, RUNTIME_STATE
|
|
19
|
+
from sticker_convert.gui_components.frames.comp_frame import CompFrame
|
|
20
|
+
from sticker_convert.gui_components.frames.config_frame import ConfigFrame
|
|
21
|
+
from sticker_convert.gui_components.frames.control_frame import ControlFrame
|
|
22
|
+
from sticker_convert.gui_components.frames.cred_frame import CredFrame
|
|
23
|
+
from sticker_convert.gui_components.frames.input_frame import InputFrame
|
|
24
|
+
from sticker_convert.gui_components.frames.output_frame import OutputFrame
|
|
25
|
+
from sticker_convert.gui_components.frames.progress_frame import ProgressFrame
|
|
26
|
+
from sticker_convert.gui_components.gui_utils import GUIUtils
|
|
27
|
+
from sticker_convert.job import Job
|
|
28
|
+
from sticker_convert.job_option import CompOption, CredOption, InputOption, OutputOption
|
|
29
|
+
from sticker_convert.utils.callback import CallbackGui
|
|
30
|
+
from sticker_convert.utils.files.json_manager import JsonManager
|
|
31
|
+
from sticker_convert.utils.files.json_resources_loader import load_resource_json
|
|
32
|
+
from sticker_convert.utils.files.metadata_handler import MetadataHandler
|
|
33
|
+
from sticker_convert.utils.translate import SUPPORTED_LANG, I
|
|
34
|
+
from sticker_convert.utils.url_detect import UrlDetect
|
|
35
|
+
from sticker_convert.version import __version__
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class GUI(Window):
|
|
39
|
+
def __init__(self) -> None:
|
|
40
|
+
self.MSG_MORAL = I(
|
|
41
|
+
"sticker-convert is Free and Opensource software by laggykiller\n"
|
|
42
|
+
"{project_url}\n"
|
|
43
|
+
"Please use the stickers with your friends only.\n"
|
|
44
|
+
"It is illegal and immoral to sell stickers downloaded from this program."
|
|
45
|
+
)
|
|
46
|
+
self.PROJECT_URL = "https://github.com/laggykiller/sticker-convert"
|
|
47
|
+
|
|
48
|
+
self.MSG_MAC14_TK_BUG = I(
|
|
49
|
+
"NOTICE: If buttons are not responsive, try to press\n"
|
|
50
|
+
"on title bar or move mouse cursor away from window for a while.\n"
|
|
51
|
+
"(This is a bug in tkinter specific to macOS 14 python <=3.11.6)\n"
|
|
52
|
+
"({mac14_tk_bug_url})"
|
|
53
|
+
)
|
|
54
|
+
self.MAC14_TK_BUG_URL = "https://github.com/python/cpython/issues/110218"
|
|
55
|
+
|
|
56
|
+
super().__init__(themename="darkly", alpha=0) # type: ignore
|
|
57
|
+
self.cb = CallbackGui(self)
|
|
58
|
+
self.init_done = False
|
|
59
|
+
self.load_jsons()
|
|
60
|
+
|
|
61
|
+
font_path = ROOT_DIR / "resources/NotoColorEmoji.ttf"
|
|
62
|
+
self.emoji_font = ImageFont.truetype(font_path.as_posix(), 109)
|
|
63
|
+
|
|
64
|
+
GUIUtils.set_icon(self)
|
|
65
|
+
|
|
66
|
+
self.title(f"sticker-convert {__version__}")
|
|
67
|
+
self.protocol("WM_DELETE_WINDOW", self.quit)
|
|
68
|
+
|
|
69
|
+
(
|
|
70
|
+
self.main_frame,
|
|
71
|
+
self.horizontal_scrollbar_frame,
|
|
72
|
+
self.canvas,
|
|
73
|
+
self.x_scrollbar,
|
|
74
|
+
self.y_scrollbar,
|
|
75
|
+
self.scrollable_frame,
|
|
76
|
+
) = GUIUtils.create_scrollable_frame(self)
|
|
77
|
+
|
|
78
|
+
self.declare_variables()
|
|
79
|
+
self.apply_config()
|
|
80
|
+
self.apply_creds()
|
|
81
|
+
self.init_frames()
|
|
82
|
+
self.pack_frames()
|
|
83
|
+
self.author_info()
|
|
84
|
+
self.warn_tkinter_bug()
|
|
85
|
+
GUIUtils.finalize_window(self)
|
|
86
|
+
|
|
87
|
+
self.bind("<<exec_in_main>>", self.exec_in_main) # type: ignore
|
|
88
|
+
|
|
89
|
+
def __enter__(self) -> "GUI":
|
|
90
|
+
return self
|
|
91
|
+
|
|
92
|
+
def gui(self) -> None:
|
|
93
|
+
self.init_done = True
|
|
94
|
+
self.highlight_fields()
|
|
95
|
+
self.mainloop()
|
|
96
|
+
|
|
97
|
+
def quit(self) -> None:
|
|
98
|
+
if self.job:
|
|
99
|
+
response = self.cb.put(
|
|
100
|
+
("ask_bool", (I("Job is running, really quit?"),), None)
|
|
101
|
+
)
|
|
102
|
+
if response is False:
|
|
103
|
+
return
|
|
104
|
+
|
|
105
|
+
self.cb.put(I("Quitting, please wait..."))
|
|
106
|
+
|
|
107
|
+
self.save_config()
|
|
108
|
+
if self.settings_save_cred_var.get() is True:
|
|
109
|
+
self.save_creds()
|
|
110
|
+
else:
|
|
111
|
+
self.delete_creds()
|
|
112
|
+
|
|
113
|
+
if self.job:
|
|
114
|
+
self.cancel_job()
|
|
115
|
+
self.destroy()
|
|
116
|
+
|
|
117
|
+
def reset(self) -> None:
|
|
118
|
+
self.init_done = False
|
|
119
|
+
|
|
120
|
+
# These json have translated version
|
|
121
|
+
RUNTIME_STATE["help_json"] = None
|
|
122
|
+
RUNTIME_STATE["input_json"] = None
|
|
123
|
+
RUNTIME_STATE["output_json"] = None
|
|
124
|
+
self.load_jsons()
|
|
125
|
+
self.apply_config()
|
|
126
|
+
|
|
127
|
+
self.input_frame.destroy()
|
|
128
|
+
self.comp_frame.destroy()
|
|
129
|
+
self.output_frame.destroy()
|
|
130
|
+
self.cred_frame.destroy()
|
|
131
|
+
self.settings_frame.destroy()
|
|
132
|
+
self.progress_frame.destroy()
|
|
133
|
+
self.control_frame.destroy()
|
|
134
|
+
|
|
135
|
+
self.init_frames()
|
|
136
|
+
self.pack_frames()
|
|
137
|
+
self.init_done = True
|
|
138
|
+
self.highlight_fields()
|
|
139
|
+
|
|
140
|
+
def declare_variables(self) -> None:
|
|
141
|
+
# Input
|
|
142
|
+
self.input_option_display_var = StringVar(self)
|
|
143
|
+
self.input_option_true_var = StringVar(self)
|
|
144
|
+
self.input_setdir_var = StringVar(self)
|
|
145
|
+
self.input_address_var = StringVar(self)
|
|
146
|
+
|
|
147
|
+
# Compression
|
|
148
|
+
self.no_compress_var = BooleanVar()
|
|
149
|
+
self.comp_preset_var = StringVar(self)
|
|
150
|
+
self.fps_min_var = IntVar(self)
|
|
151
|
+
self.fps_max_var = IntVar(self)
|
|
152
|
+
self.fps_disable_var = BooleanVar()
|
|
153
|
+
self.fps_power_var = DoubleVar()
|
|
154
|
+
self.res_w_min_var = IntVar(self)
|
|
155
|
+
self.res_w_max_var = IntVar(self)
|
|
156
|
+
self.res_w_disable_var = BooleanVar()
|
|
157
|
+
self.res_h_min_var = IntVar(self)
|
|
158
|
+
self.res_h_max_var = IntVar(self)
|
|
159
|
+
self.res_h_disable_var = BooleanVar()
|
|
160
|
+
self.res_power_var = DoubleVar()
|
|
161
|
+
self.res_snap_pow2_var = BooleanVar()
|
|
162
|
+
self.quality_min_var = IntVar(self)
|
|
163
|
+
self.quality_max_var = IntVar(self)
|
|
164
|
+
self.quality_disable_var = BooleanVar()
|
|
165
|
+
self.quality_power_var = DoubleVar()
|
|
166
|
+
self.color_min_var = IntVar(self)
|
|
167
|
+
self.color_max_var = IntVar(self)
|
|
168
|
+
self.color_disable_var = BooleanVar()
|
|
169
|
+
self.color_power_var = DoubleVar()
|
|
170
|
+
self.duration_min_var = IntVar(self)
|
|
171
|
+
self.duration_max_var = IntVar(self)
|
|
172
|
+
self.duration_disable_var = BooleanVar()
|
|
173
|
+
self.padding_percent_var = IntVar(self)
|
|
174
|
+
self.img_size_max_var = IntVar(self)
|
|
175
|
+
self.vid_size_max_var = IntVar(self)
|
|
176
|
+
self.size_disable_var = BooleanVar()
|
|
177
|
+
self.bg_color_var = StringVar()
|
|
178
|
+
self.img_format_var = StringVar(self)
|
|
179
|
+
self.vid_format_var = StringVar(self)
|
|
180
|
+
self.fake_vid_var = BooleanVar()
|
|
181
|
+
self.scale_filter_var = StringVar(self)
|
|
182
|
+
self.quantize_method_var = StringVar(self)
|
|
183
|
+
self.chromium_path_var = StringVar(self)
|
|
184
|
+
self.cache_dir_var = StringVar(self)
|
|
185
|
+
self.default_emoji_var = StringVar(self)
|
|
186
|
+
self.steps_var = IntVar(self)
|
|
187
|
+
self.processes_var = IntVar(self)
|
|
188
|
+
|
|
189
|
+
# Output
|
|
190
|
+
self.output_option_display_var = StringVar(self)
|
|
191
|
+
self.output_option_true_var = StringVar(self)
|
|
192
|
+
self.output_setdir_var = StringVar(self)
|
|
193
|
+
self.title_var = StringVar(self)
|
|
194
|
+
self.author_var = StringVar(self)
|
|
195
|
+
|
|
196
|
+
# Credentials
|
|
197
|
+
self.signal_uuid_var = StringVar(self)
|
|
198
|
+
self.signal_password_var = StringVar(self)
|
|
199
|
+
self.telegram_token_var = StringVar(self)
|
|
200
|
+
self.telegram_userid_var = StringVar(self)
|
|
201
|
+
self.telethon_api_id_var = IntVar(self)
|
|
202
|
+
self.telethon_api_hash_var = StringVar(self)
|
|
203
|
+
self.kakao_auth_token_var = StringVar(self)
|
|
204
|
+
self.kakao_username_var = StringVar(self)
|
|
205
|
+
self.kakao_password_var = StringVar(self)
|
|
206
|
+
self.kakao_country_code_var = StringVar(self)
|
|
207
|
+
self.kakao_phone_number_var = StringVar(self)
|
|
208
|
+
self.kakao_device_uuid_var = StringVar(self)
|
|
209
|
+
self.kakao_bin_path_var = StringVar(self)
|
|
210
|
+
self.line_cookies_var = StringVar(self)
|
|
211
|
+
self.viber_auth_var = StringVar(self)
|
|
212
|
+
self.viber_bin_path_var = StringVar(self)
|
|
213
|
+
self.discord_token_var = StringVar(self)
|
|
214
|
+
|
|
215
|
+
# Config
|
|
216
|
+
self.settings_save_cred_var = BooleanVar()
|
|
217
|
+
|
|
218
|
+
# Other
|
|
219
|
+
self.lang_display_var = StringVar(self)
|
|
220
|
+
self.lang_true_var = StringVar(self)
|
|
221
|
+
self.response_event = Event()
|
|
222
|
+
self.response = None
|
|
223
|
+
self.action: Optional[Callable[..., Any]] = None
|
|
224
|
+
self.job: Optional[Job] = None
|
|
225
|
+
|
|
226
|
+
def init_frames(self) -> None:
|
|
227
|
+
self.input_frame = InputFrame(
|
|
228
|
+
self, self.scrollable_frame, borderwidth=1, text=I("Input")
|
|
229
|
+
)
|
|
230
|
+
self.comp_frame = CompFrame(
|
|
231
|
+
self, self.scrollable_frame, borderwidth=1, text=I("Compression options")
|
|
232
|
+
)
|
|
233
|
+
self.output_frame = OutputFrame(
|
|
234
|
+
self, self.scrollable_frame, borderwidth=1, text=I("Output")
|
|
235
|
+
)
|
|
236
|
+
self.cred_frame = CredFrame(
|
|
237
|
+
self, self.scrollable_frame, borderwidth=1, text=I("Credentials")
|
|
238
|
+
)
|
|
239
|
+
self.settings_frame = ConfigFrame(
|
|
240
|
+
self, self.scrollable_frame, borderwidth=1, text=I("Config")
|
|
241
|
+
)
|
|
242
|
+
self.progress_frame = ProgressFrame(
|
|
243
|
+
self, self.scrollable_frame, borderwidth=1, text=I("Progress")
|
|
244
|
+
)
|
|
245
|
+
self.control_frame = ControlFrame(self, self.scrollable_frame, borderwidth=1)
|
|
246
|
+
|
|
247
|
+
def pack_frames(self) -> None:
|
|
248
|
+
self.input_frame.grid(column=0, row=0, sticky="w", padx=5, pady=5)
|
|
249
|
+
self.comp_frame.grid(column=1, row=0, sticky="news", padx=5, pady=5)
|
|
250
|
+
self.output_frame.grid(column=0, row=1, sticky="w", padx=5, pady=5)
|
|
251
|
+
self.cred_frame.grid(column=1, row=1, rowspan=2, sticky="w", padx=5, pady=5)
|
|
252
|
+
self.settings_frame.grid(column=0, row=2, sticky="news", padx=5, pady=5)
|
|
253
|
+
self.progress_frame.grid(
|
|
254
|
+
column=0, row=3, columnspan=2, sticky="news", padx=5, pady=5
|
|
255
|
+
)
|
|
256
|
+
self.control_frame.grid(
|
|
257
|
+
column=0, row=4, columnspan=2, sticky="news", padx=5, pady=5
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
def author_info(self) -> None:
|
|
261
|
+
self.cb.put(self.MSG_MORAL.format(project_url=self.PROJECT_URL))
|
|
262
|
+
|
|
263
|
+
def warn_tkinter_bug(self) -> None:
|
|
264
|
+
if (
|
|
265
|
+
platform.system() == "Darwin"
|
|
266
|
+
and platform.mac_ver()[0].split(".")[0] == "14"
|
|
267
|
+
and sys.version_info[0] == 3
|
|
268
|
+
and sys.version_info[1] == 11
|
|
269
|
+
and sys.version_info[2] <= 6
|
|
270
|
+
):
|
|
271
|
+
self.cb.put(
|
|
272
|
+
self.MSG_MAC14_TK_BUG.format(mac14_tk_bug_url=self.MAC14_TK_BUG_URL)
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
def load_jsons(self) -> None:
|
|
276
|
+
self.help = load_resource_json("help")
|
|
277
|
+
self.input_presets = load_resource_json("input")
|
|
278
|
+
self.compression_presets = load_resource_json("compression")
|
|
279
|
+
self.output_presets = load_resource_json("output")
|
|
280
|
+
self.emoji_list = load_resource_json("emoji")
|
|
281
|
+
|
|
282
|
+
self.settings_path = CONFIG_DIR / "config.json"
|
|
283
|
+
if self.settings_path.is_file():
|
|
284
|
+
try:
|
|
285
|
+
self.settings: Dict[Any, Any] = JsonManager.load_json(
|
|
286
|
+
self.settings_path
|
|
287
|
+
)
|
|
288
|
+
except JSONDecodeError:
|
|
289
|
+
self.cb.put(I("Warning: config.json content is corrupted"))
|
|
290
|
+
self.settings = {}
|
|
291
|
+
else:
|
|
292
|
+
self.settings = {}
|
|
293
|
+
|
|
294
|
+
self.creds_path = CONFIG_DIR / "creds.json"
|
|
295
|
+
if self.creds_path.is_file():
|
|
296
|
+
try:
|
|
297
|
+
self.creds = JsonManager.load_json(self.creds_path)
|
|
298
|
+
except JSONDecodeError:
|
|
299
|
+
self.cb.put(I("Warning: creds.json content is corrupted"))
|
|
300
|
+
self.creds = {}
|
|
301
|
+
else:
|
|
302
|
+
self.creds = {}
|
|
303
|
+
|
|
304
|
+
def save_config(self) -> None:
|
|
305
|
+
# Only update comp_custom if custom preset is selected
|
|
306
|
+
if self.comp_preset_var.get() == "custom":
|
|
307
|
+
comp_custom: Dict[Any, Any] = merge( # type: ignore
|
|
308
|
+
self.compression_presets.get("custom"), # type: ignore
|
|
309
|
+
self.get_opt_comp().to_dict(),
|
|
310
|
+
)
|
|
311
|
+
comp_custom["format"]["img"] = comp_custom["format"]["img"][0]
|
|
312
|
+
comp_custom["format"]["vid"] = comp_custom["format"]["vid"][0]
|
|
313
|
+
del comp_custom["preset"]
|
|
314
|
+
del comp_custom["no_compress"]
|
|
315
|
+
else:
|
|
316
|
+
compression_presets_custom = self.compression_presets.get("custom")
|
|
317
|
+
if compression_presets_custom is None:
|
|
318
|
+
comp_custom = {}
|
|
319
|
+
else:
|
|
320
|
+
comp_custom = compression_presets_custom
|
|
321
|
+
|
|
322
|
+
self.settings = {
|
|
323
|
+
"input": self.get_opt_input().to_dict(),
|
|
324
|
+
"comp": {
|
|
325
|
+
"no_compress": self.no_compress_var.get(),
|
|
326
|
+
"preset": self.comp_preset_var.get(),
|
|
327
|
+
"chromium_path": self.chromium_path_var.get(),
|
|
328
|
+
"cache_dir": self.cache_dir_var.get(),
|
|
329
|
+
"processes": self.processes_var.get(),
|
|
330
|
+
},
|
|
331
|
+
"comp_custom": comp_custom,
|
|
332
|
+
"output": self.get_opt_output().to_dict(),
|
|
333
|
+
"creds": {"save_cred": self.settings_save_cred_var.get()},
|
|
334
|
+
"lang": self.lang_true_var.get(),
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
JsonManager.save_json(self.settings_path, self.settings)
|
|
338
|
+
|
|
339
|
+
def save_creds(self) -> None:
|
|
340
|
+
self.creds = self.get_opt_cred().to_dict()
|
|
341
|
+
|
|
342
|
+
JsonManager.save_json(self.creds_path, self.creds)
|
|
343
|
+
|
|
344
|
+
def delete_creds(self) -> None:
|
|
345
|
+
if self.creds_path.is_file():
|
|
346
|
+
os.remove(self.creds_path)
|
|
347
|
+
|
|
348
|
+
def delete_config(self) -> None:
|
|
349
|
+
if self.settings_path.is_file():
|
|
350
|
+
os.remove(self.settings_path)
|
|
351
|
+
|
|
352
|
+
def apply_config(self) -> None:
|
|
353
|
+
# Input
|
|
354
|
+
self.default_input_mode: str = self.settings.get("input", {}).get(
|
|
355
|
+
"option", "auto"
|
|
356
|
+
)
|
|
357
|
+
self.input_address_var.set(self.settings.get("input", {}).get("url", ""))
|
|
358
|
+
default_stickers_input_dir = str(DEFAULT_DIR / "stickers_input")
|
|
359
|
+
self.input_setdir_var.set(
|
|
360
|
+
self.settings.get("input", {}).get("dir", default_stickers_input_dir)
|
|
361
|
+
)
|
|
362
|
+
if not Path(self.input_setdir_var.get()).is_dir():
|
|
363
|
+
self.input_setdir_var.set(default_stickers_input_dir)
|
|
364
|
+
self.input_option_display_var.set(
|
|
365
|
+
self.input_presets[self.default_input_mode]["full_name"]
|
|
366
|
+
)
|
|
367
|
+
self.input_option_true_var.set(
|
|
368
|
+
self.input_presets[self.default_input_mode]["full_name"]
|
|
369
|
+
)
|
|
370
|
+
|
|
371
|
+
# Compression
|
|
372
|
+
self.no_compress_var.set(
|
|
373
|
+
self.settings.get("comp", {}).get("no_compress", False)
|
|
374
|
+
)
|
|
375
|
+
default_comp_preset = list(self.compression_presets.keys())[0]
|
|
376
|
+
self.comp_preset_var.set(
|
|
377
|
+
self.settings.get("comp", {}).get("preset", default_comp_preset)
|
|
378
|
+
)
|
|
379
|
+
comp_custom = self.settings.get("comp_custom")
|
|
380
|
+
if comp_custom:
|
|
381
|
+
self.compression_presets["custom"] = merge(
|
|
382
|
+
self.compression_presets["custom"], comp_custom
|
|
383
|
+
)
|
|
384
|
+
self.cache_dir_var.set(self.settings.get("comp", {}).get("cache_dir", ""))
|
|
385
|
+
self.chromium_path_var.set(
|
|
386
|
+
self.settings.get("comp", {}).get("chromium_path", "")
|
|
387
|
+
)
|
|
388
|
+
self.processes_var.set(
|
|
389
|
+
self.settings.get("comp", {}).get("processes", ceil(cpu_count() / 2))
|
|
390
|
+
)
|
|
391
|
+
self.default_output_mode: str = self.settings.get("output", {}).get(
|
|
392
|
+
"option", "signal"
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
# Output
|
|
396
|
+
default_stickers_output_dir = str(DEFAULT_DIR / "stickers_output")
|
|
397
|
+
self.output_setdir_var.set(
|
|
398
|
+
self.settings.get("output", {}).get("dir", default_stickers_output_dir)
|
|
399
|
+
)
|
|
400
|
+
if not Path(self.output_setdir_var.get()).is_dir():
|
|
401
|
+
self.output_setdir_var.set(default_stickers_output_dir)
|
|
402
|
+
self.title_var.set(self.settings.get("output", {}).get("title", ""))
|
|
403
|
+
self.author_var.set(self.settings.get("output", {}).get("author", ""))
|
|
404
|
+
self.settings_save_cred_var.set(
|
|
405
|
+
self.settings.get("creds", {}).get("save_cred", True)
|
|
406
|
+
)
|
|
407
|
+
self.output_option_display_var.set(
|
|
408
|
+
self.output_presets[self.default_output_mode]["full_name"]
|
|
409
|
+
)
|
|
410
|
+
self.output_option_true_var.set(
|
|
411
|
+
self.output_presets[self.default_output_mode]["full_name"]
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
# Language
|
|
415
|
+
self.lang_true_var.set(self.settings.get("lang", "auto"))
|
|
416
|
+
self.lang_display_var.set(
|
|
417
|
+
[k for k, v in SUPPORTED_LANG.items() if v == self.lang_true_var.get()][0]
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
def apply_creds(self) -> None:
|
|
421
|
+
self.signal_uuid_var.set(self.creds.get("signal", {}).get("uuid", ""))
|
|
422
|
+
self.signal_password_var.set(self.creds.get("signal", {}).get("password", ""))
|
|
423
|
+
self.telegram_token_var.set(self.creds.get("telegram", {}).get("token", ""))
|
|
424
|
+
self.telegram_userid_var.set(self.creds.get("telegram", {}).get("userid", ""))
|
|
425
|
+
self.telethon_api_id_var.set(self.creds.get("telethon", {}).get("api_id", 0))
|
|
426
|
+
self.telethon_api_hash_var.set(
|
|
427
|
+
self.creds.get("telethon", {}).get("api_hash", "")
|
|
428
|
+
)
|
|
429
|
+
self.kakao_auth_token_var.set(self.creds.get("kakao", {}).get("auth_token", ""))
|
|
430
|
+
self.kakao_username_var.set(self.creds.get("kakao", {}).get("username", ""))
|
|
431
|
+
self.kakao_password_var.set(self.creds.get("kakao", {}).get("password", ""))
|
|
432
|
+
self.kakao_country_code_var.set(
|
|
433
|
+
self.creds.get("kakao", {}).get("country_code", "")
|
|
434
|
+
)
|
|
435
|
+
self.kakao_phone_number_var.set(
|
|
436
|
+
self.creds.get("kakao", {}).get("phone_number", "")
|
|
437
|
+
)
|
|
438
|
+
self.kakao_device_uuid_var.set(
|
|
439
|
+
self.creds.get("kakao", {}).get("device_uuid", "")
|
|
440
|
+
)
|
|
441
|
+
self.line_cookies_var.set(self.creds.get("line", {}).get("cookies", ""))
|
|
442
|
+
self.viber_auth_var.set(self.creds.get("viber", {}).get("auth", ""))
|
|
443
|
+
self.discord_token_var.set(self.creds.get("discord", {}).get("token", ""))
|
|
444
|
+
|
|
445
|
+
def get_input_name(self) -> str:
|
|
446
|
+
return [
|
|
447
|
+
k
|
|
448
|
+
for k, v in self.input_presets.items()
|
|
449
|
+
if v["full_name"] == self.input_option_true_var.get()
|
|
450
|
+
][0]
|
|
451
|
+
|
|
452
|
+
def get_input_display_name(self) -> str:
|
|
453
|
+
return [
|
|
454
|
+
k
|
|
455
|
+
for k, v in self.input_presets.items()
|
|
456
|
+
if v["full_name"] == self.input_option_display_var.get()
|
|
457
|
+
][0]
|
|
458
|
+
|
|
459
|
+
def get_output_name(self) -> str:
|
|
460
|
+
return [
|
|
461
|
+
k
|
|
462
|
+
for k, v in self.output_presets.items()
|
|
463
|
+
if v["full_name"] == self.output_option_true_var.get()
|
|
464
|
+
][0]
|
|
465
|
+
|
|
466
|
+
# def get_output_display_name(self) -> str:
|
|
467
|
+
# return [
|
|
468
|
+
# k
|
|
469
|
+
# for k, v in self.output_presets.items()
|
|
470
|
+
# if v["full_name"] == self.output_option_display_var.get()
|
|
471
|
+
# ][0]
|
|
472
|
+
|
|
473
|
+
def get_preset(self) -> str:
|
|
474
|
+
selection = self.comp_preset_var.get()
|
|
475
|
+
if selection == "auto":
|
|
476
|
+
output_option = self.get_output_name()
|
|
477
|
+
if "telegram_emoji" in output_option:
|
|
478
|
+
return "telegram_emoji"
|
|
479
|
+
if "telegram" in output_option:
|
|
480
|
+
return "telegram"
|
|
481
|
+
if output_option == "imessage":
|
|
482
|
+
return "imessage_small"
|
|
483
|
+
if output_option == "local":
|
|
484
|
+
return selection
|
|
485
|
+
return output_option
|
|
486
|
+
|
|
487
|
+
return selection
|
|
488
|
+
|
|
489
|
+
def start_job(self) -> None:
|
|
490
|
+
self.save_config()
|
|
491
|
+
if self.settings_save_cred_var.get() is True:
|
|
492
|
+
self.save_creds()
|
|
493
|
+
else:
|
|
494
|
+
self.delete_creds()
|
|
495
|
+
|
|
496
|
+
self.control_frame.start_btn.config(text=I("Cancel"), bootstyle="danger") # type: ignore
|
|
497
|
+
self.set_inputs("disabled")
|
|
498
|
+
|
|
499
|
+
opt_input = self.get_opt_input()
|
|
500
|
+
opt_output = self.get_opt_output()
|
|
501
|
+
opt_comp = self.get_opt_comp()
|
|
502
|
+
opt_cred = self.get_opt_cred()
|
|
503
|
+
|
|
504
|
+
self.job = Job(opt_input, opt_comp, opt_output, opt_cred, self.cb)
|
|
505
|
+
|
|
506
|
+
signal.signal(signal.SIGINT, self.job.cancel)
|
|
507
|
+
|
|
508
|
+
Thread(target=self.start_process, daemon=True).start()
|
|
509
|
+
|
|
510
|
+
def get_opt_input(self) -> InputOption:
|
|
511
|
+
return InputOption(
|
|
512
|
+
option=self.get_input_name(),
|
|
513
|
+
url=self.input_address_var.get(),
|
|
514
|
+
dir=Path(self.input_setdir_var.get()),
|
|
515
|
+
)
|
|
516
|
+
|
|
517
|
+
def get_opt_output(self) -> OutputOption:
|
|
518
|
+
return OutputOption(
|
|
519
|
+
option=self.get_output_name(),
|
|
520
|
+
dir=Path(self.output_setdir_var.get()),
|
|
521
|
+
title=self.title_var.get(),
|
|
522
|
+
author=self.author_var.get(),
|
|
523
|
+
)
|
|
524
|
+
|
|
525
|
+
def get_opt_comp(self) -> CompOption:
|
|
526
|
+
return CompOption(
|
|
527
|
+
preset=self.get_preset(),
|
|
528
|
+
size_max_img=self.img_size_max_var.get()
|
|
529
|
+
if not self.size_disable_var.get()
|
|
530
|
+
else None,
|
|
531
|
+
size_max_vid=self.vid_size_max_var.get()
|
|
532
|
+
if not self.size_disable_var.get()
|
|
533
|
+
else None,
|
|
534
|
+
format_img=(self.img_format_var.get(),),
|
|
535
|
+
format_vid=(self.vid_format_var.get(),),
|
|
536
|
+
fps_min=self.fps_min_var.get() if not self.fps_disable_var.get() else None,
|
|
537
|
+
fps_max=self.fps_max_var.get() if not self.fps_disable_var.get() else None,
|
|
538
|
+
fps_power=self.fps_power_var.get(),
|
|
539
|
+
res_w_min=self.res_w_min_var.get()
|
|
540
|
+
if not self.res_w_disable_var.get()
|
|
541
|
+
else None,
|
|
542
|
+
res_w_max=self.res_w_max_var.get()
|
|
543
|
+
if not self.res_w_disable_var.get()
|
|
544
|
+
else None,
|
|
545
|
+
res_h_min=self.res_h_min_var.get()
|
|
546
|
+
if not self.res_h_disable_var.get()
|
|
547
|
+
else None,
|
|
548
|
+
res_h_max=self.res_h_max_var.get()
|
|
549
|
+
if not self.res_h_disable_var.get()
|
|
550
|
+
else None,
|
|
551
|
+
res_power=self.res_power_var.get(),
|
|
552
|
+
res_snap_pow2=self.res_snap_pow2_var.get(),
|
|
553
|
+
quality_min=self.quality_min_var.get()
|
|
554
|
+
if not self.quality_disable_var.get()
|
|
555
|
+
else None,
|
|
556
|
+
quality_max=self.quality_max_var.get()
|
|
557
|
+
if not self.quality_disable_var.get()
|
|
558
|
+
else None,
|
|
559
|
+
quality_power=self.quality_power_var.get(),
|
|
560
|
+
color_min=self.color_min_var.get()
|
|
561
|
+
if not self.color_disable_var.get()
|
|
562
|
+
else None,
|
|
563
|
+
color_max=self.color_max_var.get()
|
|
564
|
+
if not self.color_disable_var.get()
|
|
565
|
+
else None,
|
|
566
|
+
color_power=self.color_power_var.get(),
|
|
567
|
+
duration_min=self.duration_min_var.get()
|
|
568
|
+
if not self.duration_disable_var.get()
|
|
569
|
+
else None,
|
|
570
|
+
duration_max=self.duration_max_var.get()
|
|
571
|
+
if not self.duration_disable_var.get()
|
|
572
|
+
else None,
|
|
573
|
+
bg_color=self.bg_color_var.get(),
|
|
574
|
+
padding_percent=self.padding_percent_var.get(),
|
|
575
|
+
steps=self.steps_var.get(),
|
|
576
|
+
fake_vid=self.fake_vid_var.get(),
|
|
577
|
+
scale_filter=self.scale_filter_var.get(),
|
|
578
|
+
quantize_method=self.quantize_method_var.get(),
|
|
579
|
+
chromium_path=self.chromium_path_var.get()
|
|
580
|
+
if self.chromium_path_var.get() != ""
|
|
581
|
+
else None,
|
|
582
|
+
cache_dir=self.cache_dir_var.get()
|
|
583
|
+
if self.cache_dir_var.get() != ""
|
|
584
|
+
else None,
|
|
585
|
+
default_emoji=self.default_emoji_var.get(),
|
|
586
|
+
no_compress=self.no_compress_var.get(),
|
|
587
|
+
processes=self.processes_var.get(),
|
|
588
|
+
)
|
|
589
|
+
|
|
590
|
+
def get_opt_cred(self) -> CredOption:
|
|
591
|
+
return CredOption(
|
|
592
|
+
signal_uuid=self.signal_uuid_var.get(),
|
|
593
|
+
signal_password=self.signal_password_var.get(),
|
|
594
|
+
telegram_token=self.telegram_token_var.get(),
|
|
595
|
+
telegram_userid=self.telegram_userid_var.get(),
|
|
596
|
+
telethon_api_id=self.telethon_api_id_var.get(),
|
|
597
|
+
telethon_api_hash=self.telethon_api_hash_var.get(),
|
|
598
|
+
kakao_auth_token=self.kakao_auth_token_var.get(),
|
|
599
|
+
kakao_username=self.kakao_username_var.get(),
|
|
600
|
+
kakao_password=self.kakao_password_var.get(),
|
|
601
|
+
kakao_country_code=self.kakao_country_code_var.get(),
|
|
602
|
+
kakao_phone_number=self.kakao_phone_number_var.get(),
|
|
603
|
+
kakao_device_uuid=self.kakao_device_uuid_var.get(),
|
|
604
|
+
line_cookies=self.line_cookies_var.get(),
|
|
605
|
+
viber_auth=self.viber_auth_var.get(),
|
|
606
|
+
discord_token=self.discord_token_var.get(),
|
|
607
|
+
)
|
|
608
|
+
|
|
609
|
+
def start_process(self) -> None:
|
|
610
|
+
if self.job:
|
|
611
|
+
self.job.start()
|
|
612
|
+
self.job = None
|
|
613
|
+
|
|
614
|
+
self.stop_job()
|
|
615
|
+
|
|
616
|
+
def stop_job(self) -> None:
|
|
617
|
+
self.set_inputs("normal")
|
|
618
|
+
self.control_frame.start_btn.config(text=I("Start"), bootstyle="default") # type: ignore
|
|
619
|
+
|
|
620
|
+
def cancel_job(self) -> None:
|
|
621
|
+
if self.job:
|
|
622
|
+
# Need to start new thread or else GUI may freeze
|
|
623
|
+
Thread(target=self.job.cancel, daemon=True).start()
|
|
624
|
+
|
|
625
|
+
def set_inputs(self, state: str) -> None:
|
|
626
|
+
# state: 'normal', 'disabled'
|
|
627
|
+
|
|
628
|
+
self.input_frame.set_states(state=state)
|
|
629
|
+
self.comp_frame.set_states(state=state)
|
|
630
|
+
self.output_frame.set_states(state=state)
|
|
631
|
+
self.cred_frame.set_states(state=state)
|
|
632
|
+
self.settings_frame.set_states(state=state)
|
|
633
|
+
|
|
634
|
+
def exec_in_main(self, _evt: Any) -> Any:
|
|
635
|
+
if self.action:
|
|
636
|
+
self.response = self.action()
|
|
637
|
+
self.response_event.set()
|
|
638
|
+
|
|
639
|
+
def highlight_fields(self) -> bool:
|
|
640
|
+
if not self.init_done:
|
|
641
|
+
return True
|
|
642
|
+
|
|
643
|
+
input_option = self.get_input_name()
|
|
644
|
+
input_option_display = self.get_input_display_name()
|
|
645
|
+
output_option = self.get_output_name()
|
|
646
|
+
# output_option_display = self.get_output_display_name()
|
|
647
|
+
url = self.input_address_var.get()
|
|
648
|
+
|
|
649
|
+
in_out_dir_same = (
|
|
650
|
+
Path(self.input_setdir_var.get()).absolute()
|
|
651
|
+
== Path(self.output_setdir_var.get()).absolute()
|
|
652
|
+
)
|
|
653
|
+
|
|
654
|
+
# Input
|
|
655
|
+
if in_out_dir_same is True:
|
|
656
|
+
self.input_frame.input_setdir_entry.config(bootstyle="danger") # type: ignore
|
|
657
|
+
elif not Path(self.input_setdir_var.get()).is_dir():
|
|
658
|
+
self.input_frame.input_setdir_entry.config(bootstyle="warning") # type: ignore
|
|
659
|
+
else:
|
|
660
|
+
self.input_frame.input_setdir_entry.config(bootstyle="default") # type: ignore
|
|
661
|
+
|
|
662
|
+
self.input_frame.address_lbl.config(
|
|
663
|
+
text=self.input_presets[input_option_display]["address_lbls"]
|
|
664
|
+
)
|
|
665
|
+
self.input_frame.address_entry.config(bootstyle="default") # type: ignore
|
|
666
|
+
|
|
667
|
+
if input_option == "local":
|
|
668
|
+
self.input_frame.address_entry.config(state="disabled")
|
|
669
|
+
self.input_frame.address_tip.config(
|
|
670
|
+
text=self.input_presets[input_option_display]["example"]
|
|
671
|
+
)
|
|
672
|
+
|
|
673
|
+
else:
|
|
674
|
+
self.input_frame.address_entry.config(state="normal")
|
|
675
|
+
self.input_frame.address_tip.config(
|
|
676
|
+
text=self.input_presets[input_option_display]["example"]
|
|
677
|
+
)
|
|
678
|
+
download_option = UrlDetect.detect(url)
|
|
679
|
+
|
|
680
|
+
if not url:
|
|
681
|
+
self.input_frame.address_entry.config(bootstyle="warning") # type: ignore
|
|
682
|
+
|
|
683
|
+
elif (
|
|
684
|
+
download_option is None
|
|
685
|
+
or input_option.startswith(download_option) is False
|
|
686
|
+
and not (
|
|
687
|
+
input_option
|
|
688
|
+
in ("kakao", "band", "line", "discord", "discord_emoji")
|
|
689
|
+
and url.isnumeric()
|
|
690
|
+
)
|
|
691
|
+
):
|
|
692
|
+
self.input_frame.address_entry.config(bootstyle="danger") # type: ignore
|
|
693
|
+
self.input_frame.address_tip.config(
|
|
694
|
+
text=I("Invalid URL: ")
|
|
695
|
+
+ self.input_presets[input_option_display]["example"]
|
|
696
|
+
)
|
|
697
|
+
|
|
698
|
+
elif input_option_display == "auto" and download_option:
|
|
699
|
+
self.input_frame.address_tip.config(
|
|
700
|
+
text=I("Detected URL: ") + download_option
|
|
701
|
+
)
|
|
702
|
+
|
|
703
|
+
# Output
|
|
704
|
+
if in_out_dir_same is True:
|
|
705
|
+
self.output_frame.output_setdir_entry.config(bootstyle="danger") # type: ignore
|
|
706
|
+
elif not Path(self.output_setdir_var.get()).is_dir():
|
|
707
|
+
self.output_frame.output_setdir_entry.config(bootstyle="warning") # type: ignore
|
|
708
|
+
else:
|
|
709
|
+
self.output_frame.output_setdir_entry.config(bootstyle="default") # type: ignore
|
|
710
|
+
|
|
711
|
+
if (
|
|
712
|
+
MetadataHandler.check_metadata_required(output_option, "title")
|
|
713
|
+
and not MetadataHandler.check_metadata_provided(
|
|
714
|
+
Path(self.input_setdir_var.get()), input_option, "title"
|
|
715
|
+
)
|
|
716
|
+
and not self.title_var.get()
|
|
717
|
+
):
|
|
718
|
+
self.output_frame.title_entry.config(bootstyle="warning") # type: ignore
|
|
719
|
+
else:
|
|
720
|
+
self.output_frame.title_entry.config(bootstyle="default") # type: ignore
|
|
721
|
+
|
|
722
|
+
if (
|
|
723
|
+
MetadataHandler.check_metadata_required(output_option, "author")
|
|
724
|
+
and not MetadataHandler.check_metadata_provided(
|
|
725
|
+
Path(self.input_setdir_var.get()), input_option, "author"
|
|
726
|
+
)
|
|
727
|
+
and not self.author_var.get()
|
|
728
|
+
):
|
|
729
|
+
self.output_frame.author_entry.config(bootstyle="warning") # type: ignore
|
|
730
|
+
else:
|
|
731
|
+
self.output_frame.author_entry.config(bootstyle="default") # type: ignore
|
|
732
|
+
|
|
733
|
+
# Credentials
|
|
734
|
+
if output_option == "signal" and not self.signal_uuid_var.get():
|
|
735
|
+
self.cred_frame.signal_uuid_entry.config(bootstyle="warning") # type: ignore
|
|
736
|
+
else:
|
|
737
|
+
self.cred_frame.signal_uuid_entry.config(bootstyle="default") # type: ignore
|
|
738
|
+
|
|
739
|
+
if output_option == "signal" and not self.signal_password_var.get():
|
|
740
|
+
self.cred_frame.signal_password_entry.config(bootstyle="warning") # type: ignore
|
|
741
|
+
else:
|
|
742
|
+
self.cred_frame.signal_password_entry.config(bootstyle="default") # type: ignore
|
|
743
|
+
|
|
744
|
+
if (
|
|
745
|
+
input_option == "telegram" or output_option == "telegram"
|
|
746
|
+
) and not self.telegram_token_var.get():
|
|
747
|
+
self.cred_frame.telegram_token_entry.config(bootstyle="warning") # type: ignore
|
|
748
|
+
else:
|
|
749
|
+
self.cred_frame.telegram_token_entry.config(bootstyle="default") # type: ignore
|
|
750
|
+
|
|
751
|
+
if output_option == "telegram" and not self.telegram_userid_var.get():
|
|
752
|
+
self.cred_frame.telegram_userid_entry.config(bootstyle="warning") # type: ignore
|
|
753
|
+
else:
|
|
754
|
+
self.cred_frame.telegram_userid_entry.config(bootstyle="default") # type: ignore
|
|
755
|
+
|
|
756
|
+
if output_option == "viber" and not self.viber_auth_var.get():
|
|
757
|
+
self.cred_frame.viber_auth_entry.config(bootstyle="warning") # type: ignore
|
|
758
|
+
else:
|
|
759
|
+
self.cred_frame.viber_auth_entry.config(bootstyle="default") # type: ignore
|
|
760
|
+
|
|
761
|
+
if (
|
|
762
|
+
urlparse(url).netloc == "e.kakao.com"
|
|
763
|
+
and not self.kakao_auth_token_var.get()
|
|
764
|
+
):
|
|
765
|
+
self.cred_frame.kakao_auth_token_entry.config(bootstyle="warning") # type: ignore
|
|
766
|
+
else:
|
|
767
|
+
self.cred_frame.kakao_auth_token_entry.config(bootstyle="default") # type: ignore
|
|
768
|
+
|
|
769
|
+
if input_option.startswith("discord") and not self.discord_token_var.get():
|
|
770
|
+
self.cred_frame.discord_token_entry.config(bootstyle="warning") # type: ignore
|
|
771
|
+
else:
|
|
772
|
+
self.cred_frame.discord_token_entry.config(bootstyle="default") # type: ignore
|
|
773
|
+
|
|
774
|
+
# Check for Input and Compression mismatch
|
|
775
|
+
if (
|
|
776
|
+
not self.no_compress_var.get()
|
|
777
|
+
and self.get_output_name() != "local"
|
|
778
|
+
and self.comp_preset_var.get() not in ("auto", "custom")
|
|
779
|
+
and self.get_output_name().replace("_telethon", "")
|
|
780
|
+
not in self.comp_preset_var.get()
|
|
781
|
+
):
|
|
782
|
+
self.comp_frame.comp_preset_opt.config(bootstyle="warning") # type: ignore
|
|
783
|
+
self.output_frame.output_option_opt.config(bootstyle="warning") # type: ignore
|
|
784
|
+
else:
|
|
785
|
+
self.comp_frame.comp_preset_opt.config(bootstyle="secondary") # type: ignore
|
|
786
|
+
self.output_frame.output_option_opt.config(bootstyle="secondary") # type: ignore
|
|
787
|
+
|
|
788
|
+
return True
|