-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.py
70 lines (59 loc) · 2.21 KB
/
main.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
from base import *
from plex_debrid_ import update, setup
from rclone_rd import rclone
from cleanup import duplicate_cleanup
def main():
logger = get_logger()
version = '1.4.2'
ascii_art = f'''
88 88
88 88
88 88
8b,dPPYba, ,adPPYb,88 8b,dPPYba, ,adPPYba, 8b,dPPYba, ,adPPYb,88
88P' "8a a8" `Y88 88P' "Y8 a8" "" 88P' "Y8 a8" `Y88
88 d8 8b 88 88 8b 88 8b 88
88b, ,a8" "8a, ,d88 88 "8a, ,aa 88 "8a, ,d88
88`YbbdP"' `"8bbdP"Y8 88 `"Ybbd8"' 88 `"8bbdP"Y8
88
88 Version: {version}
'''
logger.info(ascii_art.format(version=version) + "\n" + "\n")
def healthcheck():
while True:
time.sleep(10)
try:
result = subprocess.run(['python', 'healthcheck.py'], capture_output=True, text=True)
if result.stderr:
logger.error(result.stderr.strip())
except Exception as e:
logger.error('Error running healthcheck.py: %s', e)
time.sleep(50)
thread = threading.Thread(target=healthcheck)
thread.daemon = True
thread.start()
try:
if not DUPECLEAN:
pass
elif DUPECLEAN:
duplicate_cleanup.duplicate_cleanup()
except Exception as e:
logger.error(e)
try:
if RDAPIKEY or ADAPIKEY:
if RCLONEMN:
rclone.setup()
else:
raise MissingAPIKeyException()
except Exception as e:
logger.error(e)
try:
if PLEXUSER:
setup.pd_setup()
if AUTOUPDATE:
update.auto_update()
else:
update.update_disabled()
except:
pass
if __name__ == "__main__":
main()