CC-1987 : Automatic upload of recorded shows to Soundcloud
Added fields to preference form for the station's soundcloud user/pass need to generalize file upload as commented out in the new Soundcloud.php file.
This commit is contained in:
parent
10706ec72a
commit
3a0f9ddcd1
|
@ -146,8 +146,7 @@ class PluploadController extends Zend_Controller_Action
|
||||||
|
|
||||||
$storedFile->setMetadataBatch($metadata);
|
$storedFile->setMetadataBatch($metadata);
|
||||||
|
|
||||||
// Return JSON-RPC response
|
return $storedFile;
|
||||||
die('{"jsonrpc" : "2.0", "id" : '.$storedFile->getId().' }');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
|
@ -158,13 +157,18 @@ class PluploadController extends Zend_Controller_Action
|
||||||
public function uploadAction()
|
public function uploadAction()
|
||||||
{
|
{
|
||||||
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";
|
||||||
$this->upload($upload_dir);
|
$file = $this->upload($upload_dir);
|
||||||
|
|
||||||
|
die('{"jsonrpc" : "2.0", "id" : '.$file->getId().' }');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function uploadRecordedAction()
|
public function uploadRecordedAction()
|
||||||
{
|
{
|
||||||
$upload_dir = ini_get("upload_tmp_dir");
|
$upload_dir = ini_get("upload_tmp_dir");
|
||||||
$this->upload($upload_dir);
|
$file = $this->upload($upload_dir);
|
||||||
|
|
||||||
|
//$file->getRealFilePath();
|
||||||
|
die('{"jsonrpc" : "2.0", "id" : '.$file->getId().' }');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pluploadAction()
|
public function pluploadAction()
|
||||||
|
|
|
@ -29,7 +29,10 @@ class PreferenceController extends Zend_Controller_Action
|
||||||
$values = $form->getValues();
|
$values = $form->getValues();
|
||||||
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
|
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
|
||||||
Application_Model_Preference::SetDefaultFade($values["stationDefaultFade"]);
|
Application_Model_Preference::SetDefaultFade($values["stationDefaultFade"]);
|
||||||
Application_Model_Preference::SetStreamLabelFormat($values["streamFormat"]);
|
Application_Model_Preference::SetStreamLabelFormat($values["streamFormat"]);
|
||||||
|
Application_Model_Preference::SetDoSoundCloudUpload($values["UseSoundCloud"]);
|
||||||
|
Application_Model_Preference::SetSoundCloudUser($values["SoundCloudUser"]);
|
||||||
|
Application_Model_Preference::SetSoundCloudPassword($values["SoundCloudPassword"]);
|
||||||
|
|
||||||
$this->view->statusMsg = "Preferences Updated.";
|
$this->view->statusMsg = "Preferences Updated.";
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ class Application_Form_Preferences extends Zend_Form
|
||||||
{
|
{
|
||||||
$this->setAction('/Preference/update')->setMethod('post');
|
$this->setAction('/Preference/update')->setMethod('post');
|
||||||
|
|
||||||
// Add login element
|
//Station name
|
||||||
$this->addElement('text', 'stationName', array(
|
$this->addElement('text', 'stationName', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'label' => 'Station Name:',
|
'label' => 'Station Name:',
|
||||||
|
@ -22,7 +22,7 @@ class Application_Form_Preferences extends Zend_Form
|
||||||
$defaultFade = '00:00:00.000000';
|
$defaultFade = '00:00:00.000000';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add login element
|
//Default station fade
|
||||||
$this->addElement('text', 'stationDefaultFade', array(
|
$this->addElement('text', 'stationDefaultFade', array(
|
||||||
'class' => 'input_text',
|
'class' => 'input_text',
|
||||||
'label' => 'Default Fade:',
|
'label' => 'Default Fade:',
|
||||||
|
@ -42,11 +42,38 @@ class Application_Form_Preferences extends Zend_Form
|
||||||
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
|
$stream_format->setValue(Application_Model_Preference::GetStreamLabelFormat());
|
||||||
$this->addElement($stream_format);
|
$this->addElement($stream_format);
|
||||||
|
|
||||||
|
|
||||||
|
$this->addElement('checkbox', 'UseSoundCloud', array(
|
||||||
|
'label' => 'Automatically Upload Recorded Shows To SoundCloud',
|
||||||
|
'required' => false,
|
||||||
|
'value' => Application_Model_Preference::GetValue("soundcloud_upload")
|
||||||
|
));
|
||||||
|
|
||||||
|
//SoundCloud Username
|
||||||
|
$this->addElement('text', 'SoundCloudUser', array(
|
||||||
|
'class' => 'input_text',
|
||||||
|
'label' => 'SoundCloud Username:',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'value' => Application_Model_Preference::GetValue("soundcloud_user")
|
||||||
|
));
|
||||||
|
|
||||||
|
//SoundCloud Password
|
||||||
|
$this->addElement('password', 'SoundCloudPassword', array(
|
||||||
|
'class' => 'input_text',
|
||||||
|
'label' => 'SoundCloud Password:',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array('StringTrim'),
|
||||||
|
'value' => Application_Model_Preference::GetValue("soundcloud_pass")
|
||||||
|
));
|
||||||
|
|
||||||
$this->addElement('submit', 'submit', array(
|
$this->addElement('submit', 'submit', array(
|
||||||
'class' => 'ui-button ui-state-default',
|
'class' => 'ui-button ui-state-default',
|
||||||
'ignore' => true,
|
'ignore' => true,
|
||||||
'label' => 'Submit',
|
'label' => 'Submit',
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ class Application_Model_Preference
|
||||||
return Application_Model_Preference::GetValue("shows_populated_until");
|
return Application_Model_Preference::GetValue("shows_populated_until");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function SetDefaultFade($fade) {
|
public static function SetDefaultFade($fade) {
|
||||||
Application_Model_Preference::SetValue("default_fade", $fade);
|
Application_Model_Preference::SetValue("default_fade", $fade);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,5 +97,30 @@ class Application_Model_Preference
|
||||||
public static function GetStationName(){
|
public static function GetStationName(){
|
||||||
return Application_Model_Preference::getValue("station_name");
|
return Application_Model_Preference::getValue("station_name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function SetDoSoundCloudUpload($upload) {
|
||||||
|
Application_Model_Preference::SetValue("soundcloud_upload", $upload);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetDoSoundCloudUpload() {
|
||||||
|
return Application_Model_Preference::GetValue("soundcloud_upload");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetSoundCloudUser($user) {
|
||||||
|
Application_Model_Preference::SetValue("soundcloud_user", $user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetSoundCloudUser() {
|
||||||
|
return Application_Model_Preference::GetValue("soundcloud_user");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function SetSoundCloudPassword($password) {
|
||||||
|
Application_Model_Preference::SetValue("soundcloud_password", $password);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function GetSoundCloudUserPassword() {
|
||||||
|
return Application_Model_Preference::GetValue("soundcloud_password");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once 'Soundcloud.php';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
require_once 'Soundcloud.php';
|
||||||
|
|
||||||
|
|
||||||
|
$soundcloud = new Services_Soundcloud('2CLCxcSXYzx7QhhPVHN4A', 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs');
|
||||||
|
|
||||||
|
$token = $soundcloud->accessTokenResourceOwner('naomiaro@gmail.com', 'airtime17');
|
||||||
|
|
||||||
|
$track_data = array(
|
||||||
|
'track[sharing]' => 'private',
|
||||||
|
'track[title]' => 'Test',
|
||||||
|
'track[asset_data]' => '@/home/naomi/Music/testoutput.mp3'
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = json_decode(
|
||||||
|
$soundcloud->post('tracks', $track_data),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
|
||||||
|
show_error($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
Loading…
Reference in New Issue