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

This commit is contained in:
Martin Konecny 2012-09-13 14:56:10 -04:00
commit 14db5053b1
5 changed files with 12 additions and 27 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
@ -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);
}

View File

@ -184,6 +184,7 @@ class AudiopreviewController extends Zend_Controller_Action
'element_artist' => isset($track['artist_name'])?$track['artist_name']:"",
'element_id' => isset($track['id'])?$track['id']:"",
'element_position' => isset($track['position'])?$track['position']:"",
'mime' => isset($track['mime'])?$track['mime']:""
);
/* If the track type is static we know it must be

View File

@ -320,7 +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::info($e);
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

@ -143,7 +143,7 @@ function buildplaylist(p_url, p_playIndex) {
mp3:data[index]['uri']
};
}
if (media) {
if (media && isAudioSupported(data[index]['mime'])) {
myPlaylist[index] = media;
}
// we should create a map according to the new position in the