sticker-convert 2.8.10__tar.gz → 2.8.11__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. {sticker_convert-2.8.10/src/sticker_convert.egg-info → sticker_convert-2.8.11}/PKG-INFO +1 -1
  2. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/converter.py +24 -6
  3. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/media/codec_info.py +23 -19
  4. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/version.py +1 -1
  5. {sticker_convert-2.8.10 → sticker_convert-2.8.11/src/sticker_convert.egg-info}/PKG-INFO +1 -1
  6. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/LICENSE +0 -0
  7. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/MANIFEST.in +0 -0
  8. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/README.md +0 -0
  9. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/pyproject.toml +0 -0
  10. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/requirements.txt +0 -0
  11. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/setup.cfg +0 -0
  12. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/__init__.py +0 -0
  13. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/__main__.py +0 -0
  14. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/cli.py +0 -0
  15. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/definitions.py +0 -0
  16. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/downloaders/__init__.py +0 -0
  17. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/downloaders/download_base.py +0 -0
  18. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/downloaders/download_kakao.py +0 -0
  19. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/downloaders/download_line.py +0 -0
  20. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/downloaders/download_signal.py +0 -0
  21. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/downloaders/download_telegram.py +0 -0
  22. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/downloaders/download_viber.py +0 -0
  23. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui.py +0 -0
  24. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/__init__.py +0 -0
  25. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/frames/__init__.py +0 -0
  26. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/frames/comp_frame.py +0 -0
  27. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/frames/config_frame.py +0 -0
  28. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/frames/control_frame.py +0 -0
  29. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/frames/cred_frame.py +0 -0
  30. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/frames/input_frame.py +0 -0
  31. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/frames/output_frame.py +0 -0
  32. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/frames/progress_frame.py +0 -0
  33. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/frames/right_clicker.py +0 -0
  34. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/gui_utils.py +0 -0
  35. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/windows/__init__.py +0 -0
  36. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/windows/advanced_compression_window.py +0 -0
  37. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/windows/base_window.py +0 -0
  38. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/windows/kakao_get_auth_window.py +0 -0
  39. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/windows/line_get_auth_window.py +0 -0
  40. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/gui_components/windows/signal_get_auth_window.py +0 -0
  41. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/.github/FUNDING.yml +0 -0
  42. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/.gitignore +0 -0
  43. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/README.md +0 -0
  44. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers/Info.plist +0 -0
  45. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Info.plist +0 -0
  46. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Contents.json +0 -0
  47. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Contents.json +0 -0
  48. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 1.sticker/Contents.json +0 -0
  49. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 1.sticker/Sticker 1.png +0 -0
  50. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 2.sticker/Contents.json +0 -0
  51. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 2.sticker/Sticker 2.png +0 -0
  52. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 3.sticker/Contents.json +0 -0
  53. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/Sticker Pack.stickerpack/Sticker 3.sticker/Sticker 3.png +0 -0
  54. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/App-Store-1024x1024pt.png +0 -0
  55. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Contents.json +0 -0
  56. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-App-Store-1024x768pt.png +0 -0
  57. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPad-67x50pt@2x.png +0 -0
  58. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPad-Pro-74x55pt@2x.png +0 -0
  59. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPhone-60x45pt@2x.png +0 -0
  60. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages-iPhone-60x45pt@3x.png +0 -0
  61. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages27x20pt@2x.png +0 -0
  62. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages27x20pt@3x.png +0 -0
  63. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages32x24pt@2x.png +0 -0
  64. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/Messages32x24pt@3x.png +0 -0
  65. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/iPad-Settings-29pt@2x.png +0 -0
  66. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/iPhone-Settings-29pt@3x.png +0 -0
  67. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers StickerPackExtension/Stickers.xcstickers/iMessage App Icon.stickersiconset/iPhone-settings-29pt@2x.png +0 -0
  68. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.pbxproj +0 -0
  69. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -0
  70. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -0
  71. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/project.xcworkspace/xcuserdata/niklaspeterson.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  72. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/ios-message-stickers-template/stickers.xcodeproj/xcuserdata/niklaspeterson.xcuserdatad/xcschemes/xcschememanagement.plist +0 -0
  73. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/job.py +0 -0
  74. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/job_option.py +0 -0
  75. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/resources/NotoColorEmoji.ttf +0 -0
  76. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/resources/appicon.icns +0 -0
  77. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/resources/appicon.ico +0 -0
  78. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/resources/appicon.png +0 -0
  79. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/resources/compression.json +0 -0
  80. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/resources/emoji.json +0 -0
  81. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/resources/help.json +0 -0
  82. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/resources/input.json +0 -0
  83. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/resources/output.json +0 -0
  84. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/uploaders/__init__.py +0 -0
  85. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/uploaders/compress_wastickers.py +0 -0
  86. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/uploaders/upload_base.py +0 -0
  87. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/uploaders/upload_signal.py +0 -0
  88. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/uploaders/upload_telegram.py +0 -0
  89. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/uploaders/xcode_imessage.py +0 -0
  90. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/auth/get_kakao_auth.py +0 -0
  91. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/auth/get_line_auth.py +0 -0
  92. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/auth/get_signal_auth.py +0 -0
  93. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/callback.py +0 -0
  94. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/files/cache_store.py +0 -0
  95. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/files/json_manager.py +0 -0
  96. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/files/json_resources_loader.py +0 -0
  97. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/files/metadata_handler.py +0 -0
  98. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/files/run_bin.py +0 -0
  99. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/files/sanitize_filename.py +0 -0
  100. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/media/apple_png_normalize.py +0 -0
  101. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/media/decrypt_kakao.py +0 -0
  102. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/media/format_verify.py +0 -0
  103. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert/utils/url_detect.py +0 -0
  104. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert.egg-info/SOURCES.txt +0 -0
  105. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert.egg-info/dependency_links.txt +0 -0
  106. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert.egg-info/entry_points.txt +0 -0
  107. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert.egg-info/requires.txt +0 -0
  108. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/src/sticker_convert.egg-info/top_level.txt +0 -0
  109. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/tests/test_compression.py +0 -0
  110. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/tests/test_download.py +0 -0
  111. {sticker_convert-2.8.10 → sticker_convert-2.8.11}/tests/test_export.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sticker-convert
3
- Version: 2.8.10
3
+ Version: 2.8.11
4
4
  Summary: Convert (animated) stickers to/from WhatsApp, Telegram, Signal, Line, Kakao, Viber, iMessage. Written in Python.
5
5
  Author-email: laggykiller <chaudominic2@gmail.com>
6
6
  Maintainer-email: laggykiller <chaudominic2@gmail.com>
@@ -430,19 +430,37 @@ class StickerConvert:
430
430
  and im.n_frames != 0
431
431
  and self.codec_info_orig.fps != 0.0
432
432
  ):
433
+ # Pillow is not reliable for getting webp frame durations
434
+ durations: Optional[List[int]]
435
+ if im.format == "WEBP":
436
+ _, _, _, durations = CodecInfo._get_file_fps_frames_duration_webp(
437
+ self.in_f
438
+ )
439
+ else:
440
+ durations = None
441
+
433
442
  duration_ptr = 0.0
434
443
  duration_inc = 1 / self.codec_info_orig.fps * 1000
435
- next_frame_start_duration = im.info.get("duration", 1000)
436
444
  frame = 0
445
+ if durations is None:
446
+ next_frame_start_duration = cast(int, im.info.get("duration", 1000))
447
+ else:
448
+ next_frame_start_duration = durations[0]
437
449
  while True:
438
450
  self.frames_raw.append(np.asarray(im.convert("RGBA")))
439
451
  duration_ptr += duration_inc
440
452
  if duration_ptr >= next_frame_start_duration:
453
+ frame += 1
441
454
  if frame == im.n_frames:
442
455
  break
443
456
  im.seek(frame)
444
- next_frame_start_duration += im.info.get("duration", 1000)
445
- frame += 1
457
+
458
+ if durations is None:
459
+ next_frame_start_duration += cast(
460
+ int, im.info.get("duration", 1000)
461
+ )
462
+ else:
463
+ next_frame_start_duration += durations[frame]
446
464
  else:
447
465
  self.frames_raw.append(np.asarray(im.convert("RGBA")))
448
466
 
@@ -725,11 +743,11 @@ class StickerConvert:
725
743
  if self.out_f.suffix in (".apng", ".png"):
726
744
  codec = "apng"
727
745
  pixel_format = "rgba"
728
- options_container["plays"] = "0"
746
+ options_stream["plays"] = "0"
729
747
  elif self.out_f.suffix in (".webm", ".mkv"):
730
748
  codec = "libvpx-vp9"
731
749
  pixel_format = "yuva420p"
732
- options_container["loop"] = "0"
750
+ options_stream["loop"] = "0"
733
751
  elif self.out_f.suffix == ".webp":
734
752
  codec = "webp"
735
753
  pixel_format = "yuva420p"
@@ -737,7 +755,7 @@ class StickerConvert:
737
755
  else:
738
756
  codec = "libvpx-vp9"
739
757
  pixel_format = "yuv420p"
740
- options_container["loop"] = "0"
758
+ options_stream["loop"] = "0"
741
759
 
742
760
  with av.open(
743
761
  self.tmp_f,
@@ -80,9 +80,9 @@ class CodecInfo:
80
80
  @staticmethod
81
81
  def get_file_fps_frames_duration(
82
82
  file: Union[Path, bytes], file_ext: Optional[str] = None
83
- ) -> Tuple[float, int, float]:
83
+ ) -> Tuple[float, int, int]:
84
84
  fps: float
85
- duration: float
85
+ duration: int
86
86
 
87
87
  if not file_ext and isinstance(file, Path):
88
88
  file_ext = CodecInfo.get_file_ext(file)
@@ -94,7 +94,9 @@ class CodecInfo:
94
94
  else:
95
95
  duration = 0
96
96
  elif file_ext == ".webp":
97
- fps, frames, duration = CodecInfo._get_file_fps_frames_duration_webp(file)
97
+ fps, frames, duration, _ = CodecInfo._get_file_fps_frames_duration_webp(
98
+ file
99
+ )
98
100
  elif file_ext in (".gif", ".apng", ".png"):
99
101
  fps, frames, duration = CodecInfo._get_file_fps_frames_duration_pillow(file)
100
102
  else:
@@ -115,7 +117,7 @@ class CodecInfo:
115
117
  if file_ext == ".tgs":
116
118
  return CodecInfo._get_file_fps_tgs(file)
117
119
  elif file_ext == ".webp":
118
- fps, _, _ = CodecInfo._get_file_fps_frames_duration_webp(file)
120
+ fps, _, _, _ = CodecInfo._get_file_fps_frames_duration_webp(file)
119
121
  return fps
120
122
  elif file_ext in (".gif", ".apng", ".png"):
121
123
  fps, _, _ = CodecInfo._get_file_fps_frames_duration_pillow(file)
@@ -159,8 +161,8 @@ class CodecInfo:
159
161
  @staticmethod
160
162
  def get_file_duration(
161
163
  file: Union[Path, bytes], file_ext: Optional[str] = None
162
- ) -> float:
163
- duration: float
164
+ ) -> int:
165
+ duration: int
164
166
 
165
167
  # Return duration in miliseconds
166
168
  if not file_ext and isinstance(file, Path):
@@ -173,7 +175,7 @@ class CodecInfo:
173
175
  else:
174
176
  duration = 0
175
177
  elif file_ext == ".webp":
176
- _, _, duration = CodecInfo._get_file_fps_frames_duration_webp(file)
178
+ _, _, duration, _ = CodecInfo._get_file_fps_frames_duration_webp(file)
177
179
  elif file_ext in (".gif", ".png", ".apng"):
178
180
  _, _, duration = CodecInfo._get_file_fps_frames_duration_pillow(file)
179
181
  else:
@@ -233,9 +235,9 @@ class CodecInfo:
233
235
  @staticmethod
234
236
  def _get_file_fps_frames_duration_pillow(
235
237
  file: Union[Path, bytes], frames_only: bool = False
236
- ) -> Tuple[float, int, float]:
237
- total_duration = 0.0
238
- durations: List[float] = []
238
+ ) -> Tuple[float, int, int]:
239
+ total_duration = 0
240
+ durations: List[int] = []
239
241
 
240
242
  with Image.open(file) as im:
241
243
  if "n_frames" in dir(im):
@@ -244,7 +246,7 @@ class CodecInfo:
244
246
  return 0.0, frames, 1
245
247
  for i in range(im.n_frames):
246
248
  im.seek(i)
247
- frame_duration = cast(float, im.info.get("duration", 1000))
249
+ frame_duration = cast(int, im.info.get("duration", 1000))
248
250
  if frame_duration not in durations and frame_duration != 0:
249
251
  durations.append(frame_duration)
250
252
  total_duration += frame_duration
@@ -255,7 +257,7 @@ class CodecInfo:
255
257
  else:
256
258
  duration_gcd = durations_gcd(*durations)
257
259
  frames_apparent = total_duration / duration_gcd
258
- fps = frames_apparent / total_duration * 1000
260
+ fps = float(frames_apparent / total_duration * 1000)
259
261
  return fps, frames, total_duration
260
262
 
261
263
  return 0.0, 1, 0
@@ -263,10 +265,11 @@ class CodecInfo:
263
265
  @staticmethod
264
266
  def _get_file_fps_frames_duration_webp(
265
267
  file: Union[Path, bytes],
266
- ) -> Tuple[float, int, int]:
268
+ ) -> Tuple[float, int, int, List[int]]:
267
269
  total_duration = 0
268
270
  frames = 0
269
271
  durations: List[int] = []
272
+ durations_unique: List[int] = []
270
273
 
271
274
  def _open_f(file: Union[Path, bytes]) -> BinaryIO:
272
275
  if isinstance(file, Path):
@@ -285,22 +288,23 @@ class CodecInfo:
285
288
  int(frame_duration_32[-1]) & 0b11111100
286
289
  )
287
290
  frame_duration = int.from_bytes(frame_duration_bytes, "little")
288
- if frame_duration not in durations and frame_duration != 0:
289
- durations.append(frame_duration)
291
+ if frame_duration not in durations_unique and frame_duration != 0:
292
+ durations_unique.append(frame_duration)
293
+ durations.append(frame_duration)
290
294
  total_duration += frame_duration
291
295
  frames += 1
292
296
 
293
297
  if frames <= 1:
294
- return 0.0, 1, 0
298
+ return 0.0, 1, 0, durations
295
299
 
296
- if len(durations) == 1:
300
+ if len(durations_unique) == 1:
297
301
  fps = frames / total_duration * 1000
298
302
  else:
299
- duration_gcd = durations_gcd(*durations)
303
+ duration_gcd = durations_gcd(*durations_unique)
300
304
  frames_apparent = total_duration / duration_gcd
301
305
  fps = float(frames_apparent / total_duration * 1000)
302
306
 
303
- return fps, frames, total_duration
307
+ return fps, frames, total_duration, durations
304
308
 
305
309
  @staticmethod
306
310
  def _get_file_frames_duration_av(
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
- __version__ = "2.8.10"
3
+ __version__ = "2.8.11"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: sticker-convert
3
- Version: 2.8.10
3
+ Version: 2.8.11
4
4
  Summary: Convert (animated) stickers to/from WhatsApp, Telegram, Signal, Line, Kakao, Viber, iMessage. Written in Python.
5
5
  Author-email: laggykiller <chaudominic2@gmail.com>
6
6
  Maintainer-email: laggykiller <chaudominic2@gmail.com>