Skip to content

Commit d06c19a

Browse files
authored
Add files via upload
1 parent 98f1991 commit d06c19a

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

pyautosrt/__init__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import PySimpleGUI as sg
2626
import httpx
2727
from glob import glob
28+
from ffmpeg_progress_yield import FfmpegProgress
2829
#import warnings
2930
#warnings.filterwarnings("ignore", category=DeprecationWarning)
3031
#warnings.filterwarnings("ignore", category=RuntimeWarning)
@@ -507,6 +508,12 @@ def extract_audio(filename, main_window, channels=1, rate=16000):
507508
main_window['-START-'].update(('Cancel','Start')[not_transcribing], button_color=(('white', ('red', '#283b5b')[not_transcribing])))
508509

509510
command = ["ffmpeg", "-y", "-i", filename, "-ac", str(channels), "-ar", str(rate), "-loglevel", "error", temp.name]
511+
ff = FfmpegProgress(command)
512+
file_display_name = os.path.basename(filename).split('/')[-1]
513+
for progress in ff.run_command_with_progress():
514+
pBar(progress, 100, 'Converting {} to a temporary WAV file : '.format(file_display_name), main_window)
515+
pBar(100, 100, 'Converting {} to a temporary WAV file : '.format(file_display_name), main_window)
516+
#main_window['-OUTPUT-MESSAGES-'].update("\n")
510517

511518
if not_transcribing: return
512519

@@ -627,9 +634,9 @@ def transcribe(src, dst, filename, subtitle_format, main_window):
627634
main_window['-OUTPUT-MESSAGES-'].update("")
628635
string_processing = "Processing {} :\n".format(file_display_name)
629636
main_window['-OUTPUT-MESSAGES-'].update(string_processing, append=True)
630-
main_window['-OUTPUT-MESSAGES-'].update("Converting {} to a temporary WAV file\n".format(file_display_name), append=True)
637+
#main_window['-OUTPUT-MESSAGES-'].update("Converting {} to a temporary WAV file\n".format(file_display_name), append=True)
631638
wav_filename, audio_rate = extract_audio(filename, main_window)
632-
main_window['-OUTPUT-MESSAGES-'].update("{} converted WAV file is : {}\n".format(file_display_name, wav_filename), append=True)
639+
main_window['-OUTPUT-MESSAGES-'].update("\n{} converted WAV file is : {}\n".format(file_display_name, wav_filename), append=True)
633640
time.sleep(2)
634641

635642
if not_transcribing: return
@@ -799,7 +806,7 @@ def main():
799806
parser.add_argument('-S', '--src-language', help="Voice language", default="en")
800807
parser.add_argument('-D', '--dst-language', help="Desired language for translation", default="en")
801808
parser.add_argument('-F', '--format', help="Destination subtitle format", default="srt")
802-
parser.add_argument('-v', '--version', action='version', version='0.1.3')
809+
parser.add_argument('-v', '--version', action='version', version='0.1.4')
803810
parser.add_argument('-lf', '--list-formats', help="List all available subtitle formats", action='store_true')
804811
parser.add_argument('-ll', '--list-languages', help="List all available source/translation languages", action='store_true')
805812

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
setup(
2020
name="pyautosrt",
21-
version="0.1.3",
21+
version="0.1.4",
2222
description="pyautosrt is a python based desktop app to generate subtitle and translated subtitle file",
2323
long_description = long_description,
2424
author="Bot Bahlul",
@@ -37,6 +37,7 @@
3737
"tk>=0.1.0",
3838
"pysimplegui>=4.60.1",
3939
"httpx>=0.13.3",
40+
"ffmpeg_progress_yield>=0.7.2",
4041
],
4142
license=open("LICENSE").read()
4243
)

0 commit comments

Comments
 (0)