Merge branch '2.5.x' into 2.5.x-installer

Conflicts:
	airtime_mvc/application/Bootstrap.php
	airtime_mvc/application/models/Show.php
This commit is contained in:
Albert Santoni 2015-01-16 17:27:52 -05:00
commit c03dd38c00
74 changed files with 560 additions and 2142 deletions

View file

@ -263,7 +263,7 @@ class Application_Model_Preference
if ($fade === "") {
// the default value of the fade is 00.5
return "00.5";
return "0.5";
}
return $fade;
@ -279,8 +279,8 @@ class Application_Model_Preference
$fade = self::getValue("default_fade_out");
if ($fade === "") {
// the default value of the fade is 00.5
return "00.5";
// the default value of the fade is 0.5
return "0.5";
}
return $fade;
@ -291,33 +291,6 @@ class Application_Model_Preference
self::setValue("default_fade", $fade);
}
public static function GetDefaultFade()
{
$fade = self::getValue("default_fade");
if ($fade === "") {
// the default value of the fade is 00.5
return "00.5";
}
// we need this function to work with 2.0 version on default_fade value in cc_pref
// it has 00:00:00.000000 format where in 2.1 we have 00.000000 format
if (preg_match("/([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{6})/", $fade, $matches) == 1 && count($matches) == 5) {
$out = 0;
$out += intval($matches[1] * 3600);
$out += intval($matches[2] * 60);
$out += intval($matches[3]);
$out .= ".$matches[4]";
$fade = $out;
}
$fade = number_format($fade, 1, '.', '');
//fades need 2 leading zeros for DateTime conversion
$fade = str_pad($fade, 4, "0", STR_PAD_LEFT);
return $fade;
}
public static function SetDefaultTransitionFade($fade)
{
self::setValue("default_transition_fade", $fade);
@ -330,7 +303,7 @@ class Application_Model_Preference
public static function GetDefaultTransitionFade()
{
$transition_fade = self::getValue("default_transition_fade");
return ($transition_fade == "") ? "00.000000" : $transition_fade;
return ($transition_fade == "") ? "0.000" : $transition_fade;
}
public static function SetStreamLabelFormat($type)

View file

@ -862,9 +862,11 @@ SQL;
* In UTC time.
* @param unknown_type $excludeInstance
* @param boolean $onlyRecord
* @param int $showId
* limits the results to instances of a given showId only
* @return array
*/
public static function getShows($start_timestamp, $end_timestamp, $onlyRecord=FALSE)
public static function getShows($start_timestamp, $end_timestamp, $onlyRecord=FALSE, $showId=null)
{
self::createAndFillShowInstancesPastPopulatedUntilDate($end_timestamp);
@ -895,13 +897,21 @@ SQL;
//only want shows that are starting at the time or later.
$start_string = $start_timestamp->format("Y-m-d H:i:s");
$end_string = $end_timestamp->format("Y-m-d H:i:s");
$params = array();
if ($showId) {
$sql .= " AND (si1.show_id = :show_id)";
$params[':show_id'] = $showId;
}
if ($onlyRecord) {
$sql .= " AND (si1.starts >= :start::TIMESTAMP AND si1.starts < :end::TIMESTAMP)";
$sql .= " AND (si1.record = 1)";
return Application_Common_Database::prepareAndExecute( $sql,
array( ':start' => $start_string,
':end' => $end_string ), 'all');
$params[':start'] = $start_string;
$params[':end'] = $end_string;
return Application_Common_Database::prepareAndExecute( $sql, $params, 'all');
} else {
$sql .= " ". <<<SQL
@ -910,15 +920,16 @@ AND ((si1.starts >= :start1::TIMESTAMP AND si1.starts < :end1::TIMESTAMP)
OR (si1.starts <= :start3::TIMESTAMP AND si1.ends >= :end3::TIMESTAMP))
ORDER BY si1.starts
SQL;
return Application_Common_Database::prepareAndExecute( $sql,
array(
$params = array_merge($params, array(
'start1' => $start_string,
'start2' => $start_string,
'start3' => $start_string,
'end1' => $end_string,
'end2' => $end_string,
'end3' => $end_string
), 'all');
)
);
return Application_Common_Database::prepareAndExecute( $sql, $params, 'all');
}
}
@ -1013,10 +1024,10 @@ SQL;
//for putting the now playing icon on the show.
if ($now > $startsDT && $now < $endsDT) {
$event["nowPlaying"] = true;
$event["nowPlaying"] = true;
}
else {
$event["nowPlaying"] = false;
$event["nowPlaying"] = false;
}
//event colouring
@ -1045,9 +1056,9 @@ SQL;
**/
private static function getPercentScheduled($p_starts, $p_ends, $p_time_filled)
{
$utcTimezone = new DatetimeZone("UTC");
$startDt = new DateTime($p_starts, $utcTimezone);
$endDt = new DateTime($p_ends, $utcTimezone);
$utcTimezone = new DatetimeZone("UTC");
$startDt = new DateTime($p_starts, $utcTimezone);
$endDt = new DateTime($p_ends, $utcTimezone);
$durationSeconds = intval($endDt->format("U")) - intval($startDt->format("U"));
$time_filled = Application_Common_DateHelper::playlistTimeToSeconds($p_time_filled);
if ($durationSeconds != 0) { //Prevent division by zero if the show duration somehow becomes zero.
@ -1272,6 +1283,7 @@ SQL;
"starts" => $rows[$i-1]['starts'],
"ends" => $rows[$i-1]['ends'],
"record" => $rows[$i-1]['record'],
"image_path" => $rows[$i-1]['image_path'],
"type" => "show");
}
@ -1289,6 +1301,7 @@ SQL;
"starts" => $rows[$i+1]['starts'],
"ends" => $rows[$i+1]['ends'],
"record" => $rows[$i+1]['record'],
"image_path" => $rows[$i+1]['image_path'],
"type" => "show");
}
break;
@ -1302,15 +1315,16 @@ SQL;
$results['nextShow'][0] = array(
"id" => $rows[$i]['id'],
"instance_id" => $rows[$i]['instance_id'],
"name" => $rows[$i]['name'],
"name" => $rows[$i]['name'],
"description" => $rows[$i]['description'],
"url" => $rows[$i]['url'],
"url" => $rows[$i]['url'],
"start_timestamp" => $rows[$i]['start_timestamp'],
"end_timestamp" => $rows[$i]['end_timestamp'],
"starts" => $rows[$i]['starts'],
"ends" => $rows[$i]['ends'],
"record" => $rows[$i]['record'],
"type" => "show");
"image_path" => $rows[$i]['image_path'],
"type" => "show");
break;
}
}
@ -1443,4 +1457,5 @@ SQL;
return array($start, $end);
}
}

View file

@ -548,7 +548,7 @@ SQL;
}
public function getShowListContent()
public function getShowListContent($timezone = null)
{
$con = Propel::getConnection();
@ -599,9 +599,14 @@ SQL;
':instance_id2' => $this->_instanceId
));
$results = $stmt->fetchAll(PDO::FETCH_ASSOC);
$userTimezone = Application_Model_Preference::GetUserTimezone();
$displayTimezone = new DateTimeZone($userTimezone);
if (isset($timezone)) {
$displayTimezone = new DateTimeZone($timezone);
} else {
$userTimezone = Application_Model_Preference::GetUserTimezone();
$displayTimezone = new DateTimeZone($userTimezone);
}
$utcTimezone = new DateTimeZone("UTC");
foreach ($results as &$row) {

View file

@ -309,7 +309,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
$media_url = self::getXspfUrl($url);
} elseif (preg_match("/pls\+xml/", $mime) || preg_match("/x-scpls/", $mime)) {
$media_url = self::getPlsUrl($url);
} elseif (preg_match("/(mpeg|ogg|audio\/aacp)/", $mime)) {
} elseif (preg_match("/(mpeg|ogg|audio\/aacp|audio\/aac)/", $mime)) {
if ($content_length_found) {
throw new Exception(_("Invalid webstream - This appears to be a file download."));
}

View file

@ -304,4 +304,23 @@ class CcShow extends BaseCcShow {
->filterByDbId($instanceId, Criteria::NOT_EQUAL)
->find();
}
public function getShowInfo()
{
$info = array();
if ($this->getDbId() == null) {
return $info;
} else {
$info['name'] = $this->getDbName();
$info['id'] = $this->getDbId();
$info['url'] = $this->getDbUrl();
$info['genre'] = $this->getDbGenre();
$info['description'] = $this->getDbDescription();
$info['color'] = $this->getDbColor();
$info['background_color'] = $this->getDbBackgroundColor();
$info['linked'] = $this->getDbLinked();
return $info;
}
}
} // CcShow