CC-2430: Preview tracks in the library + better preview (ability to jump around in clip)

- removed javascript from php files
- removed preview.js
- fixed small problems with editor
This commit is contained in:
Daniel 2012-03-05 18:59:31 -05:00
parent a246f85a5b
commit a09b63b8d0
12 changed files with 49 additions and 118 deletions

View file

@ -116,7 +116,9 @@ class ApiController extends Zend_Controller_Action
return;
}
$filename = $this->_getParam("file");
$name = $this->_getParam("name");
$filename = $this->_getParam("filename");
$file_id = substr($filename, 0, strpos($filename, "."));
if (ctype_alnum($file_id) && strlen($file_id) == 32)
{
@ -124,7 +126,6 @@ class ApiController extends Zend_Controller_Action
if ( $media != null && !PEAR::isError($media))
{
$filepath = $media->getFilePath();
if(is_file($filepath)){
$full_path = $media->getPropelOrm()->getDbFilepath();
$file_base_name = strrchr($full_path, '/');
@ -148,7 +149,6 @@ class ApiController extends Zend_Controller_Action
header("Content-Disposition: inline; filename=$file_base_name");
}
//ini_set('memory_limit', '512M');
$this->smartReadFile($filepath, $ext);
exit;
}else{
@ -197,7 +197,7 @@ class ApiController extends Zend_Controller_Action
}
}
}
if (isset($_SERVER['HTTP_RANGE']))
{
header('HTTP/1.1 206 Partial Content');
@ -215,7 +215,6 @@ class ApiController extends Zend_Controller_Action
{
header("Content-Range: bytes $begin-$end/$size");
}
header("Content-Transfer-Encoding: binary");
header("Last-Modified: $time");
@ -225,7 +224,8 @@ class ApiController extends Zend_Controller_Action
while (@ob_end_flush());
$cur = $begin;
fseek($fm, $begin, 0);
fseek($fm, $begin, 0);
while(!feof($fm) && $cur <= $end && (connection_status() == 0))
{
echo fread($fm, min(1024 * 16, ($end - $cur) + 1));

View file

@ -29,7 +29,7 @@ class PlaylistController extends Zend_Controller_Action
{
$pl = null;
if (isset($this->pl_sess->id)) {
if (isset($this->pl_sess->id)) {
$pl = new Application_Model_Playlist($this->pl_sess->id);
$modified = $this->_getParam('modified', null);
@ -112,7 +112,6 @@ class PlaylistController extends Zend_Controller_Action
$baseUrl = $request->getBaseUrl();
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/spl.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
$this->view->headScript()->appendFile($baseUrl.'/js/airtime/library/preview.js?'.$CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl.'/css/playlist_builder.css?'.$CC_CONFIG['airtime_version']);
$this->_helper->viewRenderer->setResponseSegment('spl');
@ -199,8 +198,7 @@ class PlaylistController extends Zend_Controller_Action
public function audioPreviewPlayerAction()
{
Logging::log("PlaylistControler::in the play action");
$name = $this->_getParam('name');
$fileName = $this->_getParam('filename');
$playlistIndex = $this->_getParam('index');
@ -219,6 +217,8 @@ class PlaylistController extends Zend_Controller_Action
} else {
$this->view->logo = "$baseUrl/css/images/airtime_logo_jp.png";
}
$this->view->name = $name;
$this->view->fileName = $fileName;
$this->view->playlistIndex= $playlistIndex;
}

View file

@ -19,7 +19,6 @@ class ShowbuilderController extends Zend_Controller_Action
$this->_helper->layout->setLayout('builder');
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/events/library_showbuilder.js'),'text/javascript');
$this->view->headScript()->appendFile($this->view->baseUrl('/js/airtime/library/preview.js'), 'text/javascript');
$this->_helper->actionStack('library', 'library');
$this->_helper->actionStack('builder', 'showbuilder');

View file

@ -561,7 +561,8 @@ Logging::log("getting media! - 2");
$displayColumns = array("id", "track_title", "artist_name", "album_title", "genre", "length",
"year", "utime", "mtime", "ftype", "track_number", "mood", "bpm", "composer", "info_url",
"bit_rate", "sample_rate", "isrc_number", "encoded_by", "label", "copyright", "mime", "language"
"bit_rate", "sample_rate", "isrc_number", "encoded_by", "label", "copyright", "mime",
"language", "gunid", "filepath"
);
$plSelect = array();
@ -632,8 +633,6 @@ Logging::log("getting media! - 2");
$results = Application_Model_StoredFile::searchFiles($displayColumns, $fromTable, $datatables);
//Used by the audio preview functionality in the library.
$audioResults = Application_Model_StoredFile::getAllAudioFilePaths();
foreach ($results['aaData'] as &$row) {
$row['id'] = intval($row['id']);
@ -659,10 +658,9 @@ Logging::log("getting media! - 2");
//datatable stuff really needs to be pulled out and generalized within the project
//access to zend view methods to access url helpers is needed.
if($type == "au" && isset( $audioResults )) {
$row['audioFile'] = $audioResults[$row['id']-1]['gunid'].".".pathinfo($audioResults[$row['id']-1]['filepath'], PATHINFO_EXTENSION);
$row['image'] = '<span class="ui-icon ui-icon-play"></span>';
if($type == "au"){//&& isset( $audioResults )) {
$row['audioFile'] = $row['gunid'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION);
$row['image'] = '<div class="big_play"><span class="ui-icon ui-icon-play"></span></div>';
}
else {
$row['image'] = '<img src="/css/images/icon_playlist.png">';
@ -671,19 +669,6 @@ Logging::log("getting media! - 2");
return $results;
}
public static function getAllAudioFilePaths(){
try {
$con = Propel::getConnection(CcFilesPeer::DATABASE_NAME);
$r = $con->query("SELECT id, gunid, filepath FROM cc_files");
$r->setFetchMode(PDO::FETCH_ASSOC);
$results = $r->fetchAll();
return $results;
}catch (Exception $e) {
Logging::log($e->getMessage());
}
}
public static function searchFiles($displayColumns, $fromTable, $data)
{

View file

@ -1,4 +1,5 @@
<div id="content" class="jp-container">
<span class='name'><?php echo "$this->name" ?></span>
<span class='filename'><?php echo "$this->fileName" ?></span>
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div id="jp_container_1" class="jp-audio">

View file

@ -5,10 +5,9 @@ if (count($items)) : ?>
<?php foreach($items as $item) : ?>
<li class="ui-state-default" id="spl_<?php echo $item["id"] ?>" unqid="<?php echo $item["CcFiles"]["gunid"]."_".$item["id"]; ?>">
<div class="list-item-container">
<a href="javascript:void(0);" class="big_play" onClick="open_audio_preview(
'<?php echo $item["CcFiles"]["gunid"].".".pathinfo($item["CcFiles"]["filepath"],PATHINFO_EXTENSION);?>', '<?php echo $i ?>');">
<span class="ui-icon ui-icon-play"></span></a>
<div class="big_play" audioFile="<?php echo $item["CcFiles"]["gunid"].".".pathinfo($item["CcFiles"]['filepath'], PATHINFO_EXTENSION); ?>">
<span class="ui-icon ui-icon-play"></span>
</div>
<div class="text-row top">
<span class="spl_playlength"><?php echo $item["cliplength"] ?></span>
<span class="spl_cue ui-state-default"></span>