From 2d11595a33901a7789f54fc22e21ce6180f9f41b Mon Sep 17 00:00:00 2001 From: "paul.baranowski" Date: Thu, 24 Mar 2011 16:44:23 -0400 Subject: [PATCH 01/58] CC-2100 Remove tables that are not in use Removed tables from the schema. --- build/schema.xml | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) diff --git a/build/schema.xml b/build/schema.xml index f00ad14fb..3bd235e09 100644 --- a/build/schema.xml +++ b/build/schema.xml @@ -24,13 +24,6 @@ - - - - - - -
@@ -295,45 +288,4 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
From c0e815207777f9e2dd59430a50ce0f04ab684d17 Mon Sep 17 00:00:00 2001 From: Naomi Date: Mon, 28 Mar 2011 15:39:01 -0400 Subject: [PATCH 02/58] CC-2110 : Soundcloud file metadata added text area to preferences to allow for additional soundcloud tags. --- application/controllers/PreferenceController.php | 3 ++- application/forms/Preferences.php | 8 ++++++++ application/models/Preference.php | 8 ++++++++ application/models/Soundcloud.php | 14 +++++++++++++- 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/application/controllers/PreferenceController.php b/application/controllers/PreferenceController.php index 58bd6416d..61508bb1c 100644 --- a/application/controllers/PreferenceController.php +++ b/application/controllers/PreferenceController.php @@ -32,7 +32,8 @@ class PreferenceController extends Zend_Controller_Action Application_Model_Preference::SetStreamLabelFormat($values["streamFormat"]); Application_Model_Preference::SetDoSoundCloudUpload($values["UseSoundCloud"]); Application_Model_Preference::SetSoundCloudUser($values["SoundCloudUser"]); - Application_Model_Preference::SetSoundCloudPassword($values["SoundCloudPassword"]); + Application_Model_Preference::SetSoundCloudPassword($values["SoundCloudPassword"]); + Application_Model_Preference::SetSoundCloudTags($values["SoundCloudTags"]); $this->view->statusMsg = "Preferences Updated."; } diff --git a/application/forms/Preferences.php b/application/forms/Preferences.php index 23cda3d3f..2e770a9a6 100644 --- a/application/forms/Preferences.php +++ b/application/forms/Preferences.php @@ -67,6 +67,14 @@ class Application_Form_Preferences extends Zend_Form 'value' => Application_Model_Preference::GetSoundCloudPassword() )); + // Add the description element + $this->addElement('textarea', 'SoundCloudTags', array( + 'label' => 'space separated SoundCloud Tags', + 'required' => false, + 'class' => 'input_text_area', + 'value' => Application_Model_Preference::GetSoundCloudTags() + )); + $this->addElement('submit', 'submit', array( 'class' => 'ui-button ui-state-default', 'ignore' => true, diff --git a/application/models/Preference.php b/application/models/Preference.php index 8662f4424..948b29645 100644 --- a/application/models/Preference.php +++ b/application/models/Preference.php @@ -124,5 +124,13 @@ class Application_Model_Preference return Application_Model_Preference::GetValue("soundcloud_password"); } + public static function SetSoundCloudTags($tags) { + Application_Model_Preference::SetValue("soundcloud_tags", $tags); + } + + public static function GetSoundCloudTags() { + return Application_Model_Preference::GetValue("soundcloud_tags"); + } + } diff --git a/application/models/Soundcloud.php b/application/models/Soundcloud.php index 352bd8ea7..78e9223a5 100644 --- a/application/models/Soundcloud.php +++ b/application/models/Soundcloud.php @@ -32,7 +32,13 @@ class ATSoundcloud { { if($this->getToken()) { - $tags = join(" ", $tags); + if(count($tags)) { + $tags = join(" ", $tags); + $tags = $tags." ".Application_Model_Preference::GetSoundCloudTags(); + } + else { + $tags = Application_Model_Preference::GetSoundCloudTags(); + } $track_data = array( 'track[sharing]' => 'private', @@ -47,11 +53,17 @@ class ATSoundcloud { $this->_soundcloud->post('tracks', $track_data), true ); + + echo var_dump($response); } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) { echo $e->getMessage(); } } + else + { + echo "could not get soundcloud token"; + } } } From 96a2861cfa2ee7cff3eba82f66942cf67bb37659 Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Mon, 28 Mar 2011 15:38:41 -0400 Subject: [PATCH 03/58] Improved messages during install. --- install/airtime-install.php | 14 +++++++------- install/installInit.php | 18 +++++++++++++++--- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/install/airtime-install.php b/install/airtime-install.php index 7402b5355..aea7ea529 100644 --- a/install/airtime-install.php +++ b/install/airtime-install.php @@ -26,28 +26,28 @@ AirtimeInstall::UpdateIniValue('../build/build.properties', 'project.home', real echo PHP_EOL."*** Database Installation ***".PHP_EOL; -echo "* Creating Airtime Database User".PHP_EOL; +echo "* Creating Airtime database user".PHP_EOL; AirtimeInstall::CreateDatabaseUser(); -echo "* Creating Airtime Database".PHP_EOL; +echo "* Creating Airtime database".PHP_EOL; AirtimeInstall::CreateDatabase(); AirtimeInstall::DbConnect(true); -echo "* Install Postgresql Scripting Language".PHP_EOL; +echo "* Installing Postgresql scripting language".PHP_EOL; AirtimeInstall::InstallPostgresScriptingLanguage(); -echo "* Creating Database Tables".PHP_EOL; +echo "* Creating database tables".PHP_EOL; AirtimeInstall::CreateDatabaseTables(); AirtimeInstall::MigrateTables(__DIR__); -echo "* Storage Directory Setup".PHP_EOL; +echo "* Storage directory setup".PHP_EOL; AirtimeInstall::SetupStorageDirectory($CC_CONFIG); -echo "* Setting Dir Permissions".PHP_EOL; +echo "* Giving Apache permission to access the storage directory".PHP_EOL; AirtimeInstall::ChangeDirOwnerToWebserver($CC_CONFIG["storageDir"]); -echo "* Importing Sample Audio Clips".PHP_EOL; +echo "* Importing sample audio clips".PHP_EOL; system(__DIR__."/../utils/airtime-import --copy ../audio_samples/ > /dev/null"); echo PHP_EOL."*** Pypo Installation ***".PHP_EOL; diff --git a/install/installInit.php b/install/installInit.php index 6723b063a..3f8930e12 100644 --- a/install/installInit.php +++ b/install/installInit.php @@ -144,9 +144,15 @@ class AirtimeInstall { @exec($command, $output, $results); if ($results == 0) { - echo "* User {$CC_CONFIG['dsn']['username']} created.".PHP_EOL; + echo "* Database user '{$CC_CONFIG['dsn']['username']}' created.".PHP_EOL; } else { - echo "* Could not create user {$CC_CONFIG['dsn']['username']}: $output".PHP_EOL; + if (count($output) > 0) { + echo "* Could not create user '{$CC_CONFIG['dsn']['username']}': ".PHP_EOL; + echo implode(PHP_EOL, $output); + } + else { + echo "* Database user '{$CC_CONFIG['dsn']['username']}' already exists.".PHP_EOL; + } } } @@ -159,7 +165,13 @@ class AirtimeInstall { if ($results == 0) { echo "* Database '{$CC_CONFIG['dsn']['database']}' created.".PHP_EOL; } else { - echo "* Could not create database '{$CC_CONFIG['dsn']['database']}': $output".PHP_EOL; + if (count($output) > 0) { + echo "* Could not create database '{$CC_CONFIG['dsn']['database']}': ".PHP_EOL; + echo implode(PHP_EOL, $output); + } + else { + echo "* Database '{$CC_CONFIG['dsn']['database']}' already exists.".PHP_EOL; + } } } From e6e2d70adc35f12f941b55dcc44ce79b12283851 Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Mon, 28 Mar 2011 15:42:32 -0400 Subject: [PATCH 04/58] Added credits for 1.7. --- CREDITS | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/CREDITS b/CREDITS index 05fff9198..bb5d3dad4 100644 --- a/CREDITS +++ b/CREDITS @@ -2,11 +2,30 @@ CREDITS ======= +Version 1.7.0 +------------- +Naomi Aro (naomi.aro@sourcefabric.org) + Role: Software Developer + +Martin Konecny (martin.konecny@sourcefabric.org) + Role: Software Developer + +Ofir Gal (ofir.gal@sourcefabric.org) + Role: QA + +Daniel James + Role: Documentor & QA + +Paul Baranowski (paul.baranowski@sourcefabric.org) + Role: Project Manager + + Version 1.6.1 ------------- Version 1.6.1 fixes a problem with playout being interrupted after 48 hours. It also fixes some security issues. + Version 1.6.0 ------------- This version marks a major change to the project, completely replacing the @@ -27,11 +46,14 @@ Naomi Aro (naomi.aro@sourcefabric.org) - Conversion to Propel DB backend Martin Konecny (martin.konecny@sourcefabric.org) - Role:Software Developer + Role: Software Developer Highlights: - New User Interface - Scheduler/Backend +Ofir Gal (ofir.gal@sourcefabric.org) + Role: QA + Daniel James Role: Documentor & QA From f0c47232af5e33cbba9929a3749f57f305d152ea Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Mon, 28 Mar 2011 16:12:55 -0400 Subject: [PATCH 05/58] Fixed up INSTALL docs. --- INSTALL | 35 +++++++++++++++++------------------ README | 2 ++ 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/INSTALL b/INSTALL index 1eea4e8fe..88f7a5807 100644 --- a/INSTALL +++ b/INSTALL @@ -1,23 +1,22 @@ --------------------------------------------------------------------------------- +Airtime is the open radio software for scheduling and remote station management. +Home page: http://airtime.sourcefabric.org/ - Copyright (c) 2010-2011 Sourcefabric O.P.S. +Installation instructions are here: + http://wiki.sourcefabric.org/x/BQBF - This file is part of the Airtime project. - http://airtime.sourcefabric.org/ +Here is the manual: + http://new.flossmanuals.net/airtime/index + +To report bugs, visit our bug tracker at: + http://dev.sourcefabric.org/browse/CC + +Visit our community support forum here: + http://forum.sourcefabric.org/index.php/f/14/ - To report bugs, visit our bug tracker at: - http://dev.sourcefabric.org/browse/CC +For commercial support, see: + http://sourcefabric.org/en/services/about/347/Support.htm + or send an e-mail to contact@sourcefabric.org - Visit our community support forum here: - http://forum.sourcefabric.org/index.php/f/14/ - - For commercial support, see http://sourcefabric.org/en/services/about/347/Support.htm - or send an e-mail to contact@sourcefabric.org +If you are a developer and want to hack on Airtime, go here: + http://wiki.sourcefabric.org/display/CC --------------------------------------------------------------------------------- - -Please see this page for install instructions: -http://wiki.sourcefabric.org/display/CC/Installing+Airtime+%28v1.6%29 - -If you are a developer, see this page: -http://wiki.sourcefabric.org/display/CC diff --git a/README b/README index 111c0e95c..0747ce34a 100644 --- a/README +++ b/README @@ -4,6 +4,8 @@ Airtime is an open source application that provides remote automation of a radio station. +Home page: http://airtime.sourcefabric.org/ + Major features: * Web-based remote station management. Authorized personnel can add program material, create playlists, and schedule programming all via From ab5a6bc1c526930edd020c409eee3a9b3a403185 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 28 Mar 2011 16:28:23 -0400 Subject: [PATCH 06/58] CC-1990: Widget to display schedule and "Now Playing" on any website -added third requested widget --- plugins/jquery.showinfo.js | 109 +++++++++++++++++++++++++++++++++++-- 1 file changed, 105 insertions(+), 4 deletions(-) diff --git a/plugins/jquery.showinfo.js b/plugins/jquery.showinfo.js index c31381a10..87b5c1ad8 100644 --- a/plugins/jquery.showinfo.js +++ b/plugins/jquery.showinfo.js @@ -6,6 +6,7 @@ sourceDomain: "http://localhost/", //where to get show status from }; var options = $.extend(defaults, options); + options.sourceDomain = addEndingBackslash(options.sourceDomain); return this.each(function() { var obj = $(this); @@ -58,7 +59,7 @@ $.ajax({ url: options.sourceDomain + "api/live-info/", dataType:"jsonp", success:function(data){ processData(data); }, error:function(jqXHR, textStatus, errorThrown){}}); - setTimeout(getServerData, defaults.updatePeriod*1000); + setTimeout(getServerData, options.updatePeriod*1000); } }); }; @@ -71,9 +72,10 @@ var defaults = { updatePeriod: 5, //seconds sourceDomain: "http://localhost/", //where to get show status from - audioStreamSource: "" //where to get audio stream from + audioStreamSource: "http://localhost:8000/airtime.mp3" //where to get audio stream from }; var options = $.extend(defaults, options); + options.sourceDomain = addEndingBackslash(options.sourceDomain); return this.each(function() { var obj = $(this); @@ -106,7 +108,7 @@ } obj.empty(); - obj.append("Listen WADR Live"); + obj.append("Listen WADR Live"); obj.append("

"+showStatus+" >>

"); obj.append("
    " + "
  • Current: "+currentShowName+ @@ -129,12 +131,111 @@ $.ajax({ url: options.sourceDomain + "api/live-info/", dataType:"jsonp", success:function(data){ processData(data); }, error:function(jqXHR, textStatus, errorThrown){}}); - setTimeout(getServerData, defaults.updatePeriod*1000); + setTimeout(getServerData, options.updatePeriod*1000); } }); }; })(jQuery); +(function($){ + $.fn.airtimeWeekSchedule = function(options) { + + var defaults = { + sourceDomain: "http://localhost/", //where to get show status from + updatePeriod: 600, + dowText: {monday:"Monday", tuesday:"Tuesday", wednesday:"Wednesday", thursday:"Thursday", friday:"Friday", saturday:"Saturday", sunday:"Sunday"}, + miscText: {time:"Time", programName:"Program Name", details:"Details", readMore:"Read More"} + }; + var options = $.extend(defaults, options); + options.sourceDomain = addEndingBackslash(options.sourceDomain); + + return this.each(function() { + var obj = $(this); + obj.empty(); + + obj.attr("class", "ui-tabs"); + + var dow = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]; + + var html = '
      '; + for (var i=0; i'+options.dowText[dow[i]]+''; + } + html += '
    '; + + for (var i=0; i' + } + obj.append(html); + getServerData(); + + function updateWidget(data){ + for (var i=0; i'+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+options.miscText.time+''+ + ''+options.miscText.programName+''+ + ''+options.miscText.details+''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''; + var daySchedule = data[dow[i]]; + for (var j=0; j'+ + ''+getTime(daySchedule[j].show_starts)+ " - " + getTime(daySchedule[j].show_ends)+''+ + ''+ + '

    '+daySchedule[j].show_name+'

    '+ + ''+ + ''+ + ''+ + ''+ + ''; + } + html += + ''+ + ''; + + $("#"+dow[i]).empty(); + $("#"+dow[i]).append(html); + } + } + + function processData(data){ + updateWidget(data); + } + + function getServerData(){ + $.ajax({ url: options.sourceDomain + "api/week-info/", dataType:"jsonp", success:function(data){ + processData(data); + }, error:function(jqXHR, textStatus, errorThrown){}}); + setTimeout(getServerData, options.updatePeriod*1000); + } + }); + }; +})(jQuery); + +function addEndingBackslash(str){ + if (str.charAt(str.length-1) != '/') + return str+'/'; + else return str; +} + /* ScheduleData class BEGIN */ function ScheduleData(data){ this.data = data; From 2aa0cd22c6d4d546d2cc2347949fdc76080172e8 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 28 Mar 2011 16:29:50 -0400 Subject: [PATCH 07/58] CC-1990: Widget to display schedule and "Now Playing" on any website -update to API controller to support new widget --- application/controllers/ApiController.php | 18 +++++++++++++++-- application/models/Shows.php | 24 +++++++++++++++++++++++ 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/application/controllers/ApiController.php b/application/controllers/ApiController.php index 1cc2e0303..335ae52e0 100644 --- a/application/controllers/ApiController.php +++ b/application/controllers/ApiController.php @@ -104,8 +104,6 @@ class ApiController extends Zend_Controller_Action } public function liveInfoAction(){ - global $CC_CONFIG; - // disable the view and the layout $this->view->layout()->disableLayout(); $this->_helper->viewRenderer->setNoRender(true); @@ -126,6 +124,22 @@ class ApiController extends Zend_Controller_Action echo $_GET['callback'].'('.json_encode($result).')'; } + public function weekInfoAction(){ + // disable the view and the layout + $this->view->layout()->disableLayout(); + $this->_helper->viewRenderer->setNoRender(true); + + $dow = array("sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"); + + $result = array(); + for ($i=0; $i<7; $i++){ + $result[$dow[$i]] = Show_DAL::GetShowsByDayOfWeek($i); + } + + header("Content-type: text/javascript"); + echo $_GET['callback'].'('.json_encode($result).')'; + } + public function scheduleAction() { global $CC_CONFIG; diff --git a/application/models/Shows.php b/application/models/Shows.php index 8aa83beae..2ba843697 100644 --- a/application/models/Shows.php +++ b/application/models/Shows.php @@ -935,4 +935,28 @@ class Show_DAL { return $CC_DBC->GetAll($sql); } + public static function GetShowsByDayOfWeek($day){ + //DOW FROM TIMESTAMP + //The day of the week (0 - 6; Sunday is 0) (for timestamp values only) + + //SELECT EXTRACT(DOW FROM TIMESTAMP '2001-02-16 20:38:40'); + //Result: 5 + + global $CC_CONFIG, $CC_DBC; + $sql = "SELECT" + ." si.starts as show_starts," + ." si.ends as show_ends," + ." s.name as show_name," + ." s.url as url" + ." FROM $CC_CONFIG[showInstances] si" + ." LEFT JOIN $CC_CONFIG[showTable] s" + ." ON si.show_id = s.id" + ." WHERE EXTRACT(DOW FROM si.starts) = $day" + ." AND EXTRACT(WEEK FROM si.starts) = EXTRACT(WEEK FROM localtimestamp)"; + + //echo $sql; + + return $CC_DBC->GetAll($sql); + } + } From d6c8e8ca3ddafa1ec2f4a6e22b455a7ecbe0d12b Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 28 Mar 2011 18:07:16 -0400 Subject: [PATCH 08/58] CC-2092: When listening to a rebroadcast show, UI is telling me show is empty -Fixed --- application/models/Schedule.php | 25 +++++++++++++++++++++++++ application/models/Shows.php | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/application/models/Schedule.php b/application/models/Schedule.php index d1d556e1f..d2cb8e801 100644 --- a/application/models/Schedule.php +++ b/application/models/Schedule.php @@ -466,6 +466,30 @@ class Schedule { { global $CC_CONFIG, $CC_DBC; + $sql = "SELECT DISTINCT" + ." pt.name," + ." ft.track_title," + ." ft.artist_name," + ." ft.album_title," + ." st.starts," + ." st.ends," + ." st.clip_length," + ." st.media_item_played," + ." st.group_id," + ." show.name as show_name," + ." st.instance_id" + ." FROM $CC_CONFIG[scheduleTable] st" + ." LEFT JOIN $CC_CONFIG[filesTable] ft" + ." ON st.file_id = ft.id" + ." LEFT JOIN $CC_CONFIG[playListTable] pt" + ." ON st.playlist_id = pt.id" + ." LEFT JOIN $CC_CONFIG[showInstances] si" + ." ON st.instance_id = si.id" + ." LEFT JOIN $CC_CONFIG[showTable] show" + ." ON si.show_id = show.id" + ." WHERE st.starts < si.ends"; + +/* $sql = "SELECT DISTINCT pt.name, ft.track_title, ft.artist_name, ft.album_title, st.starts, st.ends, st.clip_length, st.media_item_played, st.group_id, show.name as show_name, st.instance_id" ." FROM $CC_CONFIG[scheduleTable] st, $CC_CONFIG[filesTable] ft, $CC_CONFIG[playListTable] pt, $CC_CONFIG[showInstances] si, $CC_CONFIG[showTable] show" ." WHERE st.playlist_id = pt.id" @@ -473,6 +497,7 @@ class Schedule { ." AND st.instance_id = si.id" ." AND si.show_id = show.id" ." AND st.starts < si.ends"; +*/ if ($timePeriod < 0){ $sql .= " AND st.ends < TIMESTAMP '$timeStamp'" diff --git a/application/models/Shows.php b/application/models/Shows.php index 2ba843697..71273c00d 100644 --- a/application/models/Shows.php +++ b/application/models/Shows.php @@ -930,7 +930,7 @@ class Show_DAL { ." OR (si.starts < TIMESTAMP '$timeNow' + INTERVAL '$end seconds' AND si.ends > TIMESTAMP '$timeNow' + INTERVAL '$end seconds'))" //checking for st.starts IS NULL so that the query also returns shows that do not have any items scheduled. ." AND (st.starts < si.ends OR st.starts IS NULL)" - ." ORDER BY st.starts"; + ." ORDER BY si.starts, st.starts"; return $CC_DBC->GetAll($sql); } From d745201afe2950ccded7f98fb01a94aa0e96ece2 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 28 Mar 2011 18:23:57 -0400 Subject: [PATCH 09/58] CC-2098: Only push playlists that havent ended yet -re-added ability to specify to/from time ranges --- application/models/Schedule.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/application/models/Schedule.php b/application/models/Schedule.php index d2cb8e801..d336546a5 100644 --- a/application/models/Schedule.php +++ b/application/models/Schedule.php @@ -653,17 +653,24 @@ class Schedule { * @param string $p_toDateTime * In the format "YYYY-MM-DD-HH-mm-SS" */ - public static function GetScheduledPlaylists() + public static function GetScheduledPlaylists($p_fromDateTime = null, $p_toDateTime = null) { global $CC_CONFIG, $CC_DBC; - $t1 = new DateTime(); - $range_start = $t1->format("Y-m-d H:i:s"); - - $t2 = new DateTime(); - $t2->add(new DateInterval("PT24H")); - $range_end = $t2->format("Y-m-d H:i:s"); - + if (is_null($p_fromDateTime)) { + $t1 = new DateTime(); + $range_start = $t1->format("Y-m-d H:i:s"); + } else { + $range_start = Schedule::PypoTimeToAirtimeTime($p_fromDateTime); + } + if (is_null($p_fromDateTime)) { + $t2 = new DateTime(); + $t2->add(new DateInterval("PT24H")); + $range_end = $t2->format("Y-m-d H:i:s"); + } else { + $range_end = Schedule::PypoTimeToAirtimeTime($p_toDateTime); + } + // Scheduler wants everything in a playlist $data = Schedule::GetItems($range_start, $range_end, true); $playlists = array(); From 18ef86cee181f92e7c8ca5a3097b3a8470e54670 Mon Sep 17 00:00:00 2001 From: Naomi Date: Tue, 29 Mar 2011 12:24:32 -0400 Subject: [PATCH 10/58] CC-2111 : Show-recorder should automatically NOT record silence a user might want to adjust these sound levels for their own system setup. --- python_apps/show-recorder/testrecordscript.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_apps/show-recorder/testrecordscript.py b/python_apps/show-recorder/testrecordscript.py index c7fb2691d..cb8fa7cf6 100644 --- a/python_apps/show-recorder/testrecordscript.py +++ b/python_apps/show-recorder/testrecordscript.py @@ -61,7 +61,7 @@ class ShowRecorder(Thread): filename = self.filename.replace(" ", "-") filepath = "%s%s.%s" % (config["base_recorded_files"], filename, self.filetype) - command = "ecasound -i alsa -o %s -t:%s" % (filepath, length) + command = "ecasound -i alsa -o %s -t:%s -ge:5,1,0,-1" % (filepath, length) args = command.split(" ") print "starting record" From 37a4d7bce4a86e25ed53e18a5649399d700dde74 Mon Sep 17 00:00:00 2001 From: Naomi Date: Tue, 29 Mar 2011 12:45:22 -0400 Subject: [PATCH 11/58] CC-2111 : Show-recorder should automatically NOT record silence --- python_apps/show-recorder/testrecordscript.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_apps/show-recorder/testrecordscript.py b/python_apps/show-recorder/testrecordscript.py index cb8fa7cf6..a352e1f26 100644 --- a/python_apps/show-recorder/testrecordscript.py +++ b/python_apps/show-recorder/testrecordscript.py @@ -61,7 +61,7 @@ class ShowRecorder(Thread): filename = self.filename.replace(" ", "-") filepath = "%s%s.%s" % (config["base_recorded_files"], filename, self.filetype) - command = "ecasound -i alsa -o %s -t:%s -ge:5,1,0,-1" % (filepath, length) + command = "ecasound -i alsa -o %s -t:%s -ge:3,1,0,-1" % (filepath, length) args = command.split(" ") print "starting record" From 8c522352d7e8afdaac3c588a20f49cfe4cf28252 Mon Sep 17 00:00:00 2001 From: Naomi Date: Tue, 29 Mar 2011 12:47:34 -0400 Subject: [PATCH 12/58] CC-2110 : Soundcloud file metadata adding a users function which will prob be used for metadata... when I see what's needed. --- application/models/Shows.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/application/models/Shows.php b/application/models/Shows.php index 8aa83beae..fc78138e3 100644 --- a/application/models/Shows.php +++ b/application/models/Shows.php @@ -58,6 +58,24 @@ class Show { $show->setDbBackgroundColor($backgroundColor); } + public function getHosts() + { + global $CC_DBC; + + $sql = "SELECT first_name, last_name + FROM cc_show_hosts LEFT JOIN cc_subjs ON cc_show_hosts.subjs_id = cc_subjs.id + WHERE show_id = {$this->_showId}"; + + $hosts = $CC_DBC->GetAll($sql); + + $res = array(); + foreach($hosts as $host) { + $res[] = $host['first_name']." ".$host['last_name']; + } + + return $res; + } + public function cancelShow($day_timestamp) { global $CC_DBC; From bd54738c1b2e2b31039f783890d7e347ee5f7952 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 29 Mar 2011 12:53:52 -0400 Subject: [PATCH 13/58] CC-2104: Use PIP to install python packages -Done --- install/installInit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/installInit.php b/install/installInit.php index 1efaa4833..7e0ab2323 100644 --- a/install/installInit.php +++ b/install/installInit.php @@ -194,7 +194,7 @@ class AirtimeInstall { public static function SetUpPythonEggs() { //install poster streaming upload - $command = "sudo easy_install poster"; + $command = "pip install poster"; @exec($command); } From 0ad7a0afcdb5cd9ae8cd6d26efc50cf78366230a Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 29 Mar 2011 12:59:15 -0400 Subject: [PATCH 14/58] CC-2104: Use PIP to install python packages -Now uninstalls poster package. --- install/airtime-uninstall.php | 1 + install/installInit.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/install/airtime-uninstall.php b/install/airtime-uninstall.php index 5b9a58c3a..40a77b8bc 100644 --- a/install/airtime-uninstall.php +++ b/install/airtime-uninstall.php @@ -21,6 +21,7 @@ require_once(dirname(__FILE__).'/installInit.php'); AirtimeInstall::ExitIfNotRoot(); AirtimeInstall::RemoveSymlinks(); +AirtimeInstall::RemovePythonPackages(); echo "******************************* Uninstall Begin ********************************".PHP_EOL; //------------------------------------------------------------------------ diff --git a/install/installInit.php b/install/installInit.php index 7e0ab2323..bf263bf04 100644 --- a/install/installInit.php +++ b/install/installInit.php @@ -198,6 +198,11 @@ class AirtimeInstall { @exec($command); } + public static function RemovePythonPackages(){ + $command = "pip uninstall poster"; + @exec($command); + } + public static function DeleteFilesRecursive($p_path) { $command = "rm -rf $p_path"; From d66bcea044ebbb83ef20b2e0d9056d53af7fb735 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 29 Mar 2011 14:09:06 -0400 Subject: [PATCH 15/58] CC-2104: Use PIP to install python packages -removed pip install/uninstall from install scripts. Added to wiki instead. --- install/airtime-install.php | 3 --- install/airtime-uninstall.php | 1 - install/installInit.php | 12 ------------ 3 files changed, 16 deletions(-) diff --git a/install/airtime-install.php b/install/airtime-install.php index 1d350f1e1..a0428878c 100644 --- a/install/airtime-install.php +++ b/install/airtime-install.php @@ -52,9 +52,6 @@ AirtimeInstall::CreateSymlinks($CC_CONFIG["storageDir"]); echo "* Importing Sample Audio Clips".PHP_EOL; system(__DIR__."/../utils/airtime-import --copy ../audio_samples/ > /dev/null"); -echo "* Python eggs Setup".PHP_EOL; -AirtimeInstall::SetUpPythonEggs(); - echo PHP_EOL."*** Pypo Installation ***".PHP_EOL; system("python ".__DIR__."/../python_apps/pypo/install/pypo-install.py"); diff --git a/install/airtime-uninstall.php b/install/airtime-uninstall.php index 40a77b8bc..5b9a58c3a 100644 --- a/install/airtime-uninstall.php +++ b/install/airtime-uninstall.php @@ -21,7 +21,6 @@ require_once(dirname(__FILE__).'/installInit.php'); AirtimeInstall::ExitIfNotRoot(); AirtimeInstall::RemoveSymlinks(); -AirtimeInstall::RemovePythonPackages(); echo "******************************* Uninstall Begin ********************************".PHP_EOL; //------------------------------------------------------------------------ diff --git a/install/installInit.php b/install/installInit.php index bf263bf04..d720daaab 100644 --- a/install/installInit.php +++ b/install/installInit.php @@ -191,18 +191,6 @@ class AirtimeInstall { system($command); } - public static function SetUpPythonEggs() - { - //install poster streaming upload - $command = "pip install poster"; - @exec($command); - } - - public static function RemovePythonPackages(){ - $command = "pip uninstall poster"; - @exec($command); - } - public static function DeleteFilesRecursive($p_path) { $command = "rm -rf $p_path"; From e8b80d1e7bf4deb8b36fb0fcd0154ddccbefae64 Mon Sep 17 00:00:00 2001 From: "paul.baranowski" Date: Tue, 29 Mar 2011 14:10:18 -0400 Subject: [PATCH 16/58] Updated 3rd party software packages info. --- LICENSE_3RD_PARTY | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/LICENSE_3RD_PARTY b/LICENSE_3RD_PARTY index 892af37a1..06dcf9016 100644 --- a/LICENSE_3RD_PARTY +++ b/LICENSE_3RD_PARTY @@ -29,8 +29,19 @@ Linked code: - License: LGPLv3 * Soundcloud php api wrapper - - https://github.com/mptre/php-soundcloud/blob/master/Services/Soundcloud.php + - Web site: https://github.com/mptre/php-soundcloud/blob/master/Services/Soundcloud.php - License: MIT + - Compatible with the GPL: Yes. See http://www.gnu.org/licenses/license-list.html + + * Kombu + - Web site: http://pypi.python.org/pypi/kombu/ + - License: New BSD + - Compatible with GPLv3? Yes. + + * PHP-AMQPLIB + - Web site: https://github.com/tnc/php-amqplib + - License: LGPLv2.1 + - Compatible with GPLv3? Yes ---------------- Non-linked code: From b73e58551ff763a0e36e97972e14888cc57a4121 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 29 Mar 2011 14:44:51 -0400 Subject: [PATCH 17/58] CC-2128: storageUrlPort in application/configs/conf.php not being used -fixed --- application/configs/conf.php | 37 ------------------------------- application/models/StoredFile.php | 3 ++- 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/application/configs/conf.php b/application/configs/conf.php index 74c3b10ac..b96db1f1d 100644 --- a/application/configs/conf.php +++ b/application/configs/conf.php @@ -61,38 +61,6 @@ $CC_CONFIG = array( 'zendPath' => dirname(__FILE__).'/../../library/Zend', 'phingPath' => dirname(__FILE__).'/../../library/phing', - // name of admin group - //'AdminsGr' => 'Admins', - - // name of station preferences group -// 'StationPrefsGr'=> 'StationPrefs', - - // name of 'all users' group - //'AllGr' => 'All', - - /* ==================================== application-specific configuration */ -// 'objtypes' => array( -// 'Storage' => array(/*'Folder',*/ 'File' /*, 'Replica'*/), -// 'File' => array(), -// 'audioclip' => array(), -// 'playlist' => array(), -// ), -// 'allowedActions'=> array( -// 'File' => array('editPrivs', 'write', 'read'), -// 'audioclip' => array('editPrivs', 'write', 'read'), -// 'playlist' => array('editPrivs', 'write', 'read'), -// ), -// 'allActions' => array( -// 'editPrivs', 'write', 'read', 'subjects' -// ), - - /* =================================================== cron configuration */ - 'cronUserName' => 'www-data', -# 'lockfile' => dirname(__FILE__).'/cron/cron.lock', - 'lockfile' => dirname(__FILE__).'/stor/buffer/cron.lock', - 'cronfile' => dirname(__FILE__).'/cron/croncall.php', - 'paramdir' => dirname(__FILE__).'/cron/params', -// 'systemPrefId' => "0", // ID for system prefs in prefs table ); // Add database table names @@ -119,11 +87,6 @@ $CC_CONFIG['permSequence'] = $CC_CONFIG['permTable'].'_id'; $CC_CONFIG['subjSequence'] = $CC_CONFIG['subjTable'].'_id'; $CC_CONFIG['smembSequence'] = $CC_CONFIG['smembTable'].'_id'; -// System users/groups - they cannot be deleted -//$CC_CONFIG['sysSubjs'] = array( -// 'root', /*$CC_CONFIG['AdminsGr'],*/ /*$CC_CONFIG['AllGr'],*/ $CC_CONFIG['StationPrefsGr'] -//); - // Add libs to the PHP path $old_include_path = get_include_path(); set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'] diff --git a/application/models/StoredFile.php b/application/models/StoredFile.php index ecff91caa..cd98aff60 100644 --- a/application/models/StoredFile.php +++ b/application/models/StoredFile.php @@ -1481,7 +1481,8 @@ class StoredFile { public function getFileUrl() { global $CC_CONFIG; - return "http://".$CC_CONFIG["storageUrlHost"] + return "http://$CC_CONFIG[storageUrlHost]" + .":$CC_CONFIG[storageUrlPort]" .$CC_CONFIG["apiPath"]."get-media/file/" .$this->gunid.".".$this->getFileExtension(); } From 161505a6dfb2053305d1cfdf60bbaeb668874704 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 29 Mar 2011 16:10:00 -0400 Subject: [PATCH 18/58] CC-2044: remove hardcoded settings from application/configs/conf.php -refactored some code to begin work on this... --- application/configs/conf.php | 4 --- application/models/StoredFile.php | 5 +--- python_apps/api_clients/api_client.py | 42 ++++++++++++++++++--------- python_apps/pypo/config.cfg | 9 ++++-- python_apps/pypo/pypofetch.py | 8 ++--- python_apps/show-recorder/config.cfg | 4 +-- 6 files changed, 40 insertions(+), 32 deletions(-) diff --git a/application/configs/conf.php b/application/configs/conf.php index b96db1f1d..b4c3a9160 100644 --- a/application/configs/conf.php +++ b/application/configs/conf.php @@ -19,10 +19,6 @@ $baseFilesDir = __DIR__.'/../../files'; $CC_CONFIG = array( - // Set the URL of your installation - 'storageUrlHost' => 'localhost', - 'storageUrlPort' => 80, - // Name of the web server user 'webServerUser' => 'www-data', diff --git a/application/models/StoredFile.php b/application/models/StoredFile.php index cd98aff60..957d552b0 100644 --- a/application/models/StoredFile.php +++ b/application/models/StoredFile.php @@ -1481,10 +1481,7 @@ class StoredFile { public function getFileUrl() { global $CC_CONFIG; - return "http://$CC_CONFIG[storageUrlHost]" - .":$CC_CONFIG[storageUrlPort]" - .$CC_CONFIG["apiPath"]."get-media/file/" - .$this->gunid.".".$this->getFileExtension(); + return $this->gunid.".".$this->getFileExtension(); } /** diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index cd2a6e7d7..4de68443c 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -117,7 +117,7 @@ class AirTimeApiClient(ApiClientInterface): def __get_airtime_version(self, verbose = True): logger = logging.getLogger() - url = self.config["base_url"] + self.config["api_base"] + self.config["version_url"] + url = "http://%s:%s/%s/%s" % (self.config["base_url"], self.config["base_port"], self.config["api_base"], self.config["version_url"]) logger.debug("Trying to contact %s", url) url = url.replace("%%api_key%%", self.config["api_key"]) @@ -198,7 +198,8 @@ class AirTimeApiClient(ApiClientInterface): logger = logging.getLogger() # Construct the URL - export_url = self.config["base_url"] + self.config["api_base"] + self.config["export_url"] + #export_url = self.config["base_url"] + self.config["api_base"] + self.config["export_url"] + export_url = "http://%s:%s/%s/%s" % (self.config["base_url"], self.config["base_port"], self.config["api_base"], self.config["export_url"]) logger.info("Fetching schedule from %s", export_url) export_url = export_url.replace('%%api_key%%', self.config["api_key"]) @@ -215,12 +216,15 @@ class AirTimeApiClient(ApiClientInterface): return status, response - def get_media(self, src, dst): + def get_media(self, uri, dst): logger = logging.getLogger() try: + src = "http://%s:%s/%s/%s" % \ + (self.config["base_url"], str(self.config["base_port"]), self.config["api_base"], self.config["get_media_url"]) + src = src.replace("%%file%%", uri) logger.info("try to download from %s to %s", src, dst) - src = src + "/api_key/" + self.config["api_key"] + src = src.replace("%%api_key%%", self.config["api_key"]) # check if file exists already before downloading again filename, headers = urllib.urlretrieve(src, dst) except Exception, e: @@ -234,7 +238,9 @@ class AirTimeApiClient(ApiClientInterface): logger = logging.getLogger() playlist = schedule[pkey] schedule_id = playlist["schedule_id"] - url = self.config["base_url"] + self.config["api_base"] + self.config["update_item_url"] + #url = self.config["base_url"] + self.config["api_base"] + self.config["update_item_url"] + url = "http://%s:%s/%s/%s" % (self.config["base_url"], self.config["base_port"], self.config["api_base"], self.config["update_item_url"]) + url = url.replace("%%schedule_id%%", str(schedule_id)) logger.debug(url) url = url.replace("%%api_key%%", self.config["api_key"]) @@ -261,7 +267,8 @@ class AirTimeApiClient(ApiClientInterface): response = '' try: schedule_id = data - url = self.config["base_url"] + self.config["api_base"] + self.config["update_start_playing_url"] + #url = self.config["base_url"] + self.config["api_base"] + self.config["update_start_playing_url"] + url = "http://%s:%s/%s/%s" % (self.config["base_url"], self.config["base_port"], self.config["api_base"], self.config["update_start_playing_url"]) url = url.replace("%%media_id%%", str(media_id)) url = url.replace("%%schedule_id%%", str(schedule_id)) logger.debug(url) @@ -290,7 +297,8 @@ class AirTimeApiClient(ApiClientInterface): logger = logging.getLogger() response = '' try: - url = self.config["base_url"] + self.config["api_base"] + self.config["show_schedule_url"] + url = "http://%s:%s/%s/%s" % (self.config["base_url"], self.config["base_port"], self.config["api_base"], self.config["show_schedule_url"]) + #url = self.config["base_url"] + self.config["api_base"] + self.config["show_schedule_url"] logger.debug(url) url = url.replace("%%api_key%%", self.config["api_key"]) @@ -307,7 +315,9 @@ class AirTimeApiClient(ApiClientInterface): logger = logging.getLogger() response = '' try: - url = self.config["base_url"] + self.config["api_base"] + self.config["upload_file_url"] + #url = self.config["base_url"] + self.config["api_base"] + self.config["upload_file_url"] + url = "http://%s:%s/%s/%s" % (self.config["base_url"], self.config["base_port"], self.config["api_base"], self.config["upload_file_url"]) + logger.debug(url) url = url.replace("%%api_key%%", self.config["api_key"]) @@ -368,7 +378,9 @@ class ObpApiClient(): logger = logging.getLogger() # lookup OBP version - url = self.config["base_url"] + self.config["api_base"]+ self.config["version_url"] + #url = self.config["base_url"] + self.config["api_base"]+ self.config["version_url"] + url = "http://%s:%s/%s/%s" % (self.config["base_url"], self.config["base_port"], self.config["api_base"], self.config["version_url"]) + try: logger.debug("Trying to contact %s", url) @@ -427,7 +439,8 @@ class ObpApiClient(): range['end'] = end # Construct the URL - export_url = self.config["base_url"] + self.config["api_base"] + self.config["export_url"] + #export_url = self.config["base_url"] + self.config["api_base"] + self.config["export_url"] + export_url = "http://%s:%s/%s/%s" % (self.config["base_url"], self.config["base_port"], self.config["api_base"], self.config["export_url"]) # Insert the start and end times into the URL export_url = export_url.replace('%%api_key%%', self.config["api_key"]) @@ -465,7 +478,8 @@ class ObpApiClient(): def notify_scheduled_item_start_playing(self, pkey, schedule): #def update_scheduled_item(self, item_id, value): logger = logging.getLogger() - url = self.config["base_url"] + self.config["api_base"] + self.config["update_item_url"] + #url = self.config["base_url"] + self.config["api_base"] + self.config["update_item_url"] + url = "http://%s:%s/%s/%s" % (self.config["base_url"], self.config["base_port"], self.config["api_base"], self.config["update_item_url"]) url = url.replace("%%item_id%%", str(schedule[pkey]["id"])) url = url.replace("%%played%%", "1") @@ -495,7 +509,8 @@ class ObpApiClient(): playlist_id = data["playlist_id"] transmission_id = data["transmission_id"] - url = self.config["base_url"] + self.config["api_base"] + self.config["update_start_playing_url"] + #url = self.config["base_url"] + self.config["api_base"] + self.config["update_start_playing_url"] + url = "http://%s:%s/%s/%s" % (self.config["base_url"], self.config["base_port"], self.config["api_base"], self.config["update_start_playing_url"]) url = url.replace("%%playlist_type%%", str(playlist_type)) url = url.replace("%%export_source%%", str(export_source)) url = url.replace("%%media_id%%", str(media_id)) @@ -521,7 +536,8 @@ class ObpApiClient(): def generate_range_dp(self): logger = logging.getLogger() - url = self.config["base_url"] + self.config["api_base"] + self.config["generate_range_url"] + #url = self.config["base_url"] + self.config["api_base"] + self.config["generate_range_url"] + url = "http://%s:%s/%s/%s" % (self.config["base_url"], self.config["base_port"], self.config["api_base"], self.config["generate_range_url"]) try: response = urllib.urlopen(url, self.api_auth) diff --git a/python_apps/pypo/config.cfg b/python_apps/pypo/config.cfg index 2c0fce6f0..b1f9ed229 100644 --- a/python_apps/pypo/config.cfg +++ b/python_apps/pypo/config.cfg @@ -18,7 +18,8 @@ file_dir = '/opt/pypo/files/' tmp_dir = '/opt/pypo/tmp/' # Hostname -base_url = 'http://localhost/' +base_url = 'localhost' +base_port = 80 ############################################ # Liquidsoap settings # @@ -77,7 +78,7 @@ cue_style = 'pre' api_key = 'AAA' # Path to the base of the API -api_base = 'api/' +api_base = 'api' # URL to get the version number of the server API version_url = 'version/api_key/%%api_key%%' @@ -85,7 +86,9 @@ version_url = 'version/api_key/%%api_key%%' # Schedule export path. # %%from%% - starting date/time in the form YYYY-MM-DD-hh-mm # %%to%% - starting date/time in the form YYYY-MM-DD-hh-mm -export_url = 'schedule/api_key/%%api_key%%' +export_url = 'schedule/api_key/%%api_key%%' + +get_media_url = 'get-media/file/%%file%%/api_key/%%api_key%%' # Update whether a schedule group has begun playing. update_item_url = 'notify-schedule-group-play/api_key/%%api_key%%/schedule_id/%%schedule_id%%' diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index 2958c6bd4..bd09ff2ee 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -208,12 +208,8 @@ class PypoFetch(Thread): (self.cache_dir, str(pkey), str(media['id']), str(float(media['cue_in']) / 1000), str(float(media['cue_out']) / 1000), str(fileExt)) do_cue = True - # check if it is a remote file, if yes download - if media['uri'][0:4] == 'http': - self.handle_remote_file(media, dst, do_cue) - else: - logger.debug("invalid media uri: %s", media['uri']) - + # download media file + self.handle_remote_file(media, dst, do_cue) if True == os.access(dst, os.R_OK): # check filesize (avoid zero-byte files) diff --git a/python_apps/show-recorder/config.cfg b/python_apps/show-recorder/config.cfg index ec812b8cf..7b64b047c 100644 --- a/python_apps/show-recorder/config.cfg +++ b/python_apps/show-recorder/config.cfg @@ -1,7 +1,7 @@ api_client = "airtime" # Hostname -base_url = 'http://localhost/' +base_url = 'localhost' # base path to store recordered shows at base_recorded_files = '/home/pypo/Music/' @@ -10,7 +10,7 @@ base_recorded_files = '/home/pypo/Music/' api_key = 'AAA' # Path to the base of the API -api_base = 'api/' +api_base = 'api' # URL to get the version number of the server API version_url = 'version/api_key/%%api_key%%' From 4bdd8d425d708e478e2458b26a04004c768a47c4 Mon Sep 17 00:00:00 2001 From: Naomi Date: Tue, 29 Mar 2011 16:32:31 -0400 Subject: [PATCH 19/58] CC-2124 : Rebroadcast: Retry upload to Airtime on failed upload added configurable number of upload retries as well as length between retries. --- python_apps/api_clients/api_client.py | 38 +++++++++++++------ python_apps/show-recorder/config.cfg | 6 +++ python_apps/show-recorder/testrecordscript.py | 6 ++- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index cd2a6e7d7..92f4c0ed8 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -288,7 +288,7 @@ class AirTimeApiClient(ApiClientInterface): def get_shows_to_record(self): logger = logging.getLogger() - response = '' + response = None try: url = self.config["base_url"] + self.config["api_base"] + self.config["show_schedule_url"] logger.debug(url) @@ -301,23 +301,37 @@ class AirTimeApiClient(ApiClientInterface): except Exception, e: logger.error("Exception: %s", e) - return response[u'shows'] + return response def upload_recorded_show(self, data, headers): logger = logging.getLogger() response = '' - try: - url = self.config["base_url"] + self.config["api_base"] + self.config["upload_file_url"] - logger.debug(url) - url = url.replace("%%api_key%%", self.config["api_key"]) + retries = int(self.config["upload_retries"]) + retries_wait = int(self.config["upload_wait"]) - request = urllib2.Request(url, data, headers) - response = urllib2.urlopen(request).read().strip() + url = self.config["base_url"] + self.config["api_base"] + self.config["upload_file_url"] + logger.debug(url) + url = url.replace("%%api_key%%", self.config["api_key"]) - logger.info("uploaded show result %s", response) - - except Exception, e: - logger.error("Exception: %s", e) + for i in range(0, retries): + logger.debug("Upload attempt: %s", i+1) + + try: + request = urllib2.Request(url, data, headers) + response = urllib2.urlopen(request).read().strip() + + logger.info("uploaded show result %s", response) + break + + except urllib2.HTTPError, e: + logger.error("Http error code: %s", e.code) + except urllib2.URLError, e: + logger.error("Server is down: %s", e.args) + except Exception, e: + logger.error("Exception: %s", e) + + #wait some time before next retry + time.sleep(retries_wait) return response diff --git a/python_apps/show-recorder/config.cfg b/python_apps/show-recorder/config.cfg index ec812b8cf..823826b31 100644 --- a/python_apps/show-recorder/config.cfg +++ b/python_apps/show-recorder/config.cfg @@ -20,3 +20,9 @@ show_schedule_url = 'recorded-shows/format/json/api_key/%%api_key%%' # URL to upload the recorded show's file to Airtime upload_file_url = 'upload-recorded/format/json/api_key/%%api_key%%' + +#number of retries to upload file if connection problem +upload_retries = 3 + +#time to wait between attempts to upload file if connection problem (in seconds) +upload_wait = 60 diff --git a/python_apps/show-recorder/testrecordscript.py b/python_apps/show-recorder/testrecordscript.py index a352e1f26..ccd2946bc 100644 --- a/python_apps/show-recorder/testrecordscript.py +++ b/python_apps/show-recorder/testrecordscript.py @@ -61,7 +61,7 @@ class ShowRecorder(Thread): filename = self.filename.replace(" ", "-") filepath = "%s%s.%s" % (config["base_recorded_files"], filename, self.filetype) - command = "ecasound -i alsa -o %s -t:%s -ge:3,1,0,-1" % (filepath, length) + command = "ecasound -i alsa -o %s -t:%s -ge:5,1,0,-1" % (filepath, length) args = command.split(" ") print "starting record" @@ -145,6 +145,10 @@ class Record(): def get_shows(self): shows = self.api_client.get_shows_to_record() + if shows is not None: + shows = shows[u'shows'] + else: + shows = [] if len(shows): self.process_shows(shows) From 9ebe7ec1ca485f48d08cba0e8c983a5d312ec7d2 Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Tue, 29 Mar 2011 17:31:22 -0400 Subject: [PATCH 20/58] Better error message when timezones dont match up between pypo and airtime. --- python_apps/pypo/pypofetch.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python_apps/pypo/pypofetch.py b/python_apps/pypo/pypofetch.py index 2958c6bd4..c7b02c589 100644 --- a/python_apps/pypo/pypofetch.py +++ b/python_apps/pypo/pypofetch.py @@ -84,9 +84,12 @@ class PypoFetch(Thread): pypo_timezone = (process.communicate()[0]).strip(' \r\n\t') if server_timezone != pypo_timezone: - logger.error("Server and pypo timezone offsets do not match. Audio playback may not start when expected!") - logger.error("Server timezone offset: %s", server_timezone) - logger.error("Pypo timezone offset: %s", pypo_timezone) + logger.error("ERROR: Airtime server and pypo timezone offsets do not match. Audio playback will not start when expected!!!") + logger.error(" * Server timezone offset: %s", server_timezone) + logger.error(" * Pypo timezone offset: %s", pypo_timezone) + logger.error(" * To fix this, you need to set the 'date.timezone' value in your php.ini file and restart apache.") + logger.error(" * See this page for more info (v1.7): http://wiki.sourcefabric.org/x/BQBF") + logger.error(" * and also the 'FAQ and Support' page underneath it.") """ Process the schedule From 835960d25fa8a9b241376f613ce3cfe5522d790c Mon Sep 17 00:00:00 2001 From: Paul Baranowski Date: Tue, 29 Mar 2011 17:32:03 -0400 Subject: [PATCH 21/58] Added explanation to the user for each of the tools in dev_tools. --- dev_tools/pl.sh | 4 +++- dev_tools/pr.sh | 4 ++++ dev_tools/pypoless.sh | 4 ++++ dev_tools/pypotail.sh | 4 ++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/dev_tools/pl.sh b/dev_tools/pl.sh index 7c6f8b650..4e1c70134 100755 --- a/dev_tools/pl.sh +++ b/dev_tools/pl.sh @@ -1,3 +1,5 @@ #!/bin/sh - +echo +echo "This will tail the pypo-liquidsoap log file." +echo "Type in password for pypo user (default password is 'pypo'):" su -l pypo -c "tail -F /etc/service/pypo-liquidsoap/log/main/current" diff --git a/dev_tools/pr.sh b/dev_tools/pr.sh index f5e741658..aadab42ec 100755 --- a/dev_tools/pr.sh +++ b/dev_tools/pr.sh @@ -1,3 +1,7 @@ #!/bin/sh +echo +echo "This will tail the recorder log file." +echo "Type in password for pypo user (default password is 'pypo'):" + su -l pypo -c "tail -F /etc/service/recorder/log/main/current" diff --git a/dev_tools/pypoless.sh b/dev_tools/pypoless.sh index 542702527..f9db223af 100755 --- a/dev_tools/pypoless.sh +++ b/dev_tools/pypoless.sh @@ -1,3 +1,7 @@ #!/bin/sh +echo +echo "This will output the pypo log file." +echo "Type in password for pypo user (default password is 'pypo'):" + su -l pypo -c "less /etc/service/pypo/log/main/current" diff --git a/dev_tools/pypotail.sh b/dev_tools/pypotail.sh index e91cd3917..0f2168e44 100755 --- a/dev_tools/pypotail.sh +++ b/dev_tools/pypotail.sh @@ -1,3 +1,7 @@ #!/bin/sh +echo +echo "This will tail the pypo log file." +echo "Type in password for pypo user (default password is 'pypo'):" + su -l pypo -c "tail -F /etc/service/pypo/log/main/current" From 4c457ce6bcdf17eb29a1bc93f297cb4e7167c6dd Mon Sep 17 00:00:00 2001 From: Naomi Date: Tue, 29 Mar 2011 18:01:30 -0400 Subject: [PATCH 22/58] set gate to really low level. --- python_apps/show-recorder/testrecordscript.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_apps/show-recorder/testrecordscript.py b/python_apps/show-recorder/testrecordscript.py index ccd2946bc..439f0f07f 100644 --- a/python_apps/show-recorder/testrecordscript.py +++ b/python_apps/show-recorder/testrecordscript.py @@ -61,7 +61,7 @@ class ShowRecorder(Thread): filename = self.filename.replace(" ", "-") filepath = "%s%s.%s" % (config["base_recorded_files"], filename, self.filetype) - command = "ecasound -i alsa -o %s -t:%s -ge:5,1,0,-1" % (filepath, length) + command = "ecasound -i alsa -o %s -t:%s -ge:0.1,0.1,0,-1" % (filepath, length) args = command.split(" ") print "starting record" From 2702363a33d3ef266fa7ba5912d735edf72f2522 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 29 Mar 2011 18:32:53 -0400 Subject: [PATCH 23/58] -CC-2044: remove hardcoded settings from application/configs/conf.php -rearranged some stuff...some bugs still to go --- application/configs/conf.php | 50 +++++++++-------- build/airtime.conf | 9 ++- install/airtime-install.php | 21 +++---- install/airtime-uninstall.php | 17 ++---- .../AirtimeInstall.php} | 31 +++------- install/include/installInit.php | 56 +++++++++++++++++++ python_apps/api_clients/api_client.py | 22 ++++---- python_apps/pypo/pypo-api-validator.py | 2 +- python_apps/pypo/pypo-cli.py | 2 +- python_apps/pypo/pypo-notify.py | 2 +- python_apps/pypo/{config.cfg => pypo.cfg} | 2 +- python_apps/pypo/pypofetch.py | 2 +- python_apps/pypo/pypopush.py | 2 +- .../{config.cfg => recorder.cfg} | 2 +- python_apps/show-recorder/testrecordscript.py | 2 +- 15 files changed, 130 insertions(+), 92 deletions(-) rename install/{installInit.php => include/AirtimeInstall.php} (85%) create mode 100644 install/include/installInit.php rename python_apps/pypo/{config.cfg => pypo.cfg} (99%) rename python_apps/show-recorder/{config.cfg => recorder.cfg} (94%) diff --git a/application/configs/conf.php b/application/configs/conf.php index b4c3a9160..41f5aea4c 100644 --- a/application/configs/conf.php +++ b/application/configs/conf.php @@ -1,12 +1,4 @@ 'www-data', + 'webServerUser' => $values['general']['webServerUser'], - 'rabbitmq' => array("host" => "127.0.0.1", - "port" => "5672", - "user" => "guest", - "password" => "guest", - "vhost" => "/"), - - // *********************************************************************** - // STOP CUSTOMIZING HERE - // - // You don't need to touch anything below this point. - // *********************************************************************** + 'rabbitmq' => $values['rabbitmq'], 'baseFilesDir' => $baseFilesDir, // main directory for storing binary media files 'storageDir' => "$baseFilesDir/stor", // Database config - 'dsn' => $values['database'], + 'dsn' => array( + 'username' => $values['database']['dbuser'], + 'password' => $values['database']['dbpass'], + 'hostspec' => $values['database']['host'], + 'phptype' => 'pgsql', + 'database' => $values['database']['dbname']), // prefix for table names in the database 'tblNamePrefix' => 'cc_', /* ================================================ storage configuration */ - 'apiKey' => $values['api_key'], + 'apiKey' => array($values['general']['api_key']), 'apiPath' => '/api/', 'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A', @@ -90,8 +90,9 @@ set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'] .PATH_SEPARATOR.$old_include_path); function load_airtime_config(){ - $ini_array = parse_ini_file(dirname(__FILE__).'/../../build/airtime.conf', true); - + $ini_array = parse_ini_file('/etc/airtime/airtime.conf', true); + return $ini_array; + /* return array( 'database' => array( 'username' => $ini_array['database']['dbuser'], @@ -101,4 +102,5 @@ function load_airtime_config(){ 'database' => $ini_array['database']['dbname']), 'api_key' => array($ini_array['general']['api_key']) ); + */ } diff --git a/build/airtime.conf b/build/airtime.conf index e72855457..97c9e8147 100644 --- a/build/airtime.conf +++ b/build/airtime.conf @@ -4,6 +4,13 @@ dbname = airtime dbuser = airtime dbpass = airtime +[rabbitmq] +host = 127.0.0.1 +port = 5672 +user = guest +password = guest +vhost = / + [general] api_key = AAA - +webServerUser = www-data diff --git a/install/airtime-install.php b/install/airtime-install.php index a0428878c..0fa541db3 100644 --- a/install/airtime-install.php +++ b/install/airtime-install.php @@ -5,21 +5,16 @@ * @license http://www.gnu.org/licenses/gpl.txt */ -// Do not allow remote execution -$arr = array_diff_assoc($_SERVER, $_ENV); -if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) { - header("HTTP/1.1 400"); - header("Content-type: text/plain; charset=UTF-8"); - echo "400 Not executable\r\n"; - exit(1); -} - -require_once(dirname(__FILE__).'/../application/configs/conf.php'); -require_once(dirname(__FILE__).'/installInit.php'); - echo "******************************** Install Begin *********************************".PHP_EOL; -AirtimeInstall::ExitIfNotRoot(); +require_once(dirname(__FILE__).'/include/installInit.php'); + +ExitIfNotRoot(); +CreateINIFile(); + +require_once(dirname(__FILE__).'/../application/configs/conf.php'); +require_once(dirname(__FILE__).'/include/AirtimeInstall.php'); + AirtimeInstall::CreateApiKey(); AirtimeInstall::UpdateIniValue('../build/build.properties', 'project.home', realpath(__dir__.'/../')); diff --git a/install/airtime-uninstall.php b/install/airtime-uninstall.php index 5b9a58c3a..b82a79f07 100644 --- a/install/airtime-uninstall.php +++ b/install/airtime-uninstall.php @@ -5,20 +5,13 @@ * @license http://www.gnu.org/licenses/gpl.txt */ -// Do not allow remote execution. -$arr = array_diff_assoc($_SERVER, $_ENV); -if (isset($arr["DOCUMENT_ROOT"]) && ($arr["DOCUMENT_ROOT"] != "") ) { - header("HTTP/1.1 400"); - header("Content-type: text/plain; charset=UTF-8"); - echo "400 Not executable".PHP_EOL; - exit; -} +require_once(dirname(__FILE__).'/include/installInit.php'); +// Need to check that we are superuser before running this. +ExitIfNotRoot(); require_once(dirname(__FILE__).'/../application/configs/conf.php'); -require_once(dirname(__FILE__).'/installInit.php'); +require_once(dirname(__FILE__).'/include/AirtimeInstall.php'); -// Need to check that we are superuser before running this. -AirtimeInstall::ExitIfNotRoot(); AirtimeInstall::RemoveSymlinks(); @@ -80,7 +73,7 @@ if ($results == 0) { // Delete files //------------------------------------------------------------------------ AirtimeInstall::DeleteFilesRecursive($CC_CONFIG['storageDir']); - +RemoveINIFile(); $command = "python ".__DIR__."/../python_apps/pypo/install/pypo-uninstall.py"; system($command); diff --git a/install/installInit.php b/install/include/AirtimeInstall.php similarity index 85% rename from install/installInit.php rename to install/include/AirtimeInstall.php index d720daaab..5286e10fc 100644 --- a/install/installInit.php +++ b/install/include/AirtimeInstall.php @@ -1,11 +1,7 @@ propel-error.log"; + $command = __DIR__."/../../library/propel/generator/bin/propel-gen ../build/ insert-sql 2>propel-error.log"; @exec($command, $output, $results); } @@ -200,10 +187,10 @@ class AirtimeInstall { public static function CreateSymlinks(){ AirtimeInstall::RemoveSymlinks(); - $dir = realpath(__DIR__."/../utils/airtime-import"); + $dir = realpath(__DIR__."/../../utils/airtime-import"); exec("ln -s $dir /usr/bin/airtime-import"); - $dir = realpath(__DIR__."/../utils/airtime-clean-storage"); + $dir = realpath(__DIR__."/../../utils/airtime-clean-storage"); exec("ln -s $dir /usr/bin/airtime-clean-storage"); } @@ -211,6 +198,4 @@ class AirtimeInstall { exec("rm -f /usr/bin/airtime-import"); exec("rm -f /usr/bin/airtime-clean-storage"); } - - } diff --git a/install/include/installInit.php b/install/include/installInit.php new file mode 100644 index 000000000..99793c0ff --- /dev/null +++ b/install/include/installInit.php @@ -0,0 +1,56 @@ + Date: Tue, 29 Mar 2011 18:42:26 -0400 Subject: [PATCH 24/58] CC-2044: remove hardcoded settings from application/configs/conf.php -added missing config value to recorder.cfg --- python_apps/pypo/pypo.cfg | 2 +- python_apps/show-recorder/recorder.cfg | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/python_apps/pypo/pypo.cfg b/python_apps/pypo/pypo.cfg index 2b4accb34..b1f9ed229 100644 --- a/python_apps/pypo/pypo.cfg +++ b/python_apps/pypo/pypo.cfg @@ -75,7 +75,7 @@ cue_style = 'pre' # Airtime Config # ##################### # Value needed to access the API -api_key = 'OTBGMVOAWNJZEK7AEWSM' +api_key = 'AAA' # Path to the base of the API api_base = 'api' diff --git a/python_apps/show-recorder/recorder.cfg b/python_apps/show-recorder/recorder.cfg index ad46e2786..2dca615c6 100644 --- a/python_apps/show-recorder/recorder.cfg +++ b/python_apps/show-recorder/recorder.cfg @@ -2,12 +2,13 @@ api_client = "airtime" # Hostname base_url = 'localhost' +base_port = 80 # base path to store recordered shows at base_recorded_files = '/home/pypo/Music/' # Value needed to access the API -api_key = 'OTBGMVOAWNJZEK7AEWSM' +api_key = 'AAA' # Path to the base of the API api_base = 'api' From 8e07446e880abe852e806658aeb48a4f07cc578e Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 29 Mar 2011 19:05:25 -0400 Subject: [PATCH 25/58] CC-2044: remove hardcoded settings from application/configs/conf.php -baseFilesDir now moved to /etc/airtime/airtime.conf --- application/configs/conf.php | 27 +++++++-------------- build/airtime.conf | 1 + install/airtime-install.php | 5 +--- install/include/AirtimeInstall.php | 37 ---------------------------- install/include/installInit.php | 39 ++++++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 59 deletions(-) diff --git a/application/configs/conf.php b/application/configs/conf.php index 41f5aea4c..4888173cd 100644 --- a/application/configs/conf.php +++ b/application/configs/conf.php @@ -1,24 +1,15 @@ $values['rabbitmq'], - 'baseFilesDir' => $baseFilesDir, + 'baseFilesDir' => $values['general']['baseFilesDir'], // main directory for storing binary media files - 'storageDir' => "$baseFilesDir/stor", + 'storageDir' => $values['general']['baseFilesDir']."/stor", // Database config 'dsn' => array( diff --git a/build/airtime.conf b/build/airtime.conf index 97c9e8147..64b3260b5 100644 --- a/build/airtime.conf +++ b/build/airtime.conf @@ -14,3 +14,4 @@ vhost = / [general] api_key = AAA webServerUser = www-data +baseFilesDir = x diff --git a/install/airtime-install.php b/install/airtime-install.php index f5bd0e1f0..c67286d65 100644 --- a/install/airtime-install.php +++ b/install/airtime-install.php @@ -11,14 +11,11 @@ require_once(dirname(__FILE__).'/include/installInit.php'); ExitIfNotRoot(); CreateINIFile(); +UpdateINIFiles(); require_once(dirname(__FILE__).'/../application/configs/conf.php'); require_once(dirname(__FILE__).'/include/AirtimeInstall.php'); -AirtimeInstall::CreateApiKey(); -AirtimeInstall::UpdateIniValue('../build/build.properties', 'project.home', realpath(__dir__.'/../')); - - echo PHP_EOL."*** Database Installation ***".PHP_EOL; echo "* Creating Airtime database user".PHP_EOL; diff --git a/install/include/AirtimeInstall.php b/install/include/AirtimeInstall.php index ca2801947..6f9ce0ef5 100644 --- a/install/include/AirtimeInstall.php +++ b/install/include/AirtimeInstall.php @@ -60,43 +60,6 @@ class AirtimeInstall { chmod($filePath, $fileperms); } - private static function GenerateRandomString($len=20, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') - { - $string = ''; - for ($i = 0; $i < $len; $i++) - { - $pos = mt_rand(0, strlen($chars)-1); - $string .= $chars{$pos}; - } - return $string; - } - - public static function CreateApiKey() - { - $api_key = AirtimeInstall::GenerateRandomString(); - AirtimeInstall::UpdateIniValue('/etc/airtime/airtime.conf', 'api_key', $api_key); - AirtimeInstall::UpdateIniValue('/etc/airtime/pypo.cfg', 'api_key', "'$api_key'"); - AirtimeInstall::UpdateIniValue('/etc/airtime/recorder.cfg', 'api_key', "'$api_key'"); - } - - public static function UpdateIniValue($filename, $property, $value) - { - $lines = file($filename); - $n=count($lines); - for ($i=0; $i<$n; $i++) { - if (strlen($lines[$i]) > strlen($property)) - if ($property == substr($lines[$i], 0, strlen($property))){ - $lines[$i] = "$property = $value\n"; - } - } - - $fp=fopen($filename, 'w'); - for($i=0; $i<$n; $i++){ - fwrite($fp, $lines[$i]); - } - fclose($fp); - } - public static function SetupStorageDirectory($CC_CONFIG) { global $CC_CONFIG, $CC_DBC; diff --git a/install/include/installInit.php b/install/include/installInit.php index 99793c0ff..ee0854e1e 100644 --- a/install/include/installInit.php +++ b/install/include/installInit.php @@ -54,3 +54,42 @@ function ExitIfNotRoot() exit(1); } } + +function GenerateRandomString($len=20, $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789') +{ + $string = ''; + for ($i = 0; $i < $len; $i++) + { + $pos = mt_rand(0, strlen($chars)-1); + $string .= $chars{$pos}; + } + return $string; +} + +function UpdateIniValue($filename, $property, $value) +{ + $lines = file($filename); + $n=count($lines); + for ($i=0; $i<$n; $i++) { + if (strlen($lines[$i]) > strlen($property)) + if ($property == substr($lines[$i], 0, strlen($property))){ + $lines[$i] = "$property = $value\n"; + } + } + + $fp=fopen($filename, 'w'); + for($i=0; $i<$n; $i++){ + fwrite($fp, $lines[$i]); + } + fclose($fp); +} + +function UpdateINIFiles() +{ + $api_key = GenerateRandomString(); + UpdateIniValue('/etc/airtime/airtime.conf', 'api_key', $api_key); + UpdateIniValue('/etc/airtime/airtime.conf', 'baseFilesDir', realpath(__DIR__.'/../../files')); + UpdateIniValue('/etc/airtime/pypo.cfg', 'api_key', "'$api_key'"); + UpdateIniValue('/etc/airtime/recorder.cfg', 'api_key', "'$api_key'"); + UpdateIniValue(__DIR__.'/../../build/build.properties', 'project.home', realpath(__dir__.'/../../')); +} From a9d288385b636a4e20526fbe6a5ffa0eaa395c43 Mon Sep 17 00:00:00 2001 From: Naomi Date: Tue, 29 Mar 2011 19:36:36 -0400 Subject: [PATCH 26/58] CC-2129 : Retry automatic upload to Soundcloud if Internet connection problem static retries/wait time right now. --- application/controllers/ApiController.php | 22 ++++++++++++++++++---- application/models/Soundcloud.php | 22 ++++++---------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/application/controllers/ApiController.php b/application/controllers/ApiController.php index 4f5f4eae3..9a8d45a01 100644 --- a/application/controllers/ApiController.php +++ b/application/controllers/ApiController.php @@ -268,11 +268,25 @@ class ApiController extends Zend_Controller_Action if(Application_Model_Preference::GetDoSoundCloudUpload()) { - $show = new Show($show_inst->getShowId()); - $description = $show->getDescription(); + for($i=0; $i<3; $i++) { - $soundcloud = new ATSoundcloud(); - $soundcloud->uploadTrack($file->getRealFilePath(), $file->getName(), $description); + $show = new Show($show_inst->getShowId()); + $description = $show->getDescription(); + + try { + $soundcloud = new ATSoundcloud(); + $soundcloud->uploadTrack($file->getRealFilePath(), $file->getName(), $description); + break; + } + catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) { + $code = $e->getHttpCode(); + if($code != 0) { + break; + } + } + + sleep(60); + } } $this->view->id = $file->getId(); diff --git a/application/models/Soundcloud.php b/application/models/Soundcloud.php index 78e9223a5..1fc5efa99 100644 --- a/application/models/Soundcloud.php +++ b/application/models/Soundcloud.php @@ -48,22 +48,12 @@ class ATSoundcloud { 'track[description]' => $description ); - try { - $response = json_decode( - $this->_soundcloud->post('tracks', $track_data), - true - ); - - echo var_dump($response); - } - catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) { - echo $e->getMessage(); - } - } - else - { - echo "could not get soundcloud token"; - } + + $response = json_decode( + $this->_soundcloud->post('tracks', $track_data), + true + ); + } } } From 89d2c317cb84855fafc402e8b68941fbf3b39ac3 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 29 Mar 2011 20:44:04 -0400 Subject: [PATCH 27/58] CC-2044: remove hardcoded settings from application/configs/conf.php -moved liquidsoap config to /etc/airtime as well --- application/configs/conf.php | 11 ----------- install/include/installInit.php | 5 +++++ .../pypo/scripts/{ls_config.liq => liquidsoap.cfg} | 0 python_apps/pypo/scripts/ls_script.liq | 2 +- 4 files changed, 6 insertions(+), 12 deletions(-) rename python_apps/pypo/scripts/{ls_config.liq => liquidsoap.cfg} (100%) diff --git a/application/configs/conf.php b/application/configs/conf.php index 4888173cd..67c826da1 100644 --- a/application/configs/conf.php +++ b/application/configs/conf.php @@ -83,15 +83,4 @@ set_include_path('.'.PATH_SEPARATOR.$CC_CONFIG['pearPath'] function load_airtime_config(){ $ini_array = parse_ini_file('/etc/airtime/airtime.conf', true); return $ini_array; - /* - return array( - 'database' => array( - 'username' => $ini_array['database']['dbuser'], - 'password' => $ini_array['database']['dbpass'], - 'hostspec' => $ini_array['database']['host'], - 'phptype' => 'pgsql', - 'database' => $ini_array['database']['dbname']), - 'api_key' => array($ini_array['general']['api_key']) - ); - */ } diff --git a/install/include/installInit.php b/install/include/installInit.php index ee0854e1e..b1ccb8219 100644 --- a/install/include/installInit.php +++ b/install/include/installInit.php @@ -34,6 +34,11 @@ function CreateINIFile(){ echo "Could not copy recorder.cfg to /etc/airtime/. Exiting."; exit(1); } + + if (!copy(__DIR__."/../../python_apps/pypo/scripts/liquidsoap.cfg", "/etc/airtime/liquidsoap.cfg")){ + echo "Could not copy liquidsoap.cfg to /etc/airtime/. Exiting."; + exit(1); + } } function RemoveINIFile(){ diff --git a/python_apps/pypo/scripts/ls_config.liq b/python_apps/pypo/scripts/liquidsoap.cfg similarity index 100% rename from python_apps/pypo/scripts/ls_config.liq rename to python_apps/pypo/scripts/liquidsoap.cfg diff --git a/python_apps/pypo/scripts/ls_script.liq b/python_apps/pypo/scripts/ls_script.liq index 5fec857ea..416e0b420 100644 --- a/python_apps/pypo/scripts/ls_script.liq +++ b/python_apps/pypo/scripts/ls_script.liq @@ -1,5 +1,5 @@ %include "library/pervasives.liq" -%include "ls_config.liq" +%include "/etc/airtime/liquidsoap.cfg" set("log.file.path", log_file) set("log.stdout", true) From f5db45ecfe8b0a124717c451e4bad34ad861da55 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 29 Mar 2011 20:52:18 -0400 Subject: [PATCH 28/58] -cleaned up liquidsoap config file --- python_apps/pypo/scripts/liquidsoap.cfg | 28 ++++++++----------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/python_apps/pypo/scripts/liquidsoap.cfg b/python_apps/pypo/scripts/liquidsoap.cfg index 20b1f4215..a7f310f1a 100644 --- a/python_apps/pypo/scripts/liquidsoap.cfg +++ b/python_apps/pypo/scripts/liquidsoap.cfg @@ -1,9 +1,6 @@ ########################################### # liquidsoap config file # ########################################### -# This config assumes that there are -# two instances of LS running -# the "scheduler" & the "fallback" instance ########################################### @@ -13,13 +10,6 @@ log_file = "/var/log/pypo/