From 0bfcd3255494f438ef2c6b1d21f783ac9ac31df1 Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 22 May 2013 17:50:34 -0400 Subject: [PATCH 1/3] CC-5172 : errors from setting cues in waveform editor not handled properly --- .../controllers/PlaylistController.php | 1 + airtime_mvc/application/models/Playlist.php | 10 ++++++++ airtime_mvc/public/js/airtime/library/spl.js | 25 +++++++++++++++++-- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index 2b48b40b7..1826bde3b 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -383,6 +383,7 @@ class PlaylistController extends Zend_Controller_Action $this->createUpdateResponse($obj); } else { $this->view->cue_error = $response["error"]; + $this->view->code = $response["type"]; } } catch (PlaylistOutDatedException $e) { $this->playlistOutdated($e); diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php index aa74c78c4..ee7267cc3 100644 --- a/airtime_mvc/application/models/Playlist.php +++ b/airtime_mvc/application/models/Playlist.php @@ -10,6 +10,10 @@ require_once 'formatters/LengthFormatter.php'; */ class Application_Model_Playlist implements Application_Model_LibraryEditable { + const CUE_ALL_ERROR = 0; + const CUE_IN_ERROR = 1; + const CUE_OUT_ERROR = 2; + /** * propel connection object. */ @@ -792,6 +796,7 @@ SQL; try { if (is_null($cueIn) && is_null($cueOut)) { $errArray["error"] = _("Cue in and cue out are null."); + $errArray["type"] = self::CUE_ALL_ERROR; return $errArray; } @@ -822,6 +827,7 @@ SQL; $sql = "SELECT :cueIn::INTERVAL > :cueOut::INTERVAL"; if (Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':cueOut'=>$cueOut), 'column')) { $errArray["error"] = _("Can't set cue in to be larger than cue out."); + $errArray["type"] = self::CUE_IN_ERROR; return $errArray; } @@ -829,6 +835,7 @@ SQL; $sql = "SELECT :cueOut::INTERVAL > :origLength::INTERVAL"; if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength), 'column')) { $errArray["error"] = _("Can't set cue out to be greater than file length."); + $errArray["type"] = self::CUE_OUT_ERROR; return $errArray; } @@ -845,6 +852,7 @@ SQL; $sql = "SELECT :cueIn::INTERVAL > :oldCueOut::INTERVAL"; if (Application_Common_Database::prepareAndExecute($sql, array(':cueIn'=>$cueIn, ':oldCueOut'=>$oldCueOut), 'column')) { $errArray["error"] = _("Can't set cue in to be larger than cue out."); + $errArray["type"] = self::CUE_IN_ERROR; return $errArray; } @@ -863,6 +871,7 @@ SQL; $sql = "SELECT :cueOut::INTERVAL < :oldCueIn::INTERVAL"; if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':oldCueIn'=>$oldCueIn), 'column')) { $errArray["error"] = _("Can't set cue out to be smaller than cue in."); + $errArray["type"] = self::CUE_OUT_ERROR; return $errArray; } @@ -870,6 +879,7 @@ SQL; $sql = "SELECT :cueOut::INTERVAL > :origLength::INTERVAL"; if (Application_Common_Database::prepareAndExecute($sql, array(':cueOut'=>$cueOut, ':origLength'=>$origLength), 'column')) { $errArray["error"] = _("Can't set cue out to be greater than file length."); + $errArray["type"] = self::CUE_OUT_ERROR; return $errArray; } diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index a50684131..00f899f9c 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -144,7 +144,8 @@ var AIRTIME = (function(AIRTIME){ var url = baseUrl+"Playlist/set-cue", lastMod = getModified(), type = $('#obj_type').val(), - li; + li, + span; if (!isTimeValid(cueIn)){ $el.find('.cue-in-error').val($.i18n._("please put in a time '00:00:00 (.0)'")).show(); @@ -174,7 +175,27 @@ var AIRTIME = (function(AIRTIME){ return; } if (json.cue_error !== undefined) { - showError(span, json.cue_error); + + li = $('#side_playlist li[unqid='+id+']'); + + if (json.code === 0) { + + span = $('#spl_cue_in_'+id).find('span'); + showError(span, json.cue_error); + span = $('#spl_cue_out_'+id).find('span'); + showError(span, json.cue_error); + } + else if (json.code === 1) { + + span = $('#spl_cue_in_'+id).find('span'); + showError(span, json.cue_error); + } + else if (json.code === 2) { + + span = $('#spl_cue_out_'+id).find('span'); + showError(span, json.cue_error); + } + return; } From bb5889e6a588f844c3f93359de319388c7d099db Mon Sep 17 00:00:00 2001 From: Naomi Date: Wed, 22 May 2013 17:52:02 -0400 Subject: [PATCH 2/3] CC-5172 : errors from setting cues in waveform editor not handled properly --- airtime_mvc/application/models/Playlist.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/models/Playlist.php b/airtime_mvc/application/models/Playlist.php index ee7267cc3..74b1b62c7 100644 --- a/airtime_mvc/application/models/Playlist.php +++ b/airtime_mvc/application/models/Playlist.php @@ -10,8 +10,8 @@ require_once 'formatters/LengthFormatter.php'; */ class Application_Model_Playlist implements Application_Model_LibraryEditable { - const CUE_ALL_ERROR = 0; - const CUE_IN_ERROR = 1; + const CUE_ALL_ERROR = 0; + const CUE_IN_ERROR = 1; const CUE_OUT_ERROR = 2; /** From 45e5d339a146a997a075bbe7c87ca125e7ef3456 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 22 May 2013 18:03:56 -0400 Subject: [PATCH 3/3] make more operators local to each source --- python_apps/pypo/liquidsoap_scripts/ls_script.liq | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python_apps/pypo/liquidsoap_scripts/ls_script.liq b/python_apps/pypo/liquidsoap_scripts/ls_script.liq index 89a11aa8e..b272bab71 100644 --- a/python_apps/pypo/liquidsoap_scripts/ls_script.liq +++ b/python_apps/pypo/liquidsoap_scripts/ls_script.liq @@ -40,6 +40,11 @@ source_id = ref 0 def create_source() l = request.equeue(id="s#{!source_id}", length=0.5) l = cue_cut(l) + + l = audio_to_stereo(id="queue_src", l) + l = amplify(1., override="replay_gain", l) + l = crossfade_airtime(l) + l = on_metadata(notify, l) sources := list.append([l], !sources) server.register(namespace="queues", @@ -63,11 +68,8 @@ create_source() queue = add(!sources, normalize=false) -queue = audio_to_stereo(id="queue_src", queue) -queue = amplify(1., override="replay_gain", queue) - # the crossfade function controls fade in/out -queue = crossfade_airtime(queue) + output.dummy(fallible=true, queue) http = input.http_restart(id="http")