-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.py
36 lines (27 loc) · 946 Bytes
/
install.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
from configparser import ConfigParser
import sys
import os
config = ConfigParser(allow_no_value=True)
def checker():
ffmpeg_path = input("File path of FFmpeg: ")
if os.path.exists('config.ini'):
print('Config file already exists.')
with open('config.ini', 'r') as cfg:
path = config.get('Path of ffmpeg', 'path')
if path in ffmpeg_path:
print("File path is also the same as in the config file.")
pass
sys.exit()
else:
return ffmpeg_path
def config_writer(ffmpeg_path):
config.add_section('Path of ffmpeg')
config.set('Path of ffmpeg', 'Path', str(ffmpeg_path))
with open('config.ini', 'w') as cfg:
config.write(cfg)
print('Config has successfully created. \n'
f'Path of ffmpeg as been set to {ffmpeg_path}')
def main():
config_writer(checker())
if __name__ == '__main__':
main()