Merge branch 'master' of dev.sourcefabric.org:airtime

Conflicts:
	application/models/Shows.php
This commit is contained in:
paul.baranowski 2011-03-22 10:00:37 -04:00
commit b650abcbb8
24 changed files with 446 additions and 88 deletions

View file

@ -14,6 +14,7 @@ require_once (__DIR__."/configs/constants.php");
require_once (__DIR__."/configs/conf.php");
require_once 'DB.php';
require_once 'Soundcloud.php';
require_once 'Playlist.php';
require_once 'StoredFile.php';
require_once 'Schedule.php';

View file

@ -53,6 +53,9 @@ $CC_CONFIG = array(
'apiKey' => $values['api_key'],
'apiPath' => '/api/',
'soundcloud-client-id' => '2CLCxcSXYzx7QhhPVHN4A',
'soundcloud-client-secret' => 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs',
"rootDir" => __DIR__."/../..",
'pearPath' => dirname(__FILE__).'/../../library/pear',
'zendPath' => dirname(__FILE__).'/../../library/Zend',

View file

@ -101,6 +101,19 @@ class ApiController extends Zend_Controller_Action
exit;
}
public function liveInfoAction(){
global $CC_CONFIG;
// disable the view and the layout
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$result = Schedule::GetPlayOrderRange(0, 1);
//echo json_encode($result);
header("Content-type: text/javascript");
echo $_GET['callback'].'('.json_encode($result).')';
}
public function scheduleAction()
{
global $CC_CONFIG;

View file

@ -167,8 +167,18 @@ class PluploadController extends Zend_Controller_Action
$upload_dir = ini_get("upload_tmp_dir");
$file = $this->upload($upload_dir);
//$file->getRealFilePath();
die('{"jsonrpc" : "2.0", "id" : '.$file->getId().' }');
if(Application_Model_Preference::GetDoSoundCloudUpload())
{
$soundcloud = new ATSoundcloud();
$soundcloud->uploadTrack($file->getRealFilePath(), $file->getName());
}
$show_instance = $this->_getParam('show_instance');
$show = new ShowInstance($show_instance);
$show->setRecordedFile($file->getId());
die('{"jsonrpc" : "2.0", "id" : '.$file->getId().'}');
}
public function pluploadAction()

View file

@ -17,7 +17,7 @@ class Application_Form_Preferences extends Zend_Form
'value' => Application_Model_Preference::GetValue("station_name")
));
$defaultFade = Application_Model_Preference::GetValue("default_fade");
$defaultFade = Application_Model_Preference::GetDefaultFade();
if($defaultFade == ""){
$defaultFade = '00:00:00.000000';
}
@ -46,7 +46,7 @@ class Application_Form_Preferences extends Zend_Form
$this->addElement('checkbox', 'UseSoundCloud', array(
'label' => 'Automatically Upload Recorded Shows To SoundCloud',
'required' => false,
'value' => Application_Model_Preference::GetValue("soundcloud_upload")
'value' => Application_Model_Preference::GetDoSoundCloudUpload()
));
//SoundCloud Username
@ -55,16 +55,16 @@ class Application_Form_Preferences extends Zend_Form
'label' => 'SoundCloud Username:',
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetValue("soundcloud_user")
'value' => Application_Model_Preference::GetSoundCloudUser()
));
//SoundCloud Password
$this->addElement('password', 'SoundCloudPassword', array(
$this->addElement('text', 'SoundCloudPassword', array(
'class' => 'input_text',
'label' => 'SoundCloud Password:',
'required' => false,
'filters' => array('StringTrim'),
'value' => Application_Model_Preference::GetValue("soundcloud_pass")
'value' => Application_Model_Preference::GetSoundCloudPassword()
));
$this->addElement('submit', 'submit', array(

View file

@ -118,7 +118,7 @@ class Application_Model_Preference
Application_Model_Preference::SetValue("soundcloud_password", $password);
}
public static function GetSoundCloudUserPassword() {
public static function GetSoundCloudPassword() {
return Application_Model_Preference::GetValue("soundcloud_password");
}

View file

@ -738,6 +738,14 @@ class ShowInstance {
RabbitMq::PushSchedule();
}
public function setRecordedFile($file_id)
{
$showInstance = CcShowInstancesQuery::create()
->findPK($this->_instanceId);
$showInstance->setDbRecordedFile($file_id)
->save();
}
public function getTimeScheduled()
{
$instance_id = $this->getShowInstanceId();

View file

@ -1,31 +1,54 @@
<?php
require_once 'Soundcloud.php';
require_once 'soundcloud-api/Services/Soundcloud.php';
class ATSoundcloud {
/*
private $_soundcloud;
require_once 'Soundcloud.php';
public function __construct()
{
global $CC_CONFIG;
$this->_soundcloud = new Services_Soundcloud($CC_CONFIG['soundcloud-client-id'], $CC_CONFIG['soundcloud-client-secret']);
}
$soundcloud = new Services_Soundcloud('2CLCxcSXYzx7QhhPVHN4A', 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs');
private function getToken()
{
$username = Application_Model_Preference::GetSoundCloudUser();
$password = Application_Model_Preference::GetSoundCloudPassword();
$token = $soundcloud->accessTokenResourceOwner('naomiaro@gmail.com', 'airtime17');
if($username === "" || $password === "")
{
return false;
}
$track_data = array(
'track[sharing]' => 'private',
'track[title]' => 'Test',
'track[asset_data]' => '@/home/naomi/Music/testoutput.mp3'
);
$token = $this->_soundcloud->accessTokenResourceOwner($username, $password);
return $token;
}
public function uploadTrack($filepath, $filename)
{
if($this->getToken())
{
$track_data = array(
'track[sharing]' => 'private',
'track[title]' => $filename,
'track[asset_data]' => '@' . $filepath
);
try {
$response = json_decode(
$this->_soundcloud->post('tracks', $track_data),
true
);
}
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
echo $e->getMessage();
echo var_dump($track_data);
}
}
}
try {
$response = json_decode(
$soundcloud->post('tracks', $track_data),
true
);
}
catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
show_error($e->getMessage());
}
*/

View file

@ -10,6 +10,7 @@
<div class="text-row top">
<span class="spl_playlength"><?php echo $item["cliplength"] ?></span>
<span class="spl_cue ui-state-default"></span>
<span class="spl_title"><?php echo $item["CcFiles"]['track_title'] ?></span>
</div>
<div class="text-row">