Fixed autoplaylist repeat to fill show

This commit is contained in:
Robb Ebright 2017-04-01 00:56:55 -04:00
parent 8bd93e3f6d
commit 8a92c80bcb
2 changed files with 40 additions and 4 deletions

View file

@ -236,14 +236,19 @@ SQL;
{
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
$id = $this->_showInstance->getDbId();
$lastid = $this->getLastAudioItemId();
// Logging::info("The last id is $lastid");
$scheduler = new Application_Model_Scheduler($checkUserPerm);
$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"))
);
}
/**
* Add a media file as the last item in the show.
*
@ -649,12 +654,28 @@ SQL;
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()
{
$con = Propel::getConnection();
$sql = "SELECT ends FROM cc_schedule "
."WHERE instance_id = :instanceId"
."WHERE instance_id = :instanceId "
."ORDER BY ends DESC "
."LIMIT 1";