You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Plex-Automatic-Pre-roll-GUI/Preroll.py

217 lines
19 KiB

import PySimpleGUI as sg
import webbrowser
import PrerollUpdate
from plexapi.server import PlexServer
import re
import requests
import yaml
from urllib.parse import quote_plus, urlencode
from plexapi import media, utils, settings, library
from plexapi.base import Playable, PlexPartialObject
from plexapi.exceptions import BadRequest, NotFound
from argparse import ArgumentParser
import os
import random
import pathlib
from configparser import *
import pathlib
import datetime
print('#############################')
print('# #')
print('# Plex Automated Preroll! #')
print('# #')
print('#############################' + '\n')
button_base64 =b'iVBORw0KGgoAAAANSUhEUgAAAHgAAAAoCAYAAAA16j4lAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABNySURBVHja7VsJUNRnlo+QbCqTndmZ2a2kdlKpmampqd3sTs3W1NZuqmYym8QEAQWEiCKIF4kXKqg0V4McIiog4AnegOIBeKByKafc3c2NXCLIpZx9NzQNDb99/6+bBgLGJMM4Zre/qlf/+3q/7733e+/7/q+9ZmzGZmzGZmzGZmw/2Da5Nead4RXByxVWfD/FMp84xececUqHfW0KW7/73Lp8uf8JhZWPq2JN6J/zAwNfN2rsB9Cebj79I4XzQX+FDV+oXOKJoaXeaF0bAtGOaOT6nEZW4Hnc9z+LQs+TqN0cjp4VeyFfwoN8qc+Iwpp/WekS9qlRi69gk22L+ZnSISRIudR7sN/GFwVeMTiZkA6fPAHcS2vgVlaDXUyq2dKNLavhUVKFfelFuBZ1DfVfhkFuzoPKLqBE6RRqBPpVaVI7v8XkgmV9y/2QFhIH/+xSBigHIifutL6vugF+FQ/BE9QirKaZ7QuubsT+6iZ2LrftXlqNqKv3UbktkoD2hNKGf0Ox+fA/GTX8N2oITP57csURCnKxpbuOwie3HO7lNUwYsPp134p6nGtuZ0Bea+vGnvI68MprkdTepQO2rMZwLie7COjjlzLIfQdAtcxXqrTba2bU9ssGd/PpN1QrArLF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HoqTbDwQJ9lwQLdkcoiJbG3oIRoCXJhnLqRM6WFNoKts62Hzocj49xZ8bpbSMSRWRsN29/ee1w1C6IHeScsd5F633C/Epjv34XIzFRuSr2PD1SSsv3wV6xJJaLn+ShI2Xk3BhpQ72HgrA5sycuGaVwa3kkrm7g/ezMPjNWS5Fp5Dw5uiPzTOhnvZsyu5KTwrghzlS73GWtaHMkAMszxmDBJMlRin99dOr+v/eHCfwZp5RRX0p8NViKlypvwioEW+Iey3Rm3/DZvaNuQ39BdCk8zcCwIadI5IySECVqUjXs+ZkDdzsrubPoZzXiDxeAo6VgVxZGpcQfVvGH9Ke1X+cgh8XeG8fwVVu8o4AtbgchDJh68g7HoueAUiHdvWA+yuF27qj392GRUv0pHLj8UzO3/IiaEr7fxjldah7xq1+oo25YZDZvS7SZzKhi9TUowepIHvdsdg1G4KRyXNb67cGoGGjQfZrync/Gr6YQ30S2nV8JrQA6pdUf9s1OAPKEZrfM/+Xr72wFq5Dd9TtS70mtI+IJn+ikhWrgwIG7EP8hzeHGE96fGCsUpjMzZjMzZjM7b/P+1/AVnOqsJEmROoAAAAAElFTkSuQmCC'
sg.theme('DarkBlue')
settings = sg.UserSettings()
file1 = open("config.yml", "w+")
file1.write("Plex: " + "\n")
file1.write(" Path: " + sg.user_settings_filename() + "\n")
file1.close()
print(sg.user_settings_filename())
col_1 = [[sg.Text('Automate your Plex Preroll!', size=(30, 1), font=("Helvetica", 25))],
[sg.Text('Plex Server URL')],
[sg.InputText(settings['URL'], key='URL')],
[sg.Text('Plex Server Token')],
[sg.InputText(settings['Token'], key='Token')],
[sg.Text('Schedule')],
[sg.Listbox(values=['Monthly','Weekly','Daily', 'Holiday'], size=(20,4), key='Freq', default_values=settings['Freq'], enable_events = True)],
[sg.Text('Default Files')],
[sg.In(default_text=settings['Default'],key='Default'), sg.FilesBrowse()],
[sg.Text('')],
[sg.Text('')],
[sg.Text('')],
[sg.Save(), sg.Submit()],
[sg.Button('', image_data=button_base64, key='Buy', button_color='Yellow')]]
col_month = [[sg.Text('Select your files', size=(20, 1), font=("Helvetica", 15))],
[sg.Text("Jan : ", size=(5, 1), justification='right'), sg.In(default_text=settings['Jan'],key='Jan'), sg.FilesBrowse()],
[sg.Text("Feb : ", size=(5, 1) , justification='right'), sg.In(default_text=settings['Feb'],key='Feb'), sg.FilesBrowse()],
[sg.Text("Mar : ", size=(5, 1) , justification='right'), sg.In(default_text=settings['Mar'],key='Mar'), sg.FilesBrowse()],
[sg.Text("Apr : ", size=(5, 1) , justification='right'), sg.In(default_text=settings['Apr'],key='Apr'), sg.FilesBrowse()],
[sg.Text("May : ", size=(5, 1) , justification='right'), sg.In(default_text=settings['May'],key='May'), sg.FilesBrowse()],
[sg.Text("Jun : ", size=(5, 1) , justification='right'), sg.In(default_text=settings['Jun'],key='Jun'), sg.FilesBrowse()],
[sg.Text("Jul : ", size=(5, 1) , justification='right'), sg.In(default_text=settings['Jul'],key='Jul'), sg.FilesBrowse()],
[sg.Text("Aug : ", size=(5, 1) , justification='right'), sg.In(default_text=settings['Aug'],key='Aug'), sg.FilesBrowse()],
[sg.Text("Sep : ", size=(5, 1) , justification='right'), sg.In(default_text=settings['Sep'],key='Sep'), sg.FilesBrowse()],
[sg.Text("Oct : ", size=(5, 1) , justification='right'), sg.In(default_text=settings['Oct'],key='Oct'), sg.FilesBrowse()],
[sg.Text("Nov : ", size=(5, 1) , justification='right'), sg.In(default_text=settings['Nov'],key='Nov'), sg.FilesBrowse()],
[sg.Text("Dec : ", size=(5, 1) , justification='right'), sg.In(default_text=settings['Dec'],key='Dec'), sg.FilesBrowse()]];
col_week = [[sg.Text('Select your files', size=(20, 1), font=("Helvetica", 15))],
[sg.Text('Start Date', size=(10, 1)), sg.InputText(default_text=settings['WeekStart'],key='WeekStart',), sg.CalendarButton(button_text="Select", format='%Y-%m-%d')],
[sg.Text('End Date', size=(10, 1)), sg.InputText(default_text=settings['WeekEnd'], key='WeekEnd'), sg.CalendarButton(button_text="Select", format='%Y-%m-%d')],
[sg.Text('Path: ', size=(10, 1)), sg.In(key='WeekPath', justification='right'), sg.FilesBrowse()],
]
col_day = [[sg.Text('Select your files', size=(20, 1), font=("Helvetica", 15))],
[sg.Text('Monday', size=(10, 1)), sg.In(default_text=settings['Mon'],key='Mon'), sg.FilesBrowse()],
[sg.Text('Tuesday', size=(10, 1)), sg.In(default_text=settings['Tue'],key='Tue'), sg.FilesBrowse()],
[sg.Text('Wednesday', size=(10, 1)), sg.In(default_text=settings['Wed'],key='Wed'), sg.FilesBrowse()],
[sg.Text('Thursday', size=(10, 1)), sg.In(default_text=settings['Thur'],key='Thur'), sg.FilesBrowse()],
[sg.Text('Friday', size=(10, 1)), sg.In(default_text=settings['Fri'],key='Fri'), sg.FilesBrowse()],
[sg.Text('Saturday', size=(10, 1)), sg.In(default_text=settings['Sat'],key='Sat'), sg.FilesBrowse()],
[sg.Text('Sunday', size=(10, 1)), sg.In(default_text=settings['Sun'],key='Sun'), sg.FilesBrowse()]]
col_holiday = [[sg.Text('Select your files', size=(20, 1), font=("Helvetica", 15))],
[sg.Text('Valentines Day', size=(11, 1)), sg.In(default_text=settings['Valentines Day'],key='Valentines Day'), sg.FilesBrowse(),sg.Checkbox('Enable', key='Valentines Day Enabled', default=settings['Valentines Day Enabled'])],
[sg.Text('April Fools', size=(11, 1)), sg.In(default_text=settings['April Fools'],key='April Fools'), sg.FilesBrowse(),sg.Checkbox('Enable', key='April Fools Enabled', default=settings['April Fools Enabled'])],
[ sg.Text('July 4th', size=(11, 1)), sg.In(default_text=settings['July 4th'],key='July 4th'), sg.FilesBrowse(),sg.Checkbox('Enable', key='July 4th Enabled', default=settings['July 4th Enabled'])],
[sg.Text('Mardi Gras', size=(11, 1)), sg.In(default_text=settings['Mardi Gras'], key='Mardi Gras'),
sg.FilesBrowse(),
sg.Checkbox('Enable', key='Mardi Gras Enabled', default=settings['Mardi Gras Enabled'])],
[sg.Text('Easter', size=(11, 1)), sg.In(default_text=settings['Easter'], key='Easter'), sg.FilesBrowse(),
sg.Checkbox('Enable', key='Easter Enabled', default=settings['Easter Enabled'])],
[sg.Text('Halloween', size=(11, 1)), sg.In(default_text=settings['Halloween'], key='Halloween'),
sg.FilesBrowse(),
sg.Checkbox('Enable', key='Halloween Enabled', default=settings['Halloween Enabled'])],
[sg.Text('Thanksgiving', size=(11, 1)), sg.In(default_text=settings['Thanksgiving'], key='Thanksgiving'),
sg.FilesBrowse(),
sg.Checkbox('Enable', key='Thanksgiving Enabled', default=settings['Thanksgiving Enabled'])],
[sg.Text('Christmas', size=(11, 1)), sg.In(default_text=settings['Christmas'], key='Christmas'),
sg.FilesBrowse(),
sg.Checkbox('Enable', key='Christmas Enabled', default=settings['Christmas Enabled'])]]
layout = [[sg.Frame(layout=col_1, title='',border_width=0), sg.Frame(layout=col_month, title='',border_width=0, visible=False, key='Month'), sg.Frame(layout=col_week, title='',border_width=0, visible=False, key='Week'), sg.Frame(layout=col_day, title='',border_width=0, visible=False, key='Day'), sg.Frame(layout=col_holiday, title='',border_width=0, visible=False, key='Holiday')]
]
window = sg.Window('Plex Automated Preroll', layout)
while True:
event, values = window.read()
if event == 'Buy':
webbrowser.open_new('https://www.buymeacoffee.com/thehumanrobot')
if event == 'Save':
settings['URL'] = values['URL']
settings['Token'] = values['Token']
settings['Freq'] = values['Freq']
settings['Jan'] = values['Jan']
settings['Feb'] = values['Feb']
settings['Mar'] = values['Mar']
settings['Apr'] = values['Apr']
settings['May'] = values['May']
settings['Jun'] = values['Jun']
settings['Jul'] = values['Jul']
settings['Aug'] = values['Aug']
settings['Sep'] = values['Sep']
settings['Oct'] = values['Oct']
settings['Nov'] = values['Nov']
settings['Dec'] = values['Dec']
settings['WeekStart'] = values['WeekStart']
settings['WeekEnd'] = values['WeekEnd']
settings['WeekPath'] = values['WeekPath']
settings['Sunday'] = values['Sun']
settings['Monday'] = values['Mon']
settings['Tuesday'] = values['Tue']
settings['Wednesday'] = values['Wed']
settings['Thursday'] = values['Thur']
settings['Friday'] = values['Fri']
settings['Saturday'] = values['Sat']
settings['Valentines Day'] = values['Valentines Day']
settings['April Fools'] = values['April Fools']
settings['July 4th'] = values['July 4th']
settings['Mardi Gras'] = values['Mardi Gras']
settings['Easter'] = values['Easter']
settings['Halloween'] = values['Halloween']
settings['Thanksgiving'] = values['Thanksgiving']
settings['Christmas'] = values['Christmas']
settings['Valentines Day Enabled'] = values['Valentines Day Enabled']
settings['April Fools Enabled'] = values['April Fools Enabled']
settings['July 4th Enabled'] = values['July 4th Enabled']
settings['Mardi Gras Enabled'] = values['Mardi Gras Enabled']
settings['Easter Enabled'] = values['Easter Enabled']
settings['Halloween Enabled'] = values['Halloween Enabled']
settings['Thanksgiving Enabled'] = values['Thanksgiving Enabled']
settings['Christmas Enabled'] = values['Christmas Enabled']
settings['Default'] = values['Default']
if event == 'Submit':
settings['URL'] = values['URL']
settings['Token'] = values['Token']
settings['Freq'] = values['Freq']
settings['Jan'] = values['Jan']
settings['Feb'] = values['Feb']
settings['Mar'] = values['Mar']
settings['Apr'] = values['Apr']
settings['May'] = values['May']
settings['Jun'] = values['Jun']
settings['Jul'] = values['Jul']
settings['Aug'] = values['Aug']
settings['Sep'] = values['Sep']
settings['Oct'] = values['Oct']
settings['Nov'] = values['Nov']
settings['Dec'] = values['Dec']
settings['WeekStart'] = values['WeekStart']
settings['WeekEnd'] = values['WeekEnd']
settings['WeekPath'] = values['WeekPath']
settings['Sunday'] = values['Sun']
settings['Monday'] = values['Mon']
settings['Tuesday'] = values['Tue']
settings['Wednesday'] = values['Wed']
settings['Thursday'] = values['Thur']
settings['Friday'] = values['Fri']
settings['Saturday'] = values['Sat']
settings['Valentines Day'] = values['Valentines Day']
settings['April Fools'] = values['April Fools']
settings['July 4th'] = values['July 4th']
settings['Mardi Gras'] = values['Mardi Gras']
settings['Easter'] = values['Easter']
settings['Halloween'] = values['Halloween']
settings['Thanksgiving'] = values['Thanksgiving']
settings['Christmas'] = values['Christmas']
settings['Valentines Day Enabled'] = values['Valentines Day Enabled']
settings['April Fools Enabled'] = values['April Fools Enabled']
settings['July 4th Enabled'] = values['July 4th Enabled']
settings['Mardi Gras Enabled'] = values['Mardi Gras Enabled']
settings['Easter Enabled'] = values['Easter Enabled']
settings['Halloween Enabled'] = values['Halloween Enabled']
settings['Thanksgiving Enabled'] = values['Thanksgiving Enabled']
settings['Christmas Enabled'] = values['Christmas Enabled']
PrerollUpdate.update()
if event == 'Freq':
if values['Freq'] == ['Monthly']:
window['Month'].update(visible=True)
window['Week'].update(visible=False)
window['Day'].update(visible=False)
window['Holiday'].update(visible=False)
elif values['Freq'] == ['Weekly']:
window['Month'].update(visible=False)
window['Week'].update(visible=True)
window['Day'].update(visible=False)
window['Holiday'].update(visible=False)
elif values['Freq'] == ['Daily']:
window['Month'].update(visible=False)
window['Week'].update(visible=False)
window['Day'].update(visible=True)
window['Holiday'].update(visible=False)
elif values['Freq'] == ['Holiday']:
window['Month'].update(visible=False)
window['Week'].update(visible=False)
window['Day'].update(visible=False)
window['Holiday'].update(visible=True)
if event == sg.WIN_CLOSED:
break
window.close()