@@ -26,6 +26,7 @@ import tkinter as tk
2626import httpx
2727from glob import glob
2828import ctypes
29+ import ctypes .wintypes
2930from streamlink import Streamlink
3031from streamlink .exceptions import NoPluginError , StreamlinkError , StreamError
3132from datetime import datetime , timedelta
@@ -336,6 +337,7 @@ all_threads = []
336337
337338#-------------------------------------------------------------- CONSTANTS --------------------------------------------------------------#
338339
340+ VERSION = "0.1.14"
339341
340342GOOGLE_SPEECH_API_KEY = "AIzaSyBOti4mM-6x9WDnZIjIeyEU21OpBXqWBgw"
341343GOOGLE_SPEECH_API_URL = "http://www.google.com/speech-api/v2/recognize?client=chromium&lang={lang}&key={key}" # pylint: disable=line-too-long
@@ -1203,9 +1205,9 @@ def transcribe(src, dst, filename, subtitle_format, main_window):
12031205 not_transcribing = True
12041206 main_window ['-START-' ].update (('Cancel' ,'Start' )[not_transcribing ], button_color = (('white' , ('red' , '#283b5b' )[not_transcribing ])))
12051207
1206- remove_temp_files ("wav" )
1207- remove_temp_files ("flac" )
1208- remove_temp_files ("mp4" )
1208+ # remove_temp_files("wav")
1209+ # remove_temp_files("flac")
1210+ # remove_temp_files("mp4")
12091211
12101212
12111213def remove_temp_files (extension ):
@@ -1257,7 +1259,14 @@ def move_center(window):
12571259
12581260
12591261def get_clipboard_text ():
1260- return subprocess .check_output (['xclip' , '-selection' , 'clipboard' , '-out' ]).decode ()
1262+ try :
1263+ output = subprocess .check_output (['xclip' , '-selection' , 'clipboard' , '-out' ], stderr = subprocess .PIPE ).decode ()
1264+ if output :
1265+ return output .strip ()
1266+ else :
1267+ return None
1268+ except subprocess .CalledProcessError :
1269+ return None
12611270
12621271
12631272def set_clipboard_text (text ):
@@ -1620,7 +1629,7 @@ def main():
16201629 parser .add_argument ('-ll' , '--list-languages' , help = "List all available source/translation languages" , action = 'store_true' )
16211630 parser .add_argument ('-F' , '--format' , help = "Desired subtitle format" , default = "srt" )
16221631 parser .add_argument ('-lf' , '--list-formats' , help = "List all available subtitle formats" , action = 'store_true' )
1623- parser .add_argument ('-v' , '--version' , action = 'version' , version = '0.1.11' )
1632+ parser .add_argument ('-v' , '--version' , action = 'version' , version = VERSION )
16241633
16251634 args = parser .parse_args ()
16261635
@@ -1711,7 +1720,7 @@ def main():
17111720 [sg .Button ('Start' , expand_x = True , expand_y = True , key = '-START-' ),sg .Button ('Exit' , expand_x = True , expand_y = True )]
17121721 ]
17131722
1714- main_window = sg .Window ('PyAutoSRT-0.1.11' , layout , font = font , resizable = True , keep_on_top = True , finalize = True )
1723+ main_window = sg .Window ('PyAutoSRT-' + VERSION , layout , font = font , resizable = True , keep_on_top = True , finalize = True )
17151724 main_window ['-SRC-' ].block_focus ()
17161725 FONT_TYPE = "Arial"
17171726 FONT_SIZE = 9
@@ -1787,13 +1796,23 @@ def main():
17871796 main_window .TKroot .attributes ('-topmost' , 1 )
17881797 main_window .TKroot .attributes ('-topmost' , 0 )
17891798
1790- src = map_code_of_language [str (main_window ['-SRC-' ].get ())]
1799+ src_name = str (main_window ['-SRC-' ].get ())
1800+ if src_name :
1801+ src = map_code_of_language [src_name ]
1802+ else :
1803+ src_name = "English"
1804+ src = map_code_of_language [src_name ]
17911805 last_selected_src = src
17921806 src_file = open (src_filepath , "w" )
17931807 src_file .write (src )
17941808 src_file .close ()
17951809
1796- dst = map_code_of_language [str (main_window ['-DST-' ].get ())]
1810+ dst_name = str (main_window ['-DST-' ].get ())
1811+ if dst_name :
1812+ dst = map_code_of_language [dst_name ]
1813+ else :
1814+ dst_name = "Indonesian"
1815+ dst = map_code_of_language [dst_name ]
17971816 last_selected_dst = dst
17981817 dst_file = open (dst_filepath , "w" )
17991818 dst_file .write (dst )
0 commit comments