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

This commit is contained in:
James 2012-09-13 14:22:27 -04:00
commit b2d61f2402
5 changed files with 34 additions and 47 deletions

View file

@ -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()
{
// disable the view and the layout
@ -254,7 +239,7 @@ class ApiController extends Zend_Controller_Action
$type = $request->getParam('type');
/* 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
* 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") {
$limit = $request->getParam('limit');
if ($limit == "" || !is_numeric($limit)) {
@ -307,7 +292,8 @@ class ApiController extends Zend_Controller_Action
$dayStart = $date->getWeekStartDate();
$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();
for ($i=0; $i<7; $i++) {
@ -315,7 +301,9 @@ class ApiController extends Zend_Controller_Action
$shows = Application_Model_Show::getNextShows($utcDayStart, "0", $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;
}
@ -356,7 +344,6 @@ class ApiController extends Zend_Controller_Action
//needed for smart blocks
try {
$mediaType = Application_Model_Schedule::GetType($media_id);
var_dump($mediaType);
if ($mediaType == 'file') {
$file_id = Application_Model_Schedule::GetFileId($media_id);
if (!is_null($file_id)) {
@ -368,10 +355,8 @@ class ApiController extends Zend_Controller_Action
} else {
// webstream
$stream_id = Application_Model_Schedule::GetStreamId($media_id);
var_dump($stream_id);
if (!is_null($stream_id)) {
$webStream = new Application_Model_Webstream($stream_id);
var_dump($webStream);
$now = new DateTime("now", new DateTimeZone("UTC"));
$webStream->setLastPlayed($now);
}
@ -610,8 +595,6 @@ class ApiController extends Zend_Controller_Action
$dir_id = $request->getParam('dir_id');
$all = $request->getParam('all');
Logging::info("All param is: $all");
$this->view->files =
Application_Model_StoredFile::listAllFiles($dir_id,$all);
}

View file

@ -320,6 +320,7 @@ class LibraryController extends Zend_Controller_Action
} catch (Exception $e) {
//could throw a scheduled in future exception.
$message = "Could not delete some scheduled files.";
Logging::debug($e->getMessage());
}
}
}

View file

@ -7,9 +7,8 @@ class Application_Model_Schedule
*
* @param string $p_fileId
*/
public function IsFileScheduledInTheFuture($p_fileId)
public static function IsFileScheduledInTheFuture($p_fileId)
{
global $CC_CONFIG;
$sql = <<<SQL
SELECT COUNT(*)
FROM cc_schedule

View file

@ -14,7 +14,7 @@ $(document).ready(function(){
},[], //array of songs will be filled with below's json call
{
swfPath: "/js/jplayer",
supplied:"oga, mp3, m4v",
supplied:"oga, mp3, m4v, m4a, wav",
size: {
width: "0px",
height: "0px",
@ -37,7 +37,6 @@ $(document).ready(function(){
var audioUri = $('.audioUri').text();
var audioMime = $('.audioMime').text();
//var audioFileID = $('.audioFileID').text();
var playlistID = $('.playlistID').text();
var playlistIndex = $('.playlistIndex').text();
var showID = $('.showID').text();
@ -192,22 +191,31 @@ function play(p_playlistIndex){
function playOne(uri, mime) {
var playlist = new Array();
var media = null;
var key = null;
if (mime.search(/mp3/i) > 0 || mime.search(/mpeg/i) > 0) {
media = {title: $('.audioFileTitle').text() !== 'null' ?$('.audioFileTitle').text():"",
artist: $('.audioFileArtist').text() !== 'null' ?$('.audioFileArtist').text():"",
mp3:uri
};
key = "mp3";
} else if (mime.search(/og(g|a)/i) > 0 || mime.search(/vorbis/i) > 0) {
media = {title: $('.audioFileTitle').text() != 'null' ?$('.audioFileTitle').text():"",
artist: $('.audioFileArtist').text() != 'null' ?$('.audioFileArtist').text():"",
oga:uri
};
key = "oga";
} else if (mime.search(/mp4/i) > 0) {
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[0] = media;
_playlist_jplayer._initPlaylist(playlist);
_playlist_jplayer.play(0);
}
window.resizeTo(490, 167);
}

View file

@ -5,12 +5,8 @@ function isAudioSupported(mime){
var bMime = null;
if (mime.indexOf("ogg") != -1 || mime.indexOf("vorbis") != -1) {
bMime = 'audio/ogg; codecs="vorbis"';
} else if (mime.indexOf("mp3") != -1) {
bMime = "audio/mp3";
} else if (mime.indexOf("mp4") != -1) {
bMime = "audio/mp4";
} else if (mime.indexOf("flac") != -1) {
bMime = "audio/x-flac";
} else {
bMime = mime;
}
return !!bMime && !!audio.canPlayType && audio.canPlayType(bMime) != "";