CC-2415:Subsecond offset
- temp commit. not sure what needs to be done yet
This commit is contained in:
parent
183a348f34
commit
e05645f523
|
@ -147,6 +147,12 @@ 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){
|
||||
$sec = Playlist::playlistTimeToSeconds($data[5]);
|
||||
$data[5] = Playlist::secondsToPlaylistTime($sec);
|
||||
}*/
|
||||
|
||||
die(json_encode($datatables));
|
||||
}
|
||||
|
|
|
@ -90,8 +90,9 @@ class Playlist {
|
|||
public static function secondsToPlaylistTime($p_seconds)
|
||||
{
|
||||
$seconds = $p_seconds;
|
||||
$milliseconds = intval(($seconds - intval($seconds)) * 1000);
|
||||
$milliStr = str_pad($milliseconds, 3, '0', STR_PAD_LEFT);
|
||||
$rounded = round($seconds, 2);
|
||||
list($dump, $milliseconds) = explode('.', $rounded);
|
||||
$milliStr = str_pad($milliseconds, 2, '0', STR_PAD_LEFT);
|
||||
$hours = floor($seconds / 3600);
|
||||
$seconds -= $hours * 3600;
|
||||
$minutes = floor($seconds / 60);
|
||||
|
@ -398,6 +399,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
|
||||
$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']);
|
||||
$files[$i]['offset'] = Playlist::secondsToPlaylistTime($offset);
|
||||
$i++;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?php if (count($this->pl->getContents())) : ?>
|
||||
<?php
|
||||
$items = $this->pl->getContents();
|
||||
if (count($items)) : ?>
|
||||
|
||||
<?php $i = 0; ?>
|
||||
<?php foreach($this->pl->getContents() as $item) : ?>
|
||||
<?php foreach($items as $item) : ?>
|
||||
<li class="ui-state-default" id="spl_<?php echo $i ?>">
|
||||
<div class="list-item-container">
|
||||
<a href="javascript:void(0);" class="big_play"
|
||||
|
@ -17,7 +18,7 @@
|
|||
<span class="spl_artist"><?php echo $item["CcFiles"]['artist_name'] ?></span>
|
||||
<span class="spl_offset"><?php echo $item["offset"]?></span>
|
||||
</div>
|
||||
<?php if($i < count($this->pl->getContents()) -1): ?>
|
||||
<?php if($i < count($items) -1): ?>
|
||||
<div id="fade_<?php echo $i ?>" class="spl_fade_control ui-state-default"></div>
|
||||
<?php endif; ?>
|
||||
<span class="ui-icon ui-icon-closethick"></span>
|
||||
|
@ -25,7 +26,7 @@
|
|||
|
||||
<div id="cues_<?php echo $i ?>" class="cue-edit clearfix" style="display: none"></div>
|
||||
|
||||
<?php if($i < count($this->pl->getContents()) -1): ?>
|
||||
<?php if($i < count($items) -1): ?>
|
||||
<div id="crossfade_<?php echo $i ?>-<?php echo $i+1 ?>" class="crossfade clearfix" style="display: none"></div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
Loading…
Reference in New Issue