Skip to content

Commit d21b49d

Browse files
committed
fix: show percentage with two decimal digits in progress
1 parent 2a2639f commit d21b49d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

ffmpeg_normalize/_media_file.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
AUDIO_ONLY_FORMATS = {"aac", "ast", "flac", "mka", "oga", "ogg", "opus", "wav"}
2525
ONE_STREAM = {"aac", "ast", "flac", "mp3", "wav"}
2626

27+
TQDM_BAR_FORMAT = "{desc}: {percentage:3.2f}% |{bar}{r_bar}"
28+
2729

2830
def _to_ms(**kwargs: str) -> int:
2931
hour = int(kwargs.get("hour", 0))
@@ -189,7 +191,12 @@ def run_normalization(self) -> None:
189191

190192
# run the second pass as a whole
191193
if self.ffmpeg_normalize.progress:
192-
with tqdm(total=100, position=1, desc="Second Pass") as pbar:
194+
with tqdm(
195+
total=100,
196+
position=1,
197+
desc="Second Pass",
198+
bar_format=TQDM_BAR_FORMAT,
199+
) as pbar:
193200
for progress in self._second_pass():
194201
pbar.update(progress - pbar.n)
195202
else:
@@ -225,6 +232,7 @@ def _first_pass(self) -> None:
225232
total=100,
226233
position=1,
227234
desc=f"Stream {index + 1}/{len(self.streams['audio'].values())}",
235+
bar_format=TQDM_BAR_FORMAT,
228236
) as pbar:
229237
for progress in fun():
230238
pbar.update(progress - pbar.n)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
tqdm>=4.64.1
22
colorama>=0.4.6
3-
ffmpeg-progress-yield>=0.7.4
3+
ffmpeg-progress-yield>=0.10.0
44
colorlog==6.7.0

0 commit comments

Comments
 (0)