parent
6ee3d2f5e0
commit
61e1c56244
|
@ -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"];
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
<?php $i=0; ?>
|
||||
<?php foreach($this->showContent as $row): ?>
|
||||
<tr id="au_<?php echo $row["file_id"] ?>" class="<?php if($i&1){echo "even";}else{echo "odd";}?>">
|
||||
<td><?php echo $row["starts"] ?></td>
|
||||
<td><?php $dt = new DateTime($row["starts"], new DateTimeZone("UTC"));
|
||||
$dt->setTimezone(new DateTimeZone(date_default_timezone_get()));
|
||||
echo $dt->format("Y-m-d H:i:s") ?></td>
|
||||
<td><?php echo $row["track_title"] ?></td>
|
||||
<td><?php echo $row["artist_name"] ?></td>
|
||||
<td><?php echo $row["album_title"] ?></td>
|
||||
|
|
|
@ -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 = {}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
|
||||
|
|
Loading…
Reference in New Issue