Merge branch 'devel' of dev.sourcefabric.org:airtime into devel

This commit is contained in:
Rudi Grinberg 2012-08-22 10:39:42 -04:00
commit bf3176c8dd
24 changed files with 182 additions and 148 deletions

View File

@ -318,7 +318,7 @@ class ApiController extends Zend_Controller_Action
}
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
header("Content-type: text/javascript");
Logging::log($result);
Logging::info($result);
// If a callback is not given, then just provide the raw JSON.
echo isset($_GET['callback']) ? $_GET['callback'].'('.json_encode($result).')' : json_encode($result);
} else {
@ -359,7 +359,7 @@ class ApiController extends Zend_Controller_Action
$file->setLastPlayedTime($now);
}
} catch (Exception $e) {
Logging::log($e);
Logging::info($e);
}
echo json_encode(array("status"=>1, "message"=>""));
@ -475,8 +475,8 @@ class ApiController extends Zend_Controller_Action
);
}
Application_Model_Preference::SetImportTimestamp();
Logging::log("--->Mode: $mode || file: {$md['MDATA_KEY_FILEPATH']} ");
Logging::log( $md );
Logging::info("--->Mode: $mode || file: {$md['MDATA_KEY_FILEPATH']} ");
Logging::info( $md );
if ($mode == "create") {
$filepath = $md['MDATA_KEY_FILEPATH'];
$filepath = Application_Common_OsPath::normpath($filepath);
@ -567,8 +567,8 @@ class ApiController extends Zend_Controller_Action
//unset( $info_json["MDATA_KEY_BITRATE"] );
if( !array_key_exists('mode', $info_json) ) { // Log invalid requests
Logging::log("Received bad request(key=$k), no 'mode' parameter. Bad request is:");
Logging::log( $info_json );
Logging::info("Received bad request(key=$k), no 'mode' parameter. Bad request is:");
Logging::info( $info_json );
array_push( $responses, array(
'error' => "Bad request. no 'mode' parameter passed.",
'key' => $k));
@ -577,8 +577,8 @@ class ApiController extends Zend_Controller_Action
// A request still has a chance of being invalid even if it exists but it's validated
// by $valid_modes array
$mode = $info_json['mode'];
Logging::log("Received bad request(key=$k). 'mode' parameter was invalid with value: '$mode'. Request:");
Logging::log( $info_json );
Logging::info("Received bad request(key=$k). 'mode' parameter was invalid with value: '$mode'. Request:");
Logging::info( $info_json );
array_push( $responses, array(
'error' => "Bad request. 'mode' parameter is invalid",
'key' => $k,
@ -615,7 +615,7 @@ class ApiController extends Zend_Controller_Action
}
}
Logging::log( $md );
Logging::info( $md );
// update import timestamp
Application_Model_Preference::SetImportTimestamp();
@ -781,7 +781,7 @@ class ApiController extends Zend_Controller_Action
$component = $request->getParam('component');
$remoteAddr = Application_Model_ServiceRegister::GetRemoteIpAddr();
Logging::log("Registered Component: ".$component."@".$remoteAddr);
Logging::info("Registered Component: ".$component."@".$remoteAddr);
Application_Model_ServiceRegister::Register($component, $remoteAddr);
}
@ -902,7 +902,7 @@ class ApiController extends Zend_Controller_Action
public function rabbitmqDoPushAction()
{
$request = $this->getRequest();
Logging::log("Notifying RabbitMQ to send message to pypo");
Logging::info("Notifying RabbitMQ to send message to pypo");
Application_Model_RabbitMq::PushSchedule();
}

View File

@ -60,8 +60,9 @@ class LibraryController extends Zend_Controller_Action
try {
if (isset($this->obj_sess->id)) {
Logging::info($this->obj_sess->type);
$objInfo = Application_Model_Library::getObjInfo($this->obj_sess->type);
Logging::log($this->obj_sess->id);
Logging::info($this->obj_sess->id);
$obj = new $objInfo['className']($this->obj_sess->id);
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new Application_Model_User($userInfo->id);
@ -252,7 +253,7 @@ class LibraryController extends Zend_Controller_Action
Application_Model_Webstream::deleteStreams($streams, $user->getId());
} catch (Exception $e) {
//TODO: warn user that not all streams could be deleted.
Logging::log($e);
Logging::info($e);
}
foreach ($files as $id) {
@ -328,7 +329,7 @@ class LibraryController extends Zend_Controller_Action
// set MDATA_KEY_FILEPATH
$data['MDATA_KEY_FILEPATH'] = $file->getFilePath();
Logging::log($data['MDATA_KEY_FILEPATH']);
Logging::info($data['MDATA_KEY_FILEPATH']);
Application_Model_RabbitMq::SendMessageToMediaMonitor("md_update", $data);
$this->_redirect('Library');
@ -405,7 +406,7 @@ class LibraryController extends Zend_Controller_Action
$this->view->type = $type;
}
} catch (Exception $e) {
Logging::log($e->getMessage());
Logging::info($e->getMessage());
}
}

View File

@ -117,7 +117,7 @@ class PlaylistController extends Zend_Controller_Action
{
$this->view->error = "{$p_type} not found";
Logging::log("{$p_type} not found");
Logging::info("{$p_type} not found");
Application_Model_Library::changePlaylist(null, $p_type);
$this->createFullResponse(null);
}
@ -133,9 +133,9 @@ class PlaylistController extends Zend_Controller_Action
{
$this->view->error = "Something went wrong.";
Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
Logging::info("{$e->getFile()}");
Logging::info("{$e->getLine()}");
Logging::info("{$e->getMessage()}");
}
private function wrongTypeToBlock($obj)
@ -176,7 +176,7 @@ class PlaylistController extends Zend_Controller_Action
$id = $this->_getParam('id', null);
$type = $this->_getParam('type');
$objInfo = Application_Model_Library::getObjInfo($type);
Logging::log("editing {$type} {$id}");
Logging::info("editing {$type} {$id}");
if (!is_null($id)) {
Application_Model_Library::changePlaylist($id, $type);
@ -206,12 +206,12 @@ class PlaylistController extends Zend_Controller_Action
$user = new Application_Model_User($userInfo->id);
try {
Logging::log("Currently active {$type} {$this->obj_sess->id}");
Logging::info("Currently active {$type} {$this->obj_sess->id}");
if (in_array($this->obj_sess->id, $ids)) {
Logging::log("Deleting currently active {$type}");
Logging::info("Deleting currently active {$type}");
Application_Model_Library::changePlaylist(null, $type);
} else {
Logging::log("Not deleting currently active {$type}");
Logging::info("Not deleting currently active {$type}");
$obj = new $objInfo['className']($this->obj_sess->id);
}

View File

@ -69,8 +69,8 @@ class PlayouthistoryController extends Zend_Controller_Action
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
Logging::log("history starts {$startsDT->format("Y-m-d H:i:s")}");
Logging::log("history ends {$endsDT->format("Y-m-d H:i:s")}");
Logging::info("history starts {$startsDT->format("Y-m-d H:i:s")}");
Logging::info("history ends {$endsDT->format("Y-m-d H:i:s")}");
$history = new Application_Model_PlayoutHistory($startsDT, $endsDT, $params);

View File

@ -864,9 +864,9 @@ class ScheduleController extends Zend_Controller_Action
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
} catch (Exception $e) {
$this->view->error = $e->getMessage();
Logging::log($e->getMessage());
Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}");
Logging::info($e->getMessage());
Logging::info("{$e->getFile()}");
Logging::info("{$e->getLine()}");
}
}
}

View File

@ -290,14 +290,14 @@ class ShowbuilderController extends Zend_Controller_Action
$scheduler->scheduleAfter($scheduledItems, $mediaItems);
} catch (OutDatedScheduleException $e) {
$this->view->error = $e->getMessage();
Logging::log($e->getMessage());
Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}");
Logging::info($e->getMessage());
Logging::info("{$e->getFile()}");
Logging::info("{$e->getLine()}");
} catch (Exception $e) {
$this->view->error = $e->getMessage();
Logging::log($e->getMessage());
Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}");
Logging::info($e->getMessage());
Logging::info("{$e->getFile()}");
Logging::info("{$e->getLine()}");
}
}
@ -311,14 +311,14 @@ class ShowbuilderController extends Zend_Controller_Action
$scheduler->removeItems($items);
} catch (OutDatedScheduleException $e) {
$this->view->error = $e->getMessage();
Logging::log($e->getMessage());
Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}");
Logging::info($e->getMessage());
Logging::info("{$e->getFile()}");
Logging::info("{$e->getLine()}");
} catch (Exception $e) {
$this->view->error = $e->getMessage();
Logging::log($e->getMessage());
Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}");
Logging::info($e->getMessage());
Logging::info("{$e->getFile()}");
Logging::info("{$e->getLine()}");
}
}
@ -333,14 +333,14 @@ class ShowbuilderController extends Zend_Controller_Action
$scheduler->moveItem($selectedItems, $afterItem);
} catch (OutDatedScheduleException $e) {
$this->view->error = $e->getMessage();
Logging::log($e->getMessage());
Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}");
Logging::info($e->getMessage());
Logging::info("{$e->getFile()}");
Logging::info("{$e->getLine()}");
} catch (Exception $e) {
$this->view->error = $e->getMessage();
Logging::log($e->getMessage());
Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}");
Logging::info($e->getMessage());
Logging::info("{$e->getFile()}");
Logging::info("{$e->getLine()}");
}
}

View File

@ -10,26 +10,37 @@ class WebstreamController extends Zend_Controller_Action
->addActionContext('edit', 'json')
->addActionContext('delete', 'json')
->initContext();
//TODO
//$this->pl_sess = new Zend_Session_Namespace(UI_PLAYLIST_SESSNAME);
}
public function newAction()
{
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$webstream = new CcWebstream();
//we're not saving this primary key in the DB so it's OK
$webstream->setDbId(-1);
//$webstream->setDbId(-1);
$webstream->setDbName("Untitled Webstream");
$webstream->setDbDescription("");
$webstream->setDbUrl("http://");
$webstream->setDbLength("00:00:00");
$webstream->setDbName("Untitled Webstream");
$webstream->setDbCreatorId($userInfo->id);
$webstream->setDbUtime(new DateTime("now", new DateTimeZone('UTC')));
$webstream->setDbMtime(new DateTime("now", new DateTimeZone('UTC')));
$webstream->save();
$type = "stream";
$objInfo = Application_Model_Library::getObjInfo($type);
$obj = new $objInfo['className']($webstream);
$obj->setName($webstream->getDbName());
$obj->setMetadata('dc:creator', $userInfo->id);
$type = "stream";
Application_Model_Library::changePlaylist($obj->getId(), $type);
$this->view->ws = new Application_Model_Webstream($webstream);
$this->view->obj = new Application_Model_Webstream($webstream);
$this->view->action = "new";
$this->view->html = $this->view->render('webstream/webstream.phtml');
}
@ -44,7 +55,7 @@ class WebstreamController extends Zend_Controller_Action
}
$webstream = CcWebstreamQuery::create()->findPK($id);
$this->view->ws = new Application_Model_Webstream($webstream);
$this->view->obj = new Application_Model_Webstream($webstream);
$this->view->action = "edit";
$this->view->html = $this->view->render('webstream/webstream.phtml');
}
@ -64,7 +75,7 @@ class WebstreamController extends Zend_Controller_Action
$webstream = CcWebstreamQuery::create()->findPK($id)->delete();
$this->view->ws = null;
$this->view->obj = null;
$this->view->action = "delete";
$this->view->html = $this->view->render('webstream/webstream.phtml');
@ -73,11 +84,12 @@ class WebstreamController extends Zend_Controller_Action
public function isAuthorized($id)
{
$hasPermission = false;
$user = Application_Model_User::getCurrentUser();
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$hasPermission = true;
}
if ($user->isUserType(UTYPE_HOST)) {
if (!$hasPermission) {
if ($id != -1) {
$webstream = CcWebstreamQuery::create()->findPK($id);
//we are updating a playlist. Ensure that if the user is a host/dj, that he has the correct permission.

View File

@ -5,7 +5,7 @@ class Logging {
private static $_logger;
private static $_path;
public static function getLogger()
private static function getLogger()
{
if (!isset(self::$_logger)) {
$writer = new Zend_Log_Writer_Stream(self::$_path);
@ -37,7 +37,7 @@ class Logging {
}
}
public static function log($p_msg)
public static function info($p_msg)
{
$bt = debug_backtrace();

View File

@ -188,7 +188,7 @@ class Application_Model_Block implements Application_Model_LibraryEditable
*/
public function getContents($filterFiles=false)
{
Logging::log("Getting contents for block {$this->id}");
Logging::info("Getting contents for block {$this->id}");
$files = array();
$sql = <<<"EOT"
@ -387,11 +387,11 @@ EOT;
try {
if (is_numeric($p_afterItem)) {
Logging::log("Finding block content item {$p_afterItem}");
Logging::info("Finding block content item {$p_afterItem}");
$afterItem = CcBlockcontentsQuery::create()->findPK($p_afterItem);
$index = $afterItem->getDbPosition();
Logging::log("index is {$index}");
Logging::info("index is {$index}");
$pos = ($addType == 'after') ? $index + 1 : $index;
$contentsToUpdate = CcBlockcontentsQuery::create()
@ -400,8 +400,8 @@ EOT;
->orderByDbPosition()
->find($this->con);
Logging::log("Adding to block");
Logging::log("at position {$pos}");
Logging::info("Adding to block");
Logging::info("at position {$pos}");
} else {
//add to the end of the block
@ -424,12 +424,12 @@ EOT;
->orderByDbPosition()
->find($this->con);
Logging::log("Adding to block");
Logging::log("at position {$pos}");
Logging::info("Adding to block");
Logging::info("at position {$pos}");
}
foreach ($p_items as $ac) {
Logging::log("Adding audio file {$ac}");
Logging::info("Adding audio file {$ac}");
if (is_array($ac) && $ac[1] == 'audioclip') {
$res = $this->insertBlockElement($this->buildEntry($ac[0], $pos));
@ -485,32 +485,32 @@ EOT;
$pos = 0;
//moving items to beginning of the block.
if (is_null($p_afterItem)) {
Logging::log("moving items to beginning of block");
Logging::info("moving items to beginning of block");
foreach ($contentsToMove as $item) {
Logging::log("item {$item->getDbId()} to pos {$pos}");
Logging::info("item {$item->getDbId()} to pos {$pos}");
$item->setDbPosition($pos);
$item->save($this->con);
$pos = $pos + 1;
}
foreach ($otherContent as $item) {
Logging::log("item {$item->getDbId()} to pos {$pos}");
Logging::info("item {$item->getDbId()} to pos {$pos}");
$item->setDbPosition($pos);
$item->save($this->con);
$pos = $pos + 1;
}
} else {
Logging::log("moving items after {$p_afterItem}");
Logging::info("moving items after {$p_afterItem}");
foreach ($otherContent as $item) {
Logging::log("item {$item->getDbId()} to pos {$pos}");
Logging::info("item {$item->getDbId()} to pos {$pos}");
$item->setDbPosition($pos);
$item->save($this->con);
$pos = $pos + 1;
if ($item->getDbId() == $p_afterItem) {
foreach ($contentsToMove as $move) {
Logging::log("item {$move->getDbId()} to pos {$pos}");
Logging::info("item {$move->getDbId()} to pos {$pos}");
$move->setDbPosition($pos);
$move->save($this->con);
$pos = $pos + 1;
@ -570,7 +570,7 @@ EOT;
public function getFadeInfo($pos)
{
Logging::log("Getting fade info for pos {$pos}");
Logging::info("Getting fade info for pos {$pos}");
$row = CcBlockcontentsQuery::create()
->joinWith(CcFilesPeer::OM_CLASS)
@ -655,7 +655,7 @@ EOT;
public function setfades($fadein, $fadeout)
{
if (isset($fadein)) {
Logging::log("Setting block fade in {$fadein}");
Logging::info("Setting block fade in {$fadein}");
$row = CcBlockcontentsQuery::create()
->filterByDbBlockId($this->id)
->filterByDbPosition(0)
@ -665,7 +665,7 @@ EOT;
}
if (isset($fadeout)) {
Logging::log("Setting block fade out {$fadeout}");
Logging::info("Setting block fade out {$fadeout}");
$row = CcBlockcontentsQuery::create()
->filterByDbBlockId($this->id)
->filterByDbPosition($this->getSize()-1)
@ -992,7 +992,7 @@ EOT;
public function storeCriteriaIntoDb($p_criteriaData){
// delete criteria under $p_blockId
CcBlockcriteriaQuery::create()->findByDbBlockId($this->id)->delete();
Logging::log($p_criteriaData);
Logging::info($p_criteriaData);
//insert modifier rows
if (isset($p_criteriaData['criteria'])) {
$critKeys = array_keys($p_criteriaData['criteria']);
@ -1188,7 +1188,7 @@ EOT;
$qry->add($spCriteria, $spCriteriaValue, $spCriteriaModifier);
}
}catch (Exception $e){
Logging::log($e);
Logging::info($e);
}
$i++;
}
@ -1210,7 +1210,7 @@ EOT;
$out = $qry->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)->find();
return array("files"=>$out, "limit"=>$limits, "count"=>$out->count());
}catch(Exception $e){
Logging::log($e);
Logging::info($e);
}
}

View File

@ -21,7 +21,7 @@ class Application_Model_Library
public static function changePlaylist($p_id, $p_type)
{
$obj_sess = new Zend_Session_Namespace(UI_PLAYLISTCONTROLLER_OBJ_SESSNAME);
Logging::log($obj_sess);
Logging::info($obj_sess);
if (is_null($p_id) || is_null($p_type)) {
unset($obj_sess->id);

View File

@ -5,4 +5,6 @@ interface Application_Model_LibraryEditable
public function setMetadata($key, $val);
public function setName($name);
public function getLength();
public function getId();
}

View File

@ -96,7 +96,7 @@ class Application_Model_LiveLog
return $minutes;
} catch (Exception $e) {
header('HTTP/1.0 503 Service Unavailable');
Logging::log("GetLiveShowDuration - Could not connect to database.");
Logging::info("GetLiveShowDuration - Could not connect to database.");
exit;
}
}
@ -254,7 +254,7 @@ class Application_Model_LiveLog
return $minutes;
} catch (Exception $e) {
header('HTTP/1.0 503 Service Unavailable');
Logging::log("GetScheduledDuration - Could not connect to database.");
Logging::info("GetScheduledDuration - Could not connect to database.");
exit;
}
}
@ -301,7 +301,7 @@ class Application_Model_LiveLog
} catch (Exception $e) {
header('HTTP/1.0 503 Service Unavailable');
Logging::log("SetNewLogTime - Could not connect to database.");
Logging::info("SetNewLogTime - Could not connect to database.");
exit;
}
}
@ -338,7 +338,7 @@ class Application_Model_LiveLog
} catch (Exception $e) {
header('HTTP/1.0 503 Service Unavailable');
Logging::log("SetEndTime - Could not connect to database.");
Logging::info("SetEndTime - Could not connect to database.");
exit;
}
}

View File

@ -135,8 +135,8 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable
public function getLastModified($format = null)
{
//Logging::log($this->pl->getDbMtime($format));
//Logging::log($this->pl);
//Logging::info($this->pl->getDbMtime($format));
//Logging::info($this->pl);
return $this->pl->getDbMtime($format);
}
@ -153,7 +153,7 @@ class Application_Model_Playlist implements Application_Model_LibraryEditable
*/
public function getContents($filterFiles=false)
{
Logging::log("Getting contents for playlist {$this->id}");
Logging::info("Getting contents for playlist {$this->id}");
$files = array();
$sql = <<<SQL
@ -391,11 +391,11 @@ SQL;
try {
if (is_numeric($p_afterItem)) {
Logging::log("Finding playlist content item {$p_afterItem}");
Logging::info("Finding playlist content item {$p_afterItem}");
$afterItem = CcPlaylistcontentsQuery::create()->findPK($p_afterItem);
$index = $afterItem->getDbPosition();
Logging::log("index is {$index}");
Logging::info("index is {$index}");
$pos = ($addType == 'after') ? $index + 1 : $index;
$contentsToUpdate = CcPlaylistcontentsQuery::create()
@ -428,13 +428,13 @@ SQL;
}
Logging::log("Adding to playlist");
Logging::log("at position {$pos}");
Logging::info("Adding to playlist");
Logging::info("at position {$pos}");
foreach ($p_items as $ac) {
$res = $this->insertPlaylistElement($this->buildEntry($ac, $pos));
$pos = $pos + 1;
Logging::log("Adding $ac[1] $ac[0]");
Logging::info("Adding $ac[1] $ac[0]");
}
@ -483,32 +483,32 @@ SQL;
$pos = 0;
//moving items to beginning of the playlist.
if (is_null($p_afterItem)) {
Logging::log("moving items to beginning of playlist");
Logging::info("moving items to beginning of playlist");
foreach ($contentsToMove as $item) {
Logging::log("item {$item->getDbId()} to pos {$pos}");
Logging::info("item {$item->getDbId()} to pos {$pos}");
$item->setDbPosition($pos);
$item->save($this->con);
$pos = $pos + 1;
}
foreach ($otherContent as $item) {
Logging::log("item {$item->getDbId()} to pos {$pos}");
Logging::info("item {$item->getDbId()} to pos {$pos}");
$item->setDbPosition($pos);
$item->save($this->con);
$pos = $pos + 1;
}
} else {
Logging::log("moving items after {$p_afterItem}");
Logging::info("moving items after {$p_afterItem}");
foreach ($otherContent as $item) {
Logging::log("item {$item->getDbId()} to pos {$pos}");
Logging::info("item {$item->getDbId()} to pos {$pos}");
$item->setDbPosition($pos);
$item->save($this->con);
$pos = $pos + 1;
if ($item->getDbId() == $p_afterItem) {
foreach ($contentsToMove as $move) {
Logging::log("item {$move->getDbId()} to pos {$pos}");
Logging::info("item {$move->getDbId()} to pos {$pos}");
$move->setDbPosition($pos);
$move->save($this->con);
$pos = $pos + 1;
@ -568,7 +568,7 @@ SQL;
public function getFadeInfo($pos)
{
Logging::log("Getting fade info for pos {$pos}");
Logging::info("Getting fade info for pos {$pos}");
$row = CcPlaylistcontentsQuery::create()
->joinWith(CcFilesPeer::OM_CLASS)
@ -654,7 +654,7 @@ SQL;
public function setfades($fadein, $fadeout)
{
if (isset($fadein)) {
Logging::log("Setting playlist fade in {$fadein}");
Logging::info("Setting playlist fade in {$fadein}");
$row = CcPlaylistcontentsQuery::create()
->filterByDbPlaylistId($this->id)
->filterByDbPosition(0)
@ -664,7 +664,7 @@ SQL;
}
if (isset($fadeout)) {
Logging::log("Setting playlist fade out {$fadeout}");
Logging::info("Setting playlist fade out {$fadeout}");
$row = CcPlaylistcontentsQuery::create()
->filterByDbPlaylistId($this->id)
->filterByDbPosition($this->getSize()-1)

View File

@ -66,7 +66,7 @@ class Application_Model_Preference
} catch (Exception $e) {
header('HTTP/1.0 503 Service Unavailable');
Logging::log("Could not connect to database: ".$e->getMessage());
Logging::info("Could not connect to database: ".$e->getMessage());
exit;
}
@ -107,7 +107,7 @@ class Application_Model_Preference
}
} catch (Exception $e) {
header('HTTP/1.0 503 Service Unavailable');
Logging::log("Could not connect to database: ".$e->getMessage());
Logging::info("Could not connect to database: ".$e->getMessage());
exit;
}
}

View File

@ -32,7 +32,7 @@ class Application_Model_Schedule
{
if (!is_int($p_prev) || !is_int($p_next)) {
//must enter integers to specify ranges
Logging::log("Invalid range parameters: $p_prev or $p_next");
Logging::info("Invalid range parameters: $p_prev or $p_next");
return array();
}

View File

@ -110,7 +110,7 @@ class Application_Model_Scheduler
$ts = intval($instanceInfo[$id]);
$lastSchedTs = intval($instance->getDbLastScheduled("U")) ? : 0;
if ($ts < $lastSchedTs) {
Logging::log("ts {$ts} last sched {$lastSchedTs}");
Logging::info("ts {$ts} last sched {$lastSchedTs}");
throw new OutDatedScheduleException("The show {$show->getDbName()} has been previously updated!");
}
}
@ -317,7 +317,7 @@ class Application_Model_Scheduler
*/
private function removeGaps($showInstance, $exclude=null)
{
Logging::log("removing gaps from show instance #".$showInstance);
Logging::info("removing gaps from show instance #".$showInstance);
$instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con);
if (is_null($instance)) {
@ -416,7 +416,7 @@ class Application_Model_Scheduler
} else {
$sched = new CcSchedule();
}
Logging::log($file);
Logging::info($file);
$sched->setDbStarts($nextStartDT)
->setDbEnds($endTimeDT)
->setDbCueIn($file['cuein'])

View File

@ -216,8 +216,8 @@ class Application_Model_Show
$con->commit();
} catch (Exception $e) {
$con->rollback();
Logging::log("Couldn't update schedule status.");
Logging::log($e->getMessage());
Logging::info("Couldn't update schedule status.");
Logging::info($e->getMessage());
}
Application_Model_RabbitMq::PushSchedule();
@ -277,27 +277,27 @@ class Application_Model_Show
->filterByDbShowId($this->getId())
->find();
Logging::log("Unchecked days:");
Logging::info("Unchecked days:");
foreach ($p_uncheckedDays as $day) {
Logging::log($day);
Logging::info($day);
}
foreach ($showDays as $showDay) {
//Logging::log("Local show day is: {$showDay->getDbDay()}");
//Logging::log("First show day is: {$showDay->getDbFirstShow()}");
//Logging::log("Id show days is: {$showDay->getDbId()}");
//Logging::info("Local show day is: {$showDay->getDbDay()}");
//Logging::info("First show day is: {$showDay->getDbFirstShow()}");
//Logging::info("Id show days is: {$showDay->getDbId()}");
if (in_array($showDay->getDbDay(), $p_uncheckedDays)) {
$showDay->reload();
//Logging::log("Local show day is: {$showDay->getDbDay()}");
//Logging::log("First show day is: {$showDay->getDbFirstShow()}");
//Logging::log("Id show days is: {$showDay->getDbId()}");
//Logging::info("Local show day is: {$showDay->getDbDay()}");
//Logging::info("First show day is: {$showDay->getDbFirstShow()}");
//Logging::info("Id show days is: {$showDay->getDbId()}");
$startDay = new DateTime("{$showDay->getDbFirstShow()} {$showDay->getDbStartTime()}", new DateTimeZone($showDay->getDbTimezone()));
//Logging::log("Show start day: {$startDay->format('Y-m-d H:i:s')}");
//Logging::info("Show start day: {$startDay->format('Y-m-d H:i:s')}");
$startDay->setTimezone(new DateTimeZone("UTC"));
//Logging::log("Show start day UTC: {$startDay->format('Y-m-d H:i:s')}");
//Logging::info("Show start day UTC: {$startDay->format('Y-m-d H:i:s')}");
$daysRemovedUTC[] = $startDay->format('w');
//Logging::log("UTC show day is: {$startDay->format('w')}");
//Logging::info("UTC show day is: {$startDay->format('w')}");
}
}
@ -368,7 +368,7 @@ class Application_Model_Show
."WHERE instance_id = (SELECT id FROM cc_show_instances WHERE show_id = $showId ORDER BY starts LIMIT 1) AND rebroadcast = 1 "
."ORDER BY starts";
//Logging::log($sql);
//Logging::info($sql);
$rebroadcasts = $con->query($sql)->fetchAll();
@ -1160,8 +1160,8 @@ class Application_Model_Show
$con->commit();
} catch (Exception $e) {
$con->rollback();
Logging::log("Couldn't update schedule status.");
Logging::log($e->getMessage());
Logging::info("Couldn't update schedule status.");
Logging::info($e->getMessage());
}
}
@ -1590,7 +1590,7 @@ class Application_Model_Show
WHERE last_show IS NULL
OR first_show < '{$endTimeString}' AND last_show > '{$startTimeString}'";
//Logging::log($sql);
//Logging::info($sql);
$res = $con->query($sql)->fetchAll();
foreach ($res as $row) {
Application_Model_Show::populateShow($row, $p_endTimestamp);
@ -1723,7 +1723,7 @@ class Application_Model_Show
$showDay->setDbFirstShow($dt)->setDbStartTime($dt)
->save();
//Logging::log("setting show's first show.");
//Logging::info("setting show's first show.");
}
/* Takes in a UTC DateTime object

View File

@ -571,9 +571,9 @@ class Application_Model_ShowInstance
$rebroad = new Application_Model_ShowInstance($rebroadcast->getDbId());
$rebroad->addFileToShow($file_id, false);
} catch (Exception $e) {
Logging::log("{$e->getFile()}");
Logging::log("{$e->getLine()}");
Logging::log("{$e->getMessage()}");
Logging::info("{$e->getFile()}");
Logging::info("{$e->getLine()}");
Logging::info("{$e->getMessage()}");
}
}
}

View File

@ -96,7 +96,7 @@ class Application_Model_StoredFile
*/
public function setMetadata($p_md=null)
{
Logging::log("entered setMetadata");
Logging::info("entered setMetadata");
if (is_null($p_md)) {
$this->setDbColMetadata();
} else {
@ -153,7 +153,7 @@ class Application_Model_StoredFile
if (isset($this->_dbMD[$dbColumn])) {
$propelColumn = $this->_dbMD[$dbColumn];
$method = "set$propelColumn";
Logging::log($method);
Logging::info($method);
$this->_file->$method($mdValue);
}
}
@ -446,7 +446,7 @@ class Application_Model_StoredFile
*/
public function getRelativeFileUrl($baseUrl)
{
Logging::log("getting media!");
Logging::info("getting media!");
return $baseUrl."/api/get-media/file/".$this->getId().".".$this->getFileExtension();
}
@ -760,7 +760,7 @@ class Application_Model_StoredFile
$chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0;
$chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0;
$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
Logging::log(__FILE__.":uploadFile(): filename=$fileName to $p_targetDir");
Logging::info(__FILE__.":uploadFile(): filename=$fileName to $p_targetDir");
// Clean the fileName for security reasons
//this needs fixing for songs not in ascii.
//$fileName = preg_replace('/[^\w\._]+/', '', $fileName);
@ -852,7 +852,7 @@ class Application_Model_StoredFile
public static function copyFileToStor($p_targetDir, $fileName, $tempname)
{
$audio_file = $p_targetDir . DIRECTORY_SEPARATOR . $tempname;
Logging::log('copyFileToStor: moving file '.$audio_file);
Logging::info('copyFileToStor: moving file '.$audio_file);
$md5 = md5_file($audio_file);
$duplicate = Application_Model_StoredFile::RecallByMd5($md5, true);
@ -877,7 +877,7 @@ class Application_Model_StoredFile
}
if (chmod($audio_file, 0644) === false) {
Logging::log("Warning: couldn't change permissions of $audio_file to 0644");
Logging::info("Warning: couldn't change permissions of $audio_file to 0644");
}
//check to see if there is enough space in $stor to continue.
@ -886,7 +886,7 @@ class Application_Model_StoredFile
if (self::liquidsoapFilePlayabilityTest($audio_file)) {
Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
Logging::info("copyFileToStor: moving file $audio_file to $audio_stor");
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
if (@rename($audio_file, $audio_stor) === false) {
@ -1004,7 +1004,7 @@ class Application_Model_StoredFile
return count($rows);
} catch (Exception $e) {
header('HTTP/1.0 503 Service Unavailable');
Logging::log("Could not connect to database.");
Logging::info("Could not connect to database.");
exit;
}

View File

@ -66,7 +66,7 @@ class Application_Model_StreamSetting
$ids[] = substr($row["keyname"], 0, strpos($row["keyname"], "_"));
}
//Logging::log(print_r($ids, true));
//Logging::info(print_r($ids, true));
return $ids;
}

View File

@ -224,7 +224,7 @@ class Application_Model_Systemstatus
$partitions[$totalSpace]->totalSpace = $totalSpace;
$partitions[$totalSpace]->totalFreeSpace = $totalSpace - $usedSpace;
Logging::log($partitions[$totalSpace]->totalFreeSpace);
Logging::info($partitions[$totalSpace]->totalFreeSpace);
} else {
/* First lets get all the watched directories. Then we can group them
* into the same partitions by comparing the partition sizes. */

View File

@ -6,7 +6,13 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
public function __construct($webstream)
{
//TODO: hacky...
Logging::info("x ".$webstream);
if (is_int($webstream)) {
$this->webstream = CcWebstreamQuery::create()->findPK($webstream);
} else {
$this->webstream = $webstream;
}
}
public function getOrm()
@ -41,6 +47,11 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
return "";
}
public function getLength()
{
return $this->getDefaultLength();
}
public function getDescription()
{
return $this->webstream->getDbDescription();

View File

@ -4,8 +4,16 @@
<div id="side_playlist" class="pl-content ui-widget ui-widget-content block-shadow omega-block padded">
<?php if ($this->type == 'block') {
echo $this->render('playlist/smart-block.phtml');
} else {
echo $this->render('playlist/playlist.phtml');
} ?>
</div>
echo $this->render('playlist/smart-block.phtml');
} else if ($this->type == 'playlist') {
echo $this->render('playlist/playlist.phtml');
} else if ($this->type == 'stream') {
echo $this->render('webstream/webstream.phtml');
} else {
echo $this->render('webstream/webstream.phtml');
//throw new Exception("Unrecognized type: '{$this->type}'");
}
?>
</div>

View File

@ -1,20 +1,20 @@
<button id="ws_new" class="ui-button ui-widget ui-state-default" role="button" aria-disabled="false">New</button>
<?php if (isset($this->ws)) : ?>
<?php if (isset($this->obj)) : ?>
<button id="ws_delete" class="ui-button ui-widget ui-state-default" <?php if ($this->action == "new"): ?>style="display:none;"<?php endif; ?> role="button" aria-disabled="false">Delete</button>
<?php endif; ?>
<?php if (isset($this->ws)) : ?>
<input id="obj_id" type="hidden" value="<?php echo $this->ws->getId(); ?>"></input>
<input id="obj_lastMod" type="hidden" value="<?php echo "1";//$this->ws->getLastModified('U'); ?>"></input>
<?php if (isset($this->obj)) : ?>
<input id="obj_id" type="hidden" value="<?php echo $this->obj->getId(); ?>"></input>
<input id="obj_lastMod" type="hidden" value="<?php echo "1";//$this->obj->getLastModified('U'); ?>"></input>
<input id="obj_type" type="hidden" value="webstream"></input>
<div class="status" style="display:none;"></div>
<div class="playlist_title">
<div id="name-error" class="errors" style="display:none;"></div>
<h3 id="ws_name">
<a id="playlist_name_display" contenteditable="true"><?php echo $this->ws->getName(); ?></a>
<a id="playlist_name_display" contenteditable="true"><?php echo $this->obj->getName(); ?></a>
</h3>
<h4 id="ws_length"><?php echo $this->ws->getDefaultLength(); ?></h4>
<h4 id="ws_length"><?php echo $this->obj->getDefaultLength(); ?></h4>
</div>
<fieldset class="toggle" id="fieldset-metadate_change">
@ -22,18 +22,18 @@
<dl class="zend_form">
<dt id="description-label"><label for="description">Description</label></dt>
<dd id="description-element">
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->ws->getDescription(); ?></textarea>
<textarea cols="80" rows="24" id="description" name="description"><?php echo $this->obj->getDescription(); ?></textarea>
</dd>
<dt id="submit-label" style="display: none;">&nbsp;</dt>
<div id="url-error" class="errors" style="display:none;"></div>
<dt id="streamurl-label"><label for="streamurl">Stream URL:</label></dt>
<dd id="streamurl-element">
<input type="text" value="<?php echo $this->ws->getUrl(); ?>" size="40"/>
<input type="text" value="<?php echo $this->obj->getUrl(); ?>" size="40"/>
</dd>
<div id="length-error" class="errors" style="display:none;"></div>
<dt id="streamlength-label"><label for="streamlength">Default Length:</label></dt>
<dd id="streamlength-element">
<input type="text" value="<?php echo $this->ws->getDefaultLength() ?>"/>
<input type="text" value="<?php echo $this->obj->getDefaultLength() ?>"/>
</dd>
<dd id="submit-element" class="buttons">
<input class="ui-button ui-state-default" type="submit" value="Save" id="webstream_save" name="submit">