@@ -16,8 +16,7 @@ def get_video_file():
16
16
"""
17
17
Function that gets the video file that needs to be converted
18
18
"""
19
- global video_filepath , video_file
20
-
19
+ global video_filepath , video_file
21
20
video_filepath .set (filedialog .askopenfilename (title = "Select your video file" , filetypes = [
22
21
('MP4 (mp4, m4a, m4v, f4v, f4a, m4b, m4r, f4b, mov)' ,'*.mp4 *.m4a *.m4v *.f4v *.f4a *.m4b *.m4r *.f4b *.mov' ),
23
22
('3GP (3gp, 3gp2, 3g2, 3gpp, 3gpp2)' ,'*.3gp *.3gp2 *.3g2 *.3gpp *.3gpp2' ),
@@ -26,17 +25,13 @@ def get_video_file():
26
25
('FLV' ,'*.flv' ), ('AVI' ,'*.avi' ), ('MPEG-1 (mpg, mp2, mpeg, mpe, mpv )' ,'*.mpg *.mp2 *.mpeg *.mpe *.mpv' ),
27
26
('MPEG-2' ,'*.mpg *.mpeg *.m2v' )]))
28
27
video_file = VideoFileClip (str (video_filepath .get ()))
29
-
30
-
31
-
32
28
33
29
def save_audio_file ():
34
30
"""
35
31
Function that converts video file into audio file in a path that the user chooses
36
-
37
32
"""
38
33
global audio_filepath , audio_file , progress_bar
39
- audio_filepath .set (filedialog .asksaveasfilename (defaultextension = '.mp3' ,
34
+ audio_filepath .set (filedialog .asksaveasfilename (defaultextension = '.mp3' ,
40
35
title = "Select your audio file directory" , filetypes = [
41
36
('MP3 File' ,'*.mp3' ), ('Wave File' ,'*.wav' )]))
42
37
try :
@@ -47,26 +42,22 @@ def save_audio_file():
47
42
messagebox .showinfo (message = "File converted successfully" )
48
43
except :
49
44
messagebox .showerror (message = "File could not be converted" , title = "File Error" )
50
-
51
45
# Resetting the video and audio paths
52
46
video_filepath .set ('' )
53
47
audio_filepath .set ('' )
54
-
55
48
# Resetting the progressbar after function execution
56
49
progress_bar ['value' ] = 0
57
50
progress_bar .stop ()
58
51
59
52
def run_program ():
60
53
"""
61
54
Function that runs the process of conversion and loading bar concurrently
62
-
63
55
"""
64
56
global progress_bar
65
57
t1 = threading .Thread (target = progress_bar .start )
66
58
t2 = threading .Thread (target = save_audio_file )
67
59
t2 .start ()
68
60
t1 .start ()
69
-
70
61
71
62
# Intializing main program settings
72
63
main_prog = Tk ()
0 commit comments