Merge branch '2.2.x' of dev.sourcefabric.org:airtime into 2.2.x
This commit is contained in:
commit
3ecde35b7c
2
VERSION
2
VERSION
|
@ -1,2 +1,2 @@
|
||||||
PRODUCT_ID=Airtime
|
PRODUCT_ID=Airtime
|
||||||
PRODUCT_RELEASE=2.1.3
|
PRODUCT_RELEASE=2.2.0
|
||||||
|
|
|
@ -75,6 +75,7 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
$view->headScript()->appendScript("var baseUrl='$baseUrl/'");
|
$view->headScript()->appendScript("var baseUrl='$baseUrl/'");
|
||||||
|
|
||||||
//scripts for now playing bar
|
//scripts for now playing bar
|
||||||
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/airtime_bootstrap.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/helperfunctions.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/dashboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/dashboard.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/versiontooltip.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/airtime/dashboard/versiontooltip.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
|
@ -91,8 +92,6 @@ class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
|
||||||
}
|
}
|
||||||
$view->headScript()->appendScript("var userType = '$userType';");
|
$view->headScript()->appendScript("var userType = '$userType';");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) {
|
if (isset($CC_CONFIG['demo']) && $CC_CONFIG['demo'] == 1) {
|
||||||
$view->headScript()->appendFile($baseUrl.'/js/libs/google-analytics.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$view->headScript()->appendFile($baseUrl.'/js/libs/google-analytics.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,10 +143,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
* upto this point
|
* upto this point
|
||||||
*/
|
*/
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
$utc = new DateTimeZone('UTC');
|
||||||
|
$localTimezone = new DateTimeZone(Application_Model_Preference::GetTimezone());
|
||||||
$show_start = new DateTime($start_time);
|
$show_start = new DateTime($start_time);
|
||||||
$show_start->setTimezone(new DateTimeZone('UTC'));
|
$show_start->setTimezone($utc);
|
||||||
$show_end = new DateTime($end_time);
|
$show_end = new DateTime($end_time);
|
||||||
$show_end->setTimezone(new DateTimeZone('UTC'));
|
$show_end->setTimezone($utc);
|
||||||
|
|
||||||
if ($formData["add_show_repeats"]) {
|
if ($formData["add_show_repeats"]) {
|
||||||
|
|
||||||
|
@ -155,7 +157,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
$date = Application_Model_Preference::GetShowsPopulatedUntil();
|
$date = Application_Model_Preference::GetShowsPopulatedUntil();
|
||||||
|
|
||||||
if (is_null($date)) {
|
if (is_null($date)) {
|
||||||
$populateUntilDateTime = new DateTime("now", new DateTimeZone('UTC'));
|
$populateUntilDateTime = new DateTime("now", $utc);
|
||||||
Application_Model_Preference::SetShowsPopulatedUntil($populateUntilDateTime);
|
Application_Model_Preference::SetShowsPopulatedUntil($populateUntilDateTime);
|
||||||
} else {
|
} else {
|
||||||
$populateUntilDateTime = clone $date;
|
$populateUntilDateTime = clone $date;
|
||||||
|
@ -164,7 +166,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
} elseif (!$formData["add_show_no_end"]) {
|
} elseif (!$formData["add_show_no_end"]) {
|
||||||
$popUntil = $formData["add_show_end_date"]." ".$formData["add_show_end_time"];
|
$popUntil = $formData["add_show_end_date"]." ".$formData["add_show_end_time"];
|
||||||
$populateUntilDateTime = new DateTime($popUntil);
|
$populateUntilDateTime = new DateTime($popUntil);
|
||||||
$populateUntilDateTime->setTimezone(new DateTimeZone('UTC'));
|
$populateUntilDateTime->setTimezone($utc);
|
||||||
}
|
}
|
||||||
|
|
||||||
//get repeat interval
|
//get repeat interval
|
||||||
|
@ -203,8 +205,18 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
else
|
else
|
||||||
$daysAdd = $day - $startDow;
|
$daysAdd = $day - $startDow;
|
||||||
|
|
||||||
|
/* In case we are crossing daylights saving time we need
|
||||||
|
* to convert show start and show end to local time before
|
||||||
|
* adding the interval for the next repeating show
|
||||||
|
*/
|
||||||
|
|
||||||
|
$repeatShowStart->setTimezone($localTimezone);
|
||||||
|
$repeatShowEnd->setTimezone($localTimezone);
|
||||||
$repeatShowStart->add(new DateInterval("P".$daysAdd."D"));
|
$repeatShowStart->add(new DateInterval("P".$daysAdd."D"));
|
||||||
$repeatShowEnd->add(new DateInterval("P".$daysAdd."D"));
|
$repeatShowEnd->add(new DateInterval("P".$daysAdd."D"));
|
||||||
|
//set back to UTC
|
||||||
|
$repeatShowStart->setTimezone($utc);
|
||||||
|
$repeatShowEnd->setTimezone($utc);
|
||||||
}
|
}
|
||||||
/* Here we are checking each repeating show by
|
/* Here we are checking each repeating show by
|
||||||
* the show day.
|
* the show day.
|
||||||
|
@ -238,8 +250,12 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
|
$this->getElement('add_show_duration')->setErrors(array('Cannot schedule overlapping shows'));
|
||||||
break 1;
|
break 1;
|
||||||
} else {
|
} else {
|
||||||
|
$repeatShowStart->setTimezone($localTimezone);
|
||||||
|
$repeatShowEnd->setTimezone($localTimezone);
|
||||||
$repeatShowStart->add(new DateInterval($interval));
|
$repeatShowStart->add(new DateInterval($interval));
|
||||||
$repeatShowEnd->add(new DateInterval($interval));
|
$repeatShowEnd->add(new DateInterval($interval));
|
||||||
|
$repeatShowStart->setTimezone($utc);
|
||||||
|
$repeatShowEnd->setTimezone($utc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,12 +319,12 @@ SQL;
|
||||||
if ($mins >59) {
|
if ($mins >59) {
|
||||||
$hour = intval($mins/60);
|
$hour = intval($mins/60);
|
||||||
$hour = str_pad($hour, 2, "0", STR_PAD_LEFT);
|
$hour = str_pad($hour, 2, "0", STR_PAD_LEFT);
|
||||||
$value = $mins%60;
|
$mins = $mins%60;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$hour = str_pad($hour, 2, "0", STR_PAD_LEFT);
|
$hour = str_pad($hour, 2, "0", STR_PAD_LEFT);
|
||||||
$value = str_pad($value, 2, "0", STR_PAD_LEFT);
|
$mins = str_pad($mins, 2, "0", STR_PAD_LEFT);
|
||||||
$length = $hour.":".$value.":00";
|
$length = $hour.":".$mins.":00";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $length;
|
return $length;
|
||||||
|
|
|
@ -1743,7 +1743,8 @@ SQL;
|
||||||
$days = $interval->format('%a');
|
$days = $interval->format('%a');
|
||||||
$shows = Application_Model_Show::getShows($p_start, $p_end);
|
$shows = Application_Model_Show::getShows($p_start, $p_end);
|
||||||
$nowEpoch = time();
|
$nowEpoch = time();
|
||||||
|
$content_count = Application_Model_ShowInstance::getContentCount(
|
||||||
|
$p_start, $p_end);
|
||||||
$timezone = date_default_timezone_get();
|
$timezone = date_default_timezone_get();
|
||||||
|
|
||||||
foreach ($shows as $show) {
|
foreach ($shows as $show) {
|
||||||
|
@ -1789,9 +1790,9 @@ SQL;
|
||||||
|
|
||||||
$showInstance = new Application_Model_ShowInstance(
|
$showInstance = new Application_Model_ShowInstance(
|
||||||
$show["instance_id"]);
|
$show["instance_id"]);
|
||||||
$showContent = $showInstance->getShowListContent();
|
|
||||||
|
|
||||||
$options["show_empty"] = empty($showContent) ? 1 : 0;
|
$options["show_empty"] = (array_key_exists($show['instance_id'],
|
||||||
|
$content_count)) ? 1 : 0;
|
||||||
|
|
||||||
$events[] = &self::makeFullCalendarEvent($show, $options,
|
$events[] = &self::makeFullCalendarEvent($show, $options,
|
||||||
$startsDT, $endsDT, $startsEpochStr, $endsEpochStr);
|
$startsDT, $endsDT, $startsEpochStr, $endsEpochStr);
|
||||||
|
|
|
@ -661,6 +661,49 @@ SQL;
|
||||||
return $returnStr;
|
return $returnStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getContentCount($p_start, $p_end)
|
||||||
|
{
|
||||||
|
$sql = <<<SQL
|
||||||
|
SELECT instance_id,
|
||||||
|
count(*) AS instance_count
|
||||||
|
FROM cc_schedule
|
||||||
|
WHERE ends > :p_start::TIMESTAMP
|
||||||
|
AND starts < :p_end::TIMESTAMP
|
||||||
|
GROUP BY instance_id
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
$counts = Application_Common_Database::prepareAndExecute( $sql, array(
|
||||||
|
':p_start' => $p_start->format("Y-m-d G:i:s"),
|
||||||
|
':p_end' => $p_end->format("Y-m-d G:i:s"))
|
||||||
|
, 'all');
|
||||||
|
|
||||||
|
return $counts;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showEmpty()
|
||||||
|
{
|
||||||
|
$sql = <<<SQL
|
||||||
|
SELECT s.starts
|
||||||
|
FROM cc_schedule AS s
|
||||||
|
WHERE s.instance_id = :instance_id
|
||||||
|
AND s.playout_status >= 0
|
||||||
|
AND ((s.stream_id IS NOT NULL)
|
||||||
|
OR (s.file_id IS NOT NULL)) LIMIT 1
|
||||||
|
SQL;
|
||||||
|
# TODO : use prepareAndExecute properly
|
||||||
|
$res = Application_Common_Database::prepareAndExecute($sql,
|
||||||
|
array( ':instance_id' => $this->_instanceId ), 'all' );
|
||||||
|
# TODO : A bit retarded. fix this later
|
||||||
|
foreach ($res as $r) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function getShowListContent()
|
public function getShowListContent()
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
@ -670,15 +713,15 @@ SELECT *
|
||||||
FROM (
|
FROM (
|
||||||
(SELECT s.starts,
|
(SELECT s.starts,
|
||||||
0::INTEGER as type ,
|
0::INTEGER as type ,
|
||||||
f.id AS item_id,
|
f.id AS item_id,
|
||||||
f.track_title,
|
f.track_title,
|
||||||
f.album_title AS album,
|
f.album_title AS album,
|
||||||
f.genre AS genre,
|
f.genre AS genre,
|
||||||
f.length AS length,
|
f.length AS length,
|
||||||
f.artist_name AS creator,
|
f.artist_name AS creator,
|
||||||
f.file_exists AS EXISTS,
|
f.file_exists AS EXISTS,
|
||||||
f.filepath AS filepath,
|
f.filepath AS filepath,
|
||||||
f.mime AS mime
|
f.mime AS mime
|
||||||
FROM cc_schedule AS s
|
FROM cc_schedule AS s
|
||||||
LEFT JOIN cc_files AS f ON f.id = s.file_id
|
LEFT JOIN cc_files AS f ON f.id = s.file_id
|
||||||
WHERE s.instance_id = :instance_id1
|
WHERE s.instance_id = :instance_id1
|
||||||
|
@ -689,12 +732,12 @@ FROM (
|
||||||
1::INTEGER as type,
|
1::INTEGER as type,
|
||||||
ws.id AS item_id,
|
ws.id AS item_id,
|
||||||
(ws.name || ': ' || ws.url) AS title,
|
(ws.name || ': ' || ws.url) AS title,
|
||||||
null AS album,
|
null AS album,
|
||||||
null AS genre,
|
null AS genre,
|
||||||
ws.length AS length,
|
ws.length AS length,
|
||||||
sub.login AS creator,
|
sub.login AS creator,
|
||||||
't'::boolean AS EXISTS,
|
't'::boolean AS EXISTS,
|
||||||
ws.url AS filepath,
|
ws.url AS filepath,
|
||||||
ws.mime as mime
|
ws.mime as mime
|
||||||
FROM cc_schedule AS s
|
FROM cc_schedule AS s
|
||||||
LEFT JOIN cc_webstream AS ws ON ws.id = s.stream_id
|
LEFT JOIN cc_webstream AS ws ON ws.id = s.stream_id
|
||||||
|
|
|
@ -127,9 +127,9 @@ class CcSchedule extends BaseCcSchedule {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($microsecond == 0) {
|
if ($microsecond == 0) {
|
||||||
$this->fadein = $dt->format('H:i:s.u');
|
$this->fade_in = $dt->format('H:i:s.u');
|
||||||
} else {
|
} else {
|
||||||
$this->fadein = $dt->format('H:i:s').".".$microsecond;
|
$this->fade_in = $dt->format('H:i:s').".".$microsecond;
|
||||||
}
|
}
|
||||||
$this->modifiedColumns[] = CcSchedulePeer::FADE_IN;
|
$this->modifiedColumns[] = CcSchedulePeer::FADE_IN;
|
||||||
|
|
||||||
|
@ -164,9 +164,9 @@ class CcSchedule extends BaseCcSchedule {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($microsecond == 0) {
|
if ($microsecond == 0) {
|
||||||
$this->fadeout = $dt->format('H:i:s.u');
|
$this->fade_out = $dt->format('H:i:s.u');
|
||||||
} else {
|
} else {
|
||||||
$this->fadeout = $dt->format('H:i:s').".".$microsecond;
|
$this->fade_out = $dt->format('H:i:s').".".$microsecond;
|
||||||
}
|
}
|
||||||
$this->modifiedColumns[] = CcSchedulePeer::FADE_OUT;
|
$this->modifiedColumns[] = CcSchedulePeer::FADE_OUT;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
$(document).ready(function() {
|
||||||
|
$.ajaxSetup({
|
||||||
|
cache: false
|
||||||
|
});
|
||||||
|
});
|
|
@ -206,7 +206,6 @@ function viewDisplay( view ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function eventRender(event, element, view) {
|
function eventRender(event, element, view) {
|
||||||
getCurrentShow();
|
|
||||||
|
|
||||||
$(element).data("event", event);
|
$(element).data("event", event);
|
||||||
|
|
||||||
|
@ -371,7 +370,9 @@ function checkSCUploadStatus(){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/** This function adds and removes the current
|
||||||
|
* show icon
|
||||||
|
*/
|
||||||
function getCurrentShow(){
|
function getCurrentShow(){
|
||||||
var url = '/Schedule/get-current-show/format/json',
|
var url = '/Schedule/get-current-show/format/json',
|
||||||
id,
|
id,
|
||||||
|
|
|
@ -111,6 +111,10 @@ class UpgradeCommon{
|
||||||
$old = "list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%'";
|
$old = "list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%'";
|
||||||
$new = "list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%/all/%%all%%'";
|
$new = "list_all_db_files = 'list-all-files/format/json/api_key/%%api_key%%/dir_id/%%dir_id%%/all/%%all%%'";
|
||||||
exec("sed -i \"s#$old#$new#g\" /etc/airtime/api_client.cfg");
|
exec("sed -i \"s#$old#$new#g\" /etc/airtime/api_client.cfg");
|
||||||
|
|
||||||
|
$old = "update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/media_id/%%media_id%%/schedule_id/%%schedule_id%%'";
|
||||||
|
$new = "update_start_playing_url = 'notify-media-item-start-play/api_key/%%api_key%%/media_id/%%media_id%%/'";
|
||||||
|
exec("sed -i \"s#$old#$new#g\" /etc/airtime/api_client.cfg");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue