forked from HeeminTV/NSOVVG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNSOVVG.py
95 lines (86 loc) · 2.84 KB
/
NSOVVG.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import os
import platform
import GPUtil
if platform.system() == "Windows":
import win32console
if platform.system() == "Linux":
if not os.path.exists("/tmp/NSOVVG"):
os.makedirs("/tmp/NSOVVG")
tmp_path = "/tmp/NSOVVG/"
elif platform.system() == "Windows":
if not os.path.exists("C:\\Windows\\Temp\\NSOVVG"):
os.makedirs("C:\\Windows\\Temp\\NSOVVG")
tmp_path = "C:\\Windows\\Temp\\NSOVVG\\"
masteraudio = None
bgimage = None
x_res = 1280
y_res = 720
fps = 60
bitrate = "5000k"
linemode = "p2p"
chosenfiles = []
progressbartestpath = f"{tmp_path}displayrendering.bat"
progresslogpath = f"{tmp_path}ffmpegprogresslog.log"
fontpickerpath = f"{tmp_path}fontPicker.py"
numberboxpath = f"{tmp_path}numberBox.py"
reorderboxpath = f"{tmp_path}reorder.py"
dffont = "Arial"
displayfont = "Arial"
fontsize = 14
fontcolor = "#FFFFFF"
if os.path.exists(progresslogpath):
os.remove(progresslogpath)
os.remove(progressbartestpath)
os.remove(reorderboxpath)
def set_title(msg):
if platform.system() in ["Linux", "Darwin"]: # linux or macos. if macos does not function correctly when preforming this, please make an issue.
GOOD_TERMINALS = ["xterm"]
if os.getenv("TERM") in GOOD_TERMINALS:
print("\x1B]0;%s\x07" % msg)
elif platform.system() == "Windows":
win32console.SetConsoleTitle(msg)
set_title("Not Serious Oscilloscope View Video Generator - original by @희민Heemin, Python port by Swirly")
# chcp 949?? what??
print("Creating external scripts, please wait...")
def get_available_gpus():
local_device_protos = device_lib.list_local_devices()
return [x.name for x in local_device_protos if x.device_type == 'GPU']
print("Detecting GPU(s)...")
gpus = GPUtil.getGPUs()
for gpu in gpus:
if "NVIDIA" in gpu.name.split(" "):
gpu = "h264_nvenc"
break
elif "Intel" in gpu.name.split(" "):
gpu = "h264_qsv"
break
elif "AMD" in gpu.name.split(" "):
gpu = "h264_amf"
break
try:
gpu
except NameError:
if gpus == []:
print("No GPU(s) found, assuming libx264...")
gpu = "libx264"
with open(progressbartestpath, "w") as f:
print("""import os
import platform
import fcntl
import termios
import struct
import sys
if platform.system() == "Windows":
import win32console
def set_title(msg):
if platform.system() in ["Linux", "Darwin"]:
GOOD_TERMINALS = ["xterm"]
if os.getenv("TERM") in GOOD_TERMINALS:
print("\x1B]0;%s\x07" % msg)
elif platform.system() == "Windows":
win32console.SetConsoleTitle(msg)
def set_terminal_size(width, height):
size = struct.pack("HHHH", height, width, 0, 0)
fcntl.ioctl(sys.stdout.fileno(), termios.TIOCSWINSZ, size)
set_terminal_size(53, 7)
""", file=f)