-
Notifications
You must be signed in to change notification settings - Fork 0
/
main-gui.py
76 lines (73 loc) · 2 KB
/
main-gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env python
import PySimpleGUI as sg
from pathlib import Path
from src.music2video.musicvideo import MusicVideo
from src.music2video.generator import VideoGenerator
sg.theme("Dark Amber")
layout = [
[sg.Text("WIP Gui for music2video", size=100, justification="center")],
[
sg.Text("Container Format"),
sg.Combo(
["mkv", "webp", "mp4"],
key="-CONTAINER-",
readonly=True,
default_value="mkv",
size=8,
),
sg.Text("FPS"),
sg.Combo(
[0.5, 1, 2, 6, 12, 24, 30, 60],
key="-FPS-",
readonly=False,
default_value="1",
size=8,
),
],
[
sg.Text("Select Song File", size=14),
sg.FileBrowse(target="-MUSIC_STRING-"),
sg.Input(
size=64,
key="-MUSIC_STRING-",
default_text="Enter File Path",
),
],
[
sg.Text("Select Image File", size=14),
sg.FileBrowse(target="-IMAGE_STRING-"),
sg.Input(
size=64,
key="-IMAGE_STRING-",
default_text="Enter File Path",
),
],
[
sg.Text("Display Text"),
sg.Input(
size=32,
key="-DISPLAY_TEXT-",
default_text="TITLE",
),
],
[sg.Button("Create", key="-CREATE-")],
]
window = sg.Window("music2video GUI", layout)
while True:
event, values = window.read()
if event == sg.WIN_CLOSED:
break
if event == "-CREATE-":
print(values)
vidinfo = MusicVideo(
music_file=Path(values["-MUSIC_STRING-"]).expanduser(),
cover_file=Path(values["-IMAGE_STRING-"]).expanduser(),
)
vidgen = VideoGenerator(
vidinfo=vidinfo,
display_text=values["-DISPLAY_TEXT-"],
video_fps=values["-FPS-"],
video_file_container=values["-CONTAINER-"],
)
print(vidgen.make_video().stderr.decode())
print("hello")