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.
Files changed (93) hide show
  1. sticker_convert/__main__.py +24 -27
  2. sticker_convert/auth/__init__.py +0 -0
  3. sticker_convert/auth/auth_base.py +19 -0
  4. sticker_convert/{utils/auth/get_discord_auth.py → auth/auth_discord.py} +149 -118
  5. sticker_convert/{utils/auth/get_kakao_auth.py → auth/auth_kakao_android_login.py} +331 -330
  6. sticker_convert/auth/auth_kakao_desktop_login.py +327 -0
  7. sticker_convert/{utils/auth/get_kakao_desktop_auth.py → auth/auth_kakao_desktop_memdump.py} +281 -263
  8. sticker_convert/{utils/auth/get_line_auth.py → auth/auth_line.py} +98 -80
  9. sticker_convert/{utils/auth/get_signal_auth.py → auth/auth_signal.py} +139 -135
  10. sticker_convert/auth/auth_telethon.py +161 -0
  11. sticker_convert/{utils/auth/get_viber_auth.py → auth/auth_viber.py} +250 -235
  12. sticker_convert/{utils/auth → auth}/telegram_api.py +736 -675
  13. sticker_convert/cli.py +623 -608
  14. sticker_convert/converter.py +1093 -1084
  15. sticker_convert/definitions.py +4 -0
  16. sticker_convert/downloaders/download_band.py +111 -110
  17. sticker_convert/downloaders/download_base.py +171 -166
  18. sticker_convert/downloaders/download_discord.py +92 -91
  19. sticker_convert/downloaders/download_kakao.py +417 -404
  20. sticker_convert/downloaders/download_line.py +484 -475
  21. sticker_convert/downloaders/download_ogq.py +80 -79
  22. sticker_convert/downloaders/download_signal.py +108 -105
  23. sticker_convert/downloaders/download_telegram.py +56 -55
  24. sticker_convert/downloaders/download_viber.py +121 -120
  25. sticker_convert/gui.py +788 -873
  26. sticker_convert/gui_components/frames/comp_frame.py +180 -166
  27. sticker_convert/gui_components/frames/config_frame.py +156 -113
  28. sticker_convert/gui_components/frames/control_frame.py +32 -30
  29. sticker_convert/gui_components/frames/cred_frame.py +232 -233
  30. sticker_convert/gui_components/frames/input_frame.py +139 -137
  31. sticker_convert/gui_components/frames/output_frame.py +112 -110
  32. sticker_convert/gui_components/frames/right_clicker.py +25 -23
  33. sticker_convert/gui_components/windows/advanced_compression_window.py +757 -757
  34. sticker_convert/gui_components/windows/base_window.py +7 -2
  35. sticker_convert/gui_components/windows/discord_get_auth_window.py +79 -82
  36. sticker_convert/gui_components/windows/kakao_get_auth_window.py +511 -321
  37. sticker_convert/gui_components/windows/line_get_auth_window.py +94 -102
  38. sticker_convert/gui_components/windows/signal_get_auth_window.py +84 -89
  39. sticker_convert/gui_components/windows/viber_get_auth_window.py +168 -168
  40. sticker_convert/ios-message-stickers-template/.github/FUNDING.yml +3 -3
  41. sticker_convert/ios-message-stickers-template/README.md +10 -10
  42. sticker_convert/ios-message-stickers-template/stickers/Info.plist +43 -43
  43. sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Info.plist +31 -31
  44. sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Contents.json +6 -6
  45. sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Contents.json +20 -20
  46. sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 1.sticker/Contents.json +9 -9
  47. sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 2.sticker/Contents.json +9 -9
  48. sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 3.sticker/Contents.json +9 -9
  49. sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Contents.json +91 -91
  50. sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.pbxproj +364 -364
  51. sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -7
  52. sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -8
  53. sticker_convert/ios-message-stickers-template/stickers.xcodeproj/xcuserdata/niklaspeterson.xcuserdatad/xcschemes/xcschememanagement.plist +14 -14
  54. sticker_convert/job.py +166 -130
  55. sticker_convert/job_option.py +1 -0
  56. sticker_convert/locales/en_US/LC_MESSAGES/base.mo +0 -0
  57. sticker_convert/locales/ja_JP/LC_MESSAGES/base.mo +0 -0
  58. sticker_convert/locales/zh_CN/LC_MESSAGES/base.mo +0 -0
  59. sticker_convert/locales/zh_TW/LC_MESSAGES/base.mo +0 -0
  60. sticker_convert/py.typed +0 -0
  61. sticker_convert/resources/NotoColorEmoji.ttf +0 -0
  62. sticker_convert/resources/help.ja_JP.json +88 -0
  63. sticker_convert/resources/help.json +10 -7
  64. sticker_convert/resources/help.zh_CN.json +88 -0
  65. sticker_convert/resources/help.zh_TW.json +88 -0
  66. sticker_convert/resources/input.ja_JP.json +74 -0
  67. sticker_convert/resources/input.json +121 -121
  68. sticker_convert/resources/input.zh_CN.json +74 -0
  69. sticker_convert/resources/input.zh_TW.json +74 -0
  70. sticker_convert/resources/output.ja_JP.json +38 -0
  71. sticker_convert/resources/output.zh_CN.json +38 -0
  72. sticker_convert/resources/output.zh_TW.json +38 -0
  73. sticker_convert/uploaders/compress_wastickers.py +186 -177
  74. sticker_convert/uploaders/upload_base.py +44 -35
  75. sticker_convert/uploaders/upload_signal.py +218 -203
  76. sticker_convert/uploaders/upload_telegram.py +353 -338
  77. sticker_convert/uploaders/upload_viber.py +178 -169
  78. sticker_convert/uploaders/xcode_imessage.py +295 -286
  79. sticker_convert/utils/callback.py +238 -6
  80. sticker_convert/utils/emoji.py +16 -4
  81. sticker_convert/utils/files/json_resources_loader.py +24 -19
  82. sticker_convert/utils/files/metadata_handler.py +3 -3
  83. sticker_convert/utils/translate.py +108 -0
  84. sticker_convert/utils/url_detect.py +40 -37
  85. sticker_convert/version.py +1 -1
  86. {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/METADATA +89 -74
  87. {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/RECORD +91 -74
  88. sticker_convert/utils/auth/telethon_setup.py +0 -97
  89. sticker_convert/utils/singletons.py +0 -18
  90. {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/WHEEL +0 -0
  91. {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/entry_points.txt +0 -0
  92. {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/licenses/LICENSE +0 -0
  93. {sticker_convert-2.13.3.0.dist-info → sticker_convert-2.17.0.0.dist-info}/top_level.txt +0 -0
@@ -1,120 +1,121 @@
1
- #!/usr/bin/env python3
2
- import json
3
- import zipfile
4
- from io import BytesIO
5
- from pathlib import Path
6
- from typing import Optional, Tuple, cast
7
- from urllib.parse import urlparse
8
-
9
- import requests
10
- from bs4 import BeautifulSoup
11
-
12
- from sticker_convert.downloaders.download_base import DownloadBase
13
- from sticker_convert.job_option import CredOption, InputOption
14
- from sticker_convert.utils.callback import CallbackProtocol, CallbackReturn
15
- from sticker_convert.utils.files.metadata_handler import MetadataHandler
16
-
17
-
18
- class DownloadViber(DownloadBase):
19
- # def __init__(self, *args: Any, **kwargs: Any) -> None:
20
- # super().__init__(*args, **kwargs)
21
-
22
- def get_pack_info(self, url: str) -> Optional[Tuple[str, str, str, str]]:
23
- r = requests.get(url, allow_redirects=True)
24
- soup = BeautifulSoup(r.text, "html.parser")
25
-
26
- is_custom = urlparse(url).path.startswith("/pages/custom-sticker-packs/")
27
- if is_custom:
28
- tag_text_search = "window.CUSTOM_STICKER_PACK"
29
- else:
30
- tag_text_search = "window.PRODUCT"
31
-
32
- script_tag = soup.find(
33
- lambda tag: tag.name == "script" and tag.text.startswith(tag_text_search)
34
- )
35
- if script_tag is None:
36
- return None
37
-
38
- pack_json = script_tag.text.replace(f"{tag_text_search} = ", "", 1)[:-1]
39
- pack_dict = json.loads(pack_json)
40
-
41
- title = pack_dict["title"]
42
- first_sticker_url = cast(str, pack_dict["stickerFirstItemUrl"])
43
- zip_url = "/".join(first_sticker_url.split("/")[:-1]) + ".zip"
44
- pack_id = pack_dict["id"].split(".")[-1]
45
- if is_custom:
46
- cover_url = (
47
- "https://custom-sticker-pack.cdn.viber.com/custom-stickers/{}/thumb.png"
48
- )
49
- else:
50
- cover_url = (
51
- "https://sm-content.viber.com/static/images/product/{}/sticker.png"
52
- )
53
- cover_url = cover_url.format(pack_dict["id"])
54
-
55
- return title, zip_url, cover_url, pack_id
56
-
57
- def decompress(
58
- self, zip_file: bytes, exts: Optional[Tuple[str, ...]] = None
59
- ) -> int:
60
- with zipfile.ZipFile(BytesIO(zip_file)) as zf:
61
- self.cb.put("Unzipping...")
62
-
63
- zf_files = zf.namelist()
64
- self.cb.put(
65
- (
66
- "bar",
67
- None,
68
- {"set_progress_mode": "determinate", "steps": len(zf_files)},
69
- )
70
- )
71
-
72
- for sticker in zf_files:
73
- ext = Path(sticker).suffix
74
- if "frame" in sticker or ".db" in sticker or sticker.endswith("/"):
75
- continue
76
- if exts is not None and ext not in exts:
77
- continue
78
- num = sticker.split(".")[0][-2:].zfill(3)
79
- data = zf.read(sticker)
80
-
81
- self.cb.put(f"Read {sticker}")
82
-
83
- out_path = Path(self.out_dir, num + ext)
84
- with open(out_path, "wb") as f:
85
- f.write(data)
86
-
87
- self.cb.put("update_bar")
88
-
89
- return len(zf_files)
90
-
91
- def download_stickers_viber(self) -> Tuple[int, int]:
92
- pack_info = self.get_pack_info(self.url)
93
- if pack_info is None:
94
- self.cb.put("Download failed: Cannot get pack info")
95
- return 0, 0
96
- title, zip_url, cover_url, pack_id = pack_info
97
-
98
- anim_url = f"https://content.cdn.viber.com/stickers/ASVG/{pack_id}.zip"
99
- anim_file = self.download_file(anim_url)
100
- zip_file = self.download_file(zip_url)
101
- if anim_file:
102
- count = self.decompress(anim_file, (".svg",))
103
- count += self.decompress(zip_file, (".mp3",))
104
- else:
105
- count = self.decompress(zip_file, (".mp3", ".png"))
106
- self.download_file(cover_url, self.out_dir / "cover.png")
107
-
108
- MetadataHandler.set_metadata(self.out_dir, title=title)
109
-
110
- return count, count
111
-
112
- @staticmethod
113
- def start(
114
- opt_input: InputOption,
115
- opt_cred: Optional[CredOption],
116
- cb: CallbackProtocol,
117
- cb_return: CallbackReturn,
118
- ) -> Tuple[int, int]:
119
- downloader = DownloadViber(opt_input, opt_cred, cb, cb_return)
120
- return downloader.download_stickers_viber()
1
+ #!/usr/bin/env python3
2
+ import json
3
+ import zipfile
4
+ from io import BytesIO
5
+ from pathlib import Path
6
+ from typing import Optional, Tuple, cast
7
+ from urllib.parse import urlparse
8
+
9
+ import requests
10
+ from bs4 import BeautifulSoup
11
+
12
+ from sticker_convert.downloaders.download_base import DownloadBase
13
+ from sticker_convert.job_option import CredOption, InputOption
14
+ from sticker_convert.utils.callback import CallbackProtocol, CallbackReturn
15
+ from sticker_convert.utils.files.metadata_handler import MetadataHandler
16
+ from sticker_convert.utils.translate import I
17
+
18
+
19
+ class DownloadViber(DownloadBase):
20
+ # def __init__(self, *args: Any, **kwargs: Any) -> None:
21
+ # super().__init__(*args, **kwargs)
22
+
23
+ def get_pack_info(self, url: str) -> Optional[Tuple[str, str, str, str]]:
24
+ r = requests.get(url, allow_redirects=True)
25
+ soup = BeautifulSoup(r.text, "html.parser")
26
+
27
+ is_custom = urlparse(url).path.startswith("/pages/custom-sticker-packs/")
28
+ if is_custom:
29
+ tag_text_search = "window.CUSTOM_STICKER_PACK"
30
+ else:
31
+ tag_text_search = "window.PRODUCT"
32
+
33
+ script_tag = soup.find(
34
+ lambda tag: tag.name == "script" and tag.text.startswith(tag_text_search)
35
+ )
36
+ if script_tag is None:
37
+ return None
38
+
39
+ pack_json = script_tag.text.replace(f"{tag_text_search} = ", "", 1)[:-1]
40
+ pack_dict = json.loads(pack_json)
41
+
42
+ title = pack_dict["title"]
43
+ first_sticker_url = cast(str, pack_dict["stickerFirstItemUrl"])
44
+ zip_url = "/".join(first_sticker_url.split("/")[:-1]) + ".zip"
45
+ pack_id = pack_dict["id"].split(".")[-1]
46
+ if is_custom:
47
+ cover_url = (
48
+ "https://custom-sticker-pack.cdn.viber.com/custom-stickers/{}/thumb.png"
49
+ )
50
+ else:
51
+ cover_url = (
52
+ "https://sm-content.viber.com/static/images/product/{}/sticker.png"
53
+ )
54
+ cover_url = cover_url.format(pack_dict["id"])
55
+
56
+ return title, zip_url, cover_url, pack_id
57
+
58
+ def decompress(
59
+ self, zip_file: bytes, exts: Optional[Tuple[str, ...]] = None
60
+ ) -> int:
61
+ with zipfile.ZipFile(BytesIO(zip_file)) as zf:
62
+ self.cb.put(I("Unzipping..."))
63
+
64
+ zf_files = zf.namelist()
65
+ self.cb.put(
66
+ (
67
+ "bar",
68
+ None,
69
+ {"set_progress_mode": "determinate", "steps": len(zf_files)},
70
+ )
71
+ )
72
+
73
+ for sticker in zf_files:
74
+ ext = Path(sticker).suffix
75
+ if "frame" in sticker or ".db" in sticker or sticker.endswith("/"):
76
+ continue
77
+ if exts is not None and ext not in exts:
78
+ continue
79
+ num = sticker.split(".")[0][-2:].zfill(3)
80
+ data = zf.read(sticker)
81
+
82
+ self.cb.put(I("Read {}").format(sticker))
83
+
84
+ out_path = Path(self.out_dir, num + ext)
85
+ with open(out_path, "wb") as f:
86
+ f.write(data)
87
+
88
+ self.cb.put("update_bar")
89
+
90
+ return len(zf_files)
91
+
92
+ def download_stickers_viber(self) -> Tuple[int, int]:
93
+ pack_info = self.get_pack_info(self.url)
94
+ if pack_info is None:
95
+ self.cb.put(I("Download failed: Cannot get pack info"))
96
+ return 0, 0
97
+ title, zip_url, cover_url, pack_id = pack_info
98
+
99
+ anim_url = f"https://content.cdn.viber.com/stickers/ASVG/{pack_id}.zip"
100
+ anim_file = self.download_file(anim_url)
101
+ zip_file = self.download_file(zip_url)
102
+ if anim_file:
103
+ count = self.decompress(anim_file, (".svg",))
104
+ count += self.decompress(zip_file, (".mp3",))
105
+ else:
106
+ count = self.decompress(zip_file, (".mp3", ".png"))
107
+ self.download_file(cover_url, self.out_dir / "cover.png")
108
+
109
+ MetadataHandler.set_metadata(self.out_dir, title=title)
110
+
111
+ return count, count
112
+
113
+ @staticmethod
114
+ def start(
115
+ opt_input: InputOption,
116
+ opt_cred: Optional[CredOption],
117
+ cb: CallbackProtocol,
118
+ cb_return: CallbackReturn,
119
+ ) -> Tuple[int, int]:
120
+ downloader = DownloadViber(opt_input, opt_cred, cb, cb_return)
121
+ return downloader.download_stickers_viber()