-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunner.py
76 lines (66 loc) · 2.64 KB
/
runner.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
import subprocess
from tkinter import messagebox
from pathlib import Path
import time
import os
home = str(Path.home())
if not os.path.isdir(home + '\\Videos\\MirrorRec'):
os.system('mkdir '+ home + '\\videos\\MirrorRec\\')
def mainRun(args,window):
global home
rec_path = home + str('\\videos\\MirrorRec\\MirrorRec_') + str(time.time())
lib = 'User'
exec = ['scrcpy.exe']
if args.get(lib,'fullscreen') == 'True':
exec += ['-f']
if args.get(lib,'audio') == 'False':
exec += ['--no-audio']
if args.get(lib,'keepOn') == 'True':
exec += ['-w']
if args.get(lib,'no_buffer') == 'False':
exec += ['--display-buffer=' + str(args.get(lib,'v_buffer'))]
exec += ['--audio-buffer=' + str(args.get(lib,'a_buffer'))]
if not args.get(lib,'keepon') == 'True':
if args.get(lib,'no_control') == 'True':
exec += ['--no-control']
exec += ['--video-bit-rate=' + str(int(args.get(lib,'v_bitrate')))]
if not args.get(lib,'audio_codec') == 'raw':
exec += ['--audio-bit-rate=' + str(int(args.get(lib,'a_bitrate')))]
exec += ['--audio-codec=' + str(args.get(lib,'audio_codec'))]
exec += ['--video-codec=' + str(args.get(lib,'video_codec'))]
match args.get(lib,'res'):
case '480p':
exec += ['--max-size=480']
case '720p':
exec += ['--max-size=720']
case '1080p':
exec += ['--max-size=1080']
match args.get(lib,'mxFps'):
case '30 Fps':
exec += ['--max-fps=30']
case '50 Fps':
exec += ['--max-fps=50']
case '60 Fps':
exec += ['--max-fps=60']
match args.get(lib,'record'):
case 'Record (.mp4)':
exec += ['-r',rec_path + '.mp4']
case 'Record (.mkv)':
exec += ['-r',rec_path + '.mkv']
window.withdraw()
try:
grepOut = subprocess.check_output(exec, shell=True,cwd='Runtime')
except subprocess.CalledProcessError as grepexc:
messagebox.showerror('Program Gak iso jalan', 'Please check cable or turn on USB Debugging')
window.deiconify()
# function otg
def OtgRunner(hid,window):
exec = ['scrcpy.exe','--otg','-M']
if hid == 'key':
exec += ['-K']
try:
prog = subprocess.check_output(exec,shell=True,cwd='Runtime')
except subprocess.CalledProcessError as progexc:
messagebox.showerror('Program Gak iso jalan', 'Please check cable or turn on USB Debugging')
def OpenFolder():
subprocess.Popen(['explorer.exe',home + '\\videos\\MirrorRec'])