-fixed bug where a song would appear as current song and next song simultaneously.
-show background color switching on the list-view should now be instant.
This commit is contained in:
parent
bb82dc2f4a
commit
416c6ceb10
|
@ -75,23 +75,27 @@ class Application_Model_Nowplaying
|
||||||
|
|
||||||
foreach ($previous as $item){
|
foreach ($previous as $item){
|
||||||
array_push($rows, array("p", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
array_push($rows, array("p", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
||||||
$item["album_title"], $item["name"], $item["show_name"], $item["current_show"], $item["group_id"]));
|
$item["album_title"], $item["name"], $item["show_name"], $item["instance_id"], $item["group_id"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($current as $item){
|
foreach ($current as $item){
|
||||||
array_push($rows, array("c", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
array_push($rows, array("c", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
||||||
$item["album_title"], $item["name"], $item["show_name"], $item["current_show"], $item["group_id"]));
|
$item["album_title"], $item["name"], $item["show_name"], $item["instance_id"], $item["group_id"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($next as $item){
|
foreach ($next as $item){
|
||||||
array_push($rows, array("n", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
array_push($rows, array("n", $item["starts"], $item["starts"], $item["ends"], $item["clip_length"], $item["track_title"], $item["artist_name"],
|
||||||
$item["album_title"], $item["name"], $item["show_name"], $item["current_show"], $item["group_id"]));
|
$item["album_title"], $item["name"], $item["show_name"], $item["instance_id"], $item["group_id"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$rows = Application_Model_Nowplaying::FindGaps($rows);
|
$rows = Application_Model_Nowplaying::FindGaps($rows);
|
||||||
$data = array("rows"=>$rows);
|
|
||||||
|
$date = new Application_Model_DateHelper;
|
||||||
|
$timeNow = $date->getDate();
|
||||||
|
|
||||||
|
$data = array("currentShow"=>Show_DAL::GetCurrentShow($timeNow), "rows"=>$rows);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -469,11 +469,8 @@ class Schedule {
|
||||||
*/
|
*/
|
||||||
public static function Get_Scheduled_Item_Data($timeStamp, $timePeriod=0, $count = 0, $interval="0 hours"){
|
public static function Get_Scheduled_Item_Data($timeStamp, $timePeriod=0, $count = 0, $interval="0 hours"){
|
||||||
global $CC_CONFIG, $CC_DBC;
|
global $CC_CONFIG, $CC_DBC;
|
||||||
|
|
||||||
$date = new Application_Model_DateHelper;
|
$sql = "SELECT DISTINCT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.group_id, show.name as show_name, st.instance_id"
|
||||||
$timeNow = $date->getDate();
|
|
||||||
|
|
||||||
$sql = "SELECT DISTINCT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.group_id, show.name as show_name, (si.starts <= TIMESTAMP '$timeNow' AND si.ends > TIMESTAMP '$timeNow') as current_show"
|
|
||||||
." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] show"
|
." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] show"
|
||||||
." WHERE st.playlist_id = pt.id"
|
." WHERE st.playlist_id = pt.id"
|
||||||
." AND st.file_id = ft.id"
|
." AND st.file_id = ft.id"
|
||||||
|
@ -487,9 +484,9 @@ class Schedule {
|
||||||
." LIMIT $count";
|
." LIMIT $count";
|
||||||
} else if ($timePeriod == 0){
|
} else if ($timePeriod == 0){
|
||||||
$sql .= " AND st.starts <= TIMESTAMP '$timeStamp'"
|
$sql .= " AND st.starts <= TIMESTAMP '$timeStamp'"
|
||||||
." AND st.ends > TIMESTAMP '$timeStamp'";
|
." AND st.ends >= TIMESTAMP '$timeStamp'";
|
||||||
} else if ($timePeriod > 0){
|
} else if ($timePeriod > 0){
|
||||||
$sql .= " AND st.starts >= TIMESTAMP '$timeStamp'"
|
$sql .= " AND st.starts > TIMESTAMP '$timeStamp'"
|
||||||
." AND st.starts < (TIMESTAMP '$timeStamp' + INTERVAL '$interval')"
|
." AND st.starts < (TIMESTAMP '$timeStamp' + INTERVAL '$interval')"
|
||||||
." ORDER BY st.starts"
|
." ORDER BY st.starts"
|
||||||
." LIMIT $count";
|
." LIMIT $count";
|
||||||
|
|
|
@ -733,7 +733,7 @@ class Show_DAL{
|
||||||
$date = $timestamp[0];
|
$date = $timestamp[0];
|
||||||
$time = $timestamp[1];
|
$time = $timestamp[1];
|
||||||
|
|
||||||
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id"
|
$sql = "SELECT si.starts as start_timestamp, si.ends as end_timestamp, s.name, s.id, si.id as instance_id"
|
||||||
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
|
." FROM $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] s"
|
||||||
." WHERE si.show_id = s.id"
|
." WHERE si.show_id = s.id"
|
||||||
." AND si.starts <= TIMESTAMP '$timeNow'"
|
." AND si.starts <= TIMESTAMP '$timeNow'"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
var registered = false;
|
|
||||||
var datagridData = null;
|
var datagridData = null;
|
||||||
|
var currentShowInstanceID = -1;
|
||||||
|
|
||||||
function getDateText(obj){
|
function getDateText(obj){
|
||||||
var str = obj.aData[ obj.iDataColumn ].toString();
|
var str = obj.aData[ obj.iDataColumn ].toString();
|
||||||
|
@ -32,7 +32,7 @@ function changeTimePrecision(str){
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
function notifySongEnd(){
|
function notifySongStart(){
|
||||||
for (var i=0; i<datagridData.rows.length; i++){
|
for (var i=0; i<datagridData.rows.length; i++){
|
||||||
if (datagridData.rows[i][0] == "c")
|
if (datagridData.rows[i][0] == "c")
|
||||||
datagridData.rows[i][0] = "p";
|
datagridData.rows[i][0] = "p";
|
||||||
|
@ -45,6 +45,11 @@ function notifySongEnd(){
|
||||||
updateDataTable();
|
updateDataTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function notifyShowStart(show){
|
||||||
|
currentShowInstanceID = show.instance_id;
|
||||||
|
updateDataTable();
|
||||||
|
}
|
||||||
|
|
||||||
var columns = [{"sTitle": "type", "bVisible":false},
|
var columns = [{"sTitle": "type", "bVisible":false},
|
||||||
{"sTitle":"Date"},
|
{"sTitle":"Date"},
|
||||||
{"sTitle":"Start"},
|
{"sTitle":"Start"},
|
||||||
|
@ -88,6 +93,8 @@ function updateDataTable(){
|
||||||
function getData(){
|
function getData(){
|
||||||
$.ajax({ url: getAJAXURL(), dataType:"json", success:function(data){
|
$.ajax({ url: getAJAXURL(), dataType:"json", success:function(data){
|
||||||
datagridData = data.entries;
|
datagridData = data.entries;
|
||||||
|
if (datagridData.currentShow.length > 0)
|
||||||
|
currentShowInstanceID = datagridData.currentShow[0].instance_id;
|
||||||
updateDataTable();
|
updateDataTable();
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
|
@ -95,13 +102,7 @@ function getData(){
|
||||||
function init2(){
|
function init2(){
|
||||||
getData();
|
getData();
|
||||||
|
|
||||||
if (typeof registerSongEndListener == 'function' && !registered){
|
|
||||||
registered = true;
|
|
||||||
registerSongEndListener(notifySongEnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
setTimeout(init2, 5000);
|
setTimeout(init2, 5000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function redirect(url){
|
function redirect(url){
|
||||||
|
@ -124,7 +125,7 @@ function createDataGrid(){
|
||||||
"bPaginate": false,
|
"bPaginate": false,
|
||||||
"aoColumns": columns,
|
"aoColumns": columns,
|
||||||
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
|
||||||
if (aData[aData.length-2] == "t")
|
if (aData[aData.length-2] == currentShowInstanceID)
|
||||||
$(nRow).addClass("playing-list");
|
$(nRow).addClass("playing-list");
|
||||||
if (aData[0] == "c")
|
if (aData[0] == "c")
|
||||||
$(nRow).attr("class", "playing-song");
|
$(nRow).attr("class", "playing-song");
|
||||||
|
|
|
@ -13,8 +13,6 @@ var currentElem;
|
||||||
var serverUpdateInterval = 5000;
|
var serverUpdateInterval = 5000;
|
||||||
var uiUpdateInterval = 200;
|
var uiUpdateInterval = 200;
|
||||||
|
|
||||||
var songEndFunc;
|
|
||||||
|
|
||||||
//set to "development" if we are developing :). Useful to disable alerts
|
//set to "development" if we are developing :). Useful to disable alerts
|
||||||
//when entering production mode.
|
//when entering production mode.
|
||||||
var APPLICATION_ENV = "";
|
var APPLICATION_ENV = "";
|
||||||
|
@ -25,20 +23,6 @@ var APPLICATION_ENV = "";
|
||||||
var nextSongPrepare = true;
|
var nextSongPrepare = true;
|
||||||
var nextShowPrepare = true;
|
var nextShowPrepare = true;
|
||||||
|
|
||||||
/* Another script can register its function here
|
|
||||||
* when it wishes to know when a song ends. */
|
|
||||||
function registerSongEndListener(func){
|
|
||||||
songEndFunc = func;
|
|
||||||
}
|
|
||||||
|
|
||||||
function notifySongEndListener(){
|
|
||||||
if (typeof songEndFunc == "function"){
|
|
||||||
//create a slight delay in execution to allow the browser
|
|
||||||
//to update the display.
|
|
||||||
setTimeout(songEndFunc, 50);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTrackInfo(song){
|
function getTrackInfo(song){
|
||||||
var str = "";
|
var str = "";
|
||||||
|
|
||||||
|
@ -66,12 +50,15 @@ function newSongStart(){
|
||||||
nextSongPrepare = true;
|
nextSongPrepare = true;
|
||||||
currentSong[0] = nextSongs.shift();
|
currentSong[0] = nextSongs.shift();
|
||||||
|
|
||||||
notifySongEndListener();
|
notifySongStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextShowStart(){
|
function nextShowStart(){
|
||||||
nextShowPrepare = true;
|
nextShowPrepare = true;
|
||||||
currentShow[0] = nextShow.shift();
|
currentShow[0] = nextShow.shift();
|
||||||
|
|
||||||
|
//call function in nowplayingdatagrid.js
|
||||||
|
notifyShowStart(currentShow[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called every "uiUpdateInterval" mseconds. */
|
/* Called every "uiUpdateInterval" mseconds. */
|
||||||
|
|
Loading…
Reference in New Issue