Add progress bar to slicing audios script
Browse files- slice_audio.py +4 -1
slice_audio.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
import os
|
| 2 |
import argparse
|
|
|
|
| 3 |
|
| 4 |
START = 00
|
| 5 |
-
# SECONDS = 150
|
| 6 |
FOLDER = "chunks"
|
| 7 |
|
| 8 |
def seconds_to_hms(seconds):
|
|
@@ -39,6 +39,7 @@ def main(args):
|
|
| 39 |
# Slice audio into seconds chunks
|
| 40 |
hour, minute, second = seconds_to_hms(seconds) # Duration of each chunk
|
| 41 |
output_files = []
|
|
|
|
| 42 |
for chunk in range(num_chunks):
|
| 43 |
start_time = chunk * seconds
|
| 44 |
hour_start, minute_start, second_start = seconds_to_hms(start_time) # Start time of each chunk
|
|
@@ -58,6 +59,8 @@ def main(args):
|
|
| 58 |
|
| 59 |
output_files.append(output)
|
| 60 |
|
|
|
|
|
|
|
| 61 |
# write output files to a txt file
|
| 62 |
with open(f"{FOLDER}/output_files.txt", "w") as f:
|
| 63 |
for output_file in output_files:
|
|
|
|
| 1 |
import os
|
| 2 |
import argparse
|
| 3 |
+
from tqdm import tqdm
|
| 4 |
|
| 5 |
START = 00
|
|
|
|
| 6 |
FOLDER = "chunks"
|
| 7 |
|
| 8 |
def seconds_to_hms(seconds):
|
|
|
|
| 39 |
# Slice audio into seconds chunks
|
| 40 |
hour, minute, second = seconds_to_hms(seconds) # Duration of each chunk
|
| 41 |
output_files = []
|
| 42 |
+
progress_bar = tqdm(total=num_chunks, desc="Slice audio into chunks progress")
|
| 43 |
for chunk in range(num_chunks):
|
| 44 |
start_time = chunk * seconds
|
| 45 |
hour_start, minute_start, second_start = seconds_to_hms(start_time) # Start time of each chunk
|
|
|
|
| 59 |
|
| 60 |
output_files.append(output)
|
| 61 |
|
| 62 |
+
progress_bar.update(1)
|
| 63 |
+
|
| 64 |
# write output files to a txt file
|
| 65 |
with open(f"{FOLDER}/output_files.txt", "w") as f:
|
| 66 |
for output_file in output_files:
|