diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 57348e005..c22e63d55 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -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 @@ -182,8 +167,8 @@ class ApiController extends Zend_Controller_Action return; } - $begin= 0; - $end= $size - 1; + $begin = 0; + $end = $size - 1; if (isset($_SERVER['HTTP_RANGE'])) { 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'); /* 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); } diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index 291078323..99fc4bf08 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -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()); } } } diff --git a/airtime_mvc/application/models/Schedule.php b/airtime_mvc/application/models/Schedule.php index 99d44edd9..6e61dba97 100644 --- a/airtime_mvc/application/models/Schedule.php +++ b/airtime_mvc/application/models/Schedule.php @@ -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 = << 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) { + 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():"", - oga:uri - }; + artist: $('.audioFileArtist').text() != 'null' ?$('.audioFileArtist').text():"" + }; + media[key] = uri; } - _playlist_jplayer.option("autoPlay", true); - playlist[0] = media; - _playlist_jplayer._initPlaylist(playlist); - _playlist_jplayer.play(0); + if (media) { + _playlist_jplayer.option("autoPlay", true); + playlist[0] = media; + _playlist_jplayer._initPlaylist(playlist); + _playlist_jplayer.play(0); + } window.resizeTo(490, 167); } diff --git a/airtime_mvc/public/js/airtime/common/audioplaytest.js b/airtime_mvc/public/js/airtime/common/audioplaytest.js index 9e5218468..aa9b8917b 100644 --- a/airtime_mvc/public/js/airtime/common/audioplaytest.js +++ b/airtime_mvc/public/js/airtime/common/audioplaytest.js @@ -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) != "";