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

This commit is contained in:
James 2011-09-28 13:46:10 -04:00
commit 28f1d885f2
53 changed files with 625 additions and 294 deletions

View file

@ -11,16 +11,7 @@ require_once __DIR__."/configs/constants.php";
require_once __DIR__."/configs/conf.php";
require_once 'DB.php';
require_once 'Soundcloud.php';
//require_once 'MusicDir.php';
//require_once 'Playlist.php';
//require_once 'StoredFile.php';
//require_once 'Schedule.php';
require_once 'Preference.php';
//require_once 'Shows.php';
//require_once 'User.php';
require_once 'RabbitMq.php';
require_once 'DateHelper.php';
require_once __DIR__.'/controllers/plugins/RabbitMqPlugin.php';
global $CC_CONFIG, $CC_DBC;

View file

@ -158,7 +158,7 @@ class ApiController extends Zend_Controller_Action
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timeNow = $date->getTimestamp();
$result = array("env"=>APPLICATION_ENV,
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
@ -400,7 +400,7 @@ class ApiController extends Zend_Controller_Action
$tags = array_merge($hosts, array($show_name));
try {
$soundcloud = new ATSoundcloud();
$soundcloud = new Application_Model_AtSoundcloud();
$soundcloud_id = $soundcloud->uploadTrack($file->getFilePath(), $tmpTitle, $description, $tags, $show_start_time, $show_genre);
$file->setSoundCloudFileId($soundcloud_id);
break;
@ -673,7 +673,6 @@ class ApiController extends Zend_Controller_Action
"platform"=>Application_Model_Systemstatus::GetPlatformInfo(),
"airtime_version"=>Application_Model_Preference::GetAirtimeVersion(),
"services"=>array(
"icecast2"=>Application_Model_Systemstatus::GetIcecastStatus(),
"rabbitmq"=>Application_Model_Systemstatus::GetRabbitMqStatus(),
"pypo"=>Application_Model_Systemstatus::GetPypoStatus(),
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),

View file

@ -164,7 +164,7 @@ class LibraryController extends Zend_Controller_Action
else {
$res = settype($res, "integer");
$data = array("filepath" => $file->getFilePath(), "delete" => $res);
RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data);
}
}
@ -214,7 +214,7 @@ class LibraryController extends Zend_Controller_Action
$data = $file->getMetadata();
RabbitMq::SendMessageToMediaMonitor("md_update", $data);
Application_Model_RabbitMq::SendMessageToMediaMonitor("md_update", $data);
$this->_helper->redirector('index');
}

View file

@ -188,7 +188,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_StreamSetting::setStreamSetting($values);
$data = array();
$data['setting'] = Application_Model_StreamSetting::getStreamSetting();
RabbitMq::SendMessageToPypo("update_stream_setting", $data);
Application_Model_RabbitMq::SendMessageToPypo("update_stream_setting", $data);
$this->view->statusMsg = "<div class='success'>Stream Setting Updated.</div>";
}
}

View file

@ -152,8 +152,8 @@ class ScheduleController extends Zend_Controller_Action
$params = '/format/json/id/#id#';
$showStartDateHelper = DateHelper::ConvertToLocalDateTime($show->getShowStart());
$showEndDateHelper = DateHelper::ConvertToLocalDateTime($show->getShowEnd());
$showStartDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowStart());
$showEndDateHelper = Application_Model_DateHelper::ConvertToLocalDateTime($show->getShowEnd());
if ($epochNow < $showStartDateHelper->getTimestamp()) {
@ -461,7 +461,7 @@ class ScheduleController extends Zend_Controller_Action
$i = 1;
foreach ($rebroadcastsRelative as $rebroadcast){
$rebroadcastFormValues["add_show_rebroadcast_date_$i"] = $rebroadcast['day_offset'];
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
$rebroadcastFormValues["add_show_rebroadcast_time_$i"] = Application_Model_DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
$i++;
}
$formRebroadcast->populate($rebroadcastFormValues);
@ -471,7 +471,7 @@ class ScheduleController extends Zend_Controller_Action
$i = 1;
foreach ($rebroadcastsAbsolute as $rebroadcast){
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_date_absolute_$i"] = $rebroadcast['start_date'];
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_time_absolute_$i"] = DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
$rebroadcastAbsoluteFormValues["add_show_rebroadcast_time_absolute_$i"] = Application_Model_DateHelper::removeSecondsFromTime($rebroadcast['start_time']);
$i++;
}
$formAbsoluteRebroadcast->populate($rebroadcastAbsoluteFormValues);
@ -700,7 +700,7 @@ class ScheduleController extends Zend_Controller_Action
$show->clearShow();
$show->deleteShow();
// send 'cancel-current-show' command to pypo
RabbitMq::SendMessageToPypo("cancel_current_show", array());
Application_Model_RabbitMq::SendMessageToPypo("cancel_current_show", array());
}
}

View file

@ -18,8 +18,7 @@ class SystemstatusController extends Zend_Controller_Action
"liquidsoap"=>Application_Model_Systemstatus::GetLiquidsoapStatus(),
"show-recorder"=>Application_Model_Systemstatus::GetShowRecorderStatus(),
"media-monitor"=>Application_Model_Systemstatus::GetMediaMonitorStatus(),
"rabbitmq-server"=>Application_Model_Systemstatus::GetRabbitMqStatus(),
"icecast2"=>Application_Model_Systemstatus::GetIcecastStatus()
"rabbitmq-server"=>Application_Model_Systemstatus::GetRabbitMqStatus()
);
$partitions = Application_Model_Systemstatus::GetDiskInfo();
@ -27,7 +26,6 @@ class SystemstatusController extends Zend_Controller_Action
$this->view->status = new StdClass;
$this->view->status->services = $services;
$this->view->status->partitions = $partitions;
}
public function getLogFileAction()

View file

@ -4,10 +4,10 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract
{
public function dispatchLoopShutdown()
{
if (RabbitMq::$doPush) {
if (Application_Model_RabbitMq::$doPush) {
$md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists());
RabbitMq::SendMessageToPypo("update_schedule", $md);
RabbitMq::SendMessageToShowRecorder("update_schedule");
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
Application_Model_RabbitMq::SendMessageToShowRecorder("update_schedule");
}
}
}

View file

@ -1,6 +1,6 @@
<?php
class DateHelper
class Application_Model_DateHelper
{
private $_dateTime;

View file

@ -58,7 +58,7 @@ class Application_Model_MusicDir {
$temp_show->updateScheduledTime();
}
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
}
/**
@ -184,7 +184,7 @@ class Application_Model_MusicDir {
$data = array();
$data["directory"] = $p_path;
RabbitMq::SendMessageToMediaMonitor("new_watch", $data);
Application_Model_RabbitMq::SendMessageToMediaMonitor("new_watch", $data);
}
return $res;
}
@ -256,7 +256,7 @@ class Application_Model_MusicDir {
$data = array();
$data["directory"] = $p_dir;
$data["dir_id"] = $dirId;
RabbitMq::SendMessageToMediaMonitor("change_stor", $data);
Application_Model_RabbitMq::SendMessageToMediaMonitor("change_stor", $data);
return array("code"=>0);
}else{
return array("code"=>1, "error"=>"'$p_dir' is already set as the current storage dir or in the watched folders list.");
@ -292,7 +292,7 @@ class Application_Model_MusicDir {
$dir->remove();
$data = array();
$data["directory"] = $p_dir;
RabbitMq::SendMessageToMediaMonitor("remove_watch", $data);
Application_Model_RabbitMq::SendMessageToMediaMonitor("remove_watch", $data);
return array("code"=>0);
}
}

View file

@ -14,10 +14,10 @@ class Application_Model_Nowplaying
foreach ($p_dbRows as $dbRow){
$showStartDateTime = DateHelper::ConvertToLocalDateTime($dbRow['show_starts']);
$showEndDateTime = DateHelper::ConvertToLocalDateTime($dbRow['show_ends']);
$itemStartDateTime = DateHelper::ConvertToLocalDateTime($dbRow['item_starts']);
$itemEndDateTime = DateHelper::ConvertToLocalDateTime($dbRow['item_ends']);
$showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['show_starts']);
$showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['show_ends']);
$itemStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['item_starts']);
$itemEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($dbRow['item_ends']);
$showStarts = $showStartDateTime->format("Y-m-d H:i:s");
$showEnds = $showEndDateTime->format("Y-m-d H:i:s");
@ -61,7 +61,7 @@ class Application_Model_Nowplaying
$startCutoff = 60;
$endCutoff = 86400; //60*60*24 - seconds in a day
} else {
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$time = $date->getTime();
$date->setDate($dateString." ".$time);
$timeNow = $date->getUtcTimestamp();
@ -81,8 +81,8 @@ class Application_Model_Nowplaying
$showId = $si->getShowId();
$show = new Application_Model_Show($showId);
$showStartDateTime = DateHelper::ConvertToLocalDateTime($si->getShowStart());
$showEndDateTime = DateHelper::ConvertToLocalDateTime($si->getShowEnd());
$showStartDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowStart());
$showEndDateTime = Application_Model_DateHelper::ConvertToLocalDateTime($si->getShowEnd());
//append show header row
$data[] = self::CreateHeaderRow($show->getName(), $showStartDateTime->format("Y-m-d H:i:s"), $showEndDateTime->format("Y-m-d H:i:s"));

View file

@ -81,7 +81,7 @@ class Application_Model_Preference
self::SetValue("station_name", $title);
$defaultNamespace = new Zend_Session_Namespace('title_name');
$defaultNamespace->title = $title;
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
//set session variable to new station name so that html title is updated.
//should probably do this in a view helper to keep this controller as minimal as possible.
@ -107,7 +107,7 @@ class Application_Model_Preference
public static function SetStreamLabelFormat($type){
self::SetValue("stream_label_format", $type);
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
}
public static function GetStreamLabelFormat(){

View file

@ -1,7 +1,7 @@
<?php
require_once 'php-amqplib/amqp.inc';
class RabbitMq
class Application_Model_RabbitMq
{
static public $doPush = FALSE;
@ -9,7 +9,7 @@ class RabbitMq
* Sets a flag to push the schedule at the end of the request.
*/
public static function PushSchedule() {
RabbitMq::$doPush = TRUE;
Application_Model_RabbitMq::$doPush = TRUE;
}
public static function SendMessageToPypo($event_type, $md)

View file

@ -143,7 +143,7 @@ class Application_Model_Schedule {
global $CC_CONFIG;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timeNow = $date->getUtcTimestamp();
return array("env"=>APPLICATION_ENV,
"schedulerTime"=>$timeNow,
@ -499,8 +499,8 @@ class Application_Model_Schedule {
'fade_in' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_in"]),
'fade_out' => Application_Model_Schedule::WallTimeToMillisecs($item["fade_out"]),
'fade_cross' => 0,
'cue_in' => DateHelper::CalculateLengthInSeconds($item["cue_in"]),
'cue_out' => DateHelper::CalculateLengthInSeconds($item["cue_out"]),
'cue_in' => Application_Model_DateHelper::CalculateLengthInSeconds($item["cue_in"]),
'cue_out' => Application_Model_DateHelper::CalculateLengthInSeconds($item["cue_out"]),
'export_source' => 'scheduler',
'start' => $starts,
'end' => Application_Model_Schedule::AirtimeTimeToPypoTime($item["ends"])

View file

@ -116,7 +116,7 @@ class Application_Model_ScheduleGroup {
}
}
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
return $this->groupId;
}
@ -155,7 +155,7 @@ class Application_Model_ScheduleGroup {
." WHERE group_id = ".$this->groupId;
//echo $sql;
$retVal = $CC_DBC->query($sql);
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
return $retVal;
}

View file

@ -19,7 +19,7 @@ class Application_Model_Show {
{
$show = CcShowQuery::create()->findPK($this->_showId);
$show->setDbName($name);
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
}
public function getDescription()
@ -119,7 +119,7 @@ class Application_Model_Show {
WHERE starts >= '{$day_timestamp}' AND show_id = {$this->_showId}";
$CC_DBC->query($sql);
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
}
/**
@ -137,7 +137,7 @@ class Application_Model_Show {
$uncheckedDaysImploded = implode(",", $p_uncheckedDays);
$showId = $this->getId();
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$sql = "DELETE FROM cc_show_instances"
@ -302,7 +302,7 @@ class Application_Model_Show {
public function deleteAllInstances(){
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$showId = $this->getId();
@ -321,7 +321,7 @@ class Application_Model_Show {
public function deleteAllRebroadcasts(){
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$showId = $this->getId();
@ -343,11 +343,11 @@ class Application_Model_Show {
public function removeAllInstancesFromDate($p_date=null){
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
if(is_null($p_date)) {
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$p_date = $date->getDate();
}
@ -377,7 +377,7 @@ class Application_Model_Show {
public function removeAllInstancesBeforeDate($p_date){
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$showId = $this->getId();
@ -481,7 +481,7 @@ class Application_Model_Show {
* true if the StartDate is in the past, false otherwise
*/
public function isStartDateTimeInPast(){
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$current_timestamp = $date->getTimestamp();
return ($current_timestamp > $this->getStartDate()." ".$this->getStartTime());
}
@ -495,7 +495,7 @@ class Application_Model_Show {
public function getAllFutureInstanceIds(){
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$showId = $this->getId();
@ -517,7 +517,7 @@ class Application_Model_Show {
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$sql = "UPDATE cc_show_days "
@ -538,7 +538,7 @@ class Application_Model_Show {
global $CC_DBC;
$date = new DateHelper;
$date = new Application_Model_DateHelper;
$timestamp = $date->getTimestamp();
$sql = "UPDATE cc_show_days "
@ -871,7 +871,7 @@ class Application_Model_Show {
}
Application_Model_Show::populateShowUntil($showId);
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
return $showId;
}
@ -955,7 +955,7 @@ class Application_Model_Show {
$sql = "SELECT timestamp '{$start}' + interval '{$duration}'";
$end = $CC_DBC->GetOne($sql);
$date = new DateHelper();
$date = new Application_Model_DateHelper();
$currentTimestamp = $date->getTimestamp();
$show = new Application_Model_Show($show_id);
@ -1008,7 +1008,7 @@ class Application_Model_Show {
}
}
}
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
}
//for a show with repeat_type == 0,1,2
@ -1028,7 +1028,7 @@ class Application_Model_Show {
$rebroadcasts = $CC_DBC->GetAll($sql);
$show = new Application_Model_Show($show_id);
$date = new DateHelper();
$date = new Application_Model_DateHelper();
$currentTimestamp = $date->getTimestamp();
while(strtotime($next_date) <= strtotime($end_timestamp) && (strtotime($last_show) > strtotime($next_date) || is_null($last_show))) {
@ -1091,7 +1091,7 @@ class Application_Model_Show {
}
Application_Model_Show::setNextPop($next_date, $show_id, $day);
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
}
private static function populateShow($repeatType, $show_id, $next_pop_date,

View file

@ -111,14 +111,14 @@ class Application_Model_ShowInstance {
{
$this->_showInstance->setDbStarts($start)
->save();
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
}
public function setShowEnd($end)
{
$this->_showInstance->setDbEnds($end)
->save();
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
}
public function updateScheduledTime()
@ -153,7 +153,7 @@ class Application_Model_ShowInstance {
$CC_DBC->query($sql);
}
}
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
}
public function moveShow($deltaDay, $deltaMin)
@ -219,7 +219,7 @@ class Application_Model_ShowInstance {
$show->setShowLastShow($new_ends);
}
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
}
public function resizeShow($deltaDay, $deltaMin)
@ -263,7 +263,7 @@ class Application_Model_ShowInstance {
}
$this->setShowEnd($new_ends);
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
}
/**
@ -295,7 +295,7 @@ class Application_Model_ShowInstance {
else {
$groupId = $sched->addPlaylistAfter($this->_instanceId, $lastGroupId, $plId);
}
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
$this->updateScheduledTime();
}
@ -315,7 +315,7 @@ class Application_Model_ShowInstance {
else {
$groupId = $sched->addFileAfter($this->_instanceId, $lastGroupId, $file_id);
}
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
$this->updateScheduledTime();
}
@ -351,7 +351,7 @@ class Application_Model_ShowInstance {
WHERE starts >= '{$groupBoundry["end_timestamp"]}' AND instance_id = {$this->_instanceId}";
$CC_DBC->query($sql);
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
$this->updateScheduledTime();
}
@ -360,7 +360,7 @@ class Application_Model_ShowInstance {
CcScheduleQuery::create()
->filterByDbInstanceId($this->_instanceId)
->delete();
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
$this->updateScheduledTime();
}
@ -373,9 +373,9 @@ class Application_Model_ShowInstance {
CcShowInstancesQuery::create()
->findPK($this->_instanceId)
->delete();
RabbitMq::PushSchedule();
Application_Model_RabbitMq::PushSchedule();
if($recording){
RabbitMq::SendMessageToShowRecorder("cancel_recording");
Application_Model_RabbitMq::SendMessageToShowRecorder("cancel_recording");
}
}

View file

@ -2,7 +2,7 @@
require_once 'soundcloud-api/Services/Soundcloud.php';
class ATSoundcloud {
class Application_Model_AtSoundcloud {
private $_soundcloud;

View file

@ -945,7 +945,7 @@ class Application_Model_StoredFile {
$release = $file->getDbYear();
try {
$soundcloud = new ATSoundcloud();
$soundcloud = new Application_Model_AtSoundcloud();
$soundcloud_id = $soundcloud->uploadTrack($this->getFilePath(), $this->getName(), $description, $tag, $release, $genre);
$this->setSoundCloudFileId($soundcloud_id);
break;

View file

@ -1,7 +1,43 @@
<?php
class Application_Model_StreamSetting {
public function __construct(){
/* Returns the id's of all streams that are enabled in an array. An
* example of the array returned in JSON notation is ["s1", "s2", "s3"] */
public static function getEnabledStreamIds(){
global $CC_DBC;
$sql = "SELECT * "
."FROM cc_stream_setting "
."WHERE keyname LIKE '%_output' "
."AND value != 'disabled'";
$rows = $CC_DBC->getAll($sql);
$ids = array();
foreach ($rows as $row){
$ids[] = substr($row["keyname"], 0, strpos($row["keyname"], "_"));
}
//Logging::log(print_r($ids, true));
return $ids;
}
/* Returns all information related to a specific stream. An example
* of a stream id is 's1' or 's2'. */
public static function getStreamData($p_streamId){
global $CC_DBC;
$sql = "SELECT * "
."FROM cc_stream_setting "
."WHERE keyname LIKE '${p_streamId}_%'";
$rows = $CC_DBC->getAll($sql);
$data = array();
foreach($rows as $row){
$data[$row["keyname"]] = $row["value"];
}
return $data;
}
public static function getStreamSetting(){
@ -12,6 +48,7 @@ class Application_Model_StreamSetting {
$rows = $CC_DBC->getAll($sql);
return $rows;
}
public static function setStreamSetting($data){
global $CC_DBC;
foreach($data as $key=>$d){
@ -37,4 +74,4 @@ class Application_Model_StreamSetting {
}
}
}
}
}

View file

@ -97,9 +97,9 @@ while ($showTime < $endDate) {
$showNumber = $showNumber + 1;
}
if (RabbitMq::$doPush) {
if (Application_Model_RabbitMq::$doPush) {
$md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists());
RabbitMq::SendMessageToPypo("update_schedule", $md);
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
}

View file

@ -1,34 +1,83 @@
<div id="content" class="jp-container">
<?php $ids = Application_Model_StreamSetting::getEnabledStreamIds(); ?>
<script>
function setjPlayer(url, type){
var obj = new Object();
obj[type] = url;
$("#jquery_jplayer_1").jPlayer("destroy");
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", obj).jPlayer("play");
},
ended: function (event) {
$(this).jPlayer("play");
},
swfPath: "js",
supplied: type,
wmode: "window"
});
}
$(document).ready(function(){
$("#jquery_jplayer_1").jPlayer({
ready: function () {
$(this).jPlayer("setMedia", {
oga: "http://localhost:8000/airtime_128"
}).jPlayer("play");
},
ended: function (event) {
$(this).jPlayer("play");
},
swfPath: "js",
supplied: "oga"
});
$('.bit-rates').click(function(eventObject){
var elem = $(eventObject.target);
setjPlayer(elem.attr("data-url"), elem.attr("data-type"));
});
<?php
if (count($ids) > 0){
$id = $ids[0];
$streamData = Application_Model_StreamSetting::getStreamData($id);
$url = "http://".$streamData["${id}_host"].":".$streamData["${id}_port"]."/".$streamData["${id}_mount"];
$type = $streamData["${id}_type"];
if ($type == "ogg")
$type = "oga";
echo "setjPlayer('$url', '$type');";
}
?>
});
</script>
<div class="jp-logo"></div>
<div class="jp-stream">
<div class="jp-stream-text">Select stream:</div>
<form id="form1" method="post" action="">
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<?php
$i=0;
foreach($ids as $id):
$streamData = Application_Model_StreamSetting::getStreamData($id);
Logging::log("id: ".print_r($streamData, true));
<div class="jp-audio">
<div class="jp-type-single">
<div id="jp_interface_1" class="jp-interface">
<ul class="jp-controls">
<li><a href="#" class="jp-play" tabindex="1">play</a></li>
<li><a href="#" class="jp-pause" tabindex="1">pause</a></li>
<li><a href="#" class="jp-mute" tabindex="1">mute</a></li>
<li><a href="#" class="jp-unmute" tabindex="1">unmute</a></li>
</ul>
</div>
<div id="jp_playlist_1" class="jp-playlist">
</div>
</div>
</div>
$url = "http://".$streamData["${id}_host"].":".$streamData["${id}_port"]."/".$streamData["${id}_mount"];
$type = $streamData["${id}_type"];
if ($type == "ogg")
$type = "oga";
?>
<label>
<input class='bit-rates' type="radio" name="select-stream" value="radio" data-url="<?php echo $url ?>" data-type="<?php echo $type ?>" id="select-stream_<?php echo $id ?>" <?php echo $i==0 ? "checked=\"checked\"": ""; ?>/>
<?php echo "Stream ".substr($id, 1)." (".$streamData["${id}_bitrate"]; ?> Kbit/s)</label>
<?php $i++; endforeach; ?>
</form>
</div>
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div id="jp_container_1" class="jp-audio">
<div class="jp-type-single">
<div id="jp_interface_1" class="jp-gui jp-interface">
<ul class="jp-controls">
<li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li>
<li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li>
<li><a href="javascript:;" class="jp-mute" tabindex="1">mute</a></li>
<li><a href="javascript:;" class="jp-unmute" tabindex="1">unmute</a></li>
</ul>
</div>
<div id="jp_playlist_1" class="jp-playlist">
</div>
</div>
</div>
</div>