Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add End Time manual handling for SIS. #1005

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
12 changes: 11 additions & 1 deletion src/Classes/ServiceAPI/MyRadio_TracklistItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ public static function create($trackid, $timeslotid = null, $starttime = null, $
403
);
}


$timeslot_was_null = false;
if ($timeslotid == null) {
$timeslot_was_null = true;
$timeslot = MyRadio_Timeslot::getCurrentTimeslot();
$timeslotid = $timeslot != null ? $timeslot->getID() : null; // will be null if jukebox etc.
} else {
Expand Down Expand Up @@ -153,6 +155,14 @@ public static function create($trackid, $timeslotid = null, $starttime = null, $
# If we've been left to work out which state we're in (confirmed or off air), let's look this up.
if ($state == null) {
$state = in_array($sourceid, self::getTracklistSourcesOnAirAtTime($starttime)) ? 'c': 'o';

// If we didn't originally supply a timeslotid, and we're tracklisting off air
// Don't attach to the current timeslot.
// This is useful for BAPS, where it doesn't know if it's tracklisting to a show, or if it's the on air studio.
// We don't want to report a track as played off air to a timeslot if it's in a different room etc.
if ($state == 'o' && $timeslot_was_null == true) {
$timeslotid == null;
}
}

self::$db->query('BEGIN');
Expand Down