Merge branch 'airtime-2.0.x' of dev.sourcefabric.org:airtime into airtime-2.0.x
This commit is contained in:
commit
863de54fc8
|
@ -39,12 +39,14 @@ class Application_Form_StreamSetting extends Zend_Form
|
|||
}
|
||||
|
||||
# tooltip
|
||||
$description = 'VLC and mplayer have a serious bug when playing an OGG/VORBIS
|
||||
stream that has metadata information enabled (stream metadata is the
|
||||
track title, show name, etc displayed in the audio player): they will
|
||||
disconnect from the stream after every song if this option is enabled.
|
||||
If your listeners do not require support for these audio players,
|
||||
then you should enable this option.';
|
||||
$description = 'This option enables metadata for OGG streams (stream
|
||||
metadata is the track title, artist, and show name that is
|
||||
displayed in an audio player). VLC and mplayer have a
|
||||
serious bug when playing an OGG/VORBIS stream that has
|
||||
metadata information enabled: they will disconnect from the
|
||||
stream after every song. If you are using an OGG stream and
|
||||
your listeners do not require support for these audio
|
||||
players, then feel free to enable this option.';
|
||||
|
||||
$icecast_vorbis_metadata = new Zend_Form_Element_Checkbox('icecast_vorbis_metadata');
|
||||
$icecast_vorbis_metadata->setLabel('Icecast Vorbis Metadata')
|
||||
|
|
|
@ -351,13 +351,15 @@ class Application_Model_Show {
|
|||
public function isRepeating()
|
||||
{
|
||||
$showDaysRow = CcShowDaysQuery::create()
|
||||
->filterByDbShowId($this->_showId)
|
||||
->findOne();
|
||||
->filterByDbShowId($this->_showId)
|
||||
->findOne();
|
||||
|
||||
if (!is_null($showDaysRow)){
|
||||
return ($showDaysRow->getDbRepeatType() != -1);
|
||||
} else
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1164,7 +1166,9 @@ class Application_Model_Show {
|
|||
|
||||
Logging::log('$start time of non repeating record '.$start);
|
||||
|
||||
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
||||
if ($newInstance){
|
||||
self::createRebroadcastInstances($rebroadcasts, $currentUtcTimestamp, $show_id, $show_instance_id, $start, $duration, $timezone);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1455,18 +1459,18 @@ class Application_Model_Show {
|
|||
$endTimeString = $p_endTimestamp->format("Y-m-d H:i:s");
|
||||
if (!is_null($p_startTimestamp)) {
|
||||
$startTimeString = $p_startTimestamp->format("Y-m-d H:i:s");
|
||||
$sql = "SELECT * FROM cc_show_days
|
||||
WHERE last_show IS NULL
|
||||
OR first_show < '{$endTimeString}' AND last_show > '{$startTimeString}'";
|
||||
}
|
||||
else {
|
||||
$today_timestamp = new DateTime("now", new DateTimeZone("UTC"));
|
||||
$today_timestamp_string = $today_timestamp->format("Y-m-d H:i:s");
|
||||
$sql = "SELECT * FROM cc_show_days
|
||||
WHERE last_show IS NULL
|
||||
OR first_show < '{$endTimeString}' AND last_show > '{$today_timestamp_string}'";
|
||||
$startTimeString = $today_timestamp->format("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM cc_show_days
|
||||
WHERE last_show IS NULL
|
||||
OR first_show < '{$endTimeString}' AND last_show > '{$startTimeString}'";
|
||||
|
||||
Logging::log($sql);
|
||||
|
||||
$res = $CC_DBC->GetAll($sql);
|
||||
|
||||
foreach ($res as $row) {
|
||||
|
|
|
@ -444,6 +444,81 @@ class Application_Model_ShowInstance {
|
|||
$this->updateScheduledTime();
|
||||
}
|
||||
|
||||
private function checkToDeleteShow($showId)
|
||||
{
|
||||
//UTC DateTime object
|
||||
$showsPopUntil = Application_Model_Preference::GetShowsPopulatedUntil();
|
||||
|
||||
$showDays = CcShowDaysQuery::create()
|
||||
->filterByDbShowId($showId)
|
||||
->findOne();
|
||||
|
||||
$showEnd = $showDays->getDbLastShow();
|
||||
|
||||
//there will always be more shows populated.
|
||||
if (is_null($showEnd)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$lastShowStartDateTime = new DateTime("{$showEnd} {$showDays->getDbStartTime()}", new DateTimeZone($showDays->getDbTimezone()));
|
||||
//end dates were non inclusive.
|
||||
$lastShowStartDateTime = self::addDeltas($lastShowStartDateTime, -1, 0);
|
||||
|
||||
//there's still some shows left to be populated.
|
||||
if ($lastShowStartDateTime->getTimestamp() > $showsPopUntil->getTimestamp()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if there are any non deleted show instances remaining.
|
||||
$showInstances = CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($showId)
|
||||
->filterByDbModifiedInstance(false)
|
||||
->filterByDbRebroadcast(0)
|
||||
->find();
|
||||
|
||||
if (is_null($showInstances)){
|
||||
return true;
|
||||
}
|
||||
//only 1 show instance left of the show, make it non repeating.
|
||||
else if (count($showInstances) === 1) {
|
||||
$showInstance = $showInstances[0];
|
||||
|
||||
$showDaysOld = CcShowDaysQuery::create()
|
||||
->filterByDbShowId($showId)
|
||||
->find();
|
||||
|
||||
$tz = $showDaysOld[0]->getDbTimezone();
|
||||
|
||||
$startDate = new DateTime($showInstance->getDbStarts(), new DateTimeZone("UTC"));
|
||||
$startDate->setTimeZone(new DateTimeZone($tz));
|
||||
$endDate = self::addDeltas($startDate, 1, 0);
|
||||
|
||||
//make a new rule for a non repeating show.
|
||||
$showDayNew = new CcShowDays();
|
||||
$showDayNew->setDbFirstShow($startDate->format("Y-m-d"));
|
||||
$showDayNew->setDbLastShow($endDate->format("Y-m-d"));
|
||||
$showDayNew->setDbStartTime($startDate->format("H:i:s"));
|
||||
$showDayNew->setDbTimezone($tz);
|
||||
$showDayNew->setDbDay($startDate->format('w'));
|
||||
$showDayNew->setDbDuration($showDaysOld[0]->getDbDuration());
|
||||
$showDayNew->setDbRepeatType(-1);
|
||||
$showDayNew->setDbShowId($showDaysOld[0]->getDbShowId());
|
||||
$showDayNew->setDbRecord($showDaysOld[0]->getDbRecord());
|
||||
$showDayNew->save();
|
||||
|
||||
//delete the old rules for repeating shows
|
||||
$showDaysOld->delete();
|
||||
|
||||
//remove the old repeating deleted instances.
|
||||
$showInstances = CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($showId)
|
||||
->filterByDbModifiedInstance(true)
|
||||
->delete();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
global $CC_DBC;
|
||||
|
@ -465,6 +540,10 @@ class Application_Model_ShowInstance {
|
|||
->setDbModifiedInstance(true)
|
||||
->save();
|
||||
|
||||
if ($this->isRebroadcast()) {
|
||||
return;
|
||||
}
|
||||
|
||||
//delete the rebroadcasts of the removed recorded show.
|
||||
if ($recording) {
|
||||
CcShowInstancesQuery::create()
|
||||
|
@ -477,17 +556,8 @@ class Application_Model_ShowInstance {
|
|||
->filterByDbInstanceId($this->_instanceId)
|
||||
->delete();
|
||||
|
||||
// check if we can safely delete the show
|
||||
$showInstancesRow = CcShowInstancesQuery::create()
|
||||
->filterByDbShowId($showId)
|
||||
->filterByDbModifiedInstance(false)
|
||||
->findOne();
|
||||
|
||||
/* If we didn't find any instances of the show that haven't
|
||||
* been deleted, then just erase everything related to that show.
|
||||
* We can just delete, the show and the foreign key-constraint should
|
||||
* take care of deleting all of its instances. */
|
||||
if(is_null($showInstancesRow)){
|
||||
if ($this->checkToDeleteShow($showId)){
|
||||
CcShowQuery::create()
|
||||
->filterByDbId($showId)
|
||||
->delete();
|
||||
|
|
|
@ -99,6 +99,8 @@ class AirtimeInstall{
|
|||
|
||||
public static function MigrateTablesToVersion($dir, $version)
|
||||
{
|
||||
echo "Upgrading database, may take several minutes, please wait".PHP_EOL;
|
||||
|
||||
$appDir = AirtimeInstall::GetAirtimeSrcDir();
|
||||
$SCRIPTPATH = __DIR__;
|
||||
$command = "php --php-ini $SCRIPTPATH/../../airtime-php.ini ".
|
||||
|
|
|
@ -56,6 +56,8 @@ class UpgradeCommon{
|
|||
|
||||
public static function MigrateTablesToVersion($dir, $version)
|
||||
{
|
||||
echo "Upgrading database, may take several minutes, please wait".PHP_EOL;
|
||||
|
||||
$appDir = self::GetAirtimeSrcDir();
|
||||
$command = "php --php-ini $dir/../../airtime-php.ini ".
|
||||
"$appDir/library/doctrine/migrations/doctrine-migrations.phar ".
|
||||
|
|
Loading…
Reference in New Issue