From 40c9c48961e7991d7f481daaf208a34189242921 Mon Sep 17 00:00:00 2001 From: naomiaro Date: Fri, 25 Mar 2011 17:18:42 -0400 Subject: [PATCH 1/3] CC-2029 : Missing icons on buttons --- application/views/scripts/schedule/add-show-form.phtml | 5 ++++- application/views/scripts/user/add-user.phtml | 4 +++- public/js/airtime/schedule/add-show.js | 1 - 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/application/views/scripts/schedule/add-show-form.phtml b/application/views/scripts/schedule/add-show-form.phtml index 2a111448b..9d8613d7d 100644 --- a/application/views/scripts/schedule/add-show-form.phtml +++ b/application/views/scripts/schedule/add-show-form.phtml @@ -1,7 +1,10 @@
Close - +

What

diff --git a/application/views/scripts/user/add-user.phtml b/application/views/scripts/user/add-user.phtml index db1e76138..4f836e0fa 100644 --- a/application/views/scripts/user/add-user.phtml +++ b/application/views/scripts/user/add-user.phtml @@ -7,7 +7,9 @@
- +
diff --git a/public/js/airtime/schedule/add-show.js b/public/js/airtime/schedule/add-show.js index 50ca4058a..329391086 100644 --- a/public/js/airtime/schedule/add-show.js +++ b/public/js/airtime/schedule/add-show.js @@ -182,7 +182,6 @@ function setAddShowEvents() { }); form.find("#add-show-submit") - .button() .click(function(event){ event.preventDefault(); From df8b9af8f690b72dede7c28b78816e209e5416e8 Mon Sep 17 00:00:00 2001 From: naomiaro Date: Mon, 28 Mar 2011 12:10:51 -0400 Subject: [PATCH 2/3] CC-2110 : Soundcloud file metadata uploading show description, show name in filename, tags ready to be uploaded for creator need to figure out what to upload. --- application/controllers/ApiController.php | 23 +++++++++---------- application/models/Soundcloud.php | 9 +++++--- python_apps/api_clients/api_client.py | 7 +++--- python_apps/show-recorder/testrecordscript.py | 9 +++++--- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/application/controllers/ApiController.php b/application/controllers/ApiController.php index 1cc2e0303..7f1cf524e 100644 --- a/application/controllers/ApiController.php +++ b/application/controllers/ApiController.php @@ -236,10 +236,6 @@ class ApiController extends Zend_Controller_Action { global $CC_CONFIG; - // disable the view and the layout - $this->view->layout()->disableLayout(); - $this->_helper->viewRenderer->setNoRender(true); - $api_key = $this->_getParam('api_key'); if (!in_array($api_key, $CC_CONFIG["apiKey"])) { @@ -251,16 +247,19 @@ class ApiController extends Zend_Controller_Action $upload_dir = ini_get("upload_tmp_dir"); $file = StoredFile::uploadFile($upload_dir); - if(Application_Model_Preference::GetDoSoundCloudUpload()) - { - $soundcloud = new ATSoundcloud(); - $soundcloud->uploadTrack($file->getRealFilePath(), $file->getName()); - } - $show_instance = $this->_getParam('show_instance'); - $show = new ShowInstance($show_instance); - $show->setRecordedFile($file->getId()); + $show_inst = new ShowInstance($show_instance); + $show_inst->setRecordedFile($file->getId()); + + if(Application_Model_Preference::GetDoSoundCloudUpload()) + { + $show = new Show($show_inst->getShowId()); + $description = $show->getDescription(); + + $soundcloud = new ATSoundcloud(); + $soundcloud->uploadTrack($file->getRealFilePath(), $file->getName(), $description); + } $this->view->id = $file->getId(); } diff --git a/application/models/Soundcloud.php b/application/models/Soundcloud.php index ceaa9cc47..352bd8ea7 100644 --- a/application/models/Soundcloud.php +++ b/application/models/Soundcloud.php @@ -28,14 +28,18 @@ class ATSoundcloud { return $token; } - public function uploadTrack($filepath, $filename) + public function uploadTrack($filepath, $filename, $description, $tags=array()) { if($this->getToken()) { + $tags = join(" ", $tags); + $track_data = array( 'track[sharing]' => 'private', 'track[title]' => $filename, - 'track[asset_data]' => '@' . $filepath + 'track[asset_data]' => '@' . $filepath, + 'track[tag_list]' => $tags, + 'track[description]' => $description ); try { @@ -46,7 +50,6 @@ class ATSoundcloud { } catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) { echo $e->getMessage(); - echo var_dump($track_data); } } } diff --git a/python_apps/api_clients/api_client.py b/python_apps/api_clients/api_client.py index 0b31b9137..cd2a6e7d7 100644 --- a/python_apps/api_clients/api_client.py +++ b/python_apps/api_clients/api_client.py @@ -291,9 +291,9 @@ class AirTimeApiClient(ApiClientInterface): response = '' try: 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"]) logger.debug(url) + url = url.replace("%%api_key%%", self.config["api_key"]) + response = urllib.urlopen(url) response = json.loads(response.read()) logger.info("shows %s", response) @@ -308,9 +308,8 @@ class AirTimeApiClient(ApiClientInterface): 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"]) logger.debug(url) + url = url.replace("%%api_key%%", self.config["api_key"]) request = urllib2.Request(url, data, headers) response = urllib2.urlopen(request).read().strip() diff --git a/python_apps/show-recorder/testrecordscript.py b/python_apps/show-recorder/testrecordscript.py index 463fdd7fc..c7fb2691d 100644 --- a/python_apps/show-recorder/testrecordscript.py +++ b/python_apps/show-recorder/testrecordscript.py @@ -109,14 +109,14 @@ class Record(): show_end = getDateTimeObj(show[u'ends']) time_delta = show_end - show_starts - self.shows_to_record[show[u'starts']] = [time_delta, show[u'instance_id']] + self.shows_to_record[show[u'starts']] = [time_delta, show[u'instance_id'], show[u'name']] def check_record(self): tnow = datetime.datetime.now() sorted_show_keys = sorted(self.shows_to_record.keys()) - print sorted_show_keys + start_time = sorted_show_keys[0] next_show = getDateTimeObj(start_time) @@ -132,7 +132,10 @@ class Record(): show_length = self.shows_to_record[start_time][0] show_instance = self.shows_to_record[start_time][1] - show = ShowRecorder(show_instance, show_length.seconds, start_time, filetype="mp3") + show_name = self.shows_to_record[start_time][2] + filename = show_name+"-"+start_time + + show = ShowRecorder(show_instance, show_length.seconds, filename, filetype="mp3") show.start() #remove show from shows to record. From c0e815207777f9e2dd59430a50ce0f04ab684d17 Mon Sep 17 00:00:00 2001 From: Naomi Date: Mon, 28 Mar 2011 15:39:01 -0400 Subject: [PATCH 3/3] 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"; + } } }