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

@ -31,8 +31,23 @@ class AutoPlaylistManager {
$playlistid = $si->GetAutoPlaylistId();
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
$si->addPlaylistToShow($playlistid, false);
while ($si->getPercentScheduled() < 100) {
$sid = $si->getShowId();
$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->setAutoPlaylistBuilt(true);