From c0e815207777f9e2dd59430a50ce0f04ab684d17 Mon Sep 17 00:00:00 2001 From: Naomi Date: Mon, 28 Mar 2011 15:39:01 -0400 Subject: [PATCH] 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"; + } } }