CC-2795: Give option to set download flag of recorded shows

uploaded to Soundcloud by default

- done
This commit is contained in:
James 2011-09-29 17:10:17 -04:00
parent 8ef8dbc668
commit 7e3d25eeaa
8 changed files with 73 additions and 8 deletions

View file

@ -438,5 +438,21 @@ class Application_Model_Preference
public static function GetAirtimeVersion(){
return self::GetValue("system_version");
}
public static function SetUploadToSoundcloudOption($upload) {
self::SetValue("soundcloud_upload_option", $upload);
}
public static function GetUploadToSoundcloudOption() {
return self::GetValue("soundcloud_upload_option");
}
public static function SetSoundCloudDownloadbleOption($upload) {
self::SetValue("soundcloud_downloadable", $upload);
}
public static function GetSoundCloudDownloadbleOption() {
return self::GetValue("soundcloud_downloadable");
}
}

View file

@ -40,13 +40,15 @@ class Application_Model_AtSoundcloud {
$tags = Application_Model_Preference::GetSoundCloudTags();
}
$downloadable = Application_Model_Preference::GetSoundCloudDownloadbleOption() == '1'?true:false;
$track_data = array(
'track[sharing]' => 'private',
'track[title]' => $filename,
'track[asset_data]' => '@' . $filepath,
'track[tag_list]' => $tags,
'track[description]' => $description,
'track[downloadable]' => true,
'track[downloadable]' => $downloadable,
);

View file

@ -931,19 +931,18 @@ class Application_Model_StoredFile {
public function uploadToSoundCloud()
{
global $CC_CONFIG;
$file = $this->_file;
if(is_null($file)) {
return "File does not exist";
}
if(Application_Model_Preference::GetDoSoundCloudUpload())
if(Application_Model_Preference::GetUploadToSoundcloudOption())
{
for($i=0; $i<$CC_CONFIG['soundcloud-connection-retries']; $i++) {
$description = $file->getDbTrackTitle();
$tag = "";
$genre = $file->getDbGenre();
$release = $file->getDbYear();
try {
$soundcloud = new Application_Model_AtSoundcloud();
$soundcloud_id = $soundcloud->uploadTrack($this->getFilePath(), $this->getName(), $description, $tag, $release, $genre);