Update PrerollUpdate.py

docker
TheHumanRobot 3 years ago committed by GitHub
parent 418b879abe
commit c23d20e2c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -20,11 +20,10 @@ from configparser import *
def update(): def update():
os.chdir('/rollar/') os.chdir('/rollarr/')
f = open(str('./data.json')) f = open(str('./data.json'))
data = json.load(f) data = json.load(f)
print('pre-roll updated')
if data['Freq'] == 'Monthly': if data['Freq'] == 'Monthly':
Date = datetime.date.today() Date = datetime.date.today()
@ -34,8 +33,9 @@ def update():
requests.packages.urllib3.disable_warnings() requests.packages.urllib3.disable_warnings()
plex = PlexServer(data['URL'], data['Token'], session, timeout=None) plex = PlexServer(data['URL'], data['Token'], session, timeout=None)
print(Date) print(Date)
if data[Date] is None: if (data[Date] is None or data[Date] == 'None'):
Path = data['Default'] Path = data['Default']
print(Path)
else: else:
Path = data[Date] Path = data[Date]
prerolls = Path prerolls = Path
@ -63,17 +63,19 @@ def update():
plex.settings.get('cinemaTrailersPrerollID').set(prerolls) plex.settings.get('cinemaTrailersPrerollID').set(prerolls)
plex.settings.save() plex.settings.save()
print('Pre-roll updated') print('Pre-roll updated')
if data['Freq'][0] == 'Daily': if data['Freq'] == 'Daily':
Date = datetime.date.today() Date = datetime.date.today()
Date = Date.strftime("%a") Date = Date.strftime("%a")
session = requests.Session() session = requests.Session()
session.verify = False session.verify = False
requests.packages.urllib3.disable_warnings() requests.packages.urllib3.disable_warnings()
plex = PlexServer(data['URL'], data['Token'], session, timeout=None) plex = PlexServer(data['URL'], data['Token'], session, timeout=None)
if data[Date] is None: if (data[Date] is None or data[Date] == 'None'):
Path = data['Default'] Path = data['Default']
print(Path)
else: else:
Path = data[Date] Path = data[Date]
print(Path)
prerolls = Path prerolls = Path
plex.settings.get('cinemaTrailersPrerollID').set(prerolls) plex.settings.get('cinemaTrailersPrerollID').set(prerolls)
plex.settings.save() plex.settings.save()

Loading…
Cancel
Save