From d716176210388d71bc703a947b5d4b7f28749d84 Mon Sep 17 00:00:00 2001 From: Justin Emter Date: Mon, 24 Jul 2017 17:26:38 -0700 Subject: [PATCH] Added a flag in the config that uses google calendar to update / regenerate the daily schedule at midnight. Also incorporated random movies in calendar scheduling: 'Movie, Random, true' --- PseudoChannel.py | 15 +++++++++++++-- pseudo_config.py | 4 ++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/PseudoChannel.py b/PseudoChannel.py index 26f79b3..e53df1f 100644 --- a/PseudoChannel.py +++ b/PseudoChannel.py @@ -35,9 +35,12 @@ class PseudoChannel(): MEDIA = [] USING_GCALENDAR = config.useGoogleCalendar GKEY = config.gkey + USING_GOOGLE_CALENDAR = False def __init__(self): + self.USING_GOOGLE_CALENDAR = config.useGoogleCalendar + self.db = PseudoChannelDatabase("pseudo-channel.db") self.controller = PseudoDailyScheduleController(config.baseurl, config.token, config.plexClients) @@ -569,7 +572,7 @@ class PseudoChannel(): if section == "TV Shows": - if entry[3] == "random": + if str(entry[3]).lower() == "random": next_episode = self.db.get_random_episode() @@ -604,7 +607,7 @@ class PseudoChannel(): elif section == "Movies": - if entry[3] == "random": + if str(entry[3]).lower() == "random": the_movie = self.db.get_random_movie() @@ -938,6 +941,14 @@ if __name__ == '__main__': if now_time == time(23,59): + if pseudo_channel.USING_GOOGLE_CALENDAR: + + pseudo_channel.update_schedule_from_google_calendar() + + else: + + pass + pseudo_channel.generate_daily_schedule() pseudo_channel.controller.tv_controller(pseudo_channel.db.get_daily_schedule()) diff --git a/pseudo_config.py b/pseudo_config.py index ab0435b..ab0b02b 100644 --- a/pseudo_config.py +++ b/pseudo_config.py @@ -23,6 +23,10 @@ ...(https://docs.simplecalendar.io/find-google-calendar-id/): gkey = "the key" + + 7) If using the Google Calendar integration exclusively, set this to true below: + + useGoogleCalendar """