sticker-convert 2.1.3__py3-none-any.whl → 2.1.5__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.
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env python3
2
2
  '''sticker-convert'''
3
- __version__ = '2.1.3'
3
+ __version__ = '2.1.5'
sticker_convert/gui.py CHANGED
@@ -179,13 +179,13 @@ class GUI(Window):
179
179
 
180
180
  def warn_tkinter_bug(self):
181
181
  if (platform.system() == 'Darwin' and
182
- platform.machine() == 'x86_64' and
182
+ platform.mac_ver().split('.')[0] == '14' and
183
183
  sys.version_info[0] == 3 and
184
184
  sys.version_info[1] == 11):
185
185
  msg = 'NOTICE: If buttons are not responsive, try to press '
186
186
  msg += 'on title bar or move mouse cursor away from window for a while.'
187
187
  self.cb_msg(msg)
188
- msg = '(This is due to a bug in tkinter specific to x86_64 macOS python3.11)'
188
+ msg = '(This is due to a bug in tkinter specific to macOS 14 python3.11)'
189
189
  self.cb_msg(msg)
190
190
  msg = '(https://github.com/python/cpython/issues/110218)'
191
191
  self.cb_msg(msg)
@@ -614,7 +614,7 @@ class GUI(Window):
614
614
  self.input_frame.address_entry.config(bootstyle='warning')
615
615
 
616
616
  elif (download_option != input_option and
617
- not (input_option == 'kakao' and url.isnumeric())):
617
+ not (input_option in ('kakao', 'line') and url.isnumeric())):
618
618
 
619
619
  self.input_frame.address_entry.config(bootstyle='danger')
620
620
  self.input_frame.address_tip.config(text=f"Invalid URL. {self.input_presets[input_option_display]['example']}")
@@ -114,6 +114,7 @@ class UploadSignal(UploadBase):
114
114
 
115
115
  packs = MetadataHandler.split_sticker_packs(self.in_dir, title=title, file_per_pack=200, separate_image_anim=False)
116
116
  for pack_title, stickers in packs.items():
117
+ self.cb_msg(f'Uploading pack {pack_title}')
117
118
  pack = LocalStickerPack()
118
119
  pack.title = pack_title
119
120
  pack.author = author
@@ -227,6 +227,7 @@ class UploadTelegram(UploadBase):
227
227
  packs = MetadataHandler.split_sticker_packs(self.in_dir, title=title, file_per_anim_pack=50, file_per_image_pack=120, separate_image_anim=not self.fake_vid)
228
228
 
229
229
  for pack_title, stickers in packs.items():
230
+ self.cb_msg(f'Uploading pack {pack_title}')
230
231
  result = anyio.run(self.upload_pack, pack_title, stickers, emoji_dict)
231
232
  self.cb_msg(result)
232
233
  urls.append(result)
@@ -19,8 +19,14 @@ class XcodeImessageIconset:
19
19
  def __init__(self):
20
20
  self.iconset = {}
21
21
 
22
- with open('ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Contents.json') as f:
23
- dict = json.load(f)
22
+ if os.path.isdir('ios-message-stickers-template'):
23
+ with open('ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Contents.json') as f:
24
+ dict = json.load(f)
25
+ elif os.path.isfile('ios-message-stickers-template.zip'):
26
+ with zipfile.ZipFile('ios-message-stickers-template.zip', 'r') as f:
27
+ dict = json.loads(f.read('stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Contents.json').decode())
28
+ else:
29
+ raise FileNotFoundError('ios-message-stickers-template not found')
24
30
 
25
31
  for i in dict['images']:
26
32
  filename = i['filename']
@@ -47,6 +53,7 @@ class XcodeImessageIconset:
47
53
  # 'Messages-iPad-Pro-74x55pt@2x.png': (148, 110),
48
54
  # 'Messages-iPhone-60x45pt@2x.png': (120, 90),
49
55
  # 'Messages-iPhone-60x45pt@3x.png': (180, 135)
56
+ # }
50
57
 
51
58
 
52
59
 
@@ -91,6 +98,8 @@ class XcodeImessage(UploadBase):
91
98
  def create_imessage_xcode(self) -> list[str]:
92
99
  urls = []
93
100
  title, author, emoji_dict = MetadataHandler.get_metadata(self.in_dir, title=self.opt_output.get('title'), author=self.opt_output.get('author'))
101
+ author = author.replace(' ', '_')
102
+ title = title.replace(' ', '_')
94
103
  packs = MetadataHandler.split_sticker_packs(self.in_dir, title=title, file_per_pack=100, separate_image_anim=False)
95
104
 
96
105
  res_choice = None
@@ -135,13 +144,9 @@ class XcodeImessage(UploadBase):
135
144
 
136
145
  def add_metadata(self, author: str, title: str):
137
146
  first_image_path = os.path.join(self.in_dir, [i for i in sorted(os.listdir(self.in_dir)) if os.path.isfile(os.path.join(self.in_dir, i)) and i.endswith('.png')][0])
138
- cover_path_old = MetadataHandler.get_cover(self.in_dir)
139
- cover_path_new = os.path.join(self.out_dir, 'cover.png')
140
- if os.path.isfile(cover_path_old) and cover_path_new != cover_path_old:
141
- shutil.copy(cover_path_old, cover_path_new)
142
-
143
- if os.path.isfile(cover_path_old):
144
- icon_source = cover_path_old
147
+ cover_path = MetadataHandler.get_cover(self.in_dir)
148
+ if cover_path:
149
+ icon_source = cover_path
145
150
  else:
146
151
  icon_source = first_image_path
147
152
 
@@ -193,7 +198,7 @@ class XcodeImessage(UploadBase):
193
198
  pbxproj_data = pbxproj_data.replace('/* Build configuration list for PBXProject "stickers" */', f'/* Build configuration list for PBXProject "{title}" */')
194
199
  pbxproj_data = pbxproj_data.replace('/* Build configuration list for PBXNativeTarget "stickers StickerPackExtension" */', f'/* Build configuration list for PBXNativeTarget "{title} StickerPackExtension" */')
195
200
  pbxproj_data = pbxproj_data.replace('/* Build configuration list for PBXNativeTarget "stickers" */', f'/* Build configuration list for PBXNativeTarget "{title}" */')
196
- pbxproj_data = pbxproj_data.replace('com.niklaspeterson', f'{title}.{author}')
201
+ pbxproj_data = pbxproj_data.replace('com.niklaspeterson', f'com.{author}')
197
202
  pbxproj_data = pbxproj_data.replace('stickers/Info.plist', f'{title}/Info.plist')
198
203
 
199
204
  with open(os.path.join(pack_path, 'stickers.xcodeproj/project.pbxproj'), 'w+', encoding='utf-8') as f:
@@ -274,10 +274,10 @@ class StickerConvert:
274
274
  return frames_out
275
275
 
276
276
  def frames_drop(self, frames_in: list[np.ndarray]) -> list[np.ndarray]:
277
- frames_out = []
277
+ if not self.fps:
278
+ return [frames_in[0]]
278
279
 
279
- if not (self.duration_min or self.duration_max):
280
- return frames_in
280
+ frames_out = []
281
281
 
282
282
  frames_orig = CodecInfo.get_file_frames(self.in_f)
283
283
  fps_orig = CodecInfo.get_file_fps(self.in_f)
@@ -303,7 +303,10 @@ class StickerConvert:
303
303
  return frames_out
304
304
 
305
305
  def frames_export(self):
306
- if self.out_f_ext == '.apng':
306
+ if (self.out_f_ext == '.apng' or
307
+ (self.out_f_ext == '.png' and
308
+ self.fps != None and
309
+ (len(self.frames_processed) > 1 or self.fake_vid))):
307
310
  self.frames_export_apng()
308
311
  elif self.out_f_ext == '.png':
309
312
  self.frames_export_png()
@@ -388,9 +391,9 @@ class StickerConvert:
388
391
  self.apngasm.add_frame(frame_final)
389
392
 
390
393
  with CacheStore.get_cache_store(path=self.cache_dir) as tempdir:
391
- self.apngasm.assemble(os.path.join(tempdir, 'out.apng'))
394
+ self.apngasm.assemble(os.path.join(tempdir, f'out{self.out_f_ext}'))
392
395
 
393
- with open(os.path.join(tempdir, 'out.apng'), 'rb') as f:
396
+ with open(os.path.join(tempdir, f'out{self.out_f_ext}'), 'rb') as f:
394
397
  self.tmp_f.write(f.read())
395
398
 
396
399
  self.apngasm.reset()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sticker-convert
3
- Version: 2.1.3
3
+ Version: 2.1.5
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>
@@ -1,8 +1,8 @@
1
- sticker_convert/__init__.py,sha256=GpyYi5CEA7sb5yAqBamWoSMUFPtbUHfAOzrQ8A_BY4I,66
1
+ sticker_convert/__init__.py,sha256=zrhIFFkdukbv6wn7kdQ8y4tDW7_yyslMmBP-Wt9ZFjY,66
2
2
  sticker_convert/__main__.py,sha256=gzkK62bHS__nnQnktN2BEL7d3NE0KPMGkNOA-BBR5dg,541
3
3
  sticker_convert/cli.py,sha256=w_NRwMesXdgmynOqUkaQ7ofNN9rrhxnlyHPteTQAv7w,16182
4
4
  sticker_convert/flow.py,sha256=FM3mwMbeQo2uxjf3J8zg4CidtMOkMIAdRYaqWF-wSPc,18975
5
- sticker_convert/gui.py,sha256=AO3990pOYEyeAdMoPibwvGE8XnkMD7N8xc1ITYfpHWM,29867
5
+ sticker_convert/gui.py,sha256=DH1XGcSyBKqzOES_fapa8SEqNvIz82BYUo6Y_uaNa4U,29883
6
6
  sticker_convert/auth/get_kakao_auth.py,sha256=vjoCP60hPe90x2IwmfZyoiF7ewwvtyQ7kTByocD0HzE,9286
7
7
  sticker_convert/auth/get_line_auth.py,sha256=aN61yinyFw_AYC1phT2R-jpWVIaAdbtT0XGdm5RFbSE,1154
8
8
  sticker_convert/auth/get_signal_auth.py,sha256=gORF1svJrYYisBbDHuHlEkc9JSrZWt014tZ-I5tRsxo,12066
@@ -67,13 +67,13 @@ sticker_convert/resources/input.json,sha256=ca-S5o4Yt2Qke7iNf_RR18MAg5HKDoXd6j9G
67
67
  sticker_convert/resources/output.json,sha256=0k8J3z0nPRkyIZj4DvXI4FPvlFuYFoYgA2ldVaMtF0Y,1131
68
68
  sticker_convert/uploaders/compress_wastickers.py,sha256=aBUMxKnZ69Hd6ZOR_3XotrExj8yVupgPXiMP3QjxxmM,5242
69
69
  sticker_convert/uploaders/upload_base.py,sha256=5bNIh2a2K_ako_TmkVJ0mHtXdiILhY-chHOZXPBhzcE,658
70
- sticker_convert/uploaders/upload_signal.py,sha256=TUD4GOUxA2wItNo75DpAj-YSveaPZv3pB6wqEy9m2IY,5357
71
- sticker_convert/uploaders/upload_telegram.py,sha256=WGjZNMOulVJmmuZF2IU2nrnTHR3UYGk20edD3zivlyE,9966
72
- sticker_convert/uploaders/xcode_imessage.py,sha256=jOnBEOwsF6U87UjOGLo60QeBKSMOv4zomDStikvTbp0,12626
70
+ sticker_convert/uploaders/upload_signal.py,sha256=uEeMkqV9_jcZNO6DcUhuHiaufDJjcdE5oz4geGWIAf0,5413
71
+ sticker_convert/uploaders/upload_telegram.py,sha256=Uj0njsCyuq_xQkx7u2yABDzE4hUT-u0Gd-fTJguNQZ8,10022
72
+ sticker_convert/uploaders/xcode_imessage.py,sha256=2kzF_FE16toeGFMqCITirx2xSiZdbYzhPpIjcHXUPvo,12945
73
73
  sticker_convert/utils/apple_png_normalize.py,sha256=Qg_k4BBZllUXZ2pQrSmp5aP2xEGwRjMJ6kAXTeEB5sw,3571
74
74
  sticker_convert/utils/cache_store.py,sha256=dRQazWoTm3ZGg9QwjQ_6EeQtx4vj3JY5pxy8ITHW_Ek,724
75
75
  sticker_convert/utils/codec_info.py,sha256=FqK_4Wi6s2tqtyDbqQeW4kNXvlRmLLQLtZIbjEV2Dls,3602
76
- sticker_convert/utils/converter.py,sha256=Mkp5_mN77tXqC7rBJ9sXDOwH2j5eaX5WB1jxJftt9EM,17902
76
+ sticker_convert/utils/converter.py,sha256=6GqGttdG-VcFciZTdg4hFSQG2wMnJb-0D0tIIYcQlSY,18044
77
77
  sticker_convert/utils/curr_dir.py,sha256=xLg_9FygEp7PE5drzkirtdwzzW24H3gdBj8zIIgkBf8,2431
78
78
  sticker_convert/utils/fake_cb_msg.py,sha256=QRqEnduEfhVdE0oVdZvQquUHnyZ9ICrVcGNHcMBk2-s,213
79
79
  sticker_convert/utils/format_verify.py,sha256=RGxjS7KD0upgC5bFXSICB649vum9yu3YragP1nRoiWo,6848
@@ -82,9 +82,9 @@ sticker_convert/utils/json_manager.py,sha256=kGIeDNN0h7He__0d1Ej8ZVsbY6z_LxHqHAy
82
82
  sticker_convert/utils/metadata_handler.py,sha256=8SAMT0MwDn6cbg8snx0GQ3FD43FltDvDurfoIokwCMk,8200
83
83
  sticker_convert/utils/run_bin.py,sha256=Ck1Ktqg_6mkZYhMuGyg343QMcf8GvprHQeea4GObVwc,1519
84
84
  sticker_convert/utils/url_detect.py,sha256=SCk1PanPIEIBNE-_xWfnqHrg8xlMJQXlMaBIV8kqW_A,763
85
- sticker_convert-2.1.3.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
86
- sticker_convert-2.1.3.dist-info/METADATA,sha256=NKa4wObLNyBbBi3zGI7SfHI9lEL72KA_Gy_HGzc9Qq4,44705
87
- sticker_convert-2.1.3.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
88
- sticker_convert-2.1.3.dist-info/entry_points.txt,sha256=MNJ7XyC--ugxi5jS1nzjDLGnxCyLuaGdsVLnJhDHCqs,66
89
- sticker_convert-2.1.3.dist-info/top_level.txt,sha256=r9vfnB0l1ZnH5pTH5RvkobnK3Ow9m0RsncaOMAtiAtk,16
90
- sticker_convert-2.1.3.dist-info/RECORD,,
85
+ sticker_convert-2.1.5.dist-info/LICENSE,sha256=gXf5dRMhNSbfLPYYTY_5hsZ1r7UU1OaKQEAQUhuIBkM,18092
86
+ sticker_convert-2.1.5.dist-info/METADATA,sha256=2fCG4wszsojlQx45mmZRjTHwD83QA3yGbV_-XljMW1k,44705
87
+ sticker_convert-2.1.5.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
88
+ sticker_convert-2.1.5.dist-info/entry_points.txt,sha256=MNJ7XyC--ugxi5jS1nzjDLGnxCyLuaGdsVLnJhDHCqs,66
89
+ sticker_convert-2.1.5.dist-info/top_level.txt,sha256=r9vfnB0l1ZnH5pTH5RvkobnK3Ow9m0RsncaOMAtiAtk,16
90
+ sticker_convert-2.1.5.dist-info/RECORD,,