Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
d9af434138
|
@ -51,7 +51,8 @@ class Application_Model_Schedule
|
|||
"currentShow"=>$shows['currentShow'],
|
||||
"nextShow"=>$shows['nextShow'],
|
||||
"timezone"=> date("T"),
|
||||
"timezoneOffset"=> date("Z"));
|
||||
"timezoneOffset"=> date("Z")
|
||||
);
|
||||
|
||||
return $range;
|
||||
}
|
||||
|
@ -70,7 +71,6 @@ class Application_Model_Schedule
|
|||
return;
|
||||
}
|
||||
|
||||
global $CC_CONFIG;
|
||||
$con = Propel::getConnection();
|
||||
$sql = "SELECT %%columns%% st.starts as starts, st.ends as ends,
|
||||
st.media_item_played as media_item_played, si.ends as show_ends
|
||||
|
@ -1076,7 +1076,6 @@ SQL;
|
|||
and modified_instance = false and id != :instanceId order by ends");
|
||||
|
||||
$stmt->execute(array(
|
||||
':showInstances' => $CC_CONFIG['showInstances'],
|
||||
':show_end1' => $show_end->format('Y-m-d H:i:s'),
|
||||
':show_end2' => $show_end->format('Y-m-d H:i:s'),
|
||||
':show_end3' => $show_end->format('Y-m-d H:i:s'),
|
||||
|
|
|
@ -220,18 +220,46 @@ class Application_Model_Show
|
|||
$current_timestamp = gmdate("Y-m-d H:i:s");
|
||||
|
||||
//update all cc_show_instances that are in the future.
|
||||
$sql = "UPDATE cc_show_instances SET ends = (ends + interval '{$deltaDay} days' + interval '{$hours}:{$mins}')
|
||||
WHERE (show_id = {$this->_showId} AND ends > '$current_timestamp')
|
||||
AND ((ends + interval '{$deltaDay} days' + interval '{$hours}:{$mins}' - starts) <= interval '24:00');";
|
||||
$sql = "UPDATE cc_show_instances
|
||||
SET ends = (ends + interval '{$deltaDay} days' + interval '{$hours}:{$mins}')
|
||||
WHERE (show_id = {$this->_showId} AND ends > '$current_timestamp')
|
||||
AND ((ends + interval '{$deltaDay} days' + interval '{$hours}:{$mins}' - starts) <= interval '24:00');";
|
||||
|
||||
//update cc_show_days so future shows can be created with the new duration.
|
||||
//only setting new duration if it is less than or equal to 24 hours.
|
||||
$sql = $sql . " UPDATE cc_show_days SET duration = (CAST(duration AS interval) + interval '{$deltaDay} days' + interval '{$hours}:{$mins}')
|
||||
WHERE show_id = {$this->_showId}
|
||||
AND ((CAST(duration AS interval) + interval '{$deltaDay} days' + interval '{$hours}:{$mins}') <= interval '24:00')";
|
||||
$sql = $sql . "
|
||||
UPDATE cc_show_days SET duration = (CAST(duration AS interval) + interval '{$deltaDay} days' + interval '{$hours}:{$mins}')
|
||||
WHERE show_id = {$this->_showId}
|
||||
AND ((CAST(duration AS interval) + interval '{$deltaDay} days' + interval '{$hours}:{$mins}') <= interval '24:00')";
|
||||
|
||||
$sql_gen = <<<SQL
|
||||
UPDATE cc_show_instances
|
||||
SET ends = (ends + interval :deltaDay1 + interval :interval1)
|
||||
WHERE (show_id = :show_id1 AND ends > :current_timestamp1)
|
||||
AND ((ends + interval :deltaDay2 + interval :interval2 - starts) <= interval '24:00')
|
||||
|
||||
UPDATE cc_show_days SET duration = (CAST(duration AS interval) + interval :deltaDay3 + interval :interval3)
|
||||
WHERE show_id = :show_id2
|
||||
AND ((CAST(duration AS interval) + interval :deltaDay4 + interval :interval4) <= interval '24:00')
|
||||
SQL;
|
||||
|
||||
Application_Common_Database::prepareAndExecute($sql_gen,
|
||||
array(
|
||||
':deltaDay1' => "$deltaDay days",
|
||||
':interval1' => "$hours:$mins",
|
||||
':show_id1' => $this->_showId,
|
||||
':current_timestamp1' => $current_timestamp,
|
||||
':deltaDay2' => "$deltaDay days",
|
||||
':interval2' => "$hours:$mins",
|
||||
':deltaDay3' => "$deltaDay days",
|
||||
':interval3' => "$hours:$mins",
|
||||
':show_id2' => $this->_showId,
|
||||
':deltaDay4' => "$deltaDay days",
|
||||
':interval4' => "$hours:$mins"
|
||||
), "execute");
|
||||
|
||||
//do both the queries at once.
|
||||
$con->exec($sql);
|
||||
//$con->exec($sql);
|
||||
|
||||
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||
$con->beginTransaction();
|
||||
|
@ -768,11 +796,11 @@ class Application_Model_Show
|
|||
$timestamp = $date->getUtcTimestamp();
|
||||
|
||||
$stmt = $con->prepare("UPDATE cc_show_days "
|
||||
."SET duration = :add_show_duration"
|
||||
."SET duration = :add_show_duration "
|
||||
."WHERE show_id = :add_show_id" );
|
||||
$stmt->execute( array(
|
||||
':add_show_duration' => $p_data[add_show_duration],
|
||||
':add_show_id' => $p_data[add_show_id]
|
||||
':add_show_duration' => $p_data['add_show_duration'],
|
||||
':add_show_id' => $p_data['add_show_id']
|
||||
));
|
||||
|
||||
$sql = "UPDATE cc_show_instances "
|
||||
|
@ -1838,7 +1866,7 @@ SELECT si.starts AS start_timestamp,
|
|||
ends
|
||||
FROM cc_show_instances si
|
||||
LEFT JOIN cc_show s
|
||||
ON si.instance_id = s.id
|
||||
ON si.show_id = s.id
|
||||
WHERE si.show_id = s.id
|
||||
AND si.starts <= :timeNow1::timestamp
|
||||
AND si.ends > :timeNow2::timestamp
|
||||
|
@ -1881,7 +1909,7 @@ SELECT si.starts AS start_timestamp,
|
|||
ends
|
||||
FROM cc_show_instances si
|
||||
LEFT JOIN cc_show s
|
||||
ON si.instance_id = s.id
|
||||
ON si.show_id = s.id
|
||||
WHERE si.show_id = s.id
|
||||
AND si.starts > :timeNow1::timestamp - INTERVAL '2 days'
|
||||
AND si.ends < :timeNow2::timestamp + INTERVAL '2 days'
|
||||
|
@ -1895,7 +1923,7 @@ SQL;
|
|||
$stmt->bindValue(':timeNow2', $p_timeNow);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$rows = $stmt->fetchAll();
|
||||
} else {
|
||||
$msg = implode(',', $stmt->errorInfo());
|
||||
throw new Exception("Error: $msg");
|
||||
|
@ -2020,7 +2048,7 @@ SELECT si.starts AS start_timestamp,
|
|||
ends
|
||||
FROM cc_show_instances si
|
||||
LEFT JOIN cc_show s
|
||||
ON si.instance_id = s.id
|
||||
ON si.show_id = s.id
|
||||
WHERE si.show_id = s.id
|
||||
AND si.starts >= :timeStart::timestamp
|
||||
AND si.starts < :timeEnd::timestamp
|
||||
|
|
|
@ -115,7 +115,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
|
||||
$di = null;
|
||||
$length = $parameters["length"];
|
||||
$result = preg_match("/^(?:([0-9]{1,2})h)?\s*(?:([0-6]?[0-9])m)?$/", $length, $matches);
|
||||
$result = preg_match("/^(?:([0-9]{1,2})h)?\s*(?:([0-9]{1,2})m)?$/", $length, $matches);
|
||||
|
||||
$invalid_date_interval = false;
|
||||
if ($result == 1 && count($matches) == 2) {
|
||||
|
|
|
@ -23,6 +23,7 @@ echo " 1. Install Packages"
|
|||
echo "----------------------------------------------------"
|
||||
|
||||
dist=`lsb_release -is`
|
||||
code=`lsb_release -cs`
|
||||
|
||||
if [ "$dist" = "Debian" ]; then
|
||||
set +e
|
||||
|
@ -67,6 +68,13 @@ else
|
|||
apt-get -y install libzend-framework-php
|
||||
fi
|
||||
|
||||
if [ "$code" = "lucid" ]; then
|
||||
apt-get -y install timeout
|
||||
else
|
||||
apt-get -y install coreutils
|
||||
fi
|
||||
|
||||
|
||||
#Install Sourcefabric's custom Liquidsoap debian package
|
||||
apt-get -y --force-yes install sourcefabric-keyring
|
||||
apt-get -y --force-yes install liquidsoap
|
||||
|
|
|
@ -26,11 +26,12 @@ echo " 1. Install Packages"
|
|||
echo "----------------------------------------------------"
|
||||
|
||||
dist=`lsb_release -is`
|
||||
code=`lsb_release -cs`
|
||||
|
||||
if [ "$dist" -eq "Debian" ]; then
|
||||
grep "deb http://www.debian-multimedia.org squeeze main non-free" /etc/apt/sources.list
|
||||
grep "deb http://www.deb-multimedia.org squeeze main non-free" /etc/apt/sources.list
|
||||
if [ "$?" -ne "0" ]; then
|
||||
echo "deb http://www.debian-multimedia.org squeeze main non-free" >> /etc/apt/sources.list
|
||||
echo "deb http://www.deb-multimedia.org squeeze main non-free" >> /etc/apt/sources.list
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -42,7 +43,7 @@ php-pear php5-gd postgresql odbc-postgresql python libsoundtouch-ocaml \
|
|||
libtaglib-ocaml libao-ocaml libmad-ocaml ecasound \
|
||||
libesd0 libportaudio2 libsamplerate0 rabbitmq-server patch \
|
||||
php5-curl mpg123 monit python-virtualenv multitail libcamomile-ocaml-data \
|
||||
libpulse0 vorbis-tools lsb-release lsof sudo mp3gain vorbisgain flac vorbis-tools
|
||||
libpulse0 vorbis-tools lsb-release lsof sudo mp3gain vorbisgain flac vorbis-tools
|
||||
|
||||
#install packages with --force-yes option (this is useful in the case
|
||||
#of Debian, where these packages are unauthorized)
|
||||
|
@ -57,6 +58,12 @@ else
|
|||
apt-get -y install libzend-framework-php
|
||||
fi
|
||||
|
||||
if [ "$code" = "lucid" ]; then
|
||||
apt-get -y install timeout
|
||||
else
|
||||
apt-get -y install coreutils
|
||||
fi
|
||||
|
||||
# NGINX Config File
|
||||
echo "----------------------------------------------------"
|
||||
echo "2.1 NGINX Config File"
|
||||
|
|
Loading…
Reference in New Issue