soundcloud python/php apis, recorder python script so far.

This commit is contained in:
Naomi 2011-03-05 11:53:29 -05:00
parent b3e111b0a0
commit f68a8f67ea
109 changed files with 24297 additions and 10 deletions

View file

@ -21,7 +21,8 @@ $ccAcl->add(new Zend_Acl_Resource('library'))
->add(new Zend_Acl_Resource('nowplaying'))
->add(new Zend_Acl_Resource('search'))
->add(new Zend_Acl_Resource('dashboard'))
->add(new Zend_Acl_Resource('preference'));
->add(new Zend_Acl_Resource('preference'))
->add(new Zend_Acl_Resource('recorder'));
/** Creating permissions */
$ccAcl->allow('G', 'index')
@ -29,13 +30,13 @@ $ccAcl->allow('G', 'index')
->allow('G', 'error')
->allow('G', 'nowplaying')
->allow('G', 'api')
->allow('G', 'recorder')
->allow('G', 'schedule')
->allow('G', 'dashboard')
->allow('H', 'library')
->allow('H', 'search')
->allow('H', 'plupload')
->allow('H', 'playlist')
->allow('H', 'sideplaylist')
->allow('A', 'user')
->allow('A', 'preference');

View file

@ -0,0 +1,32 @@
<?php
class RecorderController extends Zend_Controller_Action
{
public function init()
{
$ajaxContext = $this->_helper->getHelper('contextSwitch');
$ajaxContext->addActionContext('get-show-schedule', 'json')
->initContext();
}
public function indexAction()
{
// action body
}
public function getShowScheduleAction()
{
//$from = $this->_getParam("from");
//$to = $this->_getParam("to");
$today_timestamp = date("Y-m-d H:i:s");
$this->view->shows = Show::getShows($today_timestamp, null, $excludeInstance=NULL, $onlyRecord=TRUE);
}
}

View file

@ -110,10 +110,11 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
{
$controller = strtolower($request->getControllerName());
if ($controller == 'api'){
$this->setRoleName("G");
} else if (!Zend_Auth::getInstance()->hasIdentity()){
if ($controller == 'api' || $controller == 'recorder'){
$this->setRoleName("G");
}
else if (!Zend_Auth::getInstance()->hasIdentity()){
if ($controller !== 'login') {

View file

@ -175,15 +175,26 @@ class Show {
Show::populateShowUntilLastGeneratedDate($showId);
}
public static function getShows($start_timestamp, $end_timestamp, $excludeInstance=NULL) {
public static function getShows($start_timestamp, $end_timestamp, $excludeInstance=NULL, $onlyRecord=FALSE) {
global $CC_DBC;
$sql = "SELECT starts, ends, show_id, name, description, color, background_color, cc_show_instances.id AS instance_id
FROM cc_show_instances
LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id
WHERE ((starts >= '{$start_timestamp}' AND starts < '{$end_timestamp}')
LEFT JOIN cc_show ON cc_show.id = cc_show_instances.show_id";
//only want shows that are starting at the time or later.
if($onlyRecord) {
$sql = $sql." WHERE (starts >= '{$start_timestamp}' AND starts < timestamp '{$start_timestamp}' + interval '2 hours')";
$sql = $sql." AND (record = TRUE)";
}
else {
$sql = $sql." WHERE ((starts >= '{$start_timestamp}' AND starts < '{$end_timestamp}')
OR (ends > '{$start_timestamp}' AND ends <= '{$end_timestamp}')
OR (starts <= '{$start_timestamp}' AND ends >= '{$end_timestamp}'))";
}
if(isset($excludeInstance)) {
foreach($excludeInstance as $instance) {
@ -196,7 +207,6 @@ class Show {
}
//echo $sql;
return $CC_DBC->GetAll($sql);
}

View file

@ -0,0 +1,22 @@
<?php
require_once 'soundcloud-api/Services/Soundcloud.php';
class Airtime_View_Helper_SoundCloudLink extends Zend_View_Helper_Abstract
{
public function soundCloudLink()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$host = $request->getHttpHost();
$controller = $request->getControllerName();
$action = $request->getActionName();
$redirectUrl = "http://{$host}/{$controller}/{$action}";
$soundcloud = new Services_Soundcloud('2CLCxcSXYzx7QhhPVHN4A', 'pZ7beWmF06epXLHVUP1ufOg2oEnIt9XhE8l8xt0bBs', $redirectUrl);
$authorizeUrl = $soundcloud->getAuthorizeUrl();
return $authorizeUrl;
}
}

View file

@ -0,0 +1 @@
<br /><br /><center>View script for controller <b>AirtimeRecorder</b> and script/action name <b>index</b></center>

View file

@ -0,0 +1 @@
<br /><br /><center>View script for controller <b>Recorder</b> and script/action name <b>getShowSchedule</b></center>

View file

@ -0,0 +1 @@
<br /><br /><center>View script for controller <b>Recorder</b> and script/action name <b>index</b></center>