CC-2110 : Soundcloud file metadata

added all defaults or ways to input a default for soundcloud metadata.
This commit is contained in:
naomiaro 2011-04-02 16:33:45 -04:00
parent a6927442ec
commit 5a105ff4c8
7 changed files with 126 additions and 10 deletions

View file

@ -133,6 +133,30 @@ class Application_Model_Preference
return Application_Model_Preference::GetValue("soundcloud_tags");
}
public static function SetSoundCloudGenre($genre) {
Application_Model_Preference::SetValue("soundcloud_genre", $genre);
}
public static function GetSoundCloudGenre() {
return Application_Model_Preference::GetValue("soundcloud_genre");
}
public static function SetSoundCloudTrackType($track_type) {
Application_Model_Preference::SetValue("soundcloud_tracktype", $track_type);
}
public static function GetSoundCloudTrackType() {
return Application_Model_Preference::GetValue("soundcloud_tracktype");
}
public static function SetSoundCloudLicense($license) {
Application_Model_Preference::SetValue("soundcloud_license", $license);
}
public static function GetSoundCloudLicense() {
return Application_Model_Preference::GetValue("soundcloud_license");
}
public static function SetAllow3rdPartyApi($bool) {
Application_Model_Preference::SetValue("third_party_api", $bool);
}

View file

@ -28,7 +28,7 @@ class ATSoundcloud {
return $token;
}
public function uploadTrack($filepath, $filename, $description, $tags=array())
public function uploadTrack($filepath, $filename, $description, $tags=array(), $release=null)
{
if($this->getToken())
{
@ -50,6 +50,33 @@ class ATSoundcloud {
);
if(isset($release)) {
$release = str_replace(" ", "-", $release);
$release = str_replace(":", "-", $release);
//YYYY-MM-DD-HH-mm-SS
$release = explode("-", $release);
$track_data['track[release_year]'] = $release[0];
$track_data['track[release_month]'] = $release[1];
$track_data['track[release_day]'] = $release[2];
}
$genre = Application_Model_Preference::GetSoundCloudGenre();
if ($genre != "") {
$track_data['track[genre]'] = $genre;
}
$track_type = Application_Model_Preference::GetSoundCloudTrackType();
if ($track_type != "") {
$track_data['track[track_type]'] = $track_type;
}
$license = Application_Model_Preference::GetSoundCloudLicense();
if ($license != "") {
$track_data['track[license]'] = $license;
}
$response = json_decode(
$this->_soundcloud->post('tracks', $track_data),
true