Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Daniel 2012-03-19 16:14:16 -04:00
commit 064f7cf591
29 changed files with 611 additions and 398 deletions

View file

@ -62,6 +62,8 @@ class Config {
$CC_CONFIG['baseUrl'] = $values['general']['base_url'];
$CC_CONFIG['basePort'] = $values['general']['base_port'];
$CC_CONFIG['cache_ahead_hours'] = $values['general']['cache_ahead_hours'];
// Database config
$CC_CONFIG['dsn']['username'] = $values['database']['dbuser'];
$CC_CONFIG['dsn']['password'] = $values['database']['dbpass'];

View file

@ -348,7 +348,7 @@ class PlaylistController extends Zend_Controller_Action
/**
* The playlist fades are stored in the elements themselves.
* The fade in is set to the first elements fade in and
* the fade out is set to the last elments fade out.
* the fade out is set to the last elements fade out.
**/
public function setPlaylistFadesAction()
{
@ -358,6 +358,7 @@ class PlaylistController extends Zend_Controller_Action
try {
$pl = $this->getPlaylist();
$pl->setPlaylistfades($fadeIn, $fadeOut);
$this->view->modified = $pl->getLastModified("U");
}
catch (PlaylistOutDatedException $e) {
$this->playlistOutdated($pl, $e);

View file

@ -231,7 +231,11 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);
$this->view->statusMsg = "<div class='success'>Stream Setting Updated.</div>";
}
$live_stream_subform->updateConnectionURLs();
}
$this->view->confirm_pypo_restart_text = "Updating settings will temporarily interrupt any currently playing shows. Click \'OK\' to continue.";
$this->view->num_stream = $num_of_stream;
$this->view->enable_stream_conf = Application_Model_Preference::GetEnableStreamConf();
$this->view->form = $form;

View file

@ -778,15 +778,13 @@ class ScheduleController extends Zend_Controller_Action
try {
$showInstance = new Application_Model_ShowInstance($showInstanceId);
}
catch(Exception $e){
} catch(Exception $e) {
$this->view->show_error = true;
return false;
}
$show = new Application_Model_Show($showInstance->getShowId());
$show->cancelShow($showInstance->getShowInstanceStart());
$this->view->show_id = $showInstance->getShowId();
}
}
@ -806,8 +804,8 @@ class ScheduleController extends Zend_Controller_Action
}
$showInstance->clearShow();
$showInstance->delete();
// send 'cancel-current-show' command to pypo
Application_Model_RabbitMq::SendMessageToPypo("cancel_current_show", array());
Application_Model_RabbitMq::PushSchedule();
}
}

View file

@ -70,8 +70,39 @@ class Application_Form_LiveStreamingPreferences extends Zend_Form_SubForm
$master_dj_connection_url = ($master_dj_connection_url == "")?("http://".$_SERVER['SERVER_NAME'].":".$m_port."/".$m_mount):$master_dj_connection_url;
$live_dj_connection_url = ($live_dj_connection_url == "")?"http://".$_SERVER['SERVER_NAME'].":".$l_port."/".$l_mount:$live_dj_connection_url;
if($m_port=="" || $m_mount==""){
$master_dj_connection_url = "N/A";
}
if($l_port=="" || $l_mount==""){
$live_dj_connection_url = "N/A";
}
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url,))
));
}
public function updateConnectionURLs(){
$m_port = Application_Model_StreamSetting::GetMasterLiveSteamPort();
$m_mount = Application_Model_StreamSetting::GetMasterLiveSteamMountPoint();
$l_port = Application_Model_StreamSetting::GetDJLiveSteamPort();
$l_mount = Application_Model_StreamSetting::GetDJLiveSteamMountPoint();
$master_dj_connection_url = Application_Model_Preference::GetMasterDJSourceConnectionURL();
$live_dj_connection_url = Application_Model_Preference::GetLiveDJSourceConnectionURL();
$master_dj_connection_url = ($master_dj_connection_url == "")?("http://".$_SERVER['SERVER_NAME'].":".$m_port."/".$m_mount):$master_dj_connection_url;
$live_dj_connection_url = ($live_dj_connection_url == "")?"http://".$_SERVER['SERVER_NAME'].":".$l_port."/".$l_mount:$live_dj_connection_url;
if($m_port=="" || $m_mount==""){
$master_dj_connection_url = "N/A";
}
if($l_port=="" || $l_mount==""){
$live_dj_connection_url = "N/A";
}
$this->setDecorators(array(
array('ViewScript', array('viewScript' => 'form/preferences_livestream.phtml', 'master_dj_connection_url'=>$master_dj_connection_url, 'live_dj_connection_url'=>$live_dj_connection_url,))
));
}
}

View file

@ -520,7 +520,7 @@ class Application_Model_Playlist {
throw $e;
}
return array("fadeIn"=> $fadeIn, "fadeOut"=> $fadeOut);
return array("fadeIn" => $fadeIn, "fadeOut" => $fadeOut);
}
public function setPlaylistfades($fadein, $fadeout) {
@ -536,11 +536,12 @@ class Application_Model_Playlist {
}
if (isset($fadeout)) {
Logging::log("Setting playlist fade out {$fadeout}");
$row = CcPlaylistcontentsQuery::create()
->filterByDbPlaylistId($this->id)
->filterByDbPosition($this->getSize()-1)
->findOne($this->con);
$this->changeFadeInfo($row->getDbId(), null, $fadeout);
}
}

View file

@ -609,7 +609,17 @@ class Application_Model_Schedule {
}
if (is_null($p_fromDateTime)) {
$t2 = new DateTime("@".time());
$t2->add(new DateInterval("PT30M"));
$cache_ahead_hours = $CC_CONFIG["cache_ahead_hours"];
if (is_numeric($cache_ahead_hours)){
//make sure we are not dealing with a float
$cache_ahead_hours = intval($cache_ahead_hours);
} else {
$cache_ahead_hours = 1;
}
$t2->add(new DateInterval("PT".$cache_ahead_hours."H"));
$range_end = $t2->format("Y-m-d H:i:s");
} else {
$range_end = Application_Model_Schedule::PypoTimeToAirtimeTime($p_toDateTime);

View file

@ -199,9 +199,6 @@ class Application_Model_Show {
->filterByDbShowId($this->_showId)
->update(array('DbLastShow' => $timeinfo[0]));
//$sql = "DELETE FROM cc_show_instances
// WHERE starts >= '{$day_timestamp}' AND show_id = {$this->_showId}";
$sql = "UPDATE cc_show_instances
SET modified_instance = TRUE
WHERE starts >= '{$day_timestamp}' AND show_id = {$this->_showId}";

View file

@ -196,6 +196,8 @@ class Application_Model_ShowBuilder {
$row = $this->defaultRowArray;
$row["footer"] = true;
$row["instance"] = intval($p_item["si_id"]);
$this->getRowTimestamp($p_item, $row);
$showEndDT = new DateTime($p_item["si_ends"], new DateTimeZone("UTC"));
$contentDT = $this->contentDT;

View file

@ -11,8 +11,7 @@
<input id="pl_lastMod" type="hidden" value="<?php echo $this->pl->getLastModified('U'); ?>"></input>
<div class="playlist_title">
<h3 id="spl_name">
<a id="playlist_name_display"><?php echo $this->pl->getName(); ?></a>
<input type="text" maxlength="255" size="40" class="element_hidden" id="playlist_name_input" />
<a id="playlist_name_display" contenteditable="true"><?php echo $this->pl->getName(); ?></a>
</h3>
<h4 id="spl_length"><?php echo $this->length; ?></h4>
</div>
@ -36,10 +35,10 @@
<span class="ui-icon ui-icon-closethick"></span>
<dl id="spl_editor-main" class="inline-list">
<dt>Fade in (s):</dt>
<dd id="spl_fade_in_main"><span contenteditable="true" class="spl_text_input">00</span></dd>
<dd><span contenteditable="true" class="spl_text_input spl_main_fade_in">00</span></dd>
<dd class="edit-error"></dd>
<dt>Fade out (s):</dt>
<dd id="spl_fade_out_main"><span contenteditable="true" class="spl_text_input">00/span></dd>
<dd><span contenteditable="true" class="spl_text_input spl_main_fade_out">00/span></dd>
<dd class="edit-error"></dd>
</dl>
</div>

View file

@ -1,7 +1,7 @@
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong stream-config">
<h2 <?php if($this->enable_stream_conf == "true"){?>style="float:left"<?php }?>>Stream Settings</h2>
<?php if($this->enable_stream_conf == "true"){?>
<form method="post" action="/Preference/stream-setting" enctype="application/x-www-form-urlencoded">
<form method="post" action="/Preference/stream-setting" enctype="application/x-www-form-urlencoded" onsubmit="return confirm('<?php echo $this->confirm_pypo_restart_text ?>');">
<div class="button-bar bottom" id="submit-element" style="float:right">
<input type="submit" class="ui-button ui-state-default right-floated" value="Save" id="Save" name="Save" />
</div>
@ -43,10 +43,11 @@
<dd id="vorbisMetadata-element">
<?php echo $this->form->getElement('icecast_vorbis_metadata') ?>
</dd>
<dt id="streamFormat-label" class="block-display">
<dt id="streamFormat-label">
<label class="optional"><?php echo $this->form->getElement('streamFormat')->getLabel() ?></label>
</dt>
<dd id="streamFormat-element" class="block-display radio-inline-list">
<br>
<dd id="streamFormat-element" class="radio-inline-list">
<?php $i=0;
$value = $this->form->getElement('streamFormat')->getValue();
?>
@ -83,4 +84,4 @@
<?php }?>
</div>
</form>
</div>
</div>

View file

@ -18,6 +18,10 @@ airtime_dir = x
base_url = localhost
base_port = 80
#How many hours ahead of time should Airtime playout engine (PYPO)
#cache scheduled media files.
cache_ahead_hours = 1
[soundcloud]
connection_retries = 3
time_between_retries = 60

View file

@ -1876,7 +1876,7 @@ div.errors{
}
.stream-config {
width: 1080px;
width: 1100px;
}
.preferences .padded {

View file

@ -79,6 +79,8 @@ var AIRTIME = (function(AIRTIME) {
"bProcessing": true,
"bServerSide": true,
"aLengthMenu": [[10, 15, 20, 25, 50, 100], [10, 15, 20, 25, 50, 100]],
"bStateSave": true,
"fnStateSaveParams": function (oSettings, oData) {
//remove oData components we don't want to save.

View file

@ -212,14 +212,14 @@ var AIRTIME = (function(AIRTIME){
}
function openFadeEditor(event) {
var pos, url, li;
var li;
event.stopPropagation();
li = $(this).parent().parent();
li = $(this).parents("li");
li.find(".crossfade").toggle();
if($(this).hasClass("ui-state-active")) {
if ($(this).hasClass("ui-state-active")) {
unHighlightActive(this);
}
else {
@ -228,12 +228,12 @@ var AIRTIME = (function(AIRTIME){
}
function openCueEditor(event) {
var pos, url, li, icon;
var li, icon;
event.stopPropagation();
icon = $(this);
li = $(this).parent().parent().parent();
li = $(this).parents("li");
li.find(".cue-edit").toggle();
if (li.hasClass("ui-state-active")) {
@ -248,35 +248,23 @@ var AIRTIME = (function(AIRTIME){
function editName() {
var nameElement = $(this),
playlistName = nameElement.text(),
lastMod = getModified();
$("#playlist_name_input")
.removeClass('element_hidden')
.val(playlistName)
.keydown(function(event){
if (event.keyCode === 13) {
event.preventDefault();
var input = $(this),
url = '/Playlist/set-playlist-name';
url = '/Playlist/set-playlist-name';
$.post(url,
{format: "json", name: input.val(), modified: lastMod},
function(json){
if (json.error !== undefined) {
playlistError(json);
}
else {
setModified(json.modified);
input.addClass('element_hidden');
nameElement.text(json.playlistName);
redrawLib();
}
});
}
})
.focus();
$.post(url,
{format: "json", name: nameElement.text(), modified: lastMod},
function(json){
if (json.error !== undefined) {
playlistError(json);
}
else {
setModified(json.modified);
nameElement.text(json.playlistName);
redrawLib();
}
});
}
function redrawLib() {
@ -372,13 +360,13 @@ var AIRTIME = (function(AIRTIME){
"keydown": submitOnEnter});
}
function setUpPlaylist(playlist) {
function initialEvents() {
var playlist = $("#side_playlist"),
sortableConf,
cachedDescription;
playlist.find("#spl_crossfade").on("click", function() {
//main playlist fades events
playlist.on("click", "#spl_crossfade", function() {
var lastMod = getModified();
if ($(this).hasClass("ui-state-active")) {
@ -397,10 +385,11 @@ var AIRTIME = (function(AIRTIME){
playlistError(json);
}
else {
playlist.find("#spl_fade_in_main").find("span")
playlist.find("span.spl_main_fade_in")
.empty()
.append(json.fadeIn);
playlist.find("#spl_fade_out_main").find("span")
playlist.find("span.spl_main_fade_out")
.empty()
.append(json.fadeOut);
@ -409,22 +398,79 @@ var AIRTIME = (function(AIRTIME){
});
}
});
playlist.on("blur", "span.spl_main_fade_in", function(event){
event.stopPropagation();
playlist.find("#playlist_name_display").on("click", editName);
playlist.find("#fieldset-metadate_change > legend").on("click", function(){
var descriptionElement = $(this).parent();
var url = "/Playlist/set-playlist-fades",
span = $(this),
fadeIn = $.trim(span.text()),
lastMod = getModified();
if (!isFadeValid(fadeIn)){
showError(span, "please put in a time in seconds '00 (.000000)'");
return;
}
if (descriptionElement.hasClass("closed")) {
cachedDescription = playlist.find("#fieldset-metadate_change textarea").val();
descriptionElement.removeClass("closed");
}
else {
descriptionElement.addClass("closed");
}
$.post(url,
{format: "json", fadeIn: fadeIn, modified: lastMod},
function(json){
hideError(span);
if (json.modified !== undefined) {
setModified(json.modified);
}
});
});
playlist.find("#description_save").on("click", function(){
playlist.on("blur", "span.spl_main_fade_out", function(event){
event.stopPropagation();
var url = "/Playlist/set-playlist-fades",
span = $(this),
fadeOut = $.trim(span.text()),
lastMod = getModified();
if (!isFadeValid(fadeOut)){
showError(span, "please put in a time in seconds '00 (.000000)'");
return;
}
$.post(url,
{format: "json", fadeOut: fadeOut, modified: lastMod},
function(json){
hideError(span);
if (json.modified !== undefined) {
setModified(json.modified);
}
});
});
playlist.on("keydown", "span.spl_main_fade_in, span.spl_main_fade_out", submitOnEnter);
playlist.on("click", "#crossfade_main > .ui-icon-closethick", function(){
playlist.find("#spl_crossfade").removeClass("ui-state-active");
playlist.find("#crossfade_main").hide();
});
//end main playlist fades.
//edit playlist name event
playlist.on("keydown", "#playlist_name_display", submitOnEnter);
playlist.on("blur", "#playlist_name_display", editName);
//edit playlist description events
playlist.on("click", "legend", function(){
var $fs = $(this).parents("fieldset");
if ($fs.hasClass("closed")) {
cachedDescription = $fs.find("textarea").val();
$fs.removeClass("closed");
}
else {
$fs.addClass("closed");
}
});
playlist.on("click", "#description_save", function(){
var textarea = playlist.find("#fieldset-metadate_change textarea"),
description = textarea.val(),
url,
@ -447,60 +493,19 @@ var AIRTIME = (function(AIRTIME){
});
});
playlist.find("#description_cancel").on("click", function(){
playlist.on("click", "#description_cancel", function(){
var textarea = playlist.find("#fieldset-metadate_change textarea");
textarea.val(cachedDescription);
playlist.find("#fieldset-metadate_change").addClass("closed");
});
playlist.find("#spl_fade_in_main span:first").on("blur", function(event){
event.stopPropagation();
var url = "/Playlist/set-playlist-fades",
span = $(this),
fadeIn = $.trim(span.text()),
lastMod = getModified();
if (!isFadeValid(fadeIn)){
showError(span, "please put in a time in seconds '00 (.000000)'");
return;
}
$.post(url,
{format: "json", fadeIn: fadeIn, modified: lastMod},
function(json){
hideError(span);
});
});
playlist.find("#spl_fade_out_main span:last").on("blur", function(event){
event.stopPropagation();
var url = "/Playlist/set-playlist-fades",
span = $(this),
fadeOut = $.trim(span.text()),
lastMod = getModified();
if(!isFadeValid(fadeOut)){
showError(span, "please put in a time in seconds '00 (.000000)'");
return;
}
$.post(url,
{format: "json", fadeOut: fadeOut, modified: lastMod},
function(json){
hideError(span);
});
});
playlist.find("#spl_fade_in_main span:first, #spl_fade_out_main span:first")
.on("keydown", submitOnEnter);
playlist.find("#crossfade_main > .ui-icon-closethick").on("click", function(){
playlist.find("#spl_crossfade").removeClass("ui-state-active");
playlist.find("#crossfade_main").hide();
});
//end edit playlist description events.
}
function setUpPlaylist(playlist) {
var playlist = $("#side_playlist"),
sortableConf;
sortableConf = (function(){
var aReceiveItems,
@ -728,6 +733,7 @@ var AIRTIME = (function(AIRTIME){
setCueEvents(playlist);
setFadeEvents(playlist);
initialEvents();
setUpPlaylist(playlist);
};

View file

@ -107,10 +107,11 @@ function checkLiquidsoapStatus(){
}
function setLiveSourceConnectionOverrideListener(){
$("[id=connection_url_override]").click(function(){
$("[id=connection_url_override]").click(function(event){
var div_ele = $(this).parent().find("div[id$='_dj_connection_url_tb']")
div_ele.find(":input").val("")
div_ele.show()
event.preventDefault()
})
// set action for "OK" and "X"
@ -119,36 +120,42 @@ function setLiveSourceConnectionOverrideListener(){
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(){
live_dj_input.find("#ok").click(function(event){
event.preventDefault()
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)});
event.preventDefault()
})
live_dj_input.find("#reset").click(function(){
live_dj_input.find("#reset").click(function(event){
event.preventDefault()
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)});
event.preventDefault()
})
master_dj_input.find("#ok").click(function(){
master_dj_input.find("#ok").click(function(event){
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)})
event.preventDefault()
})
master_dj_input.find("#reset").click(function(){
master_dj_input.find("#reset").click(function(event){
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)})
event.preventDefault()
})
}

View file

@ -515,14 +515,18 @@ var AIRTIME = (function(AIRTIME){
var prev = ui.item.prev();
//can't add items outside of shows.
if (prev.hasClass("sb-footer")
|| prev.find("td:first").hasClass("dataTables_empty")
if (prev.find("td:first").hasClass("dataTables_empty")
|| prev.length === 0) {
alert("Cannot schedule outside a show.");
ui.item.remove();
return;
}
//if item is added after a footer, add the item after the last item in the show.
if (prev.hasClass("sb-footer")) {
prev = prev.prev();
}
aItemData = [];
oPrevData = prev.data("aData");