sticker-convert 2.14.0.0__py3-none-any.whl → 2.15.1.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/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} +40 -13
- sticker_convert/{utils/auth/get_kakao_auth_android_login.py → auth/auth_kakao_android_login.py} +80 -84
- sticker_convert/{utils/auth/get_kakao_auth_desktop_login.py → auth/auth_kakao_desktop_login.py} +72 -30
- sticker_convert/{utils/auth/get_kakao_auth_desktop_memdump.py → auth/auth_kakao_desktop_memdump.py} +31 -24
- sticker_convert/{utils/auth/get_line_auth.py → auth/auth_line.py} +21 -6
- sticker_convert/{utils/auth/get_signal_auth.py → auth/auth_signal.py} +18 -20
- sticker_convert/auth/auth_telethon.py +151 -0
- sticker_convert/{utils/auth/get_viber_auth.py → auth/auth_viber.py} +19 -11
- sticker_convert/{utils/auth → auth}/telegram_api.py +4 -13
- sticker_convert/cli.py +44 -70
- sticker_convert/downloaders/download_line.py +2 -2
- sticker_convert/downloaders/download_telegram.py +1 -1
- sticker_convert/gui.py +15 -100
- sticker_convert/gui_components/frames/comp_frame.py +12 -4
- sticker_convert/gui_components/frames/config_frame.py +14 -6
- sticker_convert/gui_components/frames/control_frame.py +1 -1
- sticker_convert/gui_components/frames/cred_frame.py +6 -8
- sticker_convert/gui_components/windows/advanced_compression_window.py +3 -4
- sticker_convert/gui_components/windows/base_window.py +7 -2
- sticker_convert/gui_components/windows/discord_get_auth_window.py +3 -7
- sticker_convert/gui_components/windows/kakao_get_auth_window.py +79 -51
- sticker_convert/gui_components/windows/line_get_auth_window.py +5 -14
- sticker_convert/gui_components/windows/signal_get_auth_window.py +4 -12
- sticker_convert/gui_components/windows/viber_get_auth_window.py +8 -11
- sticker_convert/job.py +16 -32
- sticker_convert/uploaders/upload_telegram.py +1 -1
- sticker_convert/utils/callback.py +238 -6
- sticker_convert/version.py +1 -1
- {sticker_convert-2.14.0.0.dist-info → sticker_convert-2.15.1.0.dist-info}/METADATA +6 -6
- {sticker_convert-2.14.0.0.dist-info → sticker_convert-2.15.1.0.dist-info}/RECORD +36 -34
- sticker_convert/utils/auth/telethon_setup.py +0 -97
- {sticker_convert-2.14.0.0.dist-info → sticker_convert-2.15.1.0.dist-info}/WHEEL +0 -0
- {sticker_convert-2.14.0.0.dist-info → sticker_convert-2.15.1.0.dist-info}/entry_points.txt +0 -0
- {sticker_convert-2.14.0.0.dist-info → sticker_convert-2.15.1.0.dist-info}/licenses/LICENSE +0 -0
- {sticker_convert-2.14.0.0.dist-info → sticker_convert-2.15.1.0.dist-info}/top_level.txt +0 -0
@@ -1,13 +1,12 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
|
-
from functools import partial
|
3
2
|
from threading import Thread
|
4
3
|
from typing import Any
|
5
4
|
|
6
5
|
from ttkbootstrap import Button, Frame, Label # type: ignore
|
7
6
|
|
7
|
+
from sticker_convert.auth.auth_discord import AuthDiscord
|
8
8
|
from sticker_convert.gui_components.gui_utils import GUIUtils
|
9
9
|
from sticker_convert.gui_components.windows.base_window import BaseWindow
|
10
|
-
from sticker_convert.utils.auth.get_discord_auth import GetDiscordAuth
|
11
10
|
|
12
11
|
|
13
12
|
class DiscordGetAuthWindow(BaseWindow):
|
@@ -16,9 +15,6 @@ class DiscordGetAuthWindow(BaseWindow):
|
|
16
15
|
|
17
16
|
self.title("Get Discord token")
|
18
17
|
|
19
|
-
self.cb_msg_block_discord = partial(self.gui.cb_msg_block, parent=self)
|
20
|
-
self.cb_ask_str_discord = partial(self.gui.cb_ask_str, parent=self)
|
21
|
-
|
22
18
|
self.frame_info = Frame(self.scrollable_frame)
|
23
19
|
self.frame_start_btn = Frame(self.scrollable_frame)
|
24
20
|
|
@@ -68,7 +64,7 @@ class DiscordGetAuthWindow(BaseWindow):
|
|
68
64
|
Thread(target=self.cb_login_thread, daemon=True).start()
|
69
65
|
|
70
66
|
def cb_login_thread(self, *args: Any) -> None:
|
71
|
-
m =
|
67
|
+
m = AuthDiscord(self.gui.get_opt_cred(), self.gui.cb)
|
72
68
|
discord_token, msg = m.get_cred()
|
73
69
|
if discord_token:
|
74
70
|
if not self.gui.creds.get("discord"):
|
@@ -79,4 +75,4 @@ class DiscordGetAuthWindow(BaseWindow):
|
|
79
75
|
self.gui.save_creds()
|
80
76
|
self.gui.highlight_fields()
|
81
77
|
|
82
|
-
self.
|
78
|
+
self.gui.cb.put(("msg_block", None, {"message": msg, "parent": self}))
|
@@ -1,17 +1,16 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
2
|
import platform
|
3
|
-
from functools import partial
|
4
3
|
from threading import Thread
|
5
4
|
from typing import Any, Optional
|
6
5
|
|
7
6
|
from ttkbootstrap import Button, Entry, Frame, Label, LabelFrame # type: ignore
|
8
7
|
|
8
|
+
from sticker_convert.auth.auth_kakao_android_login import AuthKakaoAndroidLogin
|
9
|
+
from sticker_convert.auth.auth_kakao_desktop_login import AuthKakaoDesktopLogin
|
10
|
+
from sticker_convert.auth.auth_kakao_desktop_memdump import AuthKakaoDesktopMemdump
|
9
11
|
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
10
12
|
from sticker_convert.gui_components.gui_utils import GUIUtils
|
11
13
|
from sticker_convert.gui_components.windows.base_window import BaseWindow
|
12
|
-
from sticker_convert.utils.auth.get_kakao_auth_android_login import GetKakaoAuthAndroidLogin
|
13
|
-
from sticker_convert.utils.auth.get_kakao_auth_desktop_login import GetKakaoAuthDesktopLogin
|
14
|
-
from sticker_convert.utils.auth.get_kakao_auth_desktop_memdump import GetKakaoAuthDesktopMemdump
|
15
14
|
|
16
15
|
|
17
16
|
class KakaoGetAuthWindow(BaseWindow):
|
@@ -20,9 +19,6 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
20
19
|
|
21
20
|
self.title("Get Kakao auth_token")
|
22
21
|
|
23
|
-
self.cb_msg_block_kakao = partial(self.gui.cb_msg_block, parent=self)
|
24
|
-
self.cb_ask_str_kakao = partial(self.gui.cb_ask_str, parent=self)
|
25
|
-
|
26
22
|
self.frame_desktop_memdump = LabelFrame(
|
27
23
|
self.scrollable_frame, text="Method 1: KakaoTalk Desktop memdump"
|
28
24
|
)
|
@@ -137,8 +133,15 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
137
133
|
self.frame_desktop_login,
|
138
134
|
text="?",
|
139
135
|
width=1,
|
140
|
-
command=lambda: self.
|
141
|
-
|
136
|
+
command=lambda: self.gui.cb.put(
|
137
|
+
(
|
138
|
+
"msg_block",
|
139
|
+
None,
|
140
|
+
{
|
141
|
+
"message": self.gui.help["cred"]["kakao_username"],
|
142
|
+
"parent": self,
|
143
|
+
},
|
144
|
+
)
|
142
145
|
),
|
143
146
|
bootstyle="secondary", # type: ignore
|
144
147
|
)
|
@@ -160,8 +163,15 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
160
163
|
self.frame_desktop_login,
|
161
164
|
text="?",
|
162
165
|
width=1,
|
163
|
-
command=lambda: self.
|
164
|
-
|
166
|
+
command=lambda: self.gui.cb.put(
|
167
|
+
(
|
168
|
+
"msg_block",
|
169
|
+
None,
|
170
|
+
{
|
171
|
+
"message": self.gui.help["cred"]["kakao_password"],
|
172
|
+
"parent": self,
|
173
|
+
},
|
174
|
+
)
|
165
175
|
),
|
166
176
|
bootstyle="secondary", # type: ignore
|
167
177
|
)
|
@@ -179,8 +189,15 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
179
189
|
self.frame_desktop_login,
|
180
190
|
text="?",
|
181
191
|
width=1,
|
182
|
-
command=lambda: self.
|
183
|
-
|
192
|
+
command=lambda: self.gui.cb.put(
|
193
|
+
(
|
194
|
+
"msg_block",
|
195
|
+
None,
|
196
|
+
{
|
197
|
+
"message": self.gui.help["cred"]["kakao_device_uuid"],
|
198
|
+
"parent": self,
|
199
|
+
},
|
200
|
+
)
|
184
201
|
),
|
185
202
|
bootstyle="secondary", # type: ignore
|
186
203
|
)
|
@@ -254,8 +271,15 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
254
271
|
self.frame_android_login,
|
255
272
|
text="?",
|
256
273
|
width=1,
|
257
|
-
command=lambda: self.
|
258
|
-
|
274
|
+
command=lambda: self.gui.cb.put(
|
275
|
+
(
|
276
|
+
"msg_block",
|
277
|
+
None,
|
278
|
+
{
|
279
|
+
"message": self.gui.help["cred"]["kakao_username"],
|
280
|
+
"parent": self,
|
281
|
+
},
|
282
|
+
)
|
259
283
|
),
|
260
284
|
bootstyle="secondary", # type: ignore
|
261
285
|
)
|
@@ -277,8 +301,15 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
277
301
|
self.frame_android_login,
|
278
302
|
text="?",
|
279
303
|
width=1,
|
280
|
-
command=lambda: self.
|
281
|
-
|
304
|
+
command=lambda: self.gui.cb.put(
|
305
|
+
(
|
306
|
+
"msg_block",
|
307
|
+
None,
|
308
|
+
{
|
309
|
+
"message": self.gui.help["cred"]["kakao_password"],
|
310
|
+
"parent": self,
|
311
|
+
},
|
312
|
+
)
|
282
313
|
),
|
283
314
|
bootstyle="secondary", # type: ignore
|
284
315
|
)
|
@@ -296,8 +327,15 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
296
327
|
self.frame_android_login,
|
297
328
|
text="?",
|
298
329
|
width=1,
|
299
|
-
command=lambda: self.
|
300
|
-
|
330
|
+
command=lambda: self.gui.cb.put(
|
331
|
+
(
|
332
|
+
"msg_block",
|
333
|
+
None,
|
334
|
+
{
|
335
|
+
"message": self.gui.help["cred"]["kakao_country_code"],
|
336
|
+
"parent": self,
|
337
|
+
},
|
338
|
+
)
|
301
339
|
),
|
302
340
|
bootstyle="secondary", # type: ignore
|
303
341
|
)
|
@@ -315,8 +353,15 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
315
353
|
self.frame_android_login,
|
316
354
|
text="?",
|
317
355
|
width=1,
|
318
|
-
command=lambda: self.
|
319
|
-
|
356
|
+
command=lambda: self.gui.cb.put(
|
357
|
+
(
|
358
|
+
"msg_block",
|
359
|
+
None,
|
360
|
+
{
|
361
|
+
"message": self.gui.help["cred"]["kakao_phone_number"],
|
362
|
+
"parent": self,
|
363
|
+
},
|
364
|
+
)
|
320
365
|
),
|
321
366
|
bootstyle="secondary", # type: ignore
|
322
367
|
)
|
@@ -375,12 +420,7 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
375
420
|
|
376
421
|
def cb_get_auth_desktop_login_thread(self, *_: Any) -> None:
|
377
422
|
self.gui.save_creds()
|
378
|
-
m =
|
379
|
-
opt_cred=self.gui.get_opt_cred(),
|
380
|
-
cb_msg=self.gui.cb_msg,
|
381
|
-
cb_msg_block=self.cb_msg_block_kakao,
|
382
|
-
cb_ask_str=self.cb_ask_str_kakao,
|
383
|
-
)
|
423
|
+
m = AuthKakaoDesktopLogin(self.gui.get_opt_cred(), self.gui.cb)
|
384
424
|
|
385
425
|
auth_token, msg = m.get_cred()
|
386
426
|
|
@@ -393,21 +433,16 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
393
433
|
self.gui.save_creds()
|
394
434
|
self.gui.highlight_fields()
|
395
435
|
|
396
|
-
self.
|
436
|
+
self.gui.cb.put(("msg_block", None, {"message": msg, "parent": self}))
|
397
437
|
|
398
438
|
def cb_get_auth_desktop_login(self) -> None:
|
399
439
|
Thread(target=self.cb_get_auth_desktop_login_thread, daemon=True).start()
|
400
440
|
|
401
441
|
def cb_get_auth_android_login_thread(self, *_: Any) -> None:
|
402
442
|
self.gui.save_creds()
|
403
|
-
m =
|
404
|
-
opt_cred=self.gui.get_opt_cred(),
|
405
|
-
cb_msg=self.gui.cb_msg,
|
406
|
-
cb_msg_block=self.cb_msg_block_kakao,
|
407
|
-
cb_ask_str=self.cb_ask_str_kakao,
|
408
|
-
)
|
443
|
+
m = AuthKakaoAndroidLogin(self.gui.get_opt_cred(), self.gui.cb)
|
409
444
|
|
410
|
-
auth_token = m.get_cred()
|
445
|
+
auth_token, msg = m.get_cred()
|
411
446
|
|
412
447
|
if auth_token:
|
413
448
|
if not self.gui.creds.get("kakao"):
|
@@ -415,16 +450,13 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
415
450
|
self.gui.creds["kakao"]["auth_token"] = auth_token
|
416
451
|
self.gui.kakao_auth_token_var.set(auth_token)
|
417
452
|
|
418
|
-
self.cb_msg_block_kakao(f"Got auth_token successfully: {auth_token}")
|
419
453
|
self.gui.save_creds()
|
420
454
|
self.gui.highlight_fields()
|
421
|
-
|
422
|
-
|
455
|
+
|
456
|
+
self.gui.cb.put(("msg_block", None, {"message": msg, "parent": self}))
|
423
457
|
|
424
458
|
def cb_launch_desktop(self) -> None:
|
425
|
-
m =
|
426
|
-
cb_ask_str=self.cb_ask_str_kakao,
|
427
|
-
)
|
459
|
+
m = AuthKakaoDesktopMemdump(self.gui.get_opt_cred(), self.gui.cb)
|
428
460
|
if self.gui.kakao_bin_path_var.get() != "":
|
429
461
|
bin_path = self.gui.kakao_bin_path_var.get()
|
430
462
|
else:
|
@@ -433,20 +465,16 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
433
465
|
if bin_path is not None:
|
434
466
|
m.launch_kakao(bin_path)
|
435
467
|
else:
|
436
|
-
|
437
|
-
|
438
|
-
)
|
468
|
+
msg = "Error: Cannot launch Kakao Desktop. Is it installed?"
|
469
|
+
self.gui.cb.put(("msg_block", None, {"message": msg, "parent": self}))
|
439
470
|
|
440
471
|
def cb_get_auth_desktop_memdump(self) -> None:
|
441
472
|
Thread(target=self.cb_get_auth_desktop_memdump_thread, daemon=True).start()
|
442
473
|
|
443
474
|
def cb_get_auth_desktop_memdump_thread(self, *_: Any) -> None:
|
444
475
|
self.gui.save_creds()
|
445
|
-
self.gui.
|
446
|
-
self.gui.
|
447
|
-
m = GetKakaoAuthDesktopMemdump(
|
448
|
-
cb_ask_str=self.cb_ask_str_kakao,
|
449
|
-
)
|
476
|
+
self.gui.cb.bar("indeterminate")
|
477
|
+
m = AuthKakaoDesktopMemdump(self.gui.get_opt_cred(), self.gui.cb)
|
450
478
|
|
451
479
|
bin_path: Optional[str]
|
452
480
|
if self.gui.kakao_bin_path_var.get() != "":
|
@@ -464,5 +492,5 @@ class KakaoGetAuthWindow(BaseWindow):
|
|
464
492
|
self.gui.save_creds()
|
465
493
|
self.gui.highlight_fields()
|
466
494
|
|
467
|
-
self.
|
468
|
-
self.gui.
|
495
|
+
self.gui.cb.put(("msg_block", None, {"message": msg, "parent": self}))
|
496
|
+
self.gui.cb.bar("clear")
|
@@ -1,14 +1,13 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
2
|
import webbrowser
|
3
|
-
from functools import partial
|
4
3
|
from threading import Thread
|
5
4
|
from typing import Any
|
6
5
|
|
7
6
|
from ttkbootstrap import Button, Frame, Label # type: ignore
|
8
7
|
|
8
|
+
from sticker_convert.auth.auth_line import AuthLine
|
9
9
|
from sticker_convert.gui_components.gui_utils import GUIUtils
|
10
10
|
from sticker_convert.gui_components.windows.base_window import BaseWindow
|
11
|
-
from sticker_convert.utils.auth.get_line_auth import GetLineAuth
|
12
11
|
|
13
12
|
|
14
13
|
class LineGetAuthWindow(BaseWindow):
|
@@ -17,8 +16,6 @@ class LineGetAuthWindow(BaseWindow):
|
|
17
16
|
|
18
17
|
self.title("Get Line cookie")
|
19
18
|
|
20
|
-
self.cb_msg_block_line = partial(self.gui.cb_msg_block, parent=self)
|
21
|
-
|
22
19
|
self.frame_info = Frame(self.scrollable_frame)
|
23
20
|
self.frame_btn = Frame(self.scrollable_frame)
|
24
21
|
|
@@ -72,7 +69,7 @@ class LineGetAuthWindow(BaseWindow):
|
|
72
69
|
line_login_site = "https://store.line.me/login"
|
73
70
|
success = webbrowser.open(line_login_site)
|
74
71
|
if not success:
|
75
|
-
self.gui.
|
72
|
+
self.gui.cb.ask_str(
|
76
73
|
"Cannot open web browser for you. Install web browser and open:",
|
77
74
|
initialvalue=line_login_site,
|
78
75
|
)
|
@@ -81,22 +78,16 @@ class LineGetAuthWindow(BaseWindow):
|
|
81
78
|
Thread(target=self.cb_get_cookies_thread, daemon=True).start()
|
82
79
|
|
83
80
|
def cb_get_cookies_thread(self, *_: Any) -> None:
|
84
|
-
m =
|
81
|
+
m = AuthLine(self.gui.get_opt_cred(), self.gui.cb)
|
85
82
|
|
86
83
|
line_cookies = None
|
87
|
-
line_cookies = m.get_cred()
|
88
|
-
|
84
|
+
line_cookies, msg = m.get_cred()
|
85
|
+
self.gui.cb.put(("msg_block", None, {"message": msg, "parent": self}))
|
89
86
|
if line_cookies:
|
90
87
|
if not self.gui.creds.get("line"):
|
91
88
|
self.gui.creds["line"] = {}
|
92
89
|
self.gui.creds["line"]["cookies"] = line_cookies
|
93
90
|
self.gui.line_cookies_var.set(line_cookies)
|
94
|
-
|
95
|
-
self.cb_msg_block_line("Got Line cookies successfully")
|
96
91
|
self.gui.save_creds()
|
97
92
|
self.gui.highlight_fields()
|
98
93
|
return
|
99
|
-
|
100
|
-
self.cb_msg_block_line(
|
101
|
-
"Failed to get Line cookies. Have you logged in the web browser?"
|
102
|
-
)
|
@@ -1,13 +1,12 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
|
-
from functools import partial
|
3
2
|
from threading import Thread
|
4
3
|
from typing import Any
|
5
4
|
|
6
5
|
from ttkbootstrap import Button, Frame, Label # type: ignore
|
7
6
|
|
7
|
+
from sticker_convert.auth.auth_signal import AuthSignal
|
8
8
|
from sticker_convert.gui_components.gui_utils import GUIUtils
|
9
9
|
from sticker_convert.gui_components.windows.base_window import BaseWindow
|
10
|
-
from sticker_convert.utils.auth.get_signal_auth import GetSignalAuth
|
11
10
|
|
12
11
|
|
13
12
|
class SignalGetAuthWindow(BaseWindow):
|
@@ -16,9 +15,6 @@ class SignalGetAuthWindow(BaseWindow):
|
|
16
15
|
|
17
16
|
self.title("Get Signal uuid and password")
|
18
17
|
|
19
|
-
self.cb_msg_block_signal = partial(self.gui.cb_msg_block, parent=self)
|
20
|
-
self.cb_ask_str_signal = partial(self.gui.cb_ask_str, parent=self)
|
21
|
-
|
22
18
|
self.frame_info = Frame(self.scrollable_frame)
|
23
19
|
self.frame_start_btn = Frame(self.scrollable_frame)
|
24
20
|
|
@@ -68,9 +64,10 @@ class SignalGetAuthWindow(BaseWindow):
|
|
68
64
|
Thread(target=self.cb_login_thread, daemon=True).start()
|
69
65
|
|
70
66
|
def cb_login_thread(self, *args: Any) -> None:
|
71
|
-
m =
|
67
|
+
m = AuthSignal(self.gui.get_opt_cred(), self.gui.cb)
|
72
68
|
|
73
|
-
uuid, password = m.get_cred()
|
69
|
+
uuid, password, msg = m.get_cred()
|
70
|
+
self.gui.cb.put(("msg_block", None, {"message": msg, "parent": self}))
|
74
71
|
if uuid and password:
|
75
72
|
if not self.gui.creds.get("signal"):
|
76
73
|
self.gui.creds["signal"] = {}
|
@@ -79,11 +76,6 @@ class SignalGetAuthWindow(BaseWindow):
|
|
79
76
|
self.gui.signal_uuid_var.set(uuid)
|
80
77
|
self.gui.signal_password_var.set(password)
|
81
78
|
|
82
|
-
self.cb_msg_block_signal(
|
83
|
-
f"Got uuid and password successfully:\nuuid={uuid}\npassword={password}"
|
84
|
-
)
|
85
79
|
self.gui.save_creds()
|
86
80
|
self.gui.highlight_fields()
|
87
81
|
return
|
88
|
-
|
89
|
-
self.cb_msg_block_signal("Failed to get uuid and password")
|
@@ -1,6 +1,5 @@
|
|
1
1
|
#!/usr/bin/env python3
|
2
2
|
import platform
|
3
|
-
from functools import partial
|
4
3
|
from pathlib import Path
|
5
4
|
from subprocess import Popen
|
6
5
|
from threading import Thread
|
@@ -9,9 +8,9 @@ from typing import Any
|
|
9
8
|
|
10
9
|
from ttkbootstrap import Button, Entry, Frame, Label # type: ignore
|
11
10
|
|
11
|
+
from sticker_convert.auth.auth_viber import AuthViber
|
12
12
|
from sticker_convert.gui_components.gui_utils import GUIUtils
|
13
13
|
from sticker_convert.gui_components.windows.base_window import BaseWindow
|
14
|
-
from sticker_convert.utils.auth.get_viber_auth import GetViberAuth
|
15
14
|
|
16
15
|
|
17
16
|
class ViberGetAuthWindow(BaseWindow):
|
@@ -20,9 +19,6 @@ class ViberGetAuthWindow(BaseWindow):
|
|
20
19
|
|
21
20
|
self.title("Get Viber auth data")
|
22
21
|
|
23
|
-
self.cb_msg_block_viber = partial(self.gui.cb_msg_block, parent=self)
|
24
|
-
self.cb_ask_str_viber = partial(self.gui.cb_ask_str, parent=self)
|
25
|
-
|
26
22
|
self.frame_info = Frame(self.scrollable_frame)
|
27
23
|
self.frame_btns = Frame(self.scrollable_frame)
|
28
24
|
self.frame_config = Frame(self.scrollable_frame)
|
@@ -128,7 +124,7 @@ class ViberGetAuthWindow(BaseWindow):
|
|
128
124
|
Thread(target=self.cb_get_cred_thread, daemon=True).start()
|
129
125
|
|
130
126
|
def cb_get_cred_thread(self) -> None:
|
131
|
-
m =
|
127
|
+
m = AuthViber(self.gui.get_opt_cred(), self.gui.cb)
|
132
128
|
|
133
129
|
viber_bin_path = None
|
134
130
|
if self.gui.viber_bin_path_var.get():
|
@@ -145,19 +141,20 @@ class ViberGetAuthWindow(BaseWindow):
|
|
145
141
|
self.gui.save_creds()
|
146
142
|
self.gui.highlight_fields()
|
147
143
|
|
148
|
-
self.
|
144
|
+
self.gui.cb.put(("msg_block", None, {"message": msg, "parent": self}))
|
149
145
|
|
150
146
|
def cb_launch_viber(self) -> None:
|
151
|
-
m =
|
147
|
+
m = AuthViber(self.gui.get_opt_cred(), self.gui.cb)
|
152
148
|
viber_bin_path = m.get_viber_desktop()
|
153
149
|
|
154
|
-
if self.gui.
|
155
|
-
viber_bin_path = self.gui.
|
150
|
+
if self.gui.viber_bin_path_var.get():
|
151
|
+
viber_bin_path = self.gui.viber_bin_path_var.get()
|
156
152
|
|
157
153
|
if viber_bin_path:
|
158
154
|
Popen([viber_bin_path])
|
159
155
|
else:
|
160
|
-
|
156
|
+
msg = "Error: Viber Desktop not installed."
|
157
|
+
self.gui.cb.put(("msg_block", None, {"message": msg, "parent": self}))
|
161
158
|
|
162
159
|
def cb_setdir(self) -> None:
|
163
160
|
orig_input_dir = self.gui.viber_bin_path_var.get()
|
sticker_convert/job.py
CHANGED
@@ -8,7 +8,7 @@ from datetime import datetime
|
|
8
8
|
from multiprocessing import Manager, Process, Value
|
9
9
|
from pathlib import Path
|
10
10
|
from threading import Thread
|
11
|
-
from typing import Any, Callable, Dict, List, Optional, Tuple
|
11
|
+
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple, Union
|
12
12
|
from urllib.parse import urlparse
|
13
13
|
|
14
14
|
from sticker_convert.converter import StickerConvert
|
@@ -32,21 +32,18 @@ from sticker_convert.utils.files.metadata_handler import MetadataHandler
|
|
32
32
|
from sticker_convert.utils.media.codec_info import CodecInfo
|
33
33
|
from sticker_convert.utils.singletons import singletons
|
34
34
|
|
35
|
+
if TYPE_CHECKING:
|
36
|
+
from sticker_convert.utils.callback import CallbackCli, CallbackGui
|
37
|
+
|
35
38
|
|
36
39
|
class Executor:
|
37
|
-
def __init__(
|
38
|
-
self
|
39
|
-
|
40
|
-
|
41
|
-
cb_bar
|
42
|
-
cb_ask_bool
|
43
|
-
cb_ask_str
|
44
|
-
) -> None:
|
45
|
-
self.cb_msg = cb_msg
|
46
|
-
self.cb_msg_block = cb_msg_block
|
47
|
-
self.cb_bar = cb_bar
|
48
|
-
self.cb_ask_bool = cb_ask_bool
|
49
|
-
self.cb_ask_str = cb_ask_str
|
40
|
+
def __init__(self, cb: Union[CallbackGui, CallbackCli]) -> None:
|
41
|
+
self.cb_msg = cb.cb_msg
|
42
|
+
self.cb_msg_block = cb.cb_msg_block
|
43
|
+
self.cb_msg_dynamic = cb.cb_msg_dynamic
|
44
|
+
self.cb_bar = cb.cb_bar
|
45
|
+
self.cb_ask_bool = cb.cb_ask_bool
|
46
|
+
self.cb_ask_str = cb.cb_ask_str
|
50
47
|
|
51
48
|
self.manager = Manager()
|
52
49
|
self.work_queue: WorkQueueType = self.manager.Queue()
|
@@ -90,7 +87,7 @@ class Executor:
|
|
90
87
|
def cb(
|
91
88
|
self,
|
92
89
|
action: Optional[str],
|
93
|
-
args: Optional[Tuple[
|
90
|
+
args: Optional[Tuple[Any, ...]] = None,
|
94
91
|
kwargs: Optional[Dict[str, Any]] = None,
|
95
92
|
) -> None:
|
96
93
|
if args is None:
|
@@ -105,6 +102,8 @@ class Executor:
|
|
105
102
|
self.cb_bar(update_bar=1)
|
106
103
|
elif action == "msg_block":
|
107
104
|
self.cb_return.set_response(self.cb_msg_block(*args, **kwargs))
|
105
|
+
elif action == "msg_dynamic":
|
106
|
+
self.cb_msg_dynamic(*args, **kwargs)
|
108
107
|
elif action == "ask_bool":
|
109
108
|
self.cb_return.set_response(self.cb_ask_bool(*args, **kwargs))
|
110
109
|
elif action == "ask_str":
|
@@ -208,31 +207,16 @@ class Job:
|
|
208
207
|
opt_comp: CompOption,
|
209
208
|
opt_output: OutputOption,
|
210
209
|
opt_cred: CredOption,
|
211
|
-
|
212
|
-
cb_msg_block: Callable[..., None],
|
213
|
-
cb_bar: Callable[..., None],
|
214
|
-
cb_ask_bool: Callable[..., bool],
|
215
|
-
cb_ask_str: Callable[..., str],
|
210
|
+
cb: Union[CallbackCli, CallbackGui],
|
216
211
|
) -> None:
|
217
212
|
self.opt_input = opt_input
|
218
213
|
self.opt_comp = opt_comp
|
219
214
|
self.opt_output = opt_output
|
220
215
|
self.opt_cred = opt_cred
|
221
|
-
self.cb_msg = cb_msg
|
222
|
-
self.cb_msg_block = cb_msg_block
|
223
|
-
self.cb_bar = cb_bar
|
224
|
-
self.cb_ask_bool = cb_ask_bool
|
225
|
-
self.cb_ask_str = cb_ask_str
|
226
216
|
|
227
217
|
self.out_urls: List[str] = []
|
228
218
|
|
229
|
-
self.executor = Executor(
|
230
|
-
self.cb_msg,
|
231
|
-
self.cb_msg_block,
|
232
|
-
self.cb_bar,
|
233
|
-
self.cb_ask_bool,
|
234
|
-
self.cb_ask_str,
|
235
|
-
)
|
219
|
+
self.executor = Executor(cb)
|
236
220
|
|
237
221
|
def start(self) -> int:
|
238
222
|
if Path(self.opt_input.dir).is_dir() is False:
|
@@ -6,10 +6,10 @@ from typing import Any, Dict, List, Optional, Tuple, Union, cast
|
|
6
6
|
import anyio
|
7
7
|
from telegram import Sticker
|
8
8
|
|
9
|
+
from sticker_convert.auth.telegram_api import BotAPI, TelegramAPI, TelegramSticker, TelethonAPI
|
9
10
|
from sticker_convert.converter import StickerConvert
|
10
11
|
from sticker_convert.job_option import CompOption, CredOption, OutputOption
|
11
12
|
from sticker_convert.uploaders.upload_base import UploadBase
|
12
|
-
from sticker_convert.utils.auth.telegram_api import BotAPI, TelegramAPI, TelegramSticker, TelethonAPI
|
13
13
|
from sticker_convert.utils.callback import CallbackProtocol, CallbackReturn
|
14
14
|
from sticker_convert.utils.emoji import extract_emojis
|
15
15
|
from sticker_convert.utils.files.metadata_handler import MetadataHandler
|