CC-4176: Smart Playlist: Set implicit item limit when user uses time as a limit

- done
This commit is contained in:
James 2012-08-08 11:46:48 -04:00
parent f8d63b70d8
commit 61e38381af
1 changed files with 4 additions and 1 deletions

View File

@ -1211,6 +1211,7 @@ EOT;
$insertList = array();
$totalTime = 0;
$totalItems = 0;
// this moves the pointer to the first element in the collection
$files->getFirst();
@ -1220,7 +1221,9 @@ EOT;
$length = Application_Common_DateHelper::calculateLengthInSeconds($iterator->current()->getDbLength());
$insertList[$id] = $length;
$totalTime += $length;
if ( !is_null($limit['items']) && $limit['items'] == count($insertList)) {
$totalItems++;
if ((!is_null($limit['items']) && $limit['items'] == count($insertList)) || $totalItems > 500) {
break;
}