fork download
  1. import tkinter as tk
  2. import tkinter.filedialog as tk_fd
  3. import subprocess
  4.  
  5. ffmpeg_path = "C:\\Users\\username\\Downloads\\ffmpeg-20160428-git-78baa45-win64-static\\bin\\ffmpeg.exe"
  6.  
  7. class Application(tk.Frame):
  8. """Application class docstring"""
  9.  
  10. def __init__(self, master=None):
  11. """init method docstring"""
  12. super().__init__(master)
  13. self.pack()
  14.  
  15. self.mp3_path = ''
  16. self.pic_path = ''
  17. self.output_path = ''
  18.  
  19. self.create_widgets()
  20.  
  21. def create_widgets(self):
  22. self.Source1 = tk.Button(self, text = "mp3", command = lambda: self.open_mp3()).pack()
  23. self.Sourse2 = tk.Button(self, text = "pic", command = lambda: self.open_pic()).pack()
  24. self.Start = tk.Button(self, text="Start", fg="red",command= lambda: self.start()).pack()
  25.  
  26. def open_mp3(self):
  27. """mp3 method docstring"""
  28. op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
  29. path = r''.replace('',(str(op.name).replace("""/""","""\\""")))
  30. print("Path to mp3 is - " + path)
  31. self.mp3_path = path
  32.  
  33. def open_pic(self):
  34. op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])
  35. path = r''.replace('',(str(op.name).replace("""/""","""\\""")))
  36. print("Path to pic is - " + path)
  37. self.pic_path = path
  38.  
  39. def start(self):
  40. op = tk_fd.asksaveasfilename(title = "Choose where to save", filetypes = [("webm", "*.webm;")])
  41. path = r''.replace('',(str(op).replace("""/""","""\\""")+(".webm")))
  42. print("Path to webm is - " + path)
  43. self.output_path = path
  44.  
  45. subprocess.call(ffmpeg_path + self.parse_setting())
  46.  
  47. def parse_setting(self):
  48. #there must be smth to parse when settings will be done
  49. settings = u" -r 1 -loop 1 -i {} -i {} -c:v vp8 -c:a opus -b:a 128k -b:v 0 -crf 16 -g 360 -shortest {} ".format((self.pic_path), (self.mp3_path), (self.output_path))
  50. print((ffmpeg_path + settings))
  51. return(settings)
  52.  
  53.  
  54. root = tk.Tk()
  55. root.geometry("800x600")
  56. root.title("mp3 + pic = webm GUI")
  57. app = Application(master=root)
  58. app.mainloop()
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: '.' expected
import tkinter as tk
              ^
Main.java:1: error: ';' expected
import tkinter as tk
                 ^
Main.java:2: error: ';' expected
import tkinter.filedialog as tk_fd
                         ^
Main.java:3: error: '.' expected
import subprocess
                 ^
Main.java:5: error: ';' expected
ffmpeg_path = "C:\\Users\\username\\Downloads\\ffmpeg-20160428-git-78baa45-win64-static\\bin\\ffmpeg.exe"
           ^
Main.java:7: error: '{' expected
class Application(tk.Frame):
                 ^
Main.java:15: error: empty character literal
        self.mp3_path = ''
                        ^
Main.java:15: error: illegal line end in character literal
        self.mp3_path = ''
                         ^
Main.java:16: error: empty character literal
        self.pic_path = ''
                        ^
Main.java:16: error: illegal line end in character literal
        self.pic_path = ''
                         ^
Main.java:17: error: empty character literal
        self.output_path = ''
                           ^
Main.java:17: error: illegal line end in character literal
        self.output_path = ''
                            ^
Main.java:28: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
                                    ^
Main.java:28: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
                                       ^
Main.java:28: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
                                               ^
Main.java:28: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
                                                            ^
Main.java:29: error: empty character literal
        path = r''.replace('',(str(op.name).replace("""/""","""\\"""))) 
                ^
Main.java:29: error: unclosed character literal
        path = r''.replace('',(str(op.name).replace("""/""","""\\"""))) 
                 ^
Main.java:29: error: empty character literal
        path = r''.replace('',(str(op.name).replace("""/""","""\\"""))) 
                           ^
Main.java:29: error: unclosed character literal
        path = r''.replace('',(str(op.name).replace("""/""","""\\"""))) 
                            ^
Main.java:34: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])
                                    ^
Main.java:34: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])
                                       ^
Main.java:34: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])
                                               ^
Main.java:34: error: unclosed character literal
        op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])
                                                                ^
Main.java:35: error: empty character literal
        path = r''.replace('',(str(op.name).replace("""/""","""\\"""))) 
                ^
Main.java:35: error: unclosed character literal
        path = r''.replace('',(str(op.name).replace("""/""","""\\"""))) 
                 ^
Main.java:35: error: empty character literal
        path = r''.replace('',(str(op.name).replace("""/""","""\\"""))) 
                           ^
Main.java:35: error: unclosed character literal
        path = r''.replace('',(str(op.name).replace("""/""","""\\"""))) 
                            ^
Main.java:41: error: empty character literal
        path = r''.replace('',(str(op).replace("""/""","""\\""")+(".webm"))) 
                ^
Main.java:41: error: unclosed character literal
        path = r''.replace('',(str(op).replace("""/""","""\\""")+(".webm"))) 
                 ^
Main.java:41: error: empty character literal
        path = r''.replace('',(str(op).replace("""/""","""\\""")+(".webm"))) 
                           ^
Main.java:41: error: unclosed character literal
        path = r''.replace('',(str(op).replace("""/""","""\\""")+(".webm"))) 
                            ^
Main.java:48: error: illegal character: '#'
        #there must be smth to parse when settings will be done
        ^
Main.java:58: error: reached end of file while parsing
app.mainloop()
              ^
34 errors
stdout
Standard output is empty