sticker-convert 2.2.7__tar.gz → 2.3.1__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.
Files changed (99) hide show
  1. {sticker-convert-2.2.7/src/sticker_convert.egg-info → sticker-convert-2.3.1}/PKG-INFO +2 -2
  2. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/requirements.txt +1 -1
  3. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/__init__.py +1 -1
  4. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/converter.py +60 -13
  5. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui.py +15 -6
  6. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/job.py +4 -0
  7. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/media/codec_info.py +27 -2
  8. {sticker-convert-2.2.7 → sticker-convert-2.3.1/src/sticker_convert.egg-info}/PKG-INFO +2 -2
  9. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert.egg-info/requires.txt +1 -1
  10. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/LICENSE +0 -0
  11. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/MANIFEST.in +0 -0
  12. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/README.md +0 -0
  13. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/pyproject.toml +0 -0
  14. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/setup.cfg +0 -0
  15. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/__main__.py +0 -0
  16. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/cli.py +0 -0
  17. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/downloaders/download_base.py +0 -0
  18. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/downloaders/download_kakao.py +0 -0
  19. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/downloaders/download_line.py +0 -0
  20. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/downloaders/download_signal.py +0 -0
  21. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/downloaders/download_telegram.py +0 -0
  22. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/frames/comp_frame.py +0 -0
  23. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/frames/config_frame.py +0 -0
  24. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/frames/control_frame.py +0 -0
  25. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/frames/cred_frame.py +0 -0
  26. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/frames/input_frame.py +0 -0
  27. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/frames/output_frame.py +0 -0
  28. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/frames/progress_frame.py +0 -0
  29. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/frames/right_clicker.py +0 -0
  30. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/gui_utils.py +0 -0
  31. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/windows/advanced_compression_window.py +0 -0
  32. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/windows/base_window.py +0 -0
  33. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/windows/kakao_get_auth_window.py +0 -0
  34. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/windows/line_get_auth_window.py +0 -0
  35. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/gui_components/windows/signal_get_auth_window.py +0 -0
  36. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/.github/FUNDING.yml +0 -0
  37. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/.gitignore +0 -0
  38. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/README.md +0 -0
  39. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers/Info.plist +0 -0
  40. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Info.plist +0 -0
  41. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Contents.json +0 -0
  42. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Contents.json +0 -0
  43. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 1.sticker/Contents.json +0 -0
  44. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 1.sticker/Sticker 1.png +0 -0
  45. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 2.sticker/Contents.json +0 -0
  46. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 2.sticker/Sticker 2.png +0 -0
  47. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 3.sticker/Contents.json +0 -0
  48. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 3.sticker/Sticker 3.png +0 -0
  49. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/App-Store-1024x1024pt.png +0 -0
  50. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Contents.json +0 -0
  51. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-App-Store-1024x768pt.png +0 -0
  52. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPad-67x50pt@2x.png +0 -0
  53. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPad-Pro-74x55pt@2x.png +0 -0
  54. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPhone-60x45pt@2x.png +0 -0
  55. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPhone-60x45pt@3x.png +0 -0
  56. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages27x20pt@2x.png +0 -0
  57. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages27x20pt@3x.png +0 -0
  58. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages32x24pt@2x.png +0 -0
  59. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages32x24pt@3x.png +0 -0
  60. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/iPad-Settings-29pt@2x.png +0 -0
  61. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/iPhone-Settings-29pt@3x.png +0 -0
  62. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/iPhone-settings-29pt@2x.png +0 -0
  63. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.pbxproj +0 -0
  64. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  65. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  66. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/xcuserdata/niklaspeterson.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  67. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/xcuserdata/niklaspeterson.xcuserdatad/xcschemes/xcschememanagement.plist +0 -0
  68. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/job_option.py +0 -0
  69. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/resources/NotoColorEmoji.ttf +0 -0
  70. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/resources/appicon.icns +0 -0
  71. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/resources/appicon.ico +0 -0
  72. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/resources/appicon.png +0 -0
  73. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/resources/compression.json +0 -0
  74. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/resources/emoji.json +0 -0
  75. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/resources/help.json +0 -0
  76. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/resources/input.json +0 -0
  77. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/resources/output.json +0 -0
  78. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/uploaders/compress_wastickers.py +0 -0
  79. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/uploaders/upload_base.py +0 -0
  80. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/uploaders/upload_signal.py +0 -0
  81. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/uploaders/upload_telegram.py +0 -0
  82. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/uploaders/xcode_imessage.py +0 -0
  83. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/auth/get_kakao_auth.py +0 -0
  84. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/auth/get_line_auth.py +0 -0
  85. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/auth/get_signal_auth.py +0 -0
  86. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/fake_cb_msg.py +0 -0
  87. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/files/cache_store.py +0 -0
  88. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/files/dir_utils.py +0 -0
  89. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/files/json_manager.py +0 -0
  90. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/files/metadata_handler.py +0 -0
  91. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/files/run_bin.py +0 -0
  92. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/media/apple_png_normalize.py +0 -0
  93. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/media/decrypt_kakao.py +0 -0
  94. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/media/format_verify.py +0 -0
  95. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert/utils/url_detect.py +0 -0
  96. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert.egg-info/SOURCES.txt +0 -0
  97. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert.egg-info/dependency_links.txt +0 -0
  98. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert.egg-info/entry_points.txt +0 -0
  99. {sticker-convert-2.2.7 → sticker-convert-2.3.1}/src/sticker_convert.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sticker-convert
3
- Version: 2.2.7
3
+ Version: 2.3.1
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>
@@ -376,7 +376,7 @@ Requires-Dist: pyoxipng~=9.0.0
376
376
  Requires-Dist: python-telegram-bot~=20.5
377
377
  Requires-Dist: requests~=2.31.0
378
378
  Requires-Dist: rlottie_python~=1.2.1
379
- Requires-Dist: selenium~=4.16.0
379
+ Requires-Dist: selenium~=4.17.2
380
380
  Requires-Dist: signalstickers-client~=3.3.0
381
381
  Requires-Dist: tqdm~=4.66.1
382
382
  Requires-Dist: ttkbootstrap-fork-laggykiller~=1.5.1
@@ -10,7 +10,7 @@ pyoxipng~=9.0.0
10
10
  python-telegram-bot~=20.5
11
11
  requests~=2.31.0
12
12
  rlottie_python~=1.2.1
13
- selenium~=4.16.0
13
+ selenium~=4.17.2
14
14
  signalstickers-client~=3.3.0
15
15
  tqdm~=4.66.1
16
16
  ttkbootstrap-fork-laggykiller~=1.5.1
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env python3
2
2
  '''sticker-convert'''
3
- __version__ = '2.2.7'
3
+ __version__ = '2.3.1'
@@ -30,6 +30,14 @@ def get_step_value(
30
30
  else:
31
31
  return None
32
32
 
33
+ def useful_array(plane, bytes_per_pixel=1, dtype='uint8'):
34
+ total_line_size = abs(plane.line_size)
35
+ useful_line_size = plane.width * bytes_per_pixel
36
+ arr = np.frombuffer(plane, np.uint8)
37
+ if total_line_size != useful_line_size:
38
+ arr = arr.reshape(-1, total_line_size)[:, 0:useful_line_size].reshape(-1)
39
+ return arr.view(np.dtype(dtype))
40
+
33
41
  class StickerConvert:
34
42
  MSG_START_COMP = '[I] Start compressing {} -> {}'
35
43
  MSG_SKIP_COMP = '[S] Compatible file found, skip compress and just copy {} -> {}'
@@ -225,30 +233,69 @@ class StickerConvert:
225
233
  self.frames_raw.append(frame)
226
234
  return
227
235
 
228
- frame_format = 'rgba'
229
236
  # Crashes when handling some webm in yuv420p and convert to rgba
230
237
  # https://github.com/PyAV-Org/PyAV/issues/1166
231
238
  metadata = iio.immeta(self.in_f, plugin='pyav', exclude_applied=False)
232
239
  context = None
233
240
  if metadata.get('video_format') == 'yuv420p':
234
- if metadata.get('alpha_mode') != '1':
235
- frame_format = 'rgb24'
236
241
  if metadata.get('codec') == 'vp8':
237
- context = CodecContext.create('v8', 'r')
242
+ context = CodecContext.create('libvpx', 'r')
238
243
  elif metadata.get('codec') == 'vp9':
239
244
  context = CodecContext.create('libvpx-vp9', 'r')
240
245
 
241
246
  with av.open(self.in_f) as container:
242
247
  if not context:
243
248
  context = container.streams.video[0].codec_context
244
- for packet in container.demux(video=0):
249
+
250
+ for packet in container.demux(container.streams.video):
245
251
  for frame in context.decode(packet):
246
- frame = frame.to_ndarray(format=frame_format)
247
- if frame_format == 'rgb24':
248
- frame = np.dstack(
249
- (frame, np.zeros(frame.shape[:2], dtype=np.uint8)+255)
250
- )
251
- self.frames_raw.append(frame)
252
+ if frame.width % 2 != 0:
253
+ width = frame.width - 1
254
+ else:
255
+ width = frame.width
256
+ if frame.height % 2 != 0:
257
+ height = frame.height - 1
258
+ else:
259
+ height = frame.height
260
+ if frame.format.name == 'yuv420p':
261
+ rgb_array = frame.to_ndarray(format='rgb24')
262
+ rgba_array = np.dstack(
263
+ (rgb_array, np.zeros(frame.shape[:2], dtype=np.uint8) + 255)
264
+ )
265
+ else:
266
+ # yuva420p may cause crash
267
+ # https://github.com/laggykiller/sticker-convert/issues/114
268
+ frame = frame.reformat(width=width, height=height, format='yuva420p', dst_colorspace=1)
269
+
270
+ # https://stackoverflow.com/questions/72308308/converting-yuv-to-rgb-in-python-coefficients-work-with-array-dont-work-with-n
271
+ y = useful_array(frame.planes[0]).reshape(height, width)
272
+ u = useful_array(frame.planes[1]).reshape(height // 2, width // 2)
273
+ v = useful_array(frame.planes[2]).reshape(height // 2, width // 2)
274
+ a = useful_array(frame.planes[3]).reshape(height, width)
275
+
276
+ u = u.repeat(2, axis=0).repeat(2, axis=1)
277
+ v = v.repeat(2, axis=0).repeat(2, axis=1)
278
+
279
+ y = y.reshape((y.shape[0], y.shape[1], 1))
280
+ u = u.reshape((u.shape[0], u.shape[1], 1))
281
+ v = v.reshape((v.shape[0], v.shape[1], 1))
282
+ a = a.reshape((a.shape[0], a.shape[1], 1))
283
+
284
+ yuv_array = np.concatenate((y, u, v), axis=2)
285
+
286
+ yuv_array = yuv_array.astype(np.float32)
287
+ yuv_array[:, :, 0] = yuv_array[:, :, 0].clip(16, 235).astype(yuv_array.dtype) - 16
288
+ yuv_array[:, :, 1:] = yuv_array[:, :, 1:].clip(16, 240).astype(yuv_array.dtype) - 128
289
+
290
+ convert = np.array([
291
+ [1.164, 0.000, 1.793],
292
+ [1.164, -0.213, -0.533],
293
+ [1.164, 2.112, 0.000]
294
+ ])
295
+ rgb_array = np.matmul(yuv_array, convert.T).clip(0,255).astype('uint8')
296
+ rgba_array = np.concatenate((rgb_array, a), axis=2)
297
+
298
+ self.frames_raw.append(rgba_array)
252
299
 
253
300
  def frames_import_lottie(self):
254
301
  if self.in_f_ext == '.tgs':
@@ -313,11 +360,11 @@ class StickerConvert:
313
360
  # fps_ratio: 1 frame in new anim equal to how many frame in old anim
314
361
  # speed_ratio: How much to speed up / slow down
315
362
  fps_ratio = self.fps_orig / self.fps
316
- if (self.opt_comp.duration_min and
363
+ if (self.opt_comp.duration_min != None and
317
364
  self.duration_orig < self.opt_comp.duration_min):
318
365
 
319
366
  speed_ratio = self.duration_orig / self.opt_comp.duration_min
320
- elif (self.opt_comp.duration_max and
367
+ elif (self.opt_comp.duration_max != None and
321
368
  self.duration_orig > self.opt_comp.duration_max):
322
369
 
323
370
  speed_ratio = self.duration_orig / self.opt_comp.duration_max
@@ -543,11 +543,18 @@ class GUI(Window):
543
543
  # output_option_display = self.get_output_display_name()
544
544
  url = self.input_address_var.get()
545
545
 
546
- # Input
547
- if os.path.isdir(self.input_setdir_var.get()):
548
- self.input_frame.input_setdir_entry.config(bootstyle='default')
546
+ if os.path.abspath(self.input_setdir_var.get()) == os.path.abspath(self.output_setdir_var.get()):
547
+ in_out_dir_same = True
549
548
  else:
549
+ in_out_dir_same = False
550
+
551
+ # Input
552
+ if in_out_dir_same == True:
553
+ self.input_frame.input_setdir_entry.config(bootstyle='danger')
554
+ elif not os.path.isdir(self.input_setdir_var.get()):
550
555
  self.input_frame.input_setdir_entry.config(bootstyle='warning')
556
+ else:
557
+ self.input_frame.input_setdir_entry.config(bootstyle='default')
551
558
 
552
559
  self.input_frame.address_lbl.config(text=self.input_presets[input_option_display]['address_lbls'])
553
560
  self.input_frame.address_entry.config(bootstyle='default')
@@ -574,10 +581,12 @@ class GUI(Window):
574
581
  self.input_frame.address_tip.config(text=f'Detected URL: {download_option}')
575
582
 
576
583
  # Output
577
- if os.path.isdir(self.output_setdir_var.get()):
578
- self.output_frame.output_setdir_entry.config(bootstyle='default')
579
- else:
584
+ if in_out_dir_same == True:
585
+ self.output_frame.output_setdir_entry.config(bootstyle='danger')
586
+ elif not os.path.isdir(self.output_setdir_var.get()):
580
587
  self.output_frame.output_setdir_entry.config(bootstyle='warning')
588
+ else:
589
+ self.output_frame.output_setdir_entry.config(bootstyle='default')
581
590
 
582
591
  if (MetadataHandler.check_metadata_required(output_option, 'title') and
583
592
  not MetadataHandler.check_metadata_provided(self.input_setdir_var.get(), input_option, 'title') and
@@ -89,6 +89,10 @@ class Job:
89
89
  save_to_local_tip += ' If you want to upload the results by yourself,\n'
90
90
  save_to_local_tip += ' select "Save to local directory only" for output\n'
91
91
 
92
+ if os.path.abspath(self.opt_input.dir) == os.path.abspath(self.opt_output.dir):
93
+ error_msg += '\n'
94
+ error_msg += '[X] Input and output directories cannot be the same\n'
95
+
92
96
  if self.opt_input.option == 'auto':
93
97
  error_msg += '\n'
94
98
  error_msg += '[X] Unrecognized URL input source\n'
@@ -5,6 +5,8 @@ import mimetypes
5
5
  from typing import Optional
6
6
 
7
7
  import imageio.v3 as iio
8
+ import av # type: ignore
9
+ from av.codec.context import CodecContext # type: ignore
8
10
  from rlottie_python import LottieAnimation # type: ignore
9
11
  from PIL import Image, UnidentifiedImageError
10
12
  import mmap
@@ -66,8 +68,31 @@ class CodecInfo:
66
68
  else:
67
69
  fps = frames / total_duration * 1000
68
70
  else:
69
- metadata = iio.immeta(file, plugin="pyav", exclude_applied=False)
70
- fps = metadata.get("fps", 1)
71
+ # Getting fps from metadata is not reliable
72
+ # Example: https://github.com/laggykiller/sticker-convert/issues/114
73
+ metadata = iio.immeta(file, plugin='pyav', exclude_applied=False)
74
+ context = None
75
+ if metadata.get('video_format') == 'yuv420p':
76
+ if metadata.get('codec') == 'vp8':
77
+ context = CodecContext.create('libvpx', 'r')
78
+ elif metadata.get('codec') == 'vp9':
79
+ context = CodecContext.create('libvpx-vp9', 'r')
80
+
81
+ with av.open(file) as container:
82
+ stream = container.streams.video[0]
83
+ if not context:
84
+ context = stream.codec_context
85
+
86
+ last_frame = None
87
+ for frame_count, frame in enumerate(container.decode(stream)):
88
+ last_frame = frame
89
+ if frame_count > 10:
90
+ break
91
+
92
+ if frame_count <= 1:
93
+ fps = 1
94
+ else:
95
+ fps = frame_count / (last_frame.pts * last_frame.time_base.numerator / last_frame.time_base.denominator)
71
96
 
72
97
  return fps
73
98
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sticker-convert
3
- Version: 2.2.7
3
+ Version: 2.3.1
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>
@@ -376,7 +376,7 @@ Requires-Dist: pyoxipng~=9.0.0
376
376
  Requires-Dist: python-telegram-bot~=20.5
377
377
  Requires-Dist: requests~=2.31.0
378
378
  Requires-Dist: rlottie_python~=1.2.1
379
- Requires-Dist: selenium~=4.16.0
379
+ Requires-Dist: selenium~=4.17.2
380
380
  Requires-Dist: signalstickers-client~=3.3.0
381
381
  Requires-Dist: tqdm~=4.66.1
382
382
  Requires-Dist: ttkbootstrap-fork-laggykiller~=1.5.1
@@ -10,7 +10,7 @@ pyoxipng~=9.0.0
10
10
  python-telegram-bot~=20.5
11
11
  requests~=2.31.0
12
12
  rlottie_python~=1.2.1
13
- selenium~=4.16.0
13
+ selenium~=4.17.2
14
14
  signalstickers-client~=3.3.0
15
15
  tqdm~=4.66.1
16
16
  ttkbootstrap-fork-laggykiller~=1.5.1
File without changes