CC-3737: ON AIR turns to grey from time to time, while the stream keeps playing
- fixed - added a 'type' key to distinguish between tracks and shows
This commit is contained in:
parent
791d1dae1b
commit
9967f5451c
3 changed files with 25 additions and 11 deletions
|
@ -125,17 +125,20 @@ class Application_Model_Schedule {
|
|||
if ( $i - 1 >= 0){
|
||||
$results['previous'] = array("name"=>$rows[$i-1]["artist_name"]." - ".$rows[$i-1]["track_title"],
|
||||
"starts"=>$rows[$i-1]["starts"],
|
||||
"ends"=>$rows[$i-1]["ends"]);
|
||||
"ends"=>$rows[$i-1]["ends"],
|
||||
"type"=>'track');
|
||||
}
|
||||
$results['current'] = array("name"=>$rows[$i]["artist_name"]." - ".$rows[$i]["track_title"],
|
||||
"starts"=>$rows[$i]["starts"],
|
||||
"ends"=> (($rows[$i]["ends"] > $rows[$i]["show_ends"]) ? $rows[$i]["show_ends"]: $rows[$i]["ends"]),
|
||||
"media_item_played"=>$rows[$i]["media_item_played"],
|
||||
"record"=>0);
|
||||
"record"=>0,
|
||||
"type"=>'track');
|
||||
if ( isset($rows[$i+1])){
|
||||
$results['next'] = array("name"=>$rows[$i+1]["artist_name"]." - ".$rows[$i+1]["track_title"],
|
||||
"starts"=>$rows[$i+1]["starts"],
|
||||
"ends"=>$rows[$i+1]["ends"]);
|
||||
"ends"=>$rows[$i+1]["ends"],
|
||||
"type"=>'track');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -145,7 +148,8 @@ class Application_Model_Schedule {
|
|||
if (strtotime($rows[$i]['starts']) > $timeNowAsMillis) {
|
||||
$results['next'] = array("name"=>$rows[$i]["artist_name"]." - ".$rows[$i]["track_title"],
|
||||
"starts"=>$rows[$i]["starts"],
|
||||
"ends"=>$rows[$i]["ends"]);
|
||||
"ends"=>$rows[$i]["ends"],
|
||||
"type"=>'track');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1764,6 +1764,7 @@ class Application_Model_Show {
|
|||
|
||||
for( $i = 0; $i < $numberOfRows; ++$i ){
|
||||
//Find the show that is within the current time.
|
||||
$rows[$i]['type'] = 'show';
|
||||
if ((strtotime($rows[$i]['starts']) <= $timeNowAsMillis) && (strtotime($rows[$i]['ends']) >= $timeNowAsMillis)){
|
||||
if ( $i - 1 >= 0){
|
||||
$results['previousShow'][0] = array(
|
||||
|
@ -1774,7 +1775,8 @@ class Application_Model_Show {
|
|||
"start_timestamp"=>$rows[$i-1]['start_timestamp'],
|
||||
"end_timestamp"=>$rows[$i-1]['end_timestamp'],
|
||||
"starts"=>$rows[$i-1]['starts'],
|
||||
"ends"=>$rows[$i-1]['ends']);
|
||||
"ends"=>$rows[$i-1]['ends'],
|
||||
"type"=>$rows[$i-1]['type']);
|
||||
}
|
||||
|
||||
$results['currentShow'][0] = $rows[$i];
|
||||
|
@ -1788,7 +1790,8 @@ class Application_Model_Show {
|
|||
"start_timestamp"=>$rows[$i+1]['start_timestamp'],
|
||||
"end_timestamp"=>$rows[$i+1]['end_timestamp'],
|
||||
"starts"=>$rows[$i+1]['starts'],
|
||||
"ends"=>$rows[$i+1]['ends']);
|
||||
"ends"=>$rows[$i+1]['ends'],
|
||||
"type"=>$rows[$i+1]['type']);
|
||||
|
||||
}
|
||||
break;
|
||||
|
@ -1807,7 +1810,8 @@ class Application_Model_Show {
|
|||
"start_timestamp"=>$rows[$i]['start_timestamp'],
|
||||
"end_timestamp"=>$rows[$i]['end_timestamp'],
|
||||
"starts"=>$rows[$i]['starts'],
|
||||
"ends"=>$rows[$i]['ends']);
|
||||
"ends"=>$rows[$i]['ends'],
|
||||
"type"=>$rows[$i]['type']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1821,8 +1825,10 @@ class Application_Model_Show {
|
|||
"start_timestamp"=>$rows[$previousShowIndex]['start_timestamp'],
|
||||
"end_timestamp"=>$rows[$previousShowIndex]['end_timestamp'],
|
||||
"starts"=>$rows[$previousShowIndex]['starts'],
|
||||
"ends"=>$rows[$previousShowIndex]['ends']);
|
||||
"ends"=>$rows[$previousShowIndex]['ends'],
|
||||
"type"=>$rows[$previousShowIndex]['type']);
|
||||
}
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,8 +47,10 @@ function secondsTimer(){
|
|||
|
||||
function newSongStart(){
|
||||
nextSongPrepare = true;
|
||||
currentSong = nextSong;
|
||||
nextSong = null;
|
||||
if (nextSong.type == 'track') {
|
||||
currentSong = nextSong;
|
||||
nextSong = null;
|
||||
}
|
||||
}
|
||||
|
||||
function nextShowStart(){
|
||||
|
@ -74,12 +76,14 @@ function updateProgressBarValue(){
|
|||
var scheduled_play_line_to_switch = scheduled_play_div.parent().find(".line-to-switch");
|
||||
|
||||
if (currentSong !== null){
|
||||
var songElpasedTime = 0;
|
||||
songPercentDone = (estimatedSchedulePosixTime - currentSong.songStartPosixTime)/currentSong.songLengthMs*100;
|
||||
songElapsedTime = estimatedSchedulePosixTime - currentSong.songStartPosixTime;
|
||||
if (songPercentDone < 0 || songPercentDone > 100){
|
||||
songPercentDone = 0;
|
||||
currentSong = null;
|
||||
} else {
|
||||
if (currentSong.media_item_played == true && currentShow.length > 0) {
|
||||
if ((currentSong.media_item_played == true && currentShow.length > 0) || songElapsedTime < 5000) {
|
||||
scheduled_play_line_to_switch.attr("class", "line-to-switch on");
|
||||
scheduled_play_div.addClass("ready");
|
||||
scheduled_play_source = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue