better-ffmpeg-progress 2.1.8__tar.gz → 2.2.0__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: better-ffmpeg-progress
3
- Version: 2.1.8
3
+ Version: 2.2.0
4
4
  Summary: Run FFmpeg & see percentage progress + ETA.
5
5
  Home-page: https://github.com/CrypticSignal/better-ffmpeg-progress
6
6
  Author: GitHub.com/CrypticSignal
@@ -30,11 +30,11 @@ Runs an FFmpeg command and uses [Rich](https://github.com/Textualize/rich) to sh
30
30
  ## Example:
31
31
 
32
32
  ```
33
- ⠏ Processing... ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23% 0:00:04 00:15
33
+ ⠏ Processing abc.webm ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23% 0:00:04 00:15
34
34
  ```
35
35
 
36
36
  Where:
37
-
37
+ - `Processing abc.webm` is the description of the progresss bar.
38
38
  - `23%` is the percentage progress.
39
39
  - `0:00:04` is the time (H:MM:SS) elapsed.
40
40
  - `00:15` is the estimated time until the FFmpeg process completes.
@@ -78,13 +78,18 @@ def handle_error():
78
78
  # Pass a list of FFmpeg arguments, like you would if using subprocess.run()
79
79
  process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])
80
80
 
81
- ffmpeg_output_path = 'ffmpeg_output.txt'
82
-
83
81
  # Use the run method to run the FFmpeg command.
84
- process.run(progress_handler=handle_progress_info, ffmpeg_output_file=ffmpeg_output_path, success_handler=handle_success, error_handler=handle_error)
82
+ process.run(
83
+ output_file="ffmpeg_output.txt",
84
+ progress_bar_description="Converting file...",
85
+ progress_handler=handle_progress_info,
86
+ success_handler=handle_success,
87
+ error_handler=handle_error,
88
+ )
85
89
  ```
86
90
 
87
91
  The `run` method takes the following **optional** arguments:
92
+ - `progress_bar_description` - An optional string to set a custom description for the progress bar. The default description is `Processing <file>`. This can be an empty string if you don't want the progress bar to have a description.
88
93
 
89
94
  - `progress_handler`
90
95
 
@@ -96,9 +101,9 @@ The `run` method takes the following **optional** arguments:
96
101
  - Estimated output filesize in bytes. [float]
97
102
  - _Note: This is not accurate. Please take the value with a grain of salt._
98
103
 
99
- The values will be `None` if unknown. The function will receive the aforementioned metrics as arguments, about two times per second.
104
+ The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.
100
105
 
101
- - `ffmpeg_output_file` - A string path to define where you want the output of FFmpeg to be saved. By default, this is saved in a folder named "ffmpeg_output", with the filename `[<input_filename>].txt`.
106
+ - `output_file` - A string path to define where you want the output of FFmpeg to be saved. By default, this is saved in a folder named "ffmpeg_output", with the filename `[<input_filename>].txt`.
102
107
 
103
108
  - `success_handler` - A function to run if the FFmpeg process completes successfully.
104
109
 
@@ -148,3 +153,7 @@ The `run` method takes the following **optional** arguments:
148
153
 
149
154
  [19/10/2024]
150
155
  - [v2.1.8] Use [Rich](https://github.com/Textualize/rich) instead of [tqdm](https://github.com/tqdm/tqdm) and format code with [Ruff](https://github.com/astral-sh/ruff).
156
+
157
+ [20/10/2024]
158
+ - [v2.1.9] Do not clear the terminal before showing the progress bar.
159
+ - [v2.2.0] Add the ability to set a custom description for the progress bar.
@@ -13,11 +13,11 @@ Runs an FFmpeg command and uses [Rich](https://github.com/Textualize/rich) to sh
13
13
  ## Example:
14
14
 
15
15
  ```
16
- ⠏ Processing... ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23% 0:00:04 00:15
16
+ ⠏ Processing abc.webm ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23% 0:00:04 00:15
17
17
  ```
18
18
 
19
19
  Where:
20
-
20
+ - `Processing abc.webm` is the description of the progresss bar.
21
21
  - `23%` is the percentage progress.
22
22
  - `0:00:04` is the time (H:MM:SS) elapsed.
23
23
  - `00:15` is the estimated time until the FFmpeg process completes.
@@ -61,13 +61,18 @@ def handle_error():
61
61
  # Pass a list of FFmpeg arguments, like you would if using subprocess.run()
62
62
  process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])
63
63
 
64
- ffmpeg_output_path = 'ffmpeg_output.txt'
65
-
66
64
  # Use the run method to run the FFmpeg command.
67
- process.run(progress_handler=handle_progress_info, ffmpeg_output_file=ffmpeg_output_path, success_handler=handle_success, error_handler=handle_error)
65
+ process.run(
66
+ output_file="ffmpeg_output.txt",
67
+ progress_bar_description="Converting file...",
68
+ progress_handler=handle_progress_info,
69
+ success_handler=handle_success,
70
+ error_handler=handle_error,
71
+ )
68
72
  ```
69
73
 
70
74
  The `run` method takes the following **optional** arguments:
75
+ - `progress_bar_description` - An optional string to set a custom description for the progress bar. The default description is `Processing <file>`. This can be an empty string if you don't want the progress bar to have a description.
71
76
 
72
77
  - `progress_handler`
73
78
 
@@ -79,9 +84,9 @@ The `run` method takes the following **optional** arguments:
79
84
  - Estimated output filesize in bytes. [float]
80
85
  - _Note: This is not accurate. Please take the value with a grain of salt._
81
86
 
82
- The values will be `None` if unknown. The function will receive the aforementioned metrics as arguments, about two times per second.
87
+ The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.
83
88
 
84
- - `ffmpeg_output_file` - A string path to define where you want the output of FFmpeg to be saved. By default, this is saved in a folder named "ffmpeg_output", with the filename `[<input_filename>].txt`.
89
+ - `output_file` - A string path to define where you want the output of FFmpeg to be saved. By default, this is saved in a folder named "ffmpeg_output", with the filename `[<input_filename>].txt`.
85
90
 
86
91
  - `success_handler` - A function to run if the FFmpeg process completes successfully.
87
92
 
@@ -131,3 +136,7 @@ The `run` method takes the following **optional** arguments:
131
136
 
132
137
  [19/10/2024]
133
138
  - [v2.1.8] Use [Rich](https://github.com/Textualize/rich) instead of [tqdm](https://github.com/tqdm/tqdm) and format code with [Ruff](https://github.com/astral-sh/ruff).
139
+
140
+ [20/10/2024]
141
+ - [v2.1.9] Do not clear the terminal before showing the progress bar.
142
+ - [v2.2.0] Add the ability to set a custom description for the progress bar.
@@ -225,6 +225,7 @@ class FfmpegProcess:
225
225
  def run(
226
226
  self,
227
227
  output_file: Optional[Union[str, Path]] = None,
228
+ progress_bar_description: str = None,
228
229
  progress_handler: Optional[Callable] = None,
229
230
  success_handler: Optional[Callable] = None,
230
231
  error_handler: Optional[Callable] = None,
@@ -232,6 +233,7 @@ class FfmpegProcess:
232
233
  """
233
234
  Args:
234
235
  output_file: Optional filepath to write FFmpeg output to
236
+ progress_bar_description: Optional string to set a custom description for the progress bar
235
237
  progress_handler: Optional function which receives progress metrics
236
238
  success_handler: Optional function to handle successful completion of the FFmpeg process
237
239
  error_handler: Optional function for FFmpeg process error handling
@@ -239,9 +241,6 @@ class FfmpegProcess:
239
241
  if not self._check_output_exists():
240
242
  return
241
243
 
242
- # Clear the terminal
243
- print("\033[2J\033[H", end="")
244
-
245
244
  print(f"Executing: {' '.join(self._ffmpeg_args)}")
246
245
 
247
246
  if self._duration_secs and not progress_handler:
@@ -255,7 +254,10 @@ class FfmpegProcess:
255
254
  refresh_per_second=10,
256
255
  ) as progress_bar:
257
256
  task_id = progress_bar.add_task(
258
- f"Processing {self._input_filepath.name}", total=self._duration_secs
257
+ progress_bar_description
258
+ if progress_bar_description is not None
259
+ else f"Processing {self._input_filepath.name}",
260
+ total=self._duration_secs,
259
261
  )
260
262
 
261
263
  self._start_process(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: better-ffmpeg-progress
3
- Version: 2.1.8
3
+ Version: 2.2.0
4
4
  Summary: Run FFmpeg & see percentage progress + ETA.
5
5
  Home-page: https://github.com/CrypticSignal/better-ffmpeg-progress
6
6
  Author: GitHub.com/CrypticSignal
@@ -30,11 +30,11 @@ Runs an FFmpeg command and uses [Rich](https://github.com/Textualize/rich) to sh
30
30
  ## Example:
31
31
 
32
32
  ```
33
- ⠏ Processing... ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23% 0:00:04 00:15
33
+ ⠏ Processing abc.webm ━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23% 0:00:04 00:15
34
34
  ```
35
35
 
36
36
  Where:
37
-
37
+ - `Processing abc.webm` is the description of the progresss bar.
38
38
  - `23%` is the percentage progress.
39
39
  - `0:00:04` is the time (H:MM:SS) elapsed.
40
40
  - `00:15` is the estimated time until the FFmpeg process completes.
@@ -78,13 +78,18 @@ def handle_error():
78
78
  # Pass a list of FFmpeg arguments, like you would if using subprocess.run()
79
79
  process = FfmpegProcess(["ffmpeg", "-i", "input.mp4", "-c:a", "libmp3lame", "output.mp3"])
80
80
 
81
- ffmpeg_output_path = 'ffmpeg_output.txt'
82
-
83
81
  # Use the run method to run the FFmpeg command.
84
- process.run(progress_handler=handle_progress_info, ffmpeg_output_file=ffmpeg_output_path, success_handler=handle_success, error_handler=handle_error)
82
+ process.run(
83
+ output_file="ffmpeg_output.txt",
84
+ progress_bar_description="Converting file...",
85
+ progress_handler=handle_progress_info,
86
+ success_handler=handle_success,
87
+ error_handler=handle_error,
88
+ )
85
89
  ```
86
90
 
87
91
  The `run` method takes the following **optional** arguments:
92
+ - `progress_bar_description` - An optional string to set a custom description for the progress bar. The default description is `Processing <file>`. This can be an empty string if you don't want the progress bar to have a description.
88
93
 
89
94
  - `progress_handler`
90
95
 
@@ -96,9 +101,9 @@ The `run` method takes the following **optional** arguments:
96
101
  - Estimated output filesize in bytes. [float]
97
102
  - _Note: This is not accurate. Please take the value with a grain of salt._
98
103
 
99
- The values will be `None` if unknown. The function will receive the aforementioned metrics as arguments, about two times per second.
104
+ The values will be `None` if unknown. The function will receive the current values of these metrics as arguments, every 0.1s.
100
105
 
101
- - `ffmpeg_output_file` - A string path to define where you want the output of FFmpeg to be saved. By default, this is saved in a folder named "ffmpeg_output", with the filename `[<input_filename>].txt`.
106
+ - `output_file` - A string path to define where you want the output of FFmpeg to be saved. By default, this is saved in a folder named "ffmpeg_output", with the filename `[<input_filename>].txt`.
102
107
 
103
108
  - `success_handler` - A function to run if the FFmpeg process completes successfully.
104
109
 
@@ -148,3 +153,7 @@ The `run` method takes the following **optional** arguments:
148
153
 
149
154
  [19/10/2024]
150
155
  - [v2.1.8] Use [Rich](https://github.com/Textualize/rich) instead of [tqdm](https://github.com/tqdm/tqdm) and format code with [Ruff](https://github.com/astral-sh/ruff).
156
+
157
+ [20/10/2024]
158
+ - [v2.1.9] Do not clear the terminal before showing the progress bar.
159
+ - [v2.2.0] Add the ability to set a custom description for the progress bar.
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as f:
5
5
 
6
6
  setuptools.setup(
7
7
  name="better-ffmpeg-progress",
8
- version="2.1.8",
8
+ version="2.2.0",
9
9
  author="GitHub.com/CrypticSignal",
10
10
  author_email="theaudiophile@outlook.com",
11
11
  description="Run FFmpeg & see percentage progress + ETA.",