import tkinter as tk
import tkinter.filedialog as tk_fd
import subprocess
ffmpeg_path = "C:\\Users\\username\\Downloads\\ffmpeg-20160428-git-78baa45-win64-static\\bin\\ffmpeg.exe"
class Application
(tk.
Frame):
def __init__(self, master=None):
super().__init__(master)
self.pack()
self.mp3_path = ''
self.pic_path = ''
self.output_path = ''
self.create_widgets()
def create_widgets(self):
self.
Source1 = tk.
Button(self, text
= "mp3", command
= lambda
: self.
open_mp3()).
pack() self.
Sourse2 = tk.
Button(self, text
= "pic", command
= lambda
: self.
open_pic()).
pack() self.
Start = tk.
Button(self, text
="Start", fg
="red",command
= lambda
: self.
start()).
pack()
def open_mp3(self):
op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
path = (str(op.name).replace("""/""","""\\""")) #this is path to music source #have to do smth with russian chars
print("Path to mp3 is - " + path)
self.mp3_path = path
def open_pic(self):
op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
path = (str(op.name).replace("""/""","""\\""")) #this is path to pic source #have to do smth with russian chars
print("Path to pic is - " + path)
self.pic_path = path
def start(self):
op = tk_fd.asksaveasfilename(title = "Choose where to save", filetypes = [("webm", "*.webm;")])
path = (str(op).replace("""/""","""\\""")+(".webm")) #this is path to webm output #have to do smth with russian chars
print("Path to webm is - " + path)
self.output_path = path
subprocess.call(ffmpeg_path + self.parse_setting())
def parse_setting(self):
#there must be smth to parse when settings will be done
settings = " -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)
print((ffmpeg_path + settings))
return(settings)
root = tk.Tk()
root.geometry("800x600")
root.title("GUI: mp3 + pic = webm")
app = Application(master=root)
app.mainloop()
aW1wb3J0IHRraW50ZXIgYXMgd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LCAiKi53ZWJtOyIpXSkKICAgICAgICBwYXRoID0gKHN0cihvcCkucmVwbGFjZSgiIiIvIiIiLCIiIlxcIiIiKSsoIi53ZWJtIikpICN0aGlzIGlzIHBhdGggdG8gd2VibSBvdXRwdXQgI2hhdmUgdG8gZG8gc210aCB3aXRoIHJ1c3NpYW4gY2hhcnMKICAgICAgICBwcmludCgiUGF0aCB0byB3ZWJtIGlzIC0gIiArIHBhdGgpCiAgICAgICAgc2VsZi5vdXRwdXRfcGF0aCA9IHBhdGgKICAgICAgICAKICAgICAgICBzdWJwcm9jZXNzLmNhbGwoZmZtcGVnX3BhdGggKyBzZWxmLnBhcnNlX3NldHRpbmcoKSkKICAgICAgICAKICAgIGRlZiBwYXJzZV9zZXR0aW5nKHNlbGYpOgogICAgICAgICN0aGVyZSBtdXN0IGJlIHNtdGggdG8gcGFyc2Ugd2hlbiBzZXR0aW5ncyB3aWxsIGJlIGRvbmUKICAgICAgICBzZXR0aW5ncyA9ICIgLXIgMSAtbG9vcCAxIC1pIHt9IC1pIHt9IC1jOnYgdnA4IC1jOmEgb3B1cyAtYjphIDEyOGsgLWI6diAwIC1jcmYgMTYgLWcgMzYwIC1zaG9ydGVzdCB7fSIuZm9ybWF0KHNlbGYucGljX3BhdGgsIHNlbGYubXAzX3BhdGgsIHNlbGYub3V0cHV0X3BhdGgpCiAgICAgICAgcHJpbnQoKGZmbXBlZ19wYXRoICsgc2V0dGluZ3MpKQogICAgICAgIHJldHVybihzZXR0aW5ncykKCgpyb290ID0gdGsuVGsoKQpyb290Lmdlb21ldHJ5KCI4MDB4NjAwIikKcm9vdC50aXRsZSgiR1VJOiBtcDMgKyBwaWMgPSB3ZWJtIikKYXBwID0gQXBwbGljYXRpb24obWFzdGVyPXJvb3QpCmFwcC5tYWlubG9vcCgp
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:13: error: empty character literal
self.mp3_path = ''
^
Main.java:13: error: illegal line end in character literal
self.mp3_path = ''
^
Main.java:14: error: empty character literal
self.pic_path = ''
^
Main.java:14: error: illegal line end in character literal
self.pic_path = ''
^
Main.java:15: error: empty character literal
self.output_path = ''
^
Main.java:15: error: illegal line end in character literal
self.output_path = ''
^
Main.java:25: error: unclosed character literal
op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
^
Main.java:25: error: unclosed character literal
op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
^
Main.java:25: error: unclosed character literal
op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
^
Main.java:25: error: unclosed character literal
op = tk_fd.askopenfile(mode='rb',title='Choose a mp3', filetypes = [("music", "*.mp3")])
^
Main.java:26: error: illegal character: '#'
path = (str(op.name).replace("""/""","""\\""")) #this is path to music source #have to do smth with russian chars
^
Main.java:26: error: illegal character: '#'
path = (str(op.name).replace("""/""","""\\""")) #this is path to music source #have to do smth with russian chars
^
Main.java:31: error: unclosed character literal
op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
^
Main.java:31: error: unclosed character literal
op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
^
Main.java:31: error: unclosed character literal
op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
^
Main.java:31: error: unclosed character literal
op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
^
Main.java:31: error: illegal character: '#'
op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
^
Main.java:31: error: illegal character: '#'
op = tk_fd.askopenfile(mode='rb',title='Choose a picture', filetypes = [("picture", "*.jpeg; *.bmp; *.jpg; *.png")])#filetypes = ("music", "*.mp3") #filetypes = (("Template files", "*.tplate"),("HTML files", "*.html;*.htm"),("All files", "*.*"))
^
Main.java:32: error: illegal character: '#'
path = (str(op.name).replace("""/""","""\\""")) #this is path to pic source #have to do smth with russian chars
^
Main.java:32: error: illegal character: '#'
path = (str(op.name).replace("""/""","""\\""")) #this is path to pic source #have to do smth with russian chars
^
Main.java:38: error: illegal character: '#'
path = (str(op).replace("""/""","""\\""")+(".webm")) #this is path to webm output #have to do smth with russian chars
^
Main.java:38: error: illegal character: '#'
path = (str(op).replace("""/""","""\\""")+(".webm")) #this is path to webm output #have to do smth with russian chars
^
Main.java:45: error: illegal character: '#'
#there must be smth to parse when settings will be done
^
Main.java:55: error: reached end of file while parsing
app.mainloop()
^
30 errors