Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
Conflicts: airtime_mvc/public/js/airtime/showbuilder/builder.js
This commit is contained in:
commit
5b953443c6
63 changed files with 2816 additions and 781 deletions
|
@ -13,6 +13,11 @@ var currentElem;
|
|||
var serverUpdateInterval = 5000;
|
||||
var uiUpdateInterval = 200;
|
||||
|
||||
var master_dj_on_air = false;
|
||||
var live_dj_on_air = false;
|
||||
var scheduled_play_on_air = false;
|
||||
var scheduled_play_source = false;
|
||||
|
||||
//var timezoneOffset = 0;
|
||||
|
||||
//set to "development" if we are developing :). Useful to disable alerts
|
||||
|
@ -31,6 +36,8 @@ function secondsTimer(){
|
|||
estimatedSchedulePosixTime = date.getTime() - localRemoteTimeOffset;
|
||||
updateProgressBarValue();
|
||||
updatePlaybar();
|
||||
controlOnAirLight();
|
||||
controlSwitchLight();
|
||||
}
|
||||
setTimeout(secondsTimer, uiUpdateInterval);
|
||||
}
|
||||
|
@ -74,14 +81,20 @@ function updateProgressBarValue(){
|
|||
songPercentDone = 0;
|
||||
currentSong = null;
|
||||
} else {
|
||||
if (currentSong.media_item_played == "t" && currentShow.length > 0)
|
||||
$('#on-air-info').attr("class", "on-air-info on");
|
||||
else
|
||||
$('#on-air-info').attr("class", "on-air-info off");
|
||||
var scheduled_play_line_to_switch = $("#scheduled_play_div").find(".line-to-switch")
|
||||
if (currentSong.media_item_played == "t" && currentShow.length > 0){
|
||||
scheduled_play_line_to_switch.attr("class", "line-to-switch on");
|
||||
scheduled_play_source = true;
|
||||
}
|
||||
else{
|
||||
scheduled_play_source = false;
|
||||
scheduled_play_line_to_switch.attr("class", "line-to-switch off");
|
||||
}
|
||||
$('#progress-show').attr("class", "progress-show");
|
||||
}
|
||||
} else {
|
||||
$('#on-air-info').attr("class", "on-air-info off");
|
||||
scheduled_play_source = false;
|
||||
$("#scheduled_play_div").find(".line-to-switch").attr("class", "line-to-switch off");
|
||||
$('#progress-show').attr("class", "progress-show-error");
|
||||
}
|
||||
$('#progress-bar').attr("style", "width:"+songPercentDone+"%");
|
||||
|
@ -218,10 +231,85 @@ function parseItems(obj){
|
|||
localRemoteTimeOffset = date.getTime() - schedulePosixTime;
|
||||
}
|
||||
|
||||
function parseSourceStatus(obj){
|
||||
var live_div = $("#live_dj_div").find(".line-to-switch")
|
||||
var master_div = $("#master_dj_div").find(".line-to-switch")
|
||||
|
||||
if(obj.live_dj_source == false){
|
||||
live_div.attr("class", "line-to-switch off")
|
||||
}else{
|
||||
live_div.attr("class", "line-to-switch on")
|
||||
}
|
||||
|
||||
if(obj.master_dj_source == false){
|
||||
master_div.attr("class", "line-to-switch off")
|
||||
}else{
|
||||
master_div.attr("class", "line-to-switch on")
|
||||
}
|
||||
}
|
||||
|
||||
function parseSwitchStatus(obj){
|
||||
|
||||
if(obj.live_dj_source == "on" && obj.master_dj_source == "off"){
|
||||
live_dj_on_air = true;
|
||||
}else{
|
||||
live_dj_on_air = false;
|
||||
}
|
||||
|
||||
if(obj.master_dj_source == "on"){
|
||||
master_dj_on_air = true;
|
||||
}else{
|
||||
master_dj_on_air = false;
|
||||
}
|
||||
|
||||
if(obj.scheduled_play == "on"){
|
||||
scheduled_play_on_air = true;
|
||||
}else{
|
||||
scheduled_play_on_air = false;
|
||||
}
|
||||
|
||||
$("#scheduled_play.source-switch-button").find("span").html(obj.scheduled_play)
|
||||
$("#live_dj.source-switch-button").find("span").html(obj.live_dj_source)
|
||||
$("#master_dj.source-switch-button").find("span").html(obj.master_dj_source)
|
||||
}
|
||||
|
||||
function controlOnAirLight(){
|
||||
if((scheduled_play_on_air && scheduled_play_source)|| live_dj_on_air || master_dj_on_air){
|
||||
$('#on-air-info').attr("class", "on-air-info on");
|
||||
}else{
|
||||
$('#on-air-info').attr("class", "on-air-info off");
|
||||
}
|
||||
}
|
||||
|
||||
function controlSwitchLight(){
|
||||
var live_div = $("#live_dj_div")
|
||||
var master_div = $("#master_dj_div")
|
||||
var scheduled_play_div = $("#scheduled_play_div")
|
||||
|
||||
if((scheduled_play_on_air && scheduled_play_source) && !live_dj_on_air && !master_dj_on_air){
|
||||
scheduled_play_div.find(".line-to-on-air").attr("class", "line-to-on-air on")
|
||||
live_div.find(".line-to-on-air").attr("class", "line-to-on-air off")
|
||||
master_div.find(".line-to-on-air").attr("class", "line-to-on-air off")
|
||||
}else if(live_dj_on_air && !master_dj_on_air){
|
||||
scheduled_play_div.find(".line-to-on-air").attr("class", "line-to-on-air off")
|
||||
live_div.find(".line-to-on-air").attr("class", "line-to-on-air on")
|
||||
master_div.find(".line-to-on-air").attr("class", "line-to-on-air off")
|
||||
}else if(master_dj_on_air){
|
||||
scheduled_play_div.find(".line-to-on-air").attr("class", "line-to-on-air off")
|
||||
live_div.find(".line-to-on-air").attr("class", "line-to-on-air off")
|
||||
master_div.find(".line-to-on-air").attr("class", "line-to-on-air on")
|
||||
}else{
|
||||
scheduled_play_div.find(".line-to-on-air").attr("class", "line-to-on-air off")
|
||||
live_div.find(".line-to-on-air").attr("class", "line-to-on-air off")
|
||||
master_div.find(".line-to-on-air").attr("class", "line-to-on-air off")
|
||||
}
|
||||
}
|
||||
|
||||
function getScheduleFromServer(){
|
||||
$.ajax({ url: "/Schedule/get-current-playlist/format/json", dataType:"json", success:function(data){
|
||||
parseItems(data.entries);
|
||||
parseSourceStatus(data.source_status);
|
||||
parseSwitchStatus(data.switch_status);
|
||||
}, error:function(jqXHR, textStatus, errorThrown){}});
|
||||
setTimeout(getScheduleFromServer, serverUpdateInterval);
|
||||
}
|
||||
|
@ -251,6 +339,31 @@ function setupQtip(){
|
|||
}
|
||||
}
|
||||
|
||||
function setSwitchListener(ele){
|
||||
var sourcename = $(ele).attr('id')
|
||||
var status_span = $(ele).find("span")
|
||||
var status = status_span.html()
|
||||
var source_connection_status = false
|
||||
|
||||
$.get("/Dashboard/switch-source/format/json/sourcename/"+sourcename+"/status/"+status, function(data){
|
||||
if(data.error){
|
||||
alert(data.error);
|
||||
}else{
|
||||
status_span.html(data.status)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function kickSource(ele){
|
||||
var sourcename = $(ele).attr('id')
|
||||
|
||||
$.get("/Dashboard/disconnect-source/format/json/sourcename/"+sourcename, function(data){
|
||||
if(data.error){
|
||||
alert(data.error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var stream_window = null;
|
||||
|
||||
function init() {
|
||||
|
|
|
@ -154,7 +154,7 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
$.ajax( {
|
||||
"dataType": 'json',
|
||||
"type": "GET",
|
||||
"type": "POST",
|
||||
"url": sSource,
|
||||
"data": aoData,
|
||||
"success": fnCallback
|
||||
|
@ -329,6 +329,8 @@ var AIRTIME = (function(AIRTIME) {
|
|||
|
||||
addQtipToSCIcons();
|
||||
|
||||
|
||||
//begin context menu initialization.
|
||||
$.contextMenu({
|
||||
selector: '#library_display td:not(.library_checkbox)',
|
||||
trigger: "left",
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
var AIRTIME = (function(AIRTIME){
|
||||
|
||||
AIRTIME.playlist = {};
|
||||
|
||||
var mod = AIRTIME.playlist;
|
||||
|
||||
function isTimeValid(time) {
|
||||
|
@ -287,7 +288,7 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
|
||||
function setPlaylistContent(json) {
|
||||
|
||||
|
||||
$('#spl_name > a')
|
||||
.empty()
|
||||
.append(json.name);
|
||||
|
@ -302,7 +303,6 @@ var AIRTIME = (function(AIRTIME){
|
|||
.append(json.html);
|
||||
|
||||
setModified(json.modified);
|
||||
|
||||
redrawLib();
|
||||
}
|
||||
|
||||
|
@ -634,49 +634,84 @@ var AIRTIME = (function(AIRTIME){
|
|||
});
|
||||
};
|
||||
|
||||
mod.fnAddItems = function(aItems, iAfter, sAddType) {
|
||||
var lastMod = getModified();
|
||||
function playlistRequest(sUrl, oData) {
|
||||
var lastMod = getModified(),
|
||||
plContent = $("#side_playlist"),
|
||||
offset = plContent.offset(),
|
||||
plHeight = plContent.height(),
|
||||
plWidth = plContent.width(),
|
||||
overlay,
|
||||
loading;
|
||||
|
||||
$.post("/playlist/add-items",
|
||||
{format: "json", "ids": aItems, "afterItem": iAfter, "type": sAddType, "modified": lastMod},
|
||||
function(json){
|
||||
oData["modified"] = lastMod;
|
||||
oData["format"] = "json";
|
||||
|
||||
|
||||
overlay = $("<div />", {
|
||||
"class": "pl-overlay ui-widget-content",
|
||||
"css": {
|
||||
"position": "absolute",
|
||||
"top": offset.top,
|
||||
"left": offset.left,
|
||||
"height": plHeight + 16,
|
||||
"width": plWidth + 16
|
||||
}
|
||||
}).click(function(){
|
||||
return false;
|
||||
});
|
||||
|
||||
loading = $("<div />", {
|
||||
"class": "pl-loading",
|
||||
"css": {
|
||||
"position": "absolute",
|
||||
"top": offset.top + plHeight/2 - 32 - 8,
|
||||
"left": offset.left + plWidth/2 - 32 -8,
|
||||
"height": 64,
|
||||
"width": 64
|
||||
}
|
||||
});
|
||||
|
||||
$("body")
|
||||
.append(overlay)
|
||||
.append(loading);
|
||||
|
||||
$.post(
|
||||
sUrl,
|
||||
oData,
|
||||
function(json){
|
||||
|
||||
if (json.error !== undefined) {
|
||||
playlistError(json);
|
||||
}
|
||||
else {
|
||||
setPlaylistContent(json);
|
||||
}
|
||||
});
|
||||
|
||||
loading.remove();
|
||||
overlay.remove();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
mod.fnAddItems = function(aItems, iAfter, sAddType) {
|
||||
var sUrl = "/playlist/add-items";
|
||||
oData = {"ids": aItems, "afterItem": iAfter, "type": sAddType};
|
||||
|
||||
playlistRequest(sUrl, oData);
|
||||
};
|
||||
|
||||
mod.fnMoveItems = function(aIds, iAfter) {
|
||||
var lastMod = getModified();
|
||||
var sUrl = "/playlist/move-items",
|
||||
oData = {"ids": aIds, "afterItem": iAfter};
|
||||
|
||||
$.post("/playlist/move-items",
|
||||
{format: "json", "ids": aIds, "afterItem": iAfter, "modified": lastMod},
|
||||
function(json){
|
||||
if (json.error !== undefined) {
|
||||
playlistError(json);
|
||||
}
|
||||
else {
|
||||
setPlaylistContent(json);
|
||||
}
|
||||
});
|
||||
playlistRequest(sUrl, oData);
|
||||
};
|
||||
|
||||
mod.fnDeleteItems = function(aItems) {
|
||||
var lastMod = getModified();
|
||||
var sUrl = "/playlist/delete-items",
|
||||
oData = {"ids": aItems};
|
||||
|
||||
$.post("/playlist/delete-items",
|
||||
{format: "json", "ids": aItems, "modified": lastMod},
|
||||
function(json){
|
||||
if (json.error !== undefined) {
|
||||
playlistError(json);
|
||||
}
|
||||
else {
|
||||
setPlaylistContent(json);
|
||||
}
|
||||
});
|
||||
playlistRequest(sUrl, oData);
|
||||
};
|
||||
|
||||
mod.init = function() {
|
||||
|
@ -717,4 +752,24 @@ $(document).ready(function() {
|
|||
|
||||
AIRTIME.library.libraryInit();
|
||||
AIRTIME.playlist.init();
|
||||
|
||||
pl.find(".ui-icon-alert").qtip({
|
||||
content: {
|
||||
text: "File does not exist on disk..."
|
||||
},
|
||||
position:{
|
||||
adjust: {
|
||||
resize: true,
|
||||
method: "flip flip"
|
||||
},
|
||||
at: "right center",
|
||||
my: "left top",
|
||||
viewport: $(window)
|
||||
},
|
||||
style: {
|
||||
classes: "ui-tooltip-dark"
|
||||
},
|
||||
show: 'mouseover',
|
||||
hide: 'mouseout'
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,12 @@ function showErrorSections() {
|
|||
|
||||
if($("#soundcloud-settings .errors").length > 0) {
|
||||
$("#soundcloud-settings").show();
|
||||
$(window).scrollTop($("soundcloud-settings .errors").position().top);
|
||||
$(window).scrollTop($("#soundcloud-settings .errors").position().top);
|
||||
}
|
||||
|
||||
if($("#livestream-settings .errors").length > 0) {
|
||||
$("#livestream-settings").show();
|
||||
$(window).scrollTop($("#livestream-settings .errors").position().top);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,6 +106,52 @@ function checkLiquidsoapStatus(){
|
|||
});
|
||||
}
|
||||
|
||||
function setLiveSourceConnectionOverrideListener(){
|
||||
$("[id=connection_url_override]").click(function(){
|
||||
var div_ele = $(this).parent().find("div[id$='_dj_connection_url_tb']")
|
||||
div_ele.find(":input").val("")
|
||||
div_ele.show()
|
||||
})
|
||||
|
||||
// set action for "OK" and "X"
|
||||
var live_dj_input = $("#live_dj_connection_url_tb")
|
||||
var live_dj_label = live_dj_input.parent().find("span")
|
||||
var master_dj_input = $("#master_dj_connection_url_tb")
|
||||
var master_dj_label = master_dj_input.parent().find("span")
|
||||
|
||||
live_dj_input.find("#ok").click(function(){
|
||||
var url = $(this).parent().find(":input").val()
|
||||
live_dj_label.html(url)
|
||||
live_dj_input.hide()
|
||||
$.get("/Preference/set-source-connection-url/", {format: "json", type: "livedj", url:encodeURIComponent(url)});
|
||||
})
|
||||
|
||||
live_dj_input.find("#reset").click(function(){
|
||||
var port = $("#dj_harbor_input_port").val()
|
||||
var mount = $("#dj_harbor_input_mount_point").val()
|
||||
var url = "http://"+location.hostname+":"+port+"/"+mount
|
||||
live_dj_label.html(url)
|
||||
live_dj_input.hide()
|
||||
$.get("/Preference/set-source-connection-url", {format: "json", type: "livedj", url:encodeURIComponent(url)});
|
||||
})
|
||||
|
||||
master_dj_input.find("#ok").click(function(){
|
||||
var url = $(this).parent().find(":input").val()
|
||||
master_dj_label.html(url)
|
||||
master_dj_input.hide()
|
||||
$.get("/Preference/set-source-connection-url", {format: "json", type: "masterdj", url:encodeURIComponent(url)})
|
||||
})
|
||||
|
||||
master_dj_input.find("#reset").click(function(){
|
||||
var port = $("#master_harbor_input_port").val()
|
||||
var mount = $("#master_harbor_input_mount_point").val()
|
||||
var url = "http://"+location.hostname+":"+port+"/"+mount
|
||||
master_dj_label.html(url)
|
||||
master_dj_input.hide()
|
||||
$.get("/Preference/set-source-connection-url", {format: "json", type: "masterdj", url:encodeURIComponent(url)})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
// initial stream url
|
||||
|
@ -178,6 +224,8 @@ $(document).ready(function() {
|
|||
return false;
|
||||
})
|
||||
|
||||
setLiveSourceConnectionOverrideListener()
|
||||
|
||||
showErrorSections()
|
||||
setInterval('checkLiquidsoapStatus()', 1000)
|
||||
$.mask.rules = {
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue