CC-2415:subsecod-offset-in-playlist
- Displays 1 decimal place on all length and offset in playlist builder - secondsToPlaylistTime() function returns time with 1 decimal millisecond
This commit is contained in:
parent
e05645f523
commit
db7b996288
|
@ -148,11 +148,11 @@ class LibraryController extends Zend_Controller_Action
|
|||
$post = $this->getRequest()->getPost();
|
||||
$datatables = StoredFile::searchFilesForPlaylistBuilder($post);
|
||||
|
||||
//format clip lengh to 2 decimal
|
||||
/*foreach($datatables["aaData"] as &$data){
|
||||
//format clip lengh to 1 decimal
|
||||
foreach($datatables["aaData"] as &$data){
|
||||
$sec = Playlist::playlistTimeToSeconds($data[5]);
|
||||
$data[5] = Playlist::secondsToPlaylistTime($sec);
|
||||
}*/
|
||||
}
|
||||
|
||||
die(json_encode($datatables));
|
||||
}
|
||||
|
|
|
@ -90,9 +90,11 @@ class Playlist {
|
|||
public static function secondsToPlaylistTime($p_seconds)
|
||||
{
|
||||
$seconds = $p_seconds;
|
||||
$rounded = round($seconds, 2);
|
||||
list($dump, $milliseconds) = explode('.', $rounded);
|
||||
$milliStr = str_pad($milliseconds, 2, '0', STR_PAD_LEFT);
|
||||
$rounded = round($seconds, 1);
|
||||
list($dump, $milliStr) = explode('.', $rounded);
|
||||
if($milliStr == NULL){
|
||||
$milliStr = 0;
|
||||
}
|
||||
$hours = floor($seconds / 3600);
|
||||
$seconds -= $hours * 3600;
|
||||
$minutes = floor($seconds / 60);
|
||||
|
@ -399,11 +401,10 @@ class Playlist {
|
|||
$offset = 0;
|
||||
foreach ($rows as $row) {
|
||||
$files[$i] = $row->toArray(BasePeer::TYPE_FIELDNAME, true, true);
|
||||
// display only upto 2 decimal place by calling secondsToPlaylistTime
|
||||
// display only upto 1 decimal place by calling secondsToPlaylistTime
|
||||
$clipSec = Playlist::playlistTimeToSeconds($files[$i]['cliplength']);
|
||||
$files[$i]['cliplength'] = Playlist::secondsToPlaylistTime($clipSec);
|
||||
// calling the function again to get rid of round off addition error
|
||||
$offset += Playlist::playlistTimeToSeconds($files[$i]['cliplength']);
|
||||
$offset += $clipSec;
|
||||
$files[$i]['offset'] = Playlist::secondsToPlaylistTime($offset);
|
||||
$i++;
|
||||
}
|
||||
|
@ -418,7 +419,9 @@ class Playlist {
|
|||
|
||||
if(is_null($res))
|
||||
return '00:00:00';
|
||||
|
||||
|
||||
$sec = Playlist::playlistTimeToSeconds($res);
|
||||
$res = Playlist::secondsToPlaylistTime($sec);
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue