forked from HA6Bots/TikTok-Compilation-Video-Generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.py
98 lines (71 loc) · 3.21 KB
/
settings.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
96
97
98
import os
import configparser
from sys import platform
currentPath = os.path.dirname(os.path.realpath(__file__))
server_address = "127.0.0.1"
serverFTPPort = 2121
videogeneratoraddress = "127.0.0.1"
# The port the FTP server will listen on.
# This must be greater than 1023 unless you run this script as root.
FTP_PORT = 2122
HTTP_PORT = 8001
FTP_USER = "VidGen"
FTP_PASSWORD = "password"
vid_finishedvids = "FinishedVids"
vid_filepath = "VideoFiles"
final_video_path = "FinalVideos"
old_clip_path = "OldClips"
video_data_path = "VideoData"
backup_path = "Backup"
server_port = 8000
fps = 15
temp_path = "Temp"
first_clip_name = ''
useMinimumFps = False
useMaximumFps = False
backupVideos = False
config = configparser.ConfigParser()
configpath = None
if platform == "linux" or platform == "linux2":
configpath = "%s/config.ini" % currentPath
else:
configpath = "%s\\config.ini" % currentPath
def generateConfigFile():
if not os.path.isfile(configpath):
print("Could not find config file in location %s, creating a new one" % configpath)
config.add_section("video_generator_details")
config.set("video_generator_details", 'address', '127.0.0.1')
config.set("video_generator_details", 'http_port', '8001')
config.set("video_generator_details", 'ftp_port', '2122')
config.set("video_generator_details", 'FTP_USER', 'VidGen')
config.set("video_generator_details", 'FTP_PASSWORD', 'password')
config.add_section("server_location")
config.set("server_location", 'address', '127.0.0.1')
config.set("server_location", 'http_port', '8000')
config.set("server_location", 'ftp_port', '2122')
config.add_section("rendering")
config.set("rendering", 'fps', '30')
config.set("rendering", 'useMinimumFps', 'True')
config.set("rendering", 'useMaximumFps', 'False')
config.set("rendering", 'backupVideos', 'True')
with open(configpath, 'w') as configfile:
config.write(configfile)
else:
print("Found config in location %s" % configpath)
loadValues()
def loadValues():
global server_address, serverFTPPort, videogeneratoraddress, FTP_PORT, HTTP_PORT, FTP_USER, FTP_PASSWORD, fps, server_port, useMinimumFps, useMaximumFps, backupVideos
config = configparser.ConfigParser()
config.read(configpath)
videogeneratoraddress = config.get('video_generator_details', 'address')
FTP_PORT = config.getint('video_generator_details', 'ftp_port')
HTTP_PORT = config.getint('video_generator_details', 'http_port')
FTP_USER = config.get('video_generator_details', 'FTP_USER')
FTP_PASSWORD = config.get('video_generator_details', 'FTP_PASSWORD')
server_address = config.get('server_location', 'address')
server_port = config.get('server_location', 'http_port')
serverFTPPort = config.getint('server_location', 'ftp_port')
fps = config.getint('rendering', 'fps')
useMinimumFps = config.getboolean('rendering', 'useMinimumFps')
useMaximumFps = config.getboolean('rendering', 'useMaximumFps')
backupVideos = config.getboolean('rendering', 'backupVideos')