sticker-convert 2.7.4__tar.gz → 2.7.6__tar.gz
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-2.7.4/src/sticker_convert.egg-info → sticker-convert-2.7.6}/PKG-INFO +3 -1
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/requirements.txt +2 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/cli.py +2 -2
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/downloaders/download_telegram.py +54 -45
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui.py +3 -4
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/frames/config_frame.py +1 -1
- sticker-convert-2.7.6/src/sticker_convert/gui_components/frames/progress_frame.py +129 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/windows/signal_get_auth_window.py +11 -5
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/job.py +10 -11
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/uploaders/upload_telegram.py +123 -56
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/auth/get_signal_auth.py +8 -2
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/callback.py +4 -9
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/version.py +1 -1
- {sticker-convert-2.7.4 → sticker-convert-2.7.6/src/sticker_convert.egg-info}/PKG-INFO +3 -1
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert.egg-info/requires.txt +2 -0
- sticker-convert-2.7.4/src/sticker_convert/gui_components/frames/progress_frame.py +0 -97
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/LICENSE +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/MANIFEST.in +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/README.md +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/pyproject.toml +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/setup.cfg +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/__init__.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/__main__.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/converter.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/definitions.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/downloaders/__init__.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/downloaders/download_base.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/downloaders/download_kakao.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/downloaders/download_line.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/downloaders/download_signal.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/__init__.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/frames/__init__.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/frames/comp_frame.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/frames/control_frame.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/frames/cred_frame.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/frames/input_frame.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/frames/output_frame.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/frames/right_clicker.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/gui_utils.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/windows/__init__.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/windows/advanced_compression_window.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/windows/base_window.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/windows/kakao_get_auth_window.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/gui_components/windows/line_get_auth_window.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/.github/FUNDING.yml +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/.gitignore +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/README.md +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers/Info.plist +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Info.plist +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Contents.json +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Contents.json +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 1.sticker/Contents.json +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 1.sticker/Sticker 1.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 2.sticker/Contents.json +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 2.sticker/Sticker 2.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 3.sticker/Contents.json +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 3.sticker/Sticker 3.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/App-Store-1024x1024pt.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Contents.json +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-App-Store-1024x768pt.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPad-67x50pt@2x.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPad-Pro-74x55pt@2x.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPhone-60x45pt@2x.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPhone-60x45pt@3x.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages27x20pt@2x.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages27x20pt@3x.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages32x24pt@2x.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages32x24pt@3x.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/iPad-Settings-29pt@2x.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/iPhone-Settings-29pt@3x.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/iPhone-settings-29pt@2x.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.pbxproj +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/xcuserdata/niklaspeterson.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/xcuserdata/niklaspeterson.xcuserdatad/xcschemes/xcschememanagement.plist +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/job_option.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/resources/NotoColorEmoji.ttf +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/resources/appicon.icns +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/resources/appicon.ico +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/resources/appicon.png +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/resources/compression.json +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/resources/emoji.json +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/resources/help.json +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/resources/input.json +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/resources/output.json +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/uploaders/__init__.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/uploaders/compress_wastickers.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/uploaders/upload_base.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/uploaders/upload_signal.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/uploaders/xcode_imessage.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/auth/get_kakao_auth.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/auth/get_line_auth.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/files/cache_store.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/files/json_manager.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/files/json_resources_loader.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/files/metadata_handler.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/files/run_bin.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/files/sanitize_filename.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/media/apple_png_normalize.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/media/codec_info.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/media/decrypt_kakao.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/media/format_verify.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/utils/url_detect.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert.egg-info/SOURCES.txt +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert.egg-info/dependency_links.txt +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert.egg-info/entry_points.txt +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert.egg-info/top_level.txt +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/tests/test_compression.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/tests/test_download.py +0 -0
- {sticker-convert-2.7.4 → sticker-convert-2.7.6}/tests/test_export.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: sticker-convert
|
3
|
-
Version: 2.7.
|
3
|
+
Version: 2.7.6
|
4
4
|
Summary: Convert (animated) stickers to/from WhatsApp, Telegram, Signal, Line, Kakao, iMessage. Written in Python.
|
5
5
|
Author-email: laggykiller <chaudominic2@gmail.com>
|
6
6
|
Maintainer-email: laggykiller <chaudominic2@gmail.com>
|
@@ -364,6 +364,8 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
364
364
|
Requires-Python: >=3.8
|
365
365
|
Description-Content-Type: text/markdown
|
366
366
|
License-File: LICENSE
|
367
|
+
Requires-Dist: aiolimiter~=1.1.0
|
368
|
+
Requires-Dist: anyio~=3.7.1
|
367
369
|
Requires-Dist: apngasm_python~=1.2.3
|
368
370
|
Requires-Dist: av~=11.0.0
|
369
371
|
Requires-Dist: beautifulsoup4~=4.12.3
|
@@ -135,7 +135,7 @@ class CLI:
|
|
135
135
|
continue
|
136
136
|
parser_comp.add_argument(
|
137
137
|
f'--{k.replace("_", "-")}',
|
138
|
-
**keyword_args,
|
138
|
+
**keyword_args,
|
139
139
|
dest=k,
|
140
140
|
help=v,
|
141
141
|
)
|
@@ -154,7 +154,7 @@ class CLI:
|
|
154
154
|
keyword_args = {"action": "store_true"}
|
155
155
|
parser_cred.add_argument(
|
156
156
|
f'--{k.replace("_", "-")}',
|
157
|
-
**keyword_args,
|
157
|
+
**keyword_args,
|
158
158
|
dest=k,
|
159
159
|
help=v,
|
160
160
|
)
|
{sticker-convert-2.7.4 → sticker-convert-2.7.6}/src/sticker_convert/downloaders/download_telegram.py
RENAMED
@@ -5,8 +5,9 @@ from typing import Dict, Optional, Union
|
|
5
5
|
from urllib.parse import urlparse
|
6
6
|
|
7
7
|
import anyio
|
8
|
-
from telegram import
|
8
|
+
from telegram import PhotoSize, Sticker, StickerSet
|
9
9
|
from telegram.error import TelegramError
|
10
|
+
from telegram.ext import AIORateLimiter, ApplicationBuilder
|
10
11
|
|
11
12
|
from sticker_convert.downloaders.download_base import DownloadBase
|
12
13
|
from sticker_convert.job_option import CredOption
|
@@ -33,18 +34,33 @@ class DownloadTelegram(DownloadBase):
|
|
33
34
|
|
34
35
|
self.title = Path(urlparse(self.url).path).name
|
35
36
|
|
37
|
+
self.emoji_dict: Dict[str, str] = {}
|
38
|
+
|
36
39
|
return anyio.run(self.save_stickers)
|
37
40
|
|
38
41
|
async def save_stickers(self) -> bool:
|
39
|
-
|
40
|
-
|
42
|
+
timeout = 30
|
43
|
+
application = ( # type: ignore
|
44
|
+
ApplicationBuilder()
|
45
|
+
.token(self.token)
|
46
|
+
.rate_limiter(AIORateLimiter())
|
47
|
+
.connect_timeout(timeout)
|
48
|
+
.pool_timeout(timeout)
|
49
|
+
.read_timeout(timeout)
|
50
|
+
.write_timeout(timeout)
|
51
|
+
.connection_pool_size(20)
|
52
|
+
.build()
|
53
|
+
)
|
54
|
+
|
55
|
+
async with application:
|
56
|
+
bot = application.bot
|
41
57
|
try:
|
42
|
-
sticker_set = await bot.get_sticker_set(
|
43
|
-
self.title,
|
44
|
-
read_timeout=
|
45
|
-
write_timeout=
|
46
|
-
connect_timeout=
|
47
|
-
pool_timeout=
|
58
|
+
sticker_set: StickerSet = await bot.get_sticker_set(
|
59
|
+
self.title,
|
60
|
+
read_timeout=timeout,
|
61
|
+
write_timeout=timeout,
|
62
|
+
connect_timeout=timeout,
|
63
|
+
pool_timeout=timeout,
|
48
64
|
)
|
49
65
|
except TelegramError as e:
|
50
66
|
self.cb.put(
|
@@ -63,50 +79,43 @@ class DownloadTelegram(DownloadBase):
|
|
63
79
|
)
|
64
80
|
)
|
65
81
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
82
|
+
async def download_sticker(
|
83
|
+
sticker: Union[PhotoSize, Sticker], f_id: str
|
84
|
+
) -> None:
|
85
|
+
sticker_file = await sticker.get_file(
|
86
|
+
read_timeout=timeout,
|
87
|
+
write_timeout=timeout,
|
88
|
+
connect_timeout=timeout,
|
89
|
+
pool_timeout=timeout,
|
73
90
|
)
|
74
|
-
|
75
|
-
|
91
|
+
fpath = sticker_file.file_path
|
92
|
+
assert fpath is not None
|
93
|
+
ext = Path(fpath).suffix
|
76
94
|
f_name = f_id + ext
|
77
95
|
f_path = Path(self.out_dir, f_name)
|
78
|
-
await
|
96
|
+
await sticker_file.download_to_drive(
|
79
97
|
custom_path=f_path,
|
80
|
-
read_timeout=
|
81
|
-
write_timeout=
|
82
|
-
connect_timeout=
|
83
|
-
pool_timeout=
|
98
|
+
read_timeout=timeout,
|
99
|
+
write_timeout=timeout,
|
100
|
+
connect_timeout=timeout,
|
101
|
+
pool_timeout=timeout,
|
84
102
|
)
|
85
|
-
|
103
|
+
if isinstance(sticker, Sticker) and sticker.emoji is not None:
|
104
|
+
self.emoji_dict[f_id] = sticker.emoji
|
86
105
|
self.cb.put(f"Downloaded {f_name}")
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
cover_name = "cover" + cover_ext
|
98
|
-
cover_path = Path(self.out_dir, cover_name)
|
99
|
-
await cover.download_to_drive(
|
100
|
-
custom_path=cover_path,
|
101
|
-
read_timeout=30,
|
102
|
-
write_timeout=30,
|
103
|
-
connect_timeout=30,
|
104
|
-
pool_timeout=30,
|
105
|
-
)
|
106
|
-
self.cb.put(f"Downloaded {cover_name}")
|
106
|
+
if f_id != "cover":
|
107
|
+
self.cb.put("update_bar")
|
108
|
+
|
109
|
+
async with anyio.create_task_group() as tg:
|
110
|
+
for num, sticker in enumerate(sticker_set.stickers):
|
111
|
+
f_id = str(num).zfill(3)
|
112
|
+
tg.start_soon(download_sticker, sticker, f_id)
|
113
|
+
|
114
|
+
if sticker_set.thumbnail is not None:
|
115
|
+
tg.start_soon(download_sticker, sticker_set.thumbnail, "cover")
|
107
116
|
|
108
117
|
MetadataHandler.set_metadata(
|
109
|
-
self.out_dir, title=self.title, emoji_dict=emoji_dict
|
118
|
+
self.out_dir, title=self.title, emoji_dict=self.emoji_dict
|
110
119
|
)
|
111
120
|
return True
|
112
121
|
|
@@ -550,9 +550,8 @@ class GUI(Window):
|
|
550
550
|
|
551
551
|
def cancel_job(self) -> None:
|
552
552
|
if self.job:
|
553
|
-
|
554
|
-
self.job.cancel()
|
555
|
-
self.cb_bar(set_progress_mode="clear")
|
553
|
+
# Need to start new thread or else GUI may freeze
|
554
|
+
Thread(target=self.job.cancel, daemon=True).start()
|
556
555
|
|
557
556
|
def set_inputs(self, state: str) -> None:
|
558
557
|
# state: 'normal', 'disabled'
|
@@ -639,7 +638,7 @@ class GUI(Window):
|
|
639
638
|
*args: Any,
|
640
639
|
set_progress_mode: Optional[str] = None,
|
641
640
|
steps: int = 0,
|
642
|
-
update_bar:
|
641
|
+
update_bar: int = 0,
|
643
642
|
**kwargs: Any,
|
644
643
|
) -> None:
|
645
644
|
with self.bar_lock:
|
@@ -42,7 +42,7 @@ class ConfigFrame(LabelFrame):
|
|
42
42
|
)
|
43
43
|
|
44
44
|
self.settings_restore_default_lbl = Label(
|
45
|
-
self, text="
|
45
|
+
self, text="Default config", width=18, justify="left", anchor="w"
|
46
46
|
)
|
47
47
|
self.settings_restore_default_btn = Button(
|
48
48
|
self,
|
@@ -0,0 +1,129 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
from typing import TYPE_CHECKING, Any, Optional
|
3
|
+
|
4
|
+
from tqdm import tqdm
|
5
|
+
from ttkbootstrap import LabelFrame, Progressbar # type: ignore
|
6
|
+
from ttkbootstrap.scrolled import ScrolledText # type: ignore
|
7
|
+
|
8
|
+
from sticker_convert.gui_components.frames.right_clicker import RightClicker
|
9
|
+
|
10
|
+
if TYPE_CHECKING:
|
11
|
+
from sticker_convert.gui import GUI # type: ignore
|
12
|
+
|
13
|
+
|
14
|
+
class ProgressFrame(LabelFrame):
|
15
|
+
progress_bar_cli = None
|
16
|
+
progress_bar_steps = 0
|
17
|
+
auto_scroll = True
|
18
|
+
msg_cls = False
|
19
|
+
msg_buffer = ""
|
20
|
+
bar_mode_changed = False
|
21
|
+
bar_mode = "clear"
|
22
|
+
bar_updates = 0
|
23
|
+
bar_steps = 0
|
24
|
+
|
25
|
+
def __init__(self, gui: "GUI", *args: Any, **kwargs: Any) -> None:
|
26
|
+
self.gui = gui
|
27
|
+
super().__init__(*args, **kwargs) # type: ignore
|
28
|
+
|
29
|
+
self.message_box = ScrolledText(self, height=15, wrap="word")
|
30
|
+
self.message_box._text.bind("<Button-3><ButtonRelease-3>", RightClicker) # type: ignore
|
31
|
+
self.message_box._text.config(state="disabled") # type: ignore
|
32
|
+
self.progress_bar = Progressbar(self, orient="horizontal", mode="determinate")
|
33
|
+
|
34
|
+
self.message_box.bind("<Enter>", self.cb_disable_autoscroll)
|
35
|
+
self.message_box.bind("<Leave>", self.cb_enable_autoscroll)
|
36
|
+
|
37
|
+
self.message_box.pack(expand=True, fill="x")
|
38
|
+
self.progress_bar.pack(expand=True, fill="x")
|
39
|
+
|
40
|
+
self.after(40, self.update_ui)
|
41
|
+
|
42
|
+
def update_progress_bar(
|
43
|
+
self,
|
44
|
+
set_progress_mode: Optional[str] = None,
|
45
|
+
steps: int = 0,
|
46
|
+
update_bar: int = 0,
|
47
|
+
) -> None:
|
48
|
+
if update_bar:
|
49
|
+
self.bar_updates += update_bar
|
50
|
+
elif set_progress_mode:
|
51
|
+
self.bar_mode = set_progress_mode
|
52
|
+
self.bar_steps = steps
|
53
|
+
self.bar_updates = 0
|
54
|
+
self.bar_mode_changed = True
|
55
|
+
|
56
|
+
def update_message_box(self, *args: Any, **kwargs: Any) -> None:
|
57
|
+
msg = kwargs.get("msg")
|
58
|
+
cls = kwargs.get("cls")
|
59
|
+
|
60
|
+
if not msg and len(args) == 1:
|
61
|
+
msg = str(args[0])
|
62
|
+
|
63
|
+
if cls:
|
64
|
+
self.msg_cls = True
|
65
|
+
self.msg_buffer = ""
|
66
|
+
|
67
|
+
if msg:
|
68
|
+
self.msg_buffer += msg + "\n"
|
69
|
+
|
70
|
+
def update_ui(self) -> None:
|
71
|
+
if self.msg_cls or self.msg_buffer:
|
72
|
+
self.message_box._text.config(state="normal") # type: ignore
|
73
|
+
|
74
|
+
if self.msg_cls:
|
75
|
+
self.message_box.delete(1.0, "end") # type: ignore
|
76
|
+
|
77
|
+
if self.msg_buffer:
|
78
|
+
msg = self.msg_buffer.strip()
|
79
|
+
if self.progress_bar_cli:
|
80
|
+
self.progress_bar_cli.write(msg)
|
81
|
+
else:
|
82
|
+
print(msg)
|
83
|
+
|
84
|
+
self.message_box.insert("end", msg + "\n") # type: ignore
|
85
|
+
|
86
|
+
if self.auto_scroll:
|
87
|
+
self.message_box._text.yview_moveto(1.0) # type: ignore
|
88
|
+
|
89
|
+
self.msg_cls = False
|
90
|
+
self.msg_buffer = ""
|
91
|
+
|
92
|
+
self.message_box._text.config(state="disabled") # type: ignore
|
93
|
+
|
94
|
+
if self.bar_mode_changed:
|
95
|
+
if self.bar_mode == "determinate":
|
96
|
+
self.progress_bar_cli = tqdm(total=self.bar_steps)
|
97
|
+
self.progress_bar.config(mode="determinate")
|
98
|
+
self.progress_bar_steps = self.bar_steps
|
99
|
+
self.progress_bar.stop()
|
100
|
+
elif self.progress_bar_cli:
|
101
|
+
self.progress_bar_cli.close()
|
102
|
+
self.progress_bar_cli = None
|
103
|
+
|
104
|
+
if self.bar_mode == "indeterminate":
|
105
|
+
self.progress_bar.config(mode="indeterminate")
|
106
|
+
self.progress_bar.start(50)
|
107
|
+
elif self.bar_mode == "clear":
|
108
|
+
self.progress_bar.config(mode="determinate")
|
109
|
+
self.progress_bar.stop()
|
110
|
+
|
111
|
+
self.progress_bar["value"] = 0
|
112
|
+
|
113
|
+
if self.bar_updates and self.progress_bar_cli:
|
114
|
+
self.progress_bar_cli.update(self.bar_updates)
|
115
|
+
self.progress_bar["value"] += (
|
116
|
+
100 / self.progress_bar_steps * self.bar_updates
|
117
|
+
)
|
118
|
+
self.update_progress_bar(update_bar=self.bar_updates)
|
119
|
+
|
120
|
+
self.bar_mode_changed = False
|
121
|
+
self.bar_updates = 0
|
122
|
+
|
123
|
+
self.after(40, self.update_ui)
|
124
|
+
|
125
|
+
def cb_disable_autoscroll(self, *_: Any) -> None:
|
126
|
+
self.auto_scroll = False
|
127
|
+
|
128
|
+
def cb_enable_autoscroll(self, *_: Any) -> None:
|
129
|
+
self.auto_scroll = True
|
@@ -41,15 +41,21 @@ class SignalGetAuthWindow(BaseWindow):
|
|
41
41
|
|
42
42
|
# Start button frame
|
43
43
|
self.launch_btn = Button(
|
44
|
-
self.frame_btns,
|
44
|
+
self.frame_btns,
|
45
|
+
text="Launch Signal Desktop",
|
46
|
+
command=self.cb_launch_signal,
|
47
|
+
bootstyle="secondary", # type: ignore
|
45
48
|
)
|
46
49
|
|
47
|
-
self.
|
48
|
-
self.frame_btns,
|
50
|
+
self.get_cred_btn = Button(
|
51
|
+
self.frame_btns,
|
52
|
+
text="Get uuid and password",
|
53
|
+
command=self.cb_get_cred,
|
54
|
+
bootstyle="default", # type: ignore
|
49
55
|
)
|
50
56
|
|
51
57
|
self.launch_btn.pack()
|
52
|
-
self.
|
58
|
+
self.get_cred_btn.pack()
|
53
59
|
|
54
60
|
# Config frame
|
55
61
|
self.setdir_lbl = Label(
|
@@ -78,7 +84,7 @@ class SignalGetAuthWindow(BaseWindow):
|
|
78
84
|
|
79
85
|
GUIUtils.finalize_window(self)
|
80
86
|
|
81
|
-
def
|
87
|
+
def cb_get_cred(self) -> None:
|
82
88
|
m = GetSignalAuth()
|
83
89
|
|
84
90
|
signal_bin_path = None
|
@@ -11,7 +11,7 @@ from multiprocessing.managers import ListProxy, SyncManager
|
|
11
11
|
from pathlib import Path
|
12
12
|
from queue import Queue
|
13
13
|
from threading import Thread
|
14
|
-
from typing import TYPE_CHECKING, Any, Callable, Dict, Generator,
|
14
|
+
from typing import TYPE_CHECKING, Any, Callable, Dict, Generator, List, Optional, Tuple
|
15
15
|
from urllib.parse import urlparse
|
16
16
|
|
17
17
|
from sticker_convert.converter import StickerConvert
|
@@ -99,7 +99,7 @@ class Executor:
|
|
99
99
|
elif action == "bar":
|
100
100
|
self.cb_bar(*args, **kwargs)
|
101
101
|
elif action == "update_bar":
|
102
|
-
self.cb_bar(update_bar=
|
102
|
+
self.cb_bar(update_bar=1)
|
103
103
|
elif action == "msg_block":
|
104
104
|
cb_return.set_response(self.cb_msg_block(*args, **kwargs))
|
105
105
|
elif action == "ask_bool":
|
@@ -143,6 +143,7 @@ class Executor:
|
|
143
143
|
e += traceback.format_exc()
|
144
144
|
e += "#####################"
|
145
145
|
cb_queue.put(e)
|
146
|
+
|
146
147
|
work_list.append(None)
|
147
148
|
|
148
149
|
def start_workers(self, processes: int = 1) -> None:
|
@@ -175,12 +176,11 @@ class Executor:
|
|
175
176
|
pass
|
176
177
|
|
177
178
|
self.results_queue.put(None)
|
178
|
-
self.work_list =
|
179
|
+
self.work_list[:] = []
|
179
180
|
self.processes.clear()
|
180
181
|
|
181
182
|
def kill_workers(self, *_: Any, **__: Any) -> None:
|
182
183
|
self.is_cancel_job.value = 1 # type: ignore
|
183
|
-
self.work_list = self.manager.list()
|
184
184
|
|
185
185
|
for process in self.processes:
|
186
186
|
if platform.system() == "Windows":
|
@@ -189,16 +189,17 @@ class Executor:
|
|
189
189
|
process.close()
|
190
190
|
process.join()
|
191
191
|
|
192
|
-
self.cleanup()
|
192
|
+
self.cleanup(killed=True)
|
193
193
|
|
194
|
-
def cleanup(self) -> None:
|
194
|
+
def cleanup(self, killed: bool = False) -> None:
|
195
|
+
if killed:
|
196
|
+
self.cb_queue.put("Job cancelled.")
|
197
|
+
self.cb_queue.put(("bar", None, {"set_progress_mode": "clear"}))
|
195
198
|
self.cb_queue.put(None)
|
196
199
|
self.cb_thread_instance.join()
|
197
|
-
self.work_list = self.manager.list()
|
198
200
|
|
199
201
|
def get_result(self) -> Generator[Any, None, None]:
|
200
|
-
|
201
|
-
yield from gen
|
202
|
+
yield from iter(self.results_queue.get, None)
|
202
203
|
|
203
204
|
def cb(
|
204
205
|
self,
|
@@ -268,14 +269,12 @@ class Job:
|
|
268
269
|
|
269
270
|
if self.executor.is_cancel_job.value == 1: # type: ignore
|
270
271
|
code = 2
|
271
|
-
self.executor.cb("Job cancelled.")
|
272
272
|
break
|
273
273
|
if not success:
|
274
274
|
code = 1
|
275
275
|
self.executor.cb("An error occured during this run.")
|
276
276
|
break
|
277
277
|
|
278
|
-
self.executor.cb("bar", kwargs={"set_progress_mode": "clear"})
|
279
278
|
self.executor.cleanup()
|
280
279
|
|
281
280
|
return code
|