forked from jkirkcaldy/plex-utills
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_check.py
143 lines (124 loc) · 3.91 KB
/
config_check.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/usr/local/bin/python3
import os
import subprocess
from configparser import ConfigParser
import subprocess
import schedule
import time
from datetime import datetime
import re
from colorama import Fore, Back, Style
import socket
from urllib import parse
config_object = ConfigParser()
config_object.read("config/config.ini")
server = config_object["PLEXSERVER"]
schedules = config_object["SCHEDULES"]
options = config_object["OPTIONS"]
hdr_4k_posters = str.lower((options["4k_hdr_posters"]))
poster_3d = str.lower((options["3D_posters"]))
Disney = str.lower((options["Disney"]))
Pixar = (str.lower(options["Pixar"]))
hide_4k = str.lower((options["hide_4k"]))
pbak = str.lower((options["POSTER_BU"]))
HDR_BANNER = str.lower((options["HDR_BANNER"]))
optimise = str.lower((options["transcode"]))
mini_4k = str.lower((options["mini_4k"]))
mini_3d = str.lower((options["mini_3D"]))
t1 = (schedules["4k_poster_schedule"])
t2 = (schedules["disney_schedule"])
t3 = (schedules["pixar_schedule"])
t4 = (schedules["hide_poster_schedule"])
t5 = (schedules["3d_poster_schedule"])
url = parse.urlparse(server["PLEX_URL"]).hostname
try:
url = parse.urlparse(server["PLEX_URL"]).hostname
socket.inet_aton(url)
except socket.error:
raise Exception("Uh-Oh, it looks like your PLEX_URL is not correct in the config file \n Make sure you enter it as 'http://ip-address:plex-port'")
if pbak == 'true':
pass
elif pbak == 'false':
pass
else:
raise ValueError('SYNTAX ERROR: Please enter either "true" or "false" to set the script behaviour.')
if HDR_BANNER == 'true':
pass
elif HDR_BANNER == 'false':
pass
else:
raise ValueError('SYNTAX ERROR: Please enter either "true" or "false" to set the script behaviour.')
if mini_4k == 'true':
pass
elif mini_4k == 'false':
pass
else:
raise ValueError('SYNTAX ERROR: Please enter either "true" or "false" to set the script behaviour.')
if hdr_4k_posters == 'true':
pass
elif hdr_4k_posters == 'false':
pass
else:
raise ValueError('SYNTAX ERROR: Please enter either "true" or "false" to set the script behaviour.')
if poster_3d == 'true':
pass
elif poster_3d == 'false':
pass
else:
raise ValueError('SYNTAX ERROR: Please enter either "true" or "false" to set the script behaviour.')
if Disney == 'true':
pass
elif Disney == 'false':
pass
else:
raise ValueError('SYNTAX ERROR: Please enter either "true" or "false" to set the script behaviour.')
if Pixar == 'true':
pass
elif Pixar == 'false':
pass
else:
raise ValueError('SYNTAX ERROR: Please enter either "true" or "false" to set the script behaviour.')
if hide_4k == 'true':
pass
elif hide_4k == 'false':
pass
else:
raise ValueError('SYNTAX ERROR: Please enter either "true" or "false" to set the script behaviour.')
if optimise == 'true':
pass
elif optimise == 'false':
pass
else:
raise ValueError('SYNTAX ERROR: Please enter either "true" or "false" to set the script behaviour.')
a = re.compile("^[0-9]{2}:[0-9]{2}$")
if a.match(t1) and hdr_4k_posters == 'true':
pass
elif hdr_4k_posters != 'true':
pass
else:
raise ValueError('Please make sure that your scheduled times are written in the format HH:MM')
if a.match(t5) and poster_3d == 'true':
pass
elif poster_3d != 'true':
pass
else:
raise ValueError('Please make sure that your scheduled times are written in the format HH:MM')
if a.match(t2) and Disney == 'true':
pass
elif Disney != 'true':
pass
else:
raise ValueError('Please make sure that your scheduled times are written in the format HH:MM')
if a.match(t3) and Pixar == 'true':
pass
elif Pixar != 'true':
pass
else:
raise ValueError('Please make sure that your scheduled times are written in the format HH:MM')
if a.match(t4) and hide_4k == 'true':
pass
elif hide_4k != 'true':
pass
else:
raise ValueError('Please make sure that your scheduled times are written in the format HH:MM')
print('Pass')