diff --git a/airtime_mvc/application/models/Shows.php b/airtime_mvc/application/models/Shows.php index c9c714015..b5895d111 100644 --- a/airtime_mvc/application/models/Shows.php +++ b/airtime_mvc/application/models/Shows.php @@ -1225,11 +1225,17 @@ class Show { if($show["rebroadcast"]) { $event["disableResizing"] = true; } + + $startDateTime = new DateTime($show["starts"], new DateTimeZone("UTC")); + $startDateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); + + $endDateTime = new DateTime($show["ends"], new DateTimeZone("UTC")); + $endDateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); $event["id"] = $show["instance_id"]; $event["title"] = $show["name"]; - $event["start"] = $show["starts"]; - $event["end"] = $show["ends"]; + $event["start"] = $startDateTime->format("Y-m-d H:i:s"); + $event["end"] = $endDateTime->format("Y-m-d H:i:s"); $event["allDay"] = false; $event["description"] = $show["description"]; $event["showId"] = $show["show_id"]; diff --git a/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml b/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml index c830dd3da..e1562983b 100644 --- a/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml +++ b/airtime_mvc/application/views/scripts/schedule/show-content-dialog.phtml @@ -12,7 +12,9 @@ showContent as $row): ?> " class=""> - + setTimezone(new DateTimeZone(date_default_timezone_get())); + echo $dt->format("Y-m-d H:i:s") ?> diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index 7252b16a0..35c7c92ee 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -622,7 +622,9 @@ class ObpApiClient(): return obp_version - + """ + NOTE: The server currently ignores start and end parameters we send to it. + """ def get_schedule(self, start=None, end=None): logger = logging.getLogger() @@ -630,13 +632,12 @@ class ObpApiClient(): calculate start/end time range (format: YYYY-DD-MM-hh-mm-ss,YYYY-DD-MM-hh-mm-ss) (seconds are ignored, just here for consistency) """ - tnow = time.localtime(time.time()) if (not start): - tstart = time.localtime(time.time() - 3600 * int(self.config["cache_for"])) + tstart = time.gmtime(time.time() - 3600 * int(self.config["cache_for"])) start = "%04d-%02d-%02d-%02d-%02d" % (tstart[0], tstart[1], tstart[2], tstart[3], tstart[4]) if (not end): - tend = time.localtime(time.time() + 3600 * int(self.config["prepare_ahead"])) + tend = time.gmtime(time.time() + 3600 * int(self.config["prepare_ahead"])) end = "%04d-%02d-%02d-%02d-%02d" % (tend[0], tend[1], tend[2], tend[3], tend[4]) range = {} diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index f0cdecd7d..ca7f21cea 100755 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -1,6 +1,7 @@ import os import sys import time +import calendar import logging import logging.config import shutil @@ -53,12 +54,9 @@ Hopefully there is a better way to do this. if(command == 'update_schedule'): SCHEDULE_PUSH_MSG = m['schedule'] - elif (command == 'update_timezone'): - logger.info("Setting timezone to %s", m['timezone']) - os.environ['TZ'] = m['timezone'] - time.tzset() elif (command == 'update_stream_setting'): logger.info("Updating stream setting: %s", m['setting']) + # ACK the message to take it off the queue message.ack()""" @@ -423,7 +421,7 @@ class PypoFetch(Thread): for r, d, f in os.walk(self.cache_dir): for dir in d: try: - timestamp = time.mktime(time.strptime(dir, "%Y-%m-%d-%H-%M-%S")) + timestamp = calendar.timegm(time.strptime(dir, "%Y-%m-%d-%H-%M-%S")) if (now - timestamp) > offset: try: logger.debug('trying to remove %s - timestamp: %s', os.path.join(r, dir), timestamp) diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py index a4cc46282..6f7e71722 100755 --- a/python_apps/pypo/pypopush.py +++ b/python_apps/pypo/pypopush.py @@ -85,23 +85,19 @@ class PypoPush(Thread): playedItems = self.load_schedule_tracker() timenow = time.time() - tcoming = time.localtime(timenow + self.push_ahead) + tcoming = time.gmtime(timenow + self.push_ahead) str_tcoming_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tcoming[0], tcoming[1], tcoming[2], tcoming[3], tcoming[4], tcoming[5]) - tcoming2 = time.localtime(timenow + self.push_ahead2) + tcoming2 = time.gmtime(timenow + self.push_ahead2) str_tcoming2_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tcoming2[0], tcoming2[1], tcoming2[2], tcoming2[3], tcoming2[4], tcoming2[5]) - tnow = time.localtime(timenow) + tnow = time.gmtime(timenow) str_tnow_s = "%04d-%02d-%02d-%02d-%02d-%02d" % (tnow[0], tnow[1], tnow[2], tnow[3], tnow[4], tnow[5]) for pkey in schedule: plstart = schedule[pkey]['start'][0:19] - #plstart = pkey[0:19] - #playedFlag = (pkey in playedItems) and playedItems[pkey].get("played", 0) - playedFlag = False - - if plstart == str_tcoming_s or (plstart < str_tcoming_s and plstart > str_tcoming2_s and not playedFlag): + if plstart == str_tcoming_s or (plstart < str_tcoming_s and plstart > str_tcoming2_s): logger.debug('Preparing to push playlist scheduled at: %s', pkey) playlist = schedule[pkey]