better-ffmpeg-progress 2.1.9__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.9
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
 
@@ -151,3 +156,4 @@ The `run` method takes the following **optional** arguments:
151
156
 
152
157
  [20/10/2024]
153
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
 
@@ -134,3 +139,4 @@ The `run` method takes the following **optional** arguments:
134
139
 
135
140
  [20/10/2024]
136
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
@@ -252,7 +254,10 @@ class FfmpegProcess:
252
254
  refresh_per_second=10,
253
255
  ) as progress_bar:
254
256
  task_id = progress_bar.add_task(
255
- 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,
256
261
  )
257
262
 
258
263
  self._start_process(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: better-ffmpeg-progress
3
- Version: 2.1.9
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
 
@@ -151,3 +156,4 @@ The `run` method takes the following **optional** arguments:
151
156
 
152
157
  [20/10/2024]
153
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.9",
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.",