Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
b2d61f2402
5 changed files with 34 additions and 47 deletions
|
@ -52,21 +52,6 @@ class ApiController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function indexAction()
|
|
||||||
{
|
|
||||||
// action body
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns Airtime version. i.e "1.7.0-beta"
|
|
||||||
*
|
|
||||||
* First checks to ensure the correct API key was
|
|
||||||
* supplied, then returns AIRTIME_VERSION as defined
|
|
||||||
* in the database
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function versionAction()
|
public function versionAction()
|
||||||
{
|
{
|
||||||
// disable the view and the layout
|
// disable the view and the layout
|
||||||
|
@ -182,8 +167,8 @@ class ApiController extends Zend_Controller_Action
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$begin= 0;
|
$begin = 0;
|
||||||
$end= $size - 1;
|
$end = $size - 1;
|
||||||
|
|
||||||
if (isset($_SERVER['HTTP_RANGE'])) {
|
if (isset($_SERVER['HTTP_RANGE'])) {
|
||||||
if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) {
|
if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) {
|
||||||
|
@ -254,7 +239,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
$type = $request->getParam('type');
|
$type = $request->getParam('type');
|
||||||
/* This is some *extremely* lazy programming that needs to bi fixed. For some reason
|
/* This is some *extremely* lazy programming that needs to bi fixed. For some reason
|
||||||
* we are using two entirely different codepaths for very similar functionality (type = endofday
|
* we are using two entirely different codepaths for very similar functionality (type = endofday
|
||||||
* vs type = interval). Needs to be fixed for 2.2 - MK */
|
* vs type = interval). Needs to be fixed for 2.3 - MK */
|
||||||
if ($type == "endofday") {
|
if ($type == "endofday") {
|
||||||
$limit = $request->getParam('limit');
|
$limit = $request->getParam('limit');
|
||||||
if ($limit == "" || !is_numeric($limit)) {
|
if ($limit == "" || !is_numeric($limit)) {
|
||||||
|
@ -307,7 +292,8 @@ class ApiController extends Zend_Controller_Action
|
||||||
$dayStart = $date->getWeekStartDate();
|
$dayStart = $date->getWeekStartDate();
|
||||||
$utcDayStart = Application_Common_DateHelper::ConvertToUtcDateTimeString($dayStart);
|
$utcDayStart = Application_Common_DateHelper::ConvertToUtcDateTimeString($dayStart);
|
||||||
|
|
||||||
$dow = array("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday");
|
$dow = array("monday", "tuesday", "wednesday", "thursday", "friday",
|
||||||
|
"saturday", "sunday");
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
for ($i=0; $i<7; $i++) {
|
for ($i=0; $i<7; $i++) {
|
||||||
|
@ -315,7 +301,9 @@ class ApiController extends Zend_Controller_Action
|
||||||
$shows = Application_Model_Show::getNextShows($utcDayStart, "0", $utcDayEnd);
|
$shows = Application_Model_Show::getNextShows($utcDayStart, "0", $utcDayEnd);
|
||||||
$utcDayStart = $utcDayEnd;
|
$utcDayStart = $utcDayEnd;
|
||||||
|
|
||||||
Application_Model_Show::convertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
Application_Model_Show::convertToLocalTimeZone($shows,
|
||||||
|
array("starts", "ends", "start_timestamp",
|
||||||
|
"end_timestamp"));
|
||||||
|
|
||||||
$result[$dow[$i]] = $shows;
|
$result[$dow[$i]] = $shows;
|
||||||
}
|
}
|
||||||
|
@ -356,7 +344,6 @@ class ApiController extends Zend_Controller_Action
|
||||||
//needed for smart blocks
|
//needed for smart blocks
|
||||||
try {
|
try {
|
||||||
$mediaType = Application_Model_Schedule::GetType($media_id);
|
$mediaType = Application_Model_Schedule::GetType($media_id);
|
||||||
var_dump($mediaType);
|
|
||||||
if ($mediaType == 'file') {
|
if ($mediaType == 'file') {
|
||||||
$file_id = Application_Model_Schedule::GetFileId($media_id);
|
$file_id = Application_Model_Schedule::GetFileId($media_id);
|
||||||
if (!is_null($file_id)) {
|
if (!is_null($file_id)) {
|
||||||
|
@ -368,10 +355,8 @@ class ApiController extends Zend_Controller_Action
|
||||||
} else {
|
} else {
|
||||||
// webstream
|
// webstream
|
||||||
$stream_id = Application_Model_Schedule::GetStreamId($media_id);
|
$stream_id = Application_Model_Schedule::GetStreamId($media_id);
|
||||||
var_dump($stream_id);
|
|
||||||
if (!is_null($stream_id)) {
|
if (!is_null($stream_id)) {
|
||||||
$webStream = new Application_Model_Webstream($stream_id);
|
$webStream = new Application_Model_Webstream($stream_id);
|
||||||
var_dump($webStream);
|
|
||||||
$now = new DateTime("now", new DateTimeZone("UTC"));
|
$now = new DateTime("now", new DateTimeZone("UTC"));
|
||||||
$webStream->setLastPlayed($now);
|
$webStream->setLastPlayed($now);
|
||||||
}
|
}
|
||||||
|
@ -610,8 +595,6 @@ class ApiController extends Zend_Controller_Action
|
||||||
$dir_id = $request->getParam('dir_id');
|
$dir_id = $request->getParam('dir_id');
|
||||||
$all = $request->getParam('all');
|
$all = $request->getParam('all');
|
||||||
|
|
||||||
Logging::info("All param is: $all");
|
|
||||||
|
|
||||||
$this->view->files =
|
$this->view->files =
|
||||||
Application_Model_StoredFile::listAllFiles($dir_id,$all);
|
Application_Model_StoredFile::listAllFiles($dir_id,$all);
|
||||||
}
|
}
|
||||||
|
|
|
@ -320,6 +320,7 @@ class LibraryController extends Zend_Controller_Action
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
//could throw a scheduled in future exception.
|
//could throw a scheduled in future exception.
|
||||||
$message = "Could not delete some scheduled files.";
|
$message = "Could not delete some scheduled files.";
|
||||||
|
Logging::debug($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,8 @@ class Application_Model_Schedule
|
||||||
*
|
*
|
||||||
* @param string $p_fileId
|
* @param string $p_fileId
|
||||||
*/
|
*/
|
||||||
public function IsFileScheduledInTheFuture($p_fileId)
|
public static function IsFileScheduledInTheFuture($p_fileId)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$sql = <<<SQL
|
$sql = <<<SQL
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM cc_schedule
|
FROM cc_schedule
|
||||||
|
|
|
@ -14,7 +14,7 @@ $(document).ready(function(){
|
||||||
},[], //array of songs will be filled with below's json call
|
},[], //array of songs will be filled with below's json call
|
||||||
{
|
{
|
||||||
swfPath: "/js/jplayer",
|
swfPath: "/js/jplayer",
|
||||||
supplied:"oga, mp3, m4v",
|
supplied:"oga, mp3, m4v, m4a, wav",
|
||||||
size: {
|
size: {
|
||||||
width: "0px",
|
width: "0px",
|
||||||
height: "0px",
|
height: "0px",
|
||||||
|
@ -37,7 +37,6 @@ $(document).ready(function(){
|
||||||
|
|
||||||
var audioUri = $('.audioUri').text();
|
var audioUri = $('.audioUri').text();
|
||||||
var audioMime = $('.audioMime').text();
|
var audioMime = $('.audioMime').text();
|
||||||
//var audioFileID = $('.audioFileID').text();
|
|
||||||
var playlistID = $('.playlistID').text();
|
var playlistID = $('.playlistID').text();
|
||||||
var playlistIndex = $('.playlistIndex').text();
|
var playlistIndex = $('.playlistIndex').text();
|
||||||
var showID = $('.showID').text();
|
var showID = $('.showID').text();
|
||||||
|
@ -192,22 +191,31 @@ function play(p_playlistIndex){
|
||||||
function playOne(uri, mime) {
|
function playOne(uri, mime) {
|
||||||
var playlist = new Array();
|
var playlist = new Array();
|
||||||
|
|
||||||
|
var media = null;
|
||||||
|
var key = null;
|
||||||
if (mime.search(/mp3/i) > 0 || mime.search(/mpeg/i) > 0) {
|
if (mime.search(/mp3/i) > 0 || mime.search(/mpeg/i) > 0) {
|
||||||
media = {title: $('.audioFileTitle').text() !== 'null' ?$('.audioFileTitle').text():"",
|
key = "mp3";
|
||||||
artist: $('.audioFileArtist').text() !== 'null' ?$('.audioFileArtist').text():"",
|
|
||||||
mp3:uri
|
|
||||||
};
|
|
||||||
} else if (mime.search(/og(g|a)/i) > 0 || mime.search(/vorbis/i) > 0) {
|
} else if (mime.search(/og(g|a)/i) > 0 || mime.search(/vorbis/i) > 0) {
|
||||||
media = {title: $('.audioFileTitle').text() != 'null' ?$('.audioFileTitle').text():"",
|
key = "oga";
|
||||||
artist: $('.audioFileArtist').text() != 'null' ?$('.audioFileArtist').text():"",
|
} else if (mime.search(/mp4/i) > 0) {
|
||||||
oga:uri
|
key = "m4a";
|
||||||
};
|
} else if (mime.search(/wav/i) > 0) {
|
||||||
|
key = "wav";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (key) {
|
||||||
|
media = {title: $('.audioFileTitle').text() != 'null' ?$('.audioFileTitle').text():"",
|
||||||
|
artist: $('.audioFileArtist').text() != 'null' ?$('.audioFileArtist').text():""
|
||||||
|
};
|
||||||
|
media[key] = uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (media) {
|
||||||
_playlist_jplayer.option("autoPlay", true);
|
_playlist_jplayer.option("autoPlay", true);
|
||||||
playlist[0] = media;
|
playlist[0] = media;
|
||||||
_playlist_jplayer._initPlaylist(playlist);
|
_playlist_jplayer._initPlaylist(playlist);
|
||||||
_playlist_jplayer.play(0);
|
_playlist_jplayer.play(0);
|
||||||
|
}
|
||||||
|
|
||||||
window.resizeTo(490, 167);
|
window.resizeTo(490, 167);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,8 @@ function isAudioSupported(mime){
|
||||||
var bMime = null;
|
var bMime = null;
|
||||||
if (mime.indexOf("ogg") != -1 || mime.indexOf("vorbis") != -1) {
|
if (mime.indexOf("ogg") != -1 || mime.indexOf("vorbis") != -1) {
|
||||||
bMime = 'audio/ogg; codecs="vorbis"';
|
bMime = 'audio/ogg; codecs="vorbis"';
|
||||||
} else if (mime.indexOf("mp3") != -1) {
|
} else {
|
||||||
bMime = "audio/mp3";
|
bMime = mime;
|
||||||
} else if (mime.indexOf("mp4") != -1) {
|
|
||||||
bMime = "audio/mp4";
|
|
||||||
} else if (mime.indexOf("flac") != -1) {
|
|
||||||
bMime = "audio/x-flac";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return !!bMime && !!audio.canPlayType && audio.canPlayType(bMime) != "";
|
return !!bMime && !!audio.canPlayType && audio.canPlayType(bMime) != "";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue