Merge branch 'master' of dev.sourcefabric.org:airtime
This commit is contained in:
commit
70dd2a4838
10 changed files with 63 additions and 26 deletions
|
@ -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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -28,14 +28,24 @@ class ATSoundcloud {
|
|||
return $token;
|
||||
}
|
||||
|
||||
public function uploadTrack($filepath, $filename)
|
||||
public function uploadTrack($filepath, $filename, $description, $tags=array())
|
||||
{
|
||||
if($this->getToken())
|
||||
{
|
||||
if(count($tags)) {
|
||||
$tags = join(" ", $tags);
|
||||
$tags = $tags." ".Application_Model_Preference::GetSoundCloudTags();
|
||||
}
|
||||
else {
|
||||
$tags = Application_Model_Preference::GetSoundCloudTags();
|
||||
}
|
||||
|
||||
$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 {
|
||||
|
@ -43,12 +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();
|
||||
echo var_dump($track_data);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "could not get soundcloud token";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue