-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstaller_win.py
85 lines (61 loc) · 2.38 KB
/
installer_win.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
#installer for Rhubarb Barbara by Christoferis GNU GPL v3
# https://github.com/christoferis/rhubarbbarbara
import json
from os import system, path as pt
import pip
from time import sleep
welcome = '''
Welcome to the Installer / Configurator of RhubarbBarbara written by Christoferis!
This Wizard will guide you through configurating and installing all the needs of RhubarbBarbara.
'''
config = None
def get_rhubarb():
global config
path = input("Please provide the path to Rhubarb Lip Sync \n (ex.: D:/Music/rhubarb-lip-sync-1.10.0-win32/rhubarb-lip-sync-1.10.0-win32 or D:/Music/rhubarb-lip-sync-1.10.0-win32/rhubarb-lip-sync-1.10.0-win32/rhubarb.exe): ")
#check for .exe
if path.find(".exe") <= -1:
path += "rhubarb.exe"
#test if file exists
config["rhubarb"] = path
#get the standard path if desired
def standard_path():
global config
path = input("Do you want to set a standard output path? Type NONE to skip: ")
if path in ("NONE", "none"):
config["standard-savepath"] = ""
else:
if pt.isdir(path) == True:
config["standard-savepath"] = path
#return the function if check fails
else:
print("Invalid Path or Path doesn't exist")
return standard_path()
#install the packages + write config
def finalize():
global config
#write everything
with open("config.json", mode="w") as cfg:
cfg.write(json.dumps(config))
#confirm
choice = input("Do you want to proceed installing the packages? [y / n]: ")
if choice in ("Y", "y"):
# two different versions: py launcher and no py launcher
system("py -3 -m pip install moviepy")
system("pip3 install moviepy")
def main():
global welcome
global config
#open config
with open("config.json", mode="r") as cfg:
config = json.loads(cfg.read())
print(welcome)
get_rhubarb()
standard_path()
finalize()
print("\n\nThanks for installing RhubarbBarbara! Usage Tutorial can be found here: https://sites.google.com/view/christoferis/code-projects/rhubarbbarbara")
sleep(10)
try:
main()
except Exception as e:
print("An Error Occured while Installing, try running it again, if problem persists make an Github Issue \n(https://github.com/christoferis/RhubarbBarbara)\n\n" + str(e) + "\n\n This window closes in 10 Seconds automatically")
sleep(10)