CC-2795: Give option to set download flag of recorded shows
uploaded to Soundcloud by default - done
This commit is contained in:
parent
8ef8dbc668
commit
7e3d25eeaa
|
@ -91,7 +91,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$menu[] = array('action' => array('type' => 'gourl', 'url' => $url),
|
||||
'title' => 'Download');
|
||||
|
||||
if (Application_Model_Preference::GetDoSoundCloudUpload()) {
|
||||
if (Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
$text = "Upload to Soundcloud";
|
||||
if(!is_null($file->getSoundCloudId())){
|
||||
$text = "Re-upload to Soundcloud";
|
||||
|
|
|
@ -37,6 +37,8 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetTimezone($values["preferences_general"]["timezone"]);
|
||||
|
||||
Application_Model_Preference::SetDoSoundCloudUpload($values["preferences_soundcloud"]["UseSoundCloud"]);
|
||||
Application_Model_Preference::SetUploadToSoundcloudOption($values["preferences_soundcloud"]["UploadToSoundcloudOption"]);
|
||||
Application_Model_Preference::SetSoundCloudDownloadbleOption($values["preferences_soundcloud"]["SoundCloudDownloadbleOption"]);
|
||||
Application_Model_Preference::SetSoundCloudUser($values["preferences_soundcloud"]["SoundCloudUser"]);
|
||||
Application_Model_Preference::SetSoundCloudPassword($values["preferences_soundcloud"]["SoundCloudPassword"]);
|
||||
Application_Model_Preference::SetSoundCloudTags($values["preferences_soundcloud"]["SoundCloudTags"]);
|
||||
|
|
|
@ -175,7 +175,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
if ($showEndDateHelper->getTimestamp() <= $epochNow
|
||||
&& $show->isRecorded()
|
||||
&& Application_Model_Preference::GetDoSoundCloudUpload()) {
|
||||
&& Application_Model_Preference::GetUploadToSoundcloudOption()) {
|
||||
if(is_null($show->getSoundCloudFileId())){
|
||||
$menu[] = array('action' => array('type' => 'fn',
|
||||
'callback' => "window['uploadToSoundCloud']($id)"),
|
||||
|
|
|
@ -11,13 +11,33 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
|||
|
||||
//enable soundcloud uploads
|
||||
$this->addElement('checkbox', 'UseSoundCloud', array(
|
||||
'label' => 'Upload Recorded Shows To SoundCloud',
|
||||
'label' => 'Automatically Upload Recorded Shows',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetDoSoundCloudUpload(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
));
|
||||
|
||||
//enable soundcloud uploads option
|
||||
$this->addElement('checkbox', 'UploadToSoundcloudOption', array(
|
||||
'label' => 'Enable Soundcloud Upload',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetUploadToSoundcloudOption(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
//enable downloadable for soundcloud
|
||||
$this->addElement('checkbox', 'SoundCloudDownloadbleOption', array(
|
||||
'label' => 'Automatically Mark Files "Downloadable" on SoundCloud',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetSoundCloudDownloadbleOption(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
//SoundCloud Username
|
||||
$this->addElement('text', 'SoundCloudUser', array(
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
||||
);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
<fieldset class="padded">
|
||||
<dl class="zend_form">
|
||||
<dd id="UploadToSoundcloudOption-element" class="block-display" style=" margin:6px 0 10px 0">
|
||||
<label class="optional" for="UploadToSoundcloudOption">
|
||||
<?php echo $this->element->getElement('UploadToSoundcloudOption') ?>
|
||||
<strong><?php echo $this->element->getElement('UploadToSoundcloudOption')->getLabel() ?></strong>
|
||||
</label>
|
||||
<?php if($this->element->getElement('UploadToSoundcloudOption')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('UploadToSoundcloudOption')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dd id="UseSoundCloud-element" class="block-display" style=" margin:6px 0 10px 0">
|
||||
<label class="optional" for="UseSoundCloud">
|
||||
<?php echo $this->element->getElement('UseSoundCloud') ?>
|
||||
|
@ -13,6 +26,19 @@
|
|||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dd id="SoundCloudDownloadbleOption-element" class="block-display" style=" margin:6px 0 10px 0">
|
||||
<label class="optional" for="SoundCloudDownloadbleOption">
|
||||
<?php echo $this->element->getElement('SoundCloudDownloadbleOption') ?>
|
||||
<strong><?php echo $this->element->getElement('SoundCloudDownloadbleOption')->getLabel() ?></strong>
|
||||
</label>
|
||||
<?php if($this->element->getElement('SoundCloudDownloadbleOption')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('SoundCloudDownloadbleOption')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="SoundCloudUser-label" class="block-display">
|
||||
<label class="optional" for="SoundCloudUser"><?php echo $this->element->getElement('SoundCloudUser')->getLabel() ?></label>
|
||||
</dt>
|
||||
|
|
Loading…
Reference in New Issue