Skip to content

Commit c59d5ae

Browse files
committed
ver 2025
1 parent 7d39f6f commit c59d5ae

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@
33
All major and minor version changes will be documented in this file. Details of
44
patch-level version changes can be found in [commit messages](../../commits/master).
55

6+
## 2025 - 2025/02/16
7+
8+
- be opinionated and install `rlottie-python` by default/ regardless
9+
- set default backend to `rlottie-python` in the cli
10+
- add `--fmt` to the cli, where the user can select a list of formats to convert to (default is png
11+
and webp formats)
12+
- replace `--frameskip` with `--fps` as this is more intuitive
13+
614
## 2024.1.3 - 2024/08/26
715

8-
- be opinionated and install `pyrlottie` by default/ regardless
916
- clearly notify user if backend is not installed
1017

1118
## 2024.1.2 - 2024/03/25

documentation/reference/tstickers/convert.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Backend(IntEnum): ...
2727

2828
## convertAnimated
2929

30-
[Show source in convert.py:87](../../../tstickers/convert.py#L87)
30+
[Show source in convert.py:93](../../../tstickers/convert.py#L93)
3131

3232
Convert animated stickers, over a number of threads, at a given framerate, scale and to a
3333
set of formats.
@@ -78,15 +78,15 @@ Convert animated stickers with (Base/Backend.UNDEFINED).
7878

7979
```python
8080
def convertAnimatedFunc(
81-
_swd: Path, _threads: int, _fps: int, _scale: float, _formats
81+
_swd: Path, _threads: int, _fps: int, _scale: float, _formats: set[str] | None
8282
) -> int: ...
8383
```
8484

8585

8686

8787
## convertStatic
8888

89-
[Show source in convert.py:56](../../../tstickers/convert.py#L56)
89+
[Show source in convert.py:62](../../../tstickers/convert.py#L62)
9090

9191
Convert static stickers to specified formats.
9292

@@ -115,7 +115,7 @@ def convertStatic(
115115

116116
## convertWithPIL
117117

118-
[Show source in convert.py:38](../../../tstickers/convert.py#L38)
118+
[Show source in convert.py:44](../../../tstickers/convert.py#L44)
119119

120120
Convert a webp file to specified formats.
121121

tstickers/cli.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,21 @@ def cli() -> None: # pragma: no cover
4848
"--fps",
4949
default=20,
5050
type=int,
51-
help="Set fps. default=20",
51+
help="Set fps for converted animated stickers (this does not affect "
52+
"static images). default=20",
5253
)
5354
parser.add_argument(
5455
"--scale",
5556
default=1,
5657
type=float,
57-
help="Set scale. default=1.0",
58+
help="Set scale for converted animated stickers (this does not affect "
59+
"static images). default=1.0",
5860
)
5961
parser.add_argument(
6062
"-b",
6163
"--backend",
6264
choices={"rlottie_python", "pyrlottie"},
63-
default="pyrlottie",
65+
default="rlottie_python",
6466
help="Specify the convert backend",
6567
)
6668
args = parser.parse_args()
@@ -105,7 +107,7 @@ def cli() -> None: # pragma: no cover
105107

106108
formats = {fmt for sublist in (args.fmt or []) for fmt in sublist}
107109
if len(formats) == 0:
108-
formats = allowed_formats
110+
formats = {"png", "webp"}
109111

110112
downloader = StickerManager(token)
111113
for pack in packs:

tstickers/convert.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ class Backend(IntEnum):
2121
RLOTTIE_PYTHON = auto()
2222

2323

24-
def convertAnimatedFunc(_swd: Path, _threads: int, _fps: int, _scale: float, _formats) -> int:
24+
def convertAnimatedFunc(
25+
_swd: Path,
26+
_threads: int,
27+
_fps: int,
28+
_scale: float,
29+
_formats: set[str] | None,
30+
) -> int:
2531
"""Convert animated stickers with (Base/Backend.UNDEFINED)."""
2632
msg = "Backend could not be loaded"
2733
raise RuntimeError(msg)

tstickers/convert_rlottie_python.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def convert_single_tgs(
4747
width = int(width * scale)
4848
height = int(height * scale)
4949

50-
for format in formats:
51-
anim.save_animation(tgs_file.replace("tgs", format), fps, width=width, height=height)
50+
for fmt in formats:
51+
anim.save_animation(tgs_file.replace("tgs", fmt), fps, width=width, height=height)
5252

5353
finally:
5454
anim.lottie_animation_destroy()

0 commit comments

Comments
 (0)