From 259a3eb79204620505c6c21a9ca3602273eb9020 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 14:51:29 -0400 Subject: [PATCH 01/16] cc-4359: normpath'd music dir before passing it to manager.py to remove watch --- python_apps/media-monitor2/media/monitor/airtime.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python_apps/media-monitor2/media/monitor/airtime.py b/python_apps/media-monitor2/media/monitor/airtime.py index eba1f76e4..208556f71 100644 --- a/python_apps/media-monitor2/media/monitor/airtime.py +++ b/python_apps/media-monitor2/media/monitor/airtime.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from kombu.messaging import Exchange, Queue, Consumer from kombu.connection import BrokerConnection +from os.path import normpath import json import os @@ -133,7 +134,7 @@ class AirtimeMessageReceiver(Loggable): def remove_watch(self, msg): self.logger.info("Removing watch from directory: '%s'" % msg['directory']) - self.manager.remove_watch_directory(msg['directory']) + self.manager.remove_watch_directory(normpath(msg['directory'])) def rescan_watch(self, msg): self.logger.info("Trying to rescan watched directory: '%s'" % From 987b65af28970d6cf39c4fd85d9c1ae729a46612 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 14:53:26 -0400 Subject: [PATCH 02/16] cc-4347: Extra pdo work --- airtime_mvc/application/models/MusicDir.php | 29 +++++++++++++++------ 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/airtime_mvc/application/models/MusicDir.php b/airtime_mvc/application/models/MusicDir.php index f8e950821..373ad35f1 100644 --- a/airtime_mvc/application/models/MusicDir.php +++ b/airtime_mvc/application/models/MusicDir.php @@ -79,16 +79,29 @@ class Application_Model_MusicDir $music_dir_id = $this->getId(); - $sql = "SELECT DISTINCT s.instance_id from cc_music_dirs as md " - ." LEFT JOIN cc_files as f on f.directory = md.id" - ." RIGHT JOIN cc_schedule as s on s.file_id = f.id WHERE md.id = $music_dir_id"; - - $show_instances = $con->query($sql)->fetchAll(); + $sql = << $music_dir_id ), 'all' ); // get all the files on this dir - $sql = "UPDATE cc_files SET file_exists = 'f' WHERE id IN (SELECT f.id FROM cc_music_dirs as md " - ." LEFT JOIN cc_files as f on f.directory = md.id WHERE md.id = $music_dir_id)"; - $affected = $con->exec($sql); + $sql = << $music_dir_id ), 'all'); // set RemovedFlag to true if ($userAddedWatchedDir) { From 2e0b29b14e29e1f5c176ae8fbc3cc0a09c27fe3f Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 15:31:56 -0400 Subject: [PATCH 03/16] Removed unused code --- airtime_mvc/application/models/Schedule.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index f97b21325..925dcd54b 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -1122,12 +1122,6 @@ SQL; */ //$se = $show_end->format('Y-m-d H:i:s'); if ($update) { - $sql = "SELECT id, starts, ends FROM ".$CC_CONFIG["showInstances"]." - where (ends <= '{$show_end->format('Y-m-d H:i:s')}' - or starts <= '{$show_end->format('Y-m-d H:i:s')}') - and date(starts) >= (date('{$show_end->format('Y-m-d H:i:s')}') - INTERVAL '2 days') - and modified_instance = false and id != ".$instanceId. " order by ends"; - $stmt = $con->prepare("SELECT id, starts, ends FROM {$CC_CONFIG['showInstances']} where (ends <= :show_end1 or starts <= :show_end2) @@ -1141,13 +1135,6 @@ SQL; ':instanceId' => $instanceId )); } else { - // TODO : Remove raw sql later - $sql = "SELECT id, starts, ends FROM ".$CC_CONFIG["showInstances"]." - where (ends <= '{$show_end->format('Y-m-d H:i:s')}' - or starts <= '{$show_end->format('Y-m-d H:i:s')}') - and date(starts) >= (date('{$show_end->format('Y-m-d H:i:s')}') - INTERVAL '2 days') - and modified_instance = false order by ends"; - $stmt = $con->prepare("SELECT id, starts, ends FROM {$CC_CONFIG['showInstances']} where (ends <= :show_end1 or starts <= :show_end2) From 9d825a55b3bb017a027694212b33fa226d0e946a Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 15:32:31 -0400 Subject: [PATCH 04/16] Crap comment removed --- airtime_mvc/application/models/Schedule.php | 1 - 1 file changed, 1 deletion(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 925dcd54b..76c0ad6af 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -1147,7 +1147,6 @@ SQL; ':show_end3' => $show_end->format('Y-m-d H:i:s') )); } - //$rows = $con->query($sql); $rows = $stmt->fetchAll(); foreach ($rows as $row) { From 0c1c4aa27d85d605b6ca2e6207a59484974da943 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 15:35:30 -0400 Subject: [PATCH 05/16] Put sql in heredoc for better readability --- airtime_mvc/application/models/Schedule.php | 27 +++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 76c0ad6af..5abf081ac 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -172,20 +172,21 @@ class Application_Model_Schedule public static function GetLastScheduleItem($p_timeNow) { global $CC_CONFIG; - $sql = "SELECT" - ." ft.artist_name, ft.track_title," - ." st.starts as starts, st.ends as ends" - ." FROM $CC_CONFIG[scheduleTable] st" - ." LEFT JOIN $CC_CONFIG[filesTable] ft" - ." ON st.file_id = ft.id" - ." LEFT JOIN $CC_CONFIG[showInstances] sit" - ." ON st.instance_id = sit.id" - ." WHERE st.ends < TIMESTAMP :timeNow" - ." AND st.starts >= sit.starts" //this and the next line are necessary since we can overbook shows. - ." AND st.starts < sit.ends" - ." ORDER BY st.ends DESC" - ." LIMIT 1"; + $sql = <<= sit.starts + AND st.starts < sit.ends +ORDER BY st.ends DESC LIMIT 1; +SQL; $row = Application_Common_Database::prepareAndExecute($sql, array(':timeNow'=>$p_timeNow)); return $row; From 3107286799f667c010318728b553791b9a788247 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 10 Sep 2012 15:35:32 -0400 Subject: [PATCH 06/16] CC-4370: Transitioning between two webstreams a hiccup in the stream is audible --- airtime_mvc/application/models/Schedule.php | 119 ++++++++++---------- python_apps/pypo/pypofetch.py | 5 - 2 files changed, 57 insertions(+), 67 deletions(-) diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index f97b21325..3bc7064ff 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -527,14 +527,17 @@ SQL; //." st.type AS type," ." si.starts AS show_start," ." si.ends AS show_end," + ." s.name AS show_name," ." f.id AS file_id," ." f.replay_gain AS replay_gain," ." ws.id as stream_id," ." ws.url as url" - ." FROM $CC_CONFIG[scheduleTable] AS st" - ." LEFT JOIN $CC_CONFIG[showInstances] AS si" + ." FROM cc_schedule AS st" + ." LEFT JOIN cc_show_instances AS si" ." ON st.instance_id = si.id" - ." LEFT JOIN $CC_CONFIG[filesTable] AS f" + ." LEFT JOIN cc_show as s" + ." ON s.id = si.show_id" + ." LEFT JOIN cc_files AS f" ." ON st.file_id = f.id" ." LEFT JOIN cc_webstream AS ws" ." ON st.stream_id = ws.id"; @@ -547,11 +550,10 @@ SQL; $sql = $baseQuery.$predicates; - $rows = Application_Common_Database::prepareAndExecute($sql, array(':startTime1'=>$p_startTime, ':endTime'=>$p_endTime, ':startTime2'=>$p_startTime)); + $rows = Application_Common_Database::prepareAndExecute($sql, + array(':startTime1'=>$p_startTime, ':endTime'=>$p_endTime, ':startTime2'=>$p_startTime)); if (count($rows) < 3) { - Logging::debug("Get Schedule: Less than 3 results returned. Doing another query since we need a minimum of 3 results."); - $dt = new DateTime("@".time()); $dt->add(new DateInterval("PT24H")); $range_end = $dt->format("Y-m-d H:i:s"); @@ -564,12 +566,31 @@ SQL; ." LIMIT 3"; $sql = $baseQuery.$predicates; - $rows = Application_Common_Database::prepareAndExecute($sql, array(':startTime1'=>$p_startTime, ':rangeEnd'=>$range_end, ':startTime2'=>$p_startTime)); + $rows = Application_Common_Database::prepareAndExecute($sql, + array(':startTime1'=>$p_startTime, ':rangeEnd'=>$range_end, ':startTime2'=>$p_startTime)); } return $rows; } + /** + * This function will ensure that an existing index in the + * associative array is never overwritten, instead appending + * _0, _1, _2, ... to the end of the key to make sure it is unique + */ + private static function appendScheduleItem(&$data, $time, $item) + { + $key = $time; + $i = 0; + + while (array_key_exists($key, $data["media"])) { + $key = "{$time}_{$i}"; + $i++; + } + + $data["media"][$key] = $item; + } + private static function createInputHarborKickTimes(&$data, $range_start, $range_end) { $utcTimeZone = new DateTimeZone("UTC"); @@ -601,7 +622,7 @@ SQL; } } - private static function createFileScheduleEvent(&$data, $item, $media_id) + private static function createFileScheduleEvent(&$data, $item, $media_id, $uri) { $start = self::AirtimeTimeToPypoTime($item["start"]); $end = self::AirtimeTimeToPypoTime($item["end"]); @@ -617,14 +638,14 @@ SQL; 'cue_out' => Application_Common_DateHelper::CalculateLengthInSeconds($item["cue_out"]), 'start' => $start, 'end' => $end, - 'show_name' => $showName, + 'show_name' => $item["show_name"], 'replay_gain' => is_null($item["replay_gain"]) ? "0": $item["replay_gain"], 'independent_event' => true ); - $data["media"][$start] = $schedule_item; + self::appendScheduleItem($data, $start, $schedule_item); } - private static function createStreamScheduleEvent(&$data, $item, $media_id) + private static function createStreamScheduleEvent(&$data, $item, $media_id, $uri) { $start = self::AirtimeTimeToPypoTime($item["start"]); $end = self::AirtimeTimeToPypoTime($item["end"]); @@ -644,8 +665,8 @@ SQL; 'independent_event' => true ); - //TODO: Make sure no other media is being overwritten! - $data["media"][$stream_buffer_start] = $schedule_item; + self::appendScheduleItem($data, $start, $schedule_item); + $schedule_item = array( 'id' => $media_id, 'type' => 'stream_output_start', @@ -653,21 +674,16 @@ SQL; 'uri' => $uri, 'start' => $start, 'end' => $end, - 'show_name' => $showName, + 'show_name' => $item["show_name"], 'independent_event' => true ); - $data["media"][$start] = $schedule_item; + self::appendScheduleItem($data, $start, $schedule_item); //since a stream never ends we have to insert an additional "kick stream" event. The "start" //time of this event is the "end" time of the stream minus 1 second. $dt = new DateTime($item["end"], new DateTimeZone('UTC')); $dt->sub(new DateInterval("PT1S")); - //make sure the webstream doesn't play past the end time of the show - if ($dt->getTimestamp() > $showEndDateTime->getTimestamp()) { - $dt = $showEndDateTime; - } - $stream_end = self::AirtimeTimeToPypoTime($dt->format("Y-m-d H:i:s")); $schedule_item = array( @@ -677,8 +693,7 @@ SQL; 'type' => 'stream_buffer_end', 'independent_event' => true ); - $data["media"][$stream_end] = $schedule_item; - + self::appendScheduleItem($data, $stream_end, $schedule_item); $schedule_item = array( 'start' => $stream_end, @@ -687,7 +702,7 @@ SQL; 'type' => 'stream_output_end', 'independent_event' => true ); - $data["media"][$stream_end] = $schedule_item; + self::appendScheduleItem($data, $stream_end, $schedule_item); } private static function getRangeStartAndEnd($p_fromDateTime, $p_toDateTime) @@ -723,28 +738,14 @@ SQL; return array($range_start, $range_end); } - public static function getSchedule($p_fromDateTime = null, $p_toDateTime = null) + + private static function createScheduledEvents(&$data, $range_start, $range_end) { - - list($range_start, $range_end) = self::getRangeStartAndEnd($p_fromDateTime, $p_toDateTime); - - $data = array(); $utcTimeZone = new DateTimeZone("UTC"); - - $data["status"] = array(); - $data["media"] = array(); - - self::createInputHarborKickTimes($data, $range_start, $range_end); - $items = self::getItems($range_start, $range_end); foreach ($items as $item) { - - $showInstance = CcShowInstancesQuery::create()->findPK($item["instance_id"]); - $showId = $showInstance->getDbShowId(); - $show = CcShowQuery::create()->findPK($showId); - $showName = $show->getDbName(); - $showEndDateTime = new DateTime($item["show_end"], $utcTimeZone); + $trackStartDateTime = new DateTime($item["start"], $utcTimeZone); $trackEndDateTime = new DateTime($item["end"], $utcTimeZone); @@ -773,29 +774,21 @@ SQL; self::createStreamScheduleEvent($data, $item, $media_id, $uri); } } + } + + public static function getSchedule($p_fromDateTime = null, $p_toDateTime = null) + { + list($range_start, $range_end) = self::getRangeStartAndEnd($p_fromDateTime, $p_toDateTime); + + $data = array(); + $data["media"] = array(); + + self::createInputHarborKickTimes($data, $range_start, $range_end); + self::createScheduledEvents($data, $range_start, $range_end); + return $data; } - /* - private static function collapseEvents($data) - { - $keys = array_keys($data); - - for ($i = 0, $len = count($keys); $i < $len; $i++) { - $cur = $data[$keys[$i]]; - $next = null; - if ($i+1 < $len) { - $next = $data[$keys[$i+1]]; - } - - if ($cur['type'] == 'stream_buffer_end' && !is_null($next) && $next['type'] == 'stream_buffer_start') { - unset($data[$keys[$i]]); - } - - } - } - */ - public static function deleteAll() { global $CC_CONFIG; @@ -896,10 +889,12 @@ SQL; $when = $formWhen->isValid($data); if ($when && $formWhen->checkReliantFields($data, true, null, true)) { - $start_dt = new DateTime($data['add_show_start_date']." ".$data['add_show_start_time'], new DateTimeZone(date_default_timezone_get())); + $start_dt = new DateTime($data['add_show_start_date']." ".$data['add_show_start_time'], + new DateTimeZone(date_default_timezone_get())); $start_dt->setTimezone(new DateTimeZone('UTC')); - $end_dt = new DateTime($data['add_show_end_date_no_repeat']." ".$data['add_show_end_time'], new DateTimeZone(date_default_timezone_get())); + $end_dt = new DateTime($data['add_show_end_date_no_repeat']." ".$data['add_show_end_time'], + new DateTimeZone(date_default_timezone_get())); $end_dt->setTimezone(new DateTimeZone('UTC')); $ccShowInstance = CcShowInstancesQuery::create()->findPK($data["add_show_instance_id"]); diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index 3f7cceb6e..9cd069b44 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -456,11 +456,6 @@ class PypoFetch(Thread): for key in media: media_item = media[key] - """ - {u'end': u'2012-07-26-04-05-00', u'fade_out': 500, u'show_name': u'Untitled Show', u'uri': u'http://', - u'cue_in': 0, u'start': u'2012-07-26-04-00-00', u'replay_gain': u'0', u'row_id': 16, u'cue_out': 300, u'type': - u'stream', u'id': 1, u'fade_in': 500} - """ if (media_item['type'] == 'file'): fileExt = os.path.splitext(media_item['uri'])[1] dst = os.path.join(download_dir, unicode(media_item['id']) + fileExt) From 67b295a553fe07fd36c3cc1983adcbb50cc75726 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 10 Sep 2012 15:37:22 -0400 Subject: [PATCH 07/16] CC-4367: Media Library -> Search: Please enable searching Bit Rate by Kbps - done --- airtime_mvc/application/models/Datatables.php | 3 +++ airtime_mvc/public/js/airtime/library/library.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/Datatables.php b/airtime_mvc/application/models/Datatables.php index 67586b3b3..a58a1fdb1 100644 --- a/airtime_mvc/application/models/Datatables.php +++ b/airtime_mvc/application/models/Datatables.php @@ -13,6 +13,9 @@ class Application_Model_Datatables if ($dbname == 'utime' || $dbname == 'mtime') { $input1 = isset($info[0])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[0]):null; $input2 = isset($info[1])?Application_Common_DateHelper::ConvertToUtcDateTimeString($info[1]):null; + } else if($dbname == 'bit_rate') { + $input1 = isset($info[0])?intval($info[0]) * 1000:null; + $input2 = isset($info[1])?intval($info[1]) * 1000:null; } else { $input1 = isset($info[0])?$info[0]:null; $input2 = isset($info[1])?$info[1]:null; diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js index ba7c0f574..276551d6a 100644 --- a/airtime_mvc/public/js/airtime/library/library.js +++ b/airtime_mvc/public/js/airtime/library/library.js @@ -416,7 +416,7 @@ var AIRTIME = (function(AIRTIME) { /* Language */ { "sTitle" : "Language" , "mDataProp" : "language" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } , /* Owner */ { "sTitle" : "Owner" , "mDataProp" : "owner" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } , /* Conductor */ { "sTitle" : "Conductor" , "mDataProp" : "conductor" , "bVisible" : false , "sClass" : "library_conductor" , "sWidth" : "125px" }, - /* Replay Gain */ { "sTitle" : "Replay Gain" , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "125px" } + /* Replay Gain */ { "sTitle" : "Replay Gain" , "mDataProp" : "replay_gain" , "bVisible" : false , "sClass" : "library_language" , "sWidth" : "80px" } ], "bProcessing": true, From dfb1ffed7907b515497b5593b2c99922d9887cad Mon Sep 17 00:00:00 2001 From: James Date: Mon, 10 Sep 2012 15:42:05 -0400 Subject: [PATCH 08/16] CC-4319: Calendar: Remove all contents doesn't work - fixed --- airtime_mvc/application/controllers/ScheduleController.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index f96d8ffb2..0c843786e 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -339,7 +339,7 @@ class ScheduleController extends Zend_Controller_Action return false; } - if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER) && $user->isHostOfShow($show->getShowId()))) + if($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)) || $user->isHostOfShow($show->getShowId())) $show->clearShow(); } @@ -404,7 +404,7 @@ class ScheduleController extends Zend_Controller_Action return false; } - if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER) && $user->isHostOfShow($show->getShowId()))) { + if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER)) || $user->isHostOfShow($show->getShowId())) { $show->removeGroupFromShow($group_id); } From c90ead9ef26e8d4c8af19e21e71e766f485ad510 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 16:08:08 -0400 Subject: [PATCH 09/16] cc-4359: fixed at the cost of other issues that will be fixed later (restarting media monitor). --- airtime_mvc/application/controllers/ApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 1045255e0..941281ee1 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -690,7 +690,7 @@ class ApiController extends Zend_Controller_Action $dir_id = $request->getParam('dir_id'); $this->view->files = - Application_Model_StoredFile::listAllFiles($dir_id,$all=true); + Application_Model_StoredFile::listAllFiles($dir_id,$all=false); } public function listAllWatchedDirsAction() From af225418c4573c7514888cf278b88652641984a4 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 16:08:21 -0400 Subject: [PATCH 10/16] Removed empty constructor. --- airtime_mvc/application/models/StoredFile.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 4d62bccb6..d84e74bd5 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -51,11 +51,6 @@ class Application_Model_StoredFile "owner_id" => "DbOwnerId" ); - public function __construct() - { - - } - public function getId() { return $this->_file->getDbId(); From c4f486e539794e33e1beb96731ebcc976299a90e Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 16:08:33 -0400 Subject: [PATCH 11/16] MM2: More detailed logging. --- python_apps/media-monitor2/media/monitor/airtime.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python_apps/media-monitor2/media/monitor/airtime.py b/python_apps/media-monitor2/media/monitor/airtime.py index 208556f71..bb8f1dd9d 100644 --- a/python_apps/media-monitor2/media/monitor/airtime.py +++ b/python_apps/media-monitor2/media/monitor/airtime.py @@ -126,7 +126,10 @@ class AirtimeMessageReceiver(Loggable): except Exception as e: self.fatal_exception("Failed to create watched dir '%s'" % msg['directory'],e) - else: self.new_watch(msg) + else: + self.logger.info("Created new watch directory: '%s'" % + msg['directory']) + self.new_watch(msg) else: self.__request_now_bootstrap( directory=msg['directory'] ) self.manager.add_watch_directory(msg['directory']) From f8e1bec318738fabf9189de942d2dd185ef929f5 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 10 Sep 2012 16:24:15 -0400 Subject: [PATCH 12/16] add force-yes to all airtime-full-install packages --- install_full/ubuntu/airtime-full-install | 8 ++++---- install_full/ubuntu/airtime-full-install-nginx | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/install_full/ubuntu/airtime-full-install b/install_full/ubuntu/airtime-full-install index 57faff468..6d1142bdb 100755 --- a/install_full/ubuntu/airtime-full-install +++ b/install_full/ubuntu/airtime-full-install @@ -64,15 +64,15 @@ apt-get -y --force-yes install libmp3lame-dev lame icecast2 #Ubuntu Lucid has both zendframework and zend-framework. Difference appears to be that zendframework is for #1.10 and zend-framework is 1.11 if [ "$dist" = "Debian" ]; then - apt-get -y install zendframework + apt-get -y --force-yes install zendframework else - apt-get -y install libzend-framework-php + apt-get -y --force-yes install libzend-framework-php fi if [ "$code" = "lucid" ]; then - apt-get -y install timeout + apt-get -y --force-yes install timeout else - apt-get -y install coreutils + apt-get -y --force-yes install coreutils fi diff --git a/install_full/ubuntu/airtime-full-install-nginx b/install_full/ubuntu/airtime-full-install-nginx index c00e3f159..c0b70195f 100755 --- a/install_full/ubuntu/airtime-full-install-nginx +++ b/install_full/ubuntu/airtime-full-install-nginx @@ -54,15 +54,15 @@ apt-get -y --force-yes install libmp3lame-dev lame icecast2 #Ubuntu Lucid has both zendframework and zend-framework. Difference appears to be that zendframework is for #1.10 and zend-framework is 1.11 if [ "$dist" = "Debian" ]; then - apt-get -y install zendframework + apt-get -y install --force-yes zendframework else - apt-get -y install libzend-framework-php + apt-get -y install --force-yes libzend-framework-php fi if [ "$code" = "lucid" ]; then - apt-get -y install timeout + apt-get -y install --force-yes timeout else - apt-get -y install coreutils + apt-get -y install --force-yes coreutils fi # NGINX Config File From fba0e18620e34284b2d71e015ebff2de409bf4bb Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 10 Sep 2012 16:26:30 -0400 Subject: [PATCH 13/16] add force-yes to all airtime-full-install packages --- install_full/ubuntu/airtime-full-install-nginx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_full/ubuntu/airtime-full-install-nginx b/install_full/ubuntu/airtime-full-install-nginx index c0b70195f..a41937b11 100755 --- a/install_full/ubuntu/airtime-full-install-nginx +++ b/install_full/ubuntu/airtime-full-install-nginx @@ -38,7 +38,7 @@ fi apt-get update # Updated package list -apt-get -y install tar gzip curl nginx php5-pgsql php5-fpm \ +apt-get -y --force-yes install tar gzip curl nginx php5-pgsql php5-fpm \ php-pear php5-gd postgresql odbc-postgresql python libsoundtouch-ocaml \ libtaglib-ocaml libao-ocaml libmad-ocaml ecasound \ libesd0 libportaudio2 libsamplerate0 rabbitmq-server patch \ From 4fe840765914496b7a9466fe6e166720b63d7454 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 16:29:17 -0400 Subject: [PATCH 14/16] Adde configurable value for list_all_files --- airtime_mvc/application/controllers/ApiController.php | 5 ++++- python_apps/api_clients/api_client.cfg | 2 +- python_apps/api_clients/api_client.py | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 941281ee1..20fdbf9b6 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -688,9 +688,12 @@ class ApiController extends Zend_Controller_Action { $request = $this->getRequest(); $dir_id = $request->getParam('dir_id'); + $all = $request->getParam('all'); + + Logging::info("All param is: $all"); $this->view->files = - Application_Model_StoredFile::listAllFiles($dir_id,$all=false); + Application_Model_StoredFile::listAllFiles($dir_id,$all); } public function listAllWatchedDirsAction() diff --git a/python_apps/api_clients/api_client.cfg b/python_apps/api_clients/api_client.cfg index fdd7c3b1b..efdcc763f 100644 --- a/python_apps/api_clients/api_client.cfg +++ b/python_apps/api_clients/api_client.cfg @@ -34,7 +34,7 @@ upload_recorded = 'upload-recorded/format/json/api_key/%%api_key%%/fileid/%%file update_media_url = 'reload-metadata/format/json/api_key/%%api_key%%/mode/%%mode%%' # URL to tell Airtime we want a listing of all files it knows about -list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%' +list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%/all/%%all%%' # URL to tell Airtime we want a listing of all dirs its watching (including the stor dir) list_all_watched_dirs = 'list-all-watched-dirs/format/json/api_key/%%api_key%%' diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index 983b59281..d2fbf23be 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -474,11 +474,12 @@ class AirtimeApiClient(): #{"files":["path/to/file1", "path/to/file2"]} #Note that these are relative paths to the given directory. The full #path is not returned. - def list_all_db_files(self, dir_id): + def list_all_db_files(self, dir_id, all_files=True): logger = self.logger try: url = self.construct_url("list_all_db_files") url = url.replace("%%dir_id%%", dir_id) + url = url.replace("%%all%%", all_files) response = self.get_response_from_server(url) response = json.loads(response) except Exception, e: @@ -488,7 +489,8 @@ class AirtimeApiClient(): try: return response["files"] except KeyError: - self.logger.error("Could not find index 'files' in dictionary: %s", str(response)) + self.logger.error("Could not find index 'files' in dictionary: %s", + str(response)) return [] def list_all_watched_dirs(self): From fdc7245a15d19c93e1d9fe39f879aee47d3ce0e7 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Mon, 10 Sep 2012 16:30:18 -0400 Subject: [PATCH 15/16] Removed translation of dashes to slashes. --- python_apps/media-monitor2/media/monitor/pure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_apps/media-monitor2/media/monitor/pure.py b/python_apps/media-monitor2/media/monitor/pure.py index 9fe1b41df..d60373d26 100644 --- a/python_apps/media-monitor2/media/monitor/pure.py +++ b/python_apps/media-monitor2/media/monitor/pure.py @@ -239,7 +239,7 @@ def normalized_metadata(md, original_path): """ new_md = copy.deepcopy(md) # replace all slashes with dashes - for k,v in new_md.iteritems(): new_md[k] = unicode(v).replace('/','-') + #for k,v in new_md.iteritems(): new_md[k] = unicode(v).replace('/','-') # Specific rules that are applied in a per attribute basis format_rules = { 'MDATA_KEY_TRACKNUMBER' : parse_int, From 52921374303047e5029ed5d741b4274eb6028063 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 10 Sep 2012 16:54:42 -0400 Subject: [PATCH 16/16] -return json as data type for schedule action --- airtime_mvc/application/controllers/ApiController.php | 1 + airtime_mvc/application/models/Webstream.php | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 1045255e0..66ff34c22 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -337,6 +337,7 @@ class ApiController extends Zend_Controller_Action $this->_helper->viewRenderer->setNoRender(true); $data = Application_Model_Schedule::getSchedule(); + header("Content-Type: application/json"); echo json_encode($data, JSON_FORCE_OBJECT); } diff --git a/airtime_mvc/application/models/Webstream.php b/airtime_mvc/application/models/Webstream.php index b1d4b2b77..4f721c567 100644 --- a/airtime_mvc/application/models/Webstream.php +++ b/airtime_mvc/application/models/Webstream.php @@ -262,7 +262,6 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable private static function getPlsUrl($url) { $content = self::getUrlData($url); - $ini = parse_ini_string($content, true); if ($ini !== false && isset($ini["playlist"]) && isset($ini["playlist"]["File1"])) {