Fixed autoplaylist repeat to fill show
This commit is contained in:
parent
8bd93e3f6d
commit
8a92c80bcb
|
@ -31,8 +31,23 @@ class AutoPlaylistManager {
|
||||||
$playlistid = $si->GetAutoPlaylistId();
|
$playlistid = $si->GetAutoPlaylistId();
|
||||||
Logging::info("Scheduling $playlistid");
|
Logging::info("Scheduling $playlistid");
|
||||||
// call the addPlaylist to show function and don't check for user permission to avoid call to non-existant user object
|
// call the addPlaylist to show function and don't check for user permission to avoid call to non-existant user object
|
||||||
$si->addPlaylistToShow($playlistid, false);
|
$sid = $si->getShowId();
|
||||||
while ($si->getPercentScheduled() < 100) {
|
$playlistrepeat = new Application_Model_Show($sid);
|
||||||
|
|
||||||
|
if ($playlistrepeat->getAutoPlaylistRepeat()) {
|
||||||
|
$full = false;
|
||||||
|
while(!$full) {
|
||||||
|
$si = new Application_Model_ShowInstance($autoplaylist->getDbId());
|
||||||
|
$si->addPlaylistToShow($playlistid, false);
|
||||||
|
$ps = $si->getPercentScheduled();
|
||||||
|
//Logging::info("The total percent scheduled is % $ps");
|
||||||
|
if ($ps > 100) {
|
||||||
|
$full = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
$si->addPlaylistToShow($playlistid, false);
|
$si->addPlaylistToShow($playlistid, false);
|
||||||
}
|
}
|
||||||
$si->setAutoPlaylistBuilt(true);
|
$si->setAutoPlaylistBuilt(true);
|
||||||
|
|
|
@ -236,14 +236,19 @@ SQL;
|
||||||
{
|
{
|
||||||
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
|
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
|
||||||
$id = $this->_showInstance->getDbId();
|
$id = $this->_showInstance->getDbId();
|
||||||
|
$lastid = $this->getLastAudioItemId();
|
||||||
|
// Logging::info("The last id is $lastid");
|
||||||
|
|
||||||
$scheduler = new Application_Model_Scheduler($checkUserPerm);
|
$scheduler = new Application_Model_Scheduler($checkUserPerm);
|
||||||
$scheduler->scheduleAfter(
|
$scheduler->scheduleAfter(
|
||||||
array(array("id" => 0, "instance" => $id, "timestamp" => $ts)),
|
array(array("id" => $lastid, "instance" => $id, "timestamp" => $ts)),
|
||||||
array(array("id" => $pl_id, "type" => "playlist"))
|
array(array("id" => $pl_id, "type" => "playlist"))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a media file as the last item in the show.
|
* Add a media file as the last item in the show.
|
||||||
*
|
*
|
||||||
|
@ -649,12 +654,28 @@ SQL;
|
||||||
return $results;
|
return $results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getLastAudioItemId()
|
||||||
|
{
|
||||||
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
|
$sql = "SELECT id FROM cc_schedule "
|
||||||
|
."WHERE instance_id = :instanceId "
|
||||||
|
."ORDER BY ends DESC "
|
||||||
|
."LIMIT 1";
|
||||||
|
|
||||||
|
$query = Application_Common_Database::prepareAndExecute( $sql,
|
||||||
|
array(':instanceId' => $this->_instanceId), 'column');
|
||||||
|
|
||||||
|
return ($query !== false) ? $query : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getLastAudioItemEnd()
|
public function getLastAudioItemEnd()
|
||||||
{
|
{
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$sql = "SELECT ends FROM cc_schedule "
|
$sql = "SELECT ends FROM cc_schedule "
|
||||||
."WHERE instance_id = :instanceId"
|
."WHERE instance_id = :instanceId "
|
||||||
."ORDER BY ends DESC "
|
."ORDER BY ends DESC "
|
||||||
."LIMIT 1";
|
."LIMIT 1";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue