From 4c58c4c9a92169f57b883c09fc9f165f54f855c5 Mon Sep 17 00:00:00 2001
From: Martin Konecny <martin.konecny@gmail.com>
Date: Tue, 18 Sep 2012 15:23:26 -0400
Subject: [PATCH 1/4] CC-4473: On Air button greys out when one out of two same
 Webstreams is cancelled

-fixed
---
 airtime_mvc/application/models/Schedule.php       | 1 +
 airtime_mvc/application/models/Webstream.php      | 2 +-
 python_apps/pypo/liquidsoap_scripts/ls_script.liq | 2 ++
 python_apps/pypo/pypopush.py                      | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php
index 5e92ca514..eff64b2ec 100644
--- a/airtime_mvc/application/models/Schedule.php
+++ b/airtime_mvc/application/models/Schedule.php
@@ -696,6 +696,7 @@ SQL;
             'start'             => $start,
             'end'               => $end,
             'show_name'         => $item["show_name"],
+            'row_id'            => $item["id"],
             'independent_event' => true
         );
         self::appendScheduleItem($data, $start, $schedule_item);
diff --git a/airtime_mvc/application/models/Webstream.php b/airtime_mvc/application/models/Webstream.php
index 561f97b12..45d3caf9a 100644
--- a/airtime_mvc/application/models/Webstream.php
+++ b/airtime_mvc/application/models/Webstream.php
@@ -216,9 +216,9 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
     }
 
     // TODO : Fix this interface
+    //This function should not be defined in the interface.
     public function setMetadata($key, $val)
     {
-        //This function should not be defined in the interface.
         throw new Exception("Not implemented.");
     }
 
diff --git a/python_apps/pypo/liquidsoap_scripts/ls_script.liq b/python_apps/pypo/liquidsoap_scripts/ls_script.liq
index 87e7fbc89..649943a19 100644
--- a/python_apps/pypo/liquidsoap_scripts/ls_script.liq
+++ b/python_apps/pypo/liquidsoap_scripts/ls_script.liq
@@ -41,11 +41,13 @@ stream_harbor_pass = list.hd(get_process_lines('pwgen -s -N 1 -n 20'))
 
 web_stream = input.harbor("test-harbor", port=8999, password=stream_harbor_pass)
 web_stream = on_metadata(notify_stream, web_stream)
+output.dummy(fallible=true, web_stream)
 
 queue = on_metadata(notify, queue)
 queue = map_metadata(update=false, append_title, queue)
 # the crossfade function controls fade in/out
 queue = crossfade(queue)
+output.dummy(fallible=true, queue)
 
 
 stream_queue = switch(id="stream_queue_switch", track_sensitive=false, 
diff --git a/python_apps/pypo/pypopush.py b/python_apps/pypo/pypopush.py
index 4defee3e9..aaacc1687 100644
--- a/python_apps/pypo/pypopush.py
+++ b/python_apps/pypo/pypopush.py
@@ -191,7 +191,7 @@ class PypoPush(Thread):
                 if self.current_stream_info is None:
                     correct = False
                 else:
-                    correct = self.current_stream_info['uri'] == media_item['uri']
+                    correct = self.current_stream_info['row_id'] == media_item['row_id']
 
         self.logger.debug("Is current item correct?: %s", str(correct))
         return correct

From 09b117999e5f1c99ea46efc0174dc74061cb7e17 Mon Sep 17 00:00:00 2001
From: denise <denise@denise-DX4860sourcefabric.org>
Date: Tue, 18 Sep 2012 15:28:38 -0400
Subject: [PATCH 2/4] CC-4475: Register form button doesn't have any styling

-fixed
---
 airtime_mvc/public/js/airtime/nowplaying/register.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/airtime_mvc/public/js/airtime/nowplaying/register.js b/airtime_mvc/public/js/airtime/nowplaying/register.js
index 3d13367f1..0b5b04249 100644
--- a/airtime_mvc/public/js/airtime/nowplaying/register.js
+++ b/airtime_mvc/public/js/airtime/nowplaying/register.js
@@ -15,9 +15,10 @@ $(document).ready(function(){
         close: doNotShowPopup,
         buttons: [
             {
-            	id: "remind_me",
-            	text: "Remind me in 1 week",
-            	click: function() {
+                id: "remind_me",
+                text: "Remind me in 1 week",
+                "class": "btn",
+                click: function() {
                     var url = '/Usersettings/remindme';
                     $.ajax({
                         url: url,
@@ -29,6 +30,7 @@ $(document).ready(function(){
             {
                 id: "remind_never",
                 text: "Remind me never",
+                "class": "btn", 
                 click: function() {
                     var url ='/Usersettings/remindme-never';
                     $.ajax({
@@ -41,6 +43,7 @@ $(document).ready(function(){
             {
             	id: "help_airtime",
             	text: "Yes, help Airtime",
+            	"class": "btn",
             	click: function() {
             	    $("#register-form").submit();
             	}

From eecc90547dd8722d437856f75b83262153668d4f Mon Sep 17 00:00:00 2001
From: James <james@sourcefabric-DX4840.(none)>
Date: Tue, 18 Sep 2012 15:47:37 -0400
Subject: [PATCH 3/4] CC-4461: Now Playing: Timeline does not reflect the
 changes on Show start time (which is changed from Calendar->Edit Show)

- fixed
---
 .../application/controllers/ScheduleController.php   |  2 ++
 airtime_mvc/application/models/Scheduler.php         |  2 +-
 airtime_mvc/application/models/ShowInstance.php      | 12 ++++++------
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php
index e061d3d5d..adf84380e 100644
--- a/airtime_mvc/application/controllers/ScheduleController.php
+++ b/airtime_mvc/application/controllers/ScheduleController.php
@@ -783,6 +783,8 @@ class ScheduleController extends Zend_Controller_Action
             $data['add_show_instance_id']);
 
         if ($success) {
+            $scheduler = new Application_Model_Scheduler();
+            $scheduler->removeGaps($data['add_show_instance_id']);
             $this->view->addNewShow = true;
             $this->view->newForm = $this->view->render('schedule/add-show-form.phtml');
         } else {
diff --git a/airtime_mvc/application/models/Scheduler.php b/airtime_mvc/application/models/Scheduler.php
index 95454eeb4..664c40504 100644
--- a/airtime_mvc/application/models/Scheduler.php
+++ b/airtime_mvc/application/models/Scheduler.php
@@ -331,7 +331,7 @@ class Application_Model_Scheduler
     *   This function squeezes all items of a show together so that
     *   there are no gaps between them.
     */
-    private function removeGaps($showInstance, $exclude=null)
+    public function removeGaps($showInstance, $exclude=null)
     {
         Logging::info("removing gaps from show instance #".$showInstance);
 
diff --git a/airtime_mvc/application/models/ShowInstance.php b/airtime_mvc/application/models/ShowInstance.php
index f782ae076..b08a0e37c 100644
--- a/airtime_mvc/application/models/ShowInstance.php
+++ b/airtime_mvc/application/models/ShowInstance.php
@@ -187,12 +187,12 @@ SQL;
             if ($diff != 0) {
                 $sql = <<<SQL
 UPDATE cc_schedule
-SET starts = starts + INTERVAL :diff1 SECOND,
-    ends = ends + INTERVAL :diff2 SECOND
+SET starts = starts + :diff1::INTERVAL SECOND,
+    ends = ends + :diff2::INTERVAL SECOND
 WHERE instance_id = :instanceId
 SQL;
                 Application_Common_Database::prepareAndExecute($sql,
-                    array( 
+                    array(
                         ':diff1'      => $diff,
                         ':diff2'      => $diff,
                         ':instanceId' => $instance_id ), 'execute');
@@ -345,7 +345,7 @@ SQL;
         //$sql = "SELECT timestamp '{$ends}' + interval '{$deltaDay} days' + interval '{$hours}:{$mins}'";
         $sql = "SELECT timestamp :ends + interval :deltaDays + interval :deltaTime";
 
-        $now_ends = Application_Common_Database::prepareAndExecute($sql, 
+        $now_ends = Application_Common_Database::prepareAndExecute($sql,
             array(':ends'      => $ends,
                   ':deltaDays' => "$deltaDay days",
                   ':deltaTime' => "{$hours}:{$mins}"), 'column'
@@ -765,7 +765,7 @@ WHERE si.ends < :timeNow::TIMESTAMP
   AND si.modified_instance = 'f'
 ORDER BY si.ends DESC LIMIT 1;
 SQL;
-        $id = Application_Common_Database( $sql, array( 
+        $id = Application_Common_Database( $sql, array(
             ':timeNow' => $p_timeNow ), 'column' );
 
         return ($id ? new Application_Model_ShowInstance($id) : null );
@@ -818,7 +818,7 @@ SELECT count(*) AS cnt
 FROM cc_show_instances
 WHERE ends < :day
 SQL;
-        return Application_Common_Database::prepareAndExecute( $sql, 
+        return Application_Common_Database::prepareAndExecute( $sql,
             array( ':day' => $day ), 'column' );
     }
 

From 8cae11d588ceeee4041623006d881750584ac3f5 Mon Sep 17 00:00:00 2001
From: denise <denise@denise-DX4860sourcefabric.org>
Date: Tue, 18 Sep 2012 15:52:11 -0400
Subject: [PATCH 4/4] CC-4478: Library: audio preview check should be skipped
 if file does not exist

-fixed
---
 airtime_mvc/public/js/airtime/library/spl.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js
index 3ee9a22ef..79c761efd 100644
--- a/airtime_mvc/public/js/airtime/library/spl.js
+++ b/airtime_mvc/public/js/airtime/library/spl.js
@@ -366,7 +366,7 @@ var AIRTIME = (function(AIRTIME){
     //and verify whether they can be previewed by the browser or not. If not
     //then the playlist element is greyed out
     mod.validatePlaylistElements = function(){
-        $.each($(".big_play"), function(index, value){
+        $.each($(".big_play ui-icon-play"), function(index, value){
             if ($(value).attr('blockId') === undefined) {
                 var mime = $(value).attr("data-mime-type");
                 if (isAudioSupported(mime)) {