From a09b63b8d08b291cfffce6a6f2ed73e26a2e9e8a Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 5 Mar 2012 18:59:31 -0500 Subject: [PATCH] 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 --- .../application/controllers/ApiController.php | 12 ++-- .../controllers/PlaylistController.php | 8 +-- .../controllers/ShowbuilderController.php | 1 - airtime_mvc/application/models/StoredFile.php | 25 ++----- .../playlist/audio-preview-player.phtml | 1 + .../views/scripts/playlist/update.phtml | 7 +- airtime_mvc/public/css/playlist_builder.css | 10 +-- .../public/js/airtime/library/library.js | 10 +-- .../public/js/airtime/library/preview.js | 69 ------------------- .../js/airtime/library/preview_jplayer.js | 7 +- airtime_mvc/public/js/airtime/library/spl.js | 13 ++++ .../jplayer.audio-preview.blue.monday.css | 4 +- 12 files changed, 49 insertions(+), 118 deletions(-) delete mode 100644 airtime_mvc/public/js/airtime/library/preview.js diff --git a/airtime_mvc/application/controllers/ApiController.php b/airtime_mvc/application/controllers/ApiController.php index 54d810fa8..369d424bb 100644 --- a/airtime_mvc/application/controllers/ApiController.php +++ b/airtime_mvc/application/controllers/ApiController.php @@ -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)); diff --git a/airtime_mvc/application/controllers/PlaylistController.php b/airtime_mvc/application/controllers/PlaylistController.php index ec514e2cd..80ebaf47e 100644 --- a/airtime_mvc/application/controllers/PlaylistController.php +++ b/airtime_mvc/application/controllers/PlaylistController.php @@ -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; } diff --git a/airtime_mvc/application/controllers/ShowbuilderController.php b/airtime_mvc/application/controllers/ShowbuilderController.php index b423243be..a32d15665 100644 --- a/airtime_mvc/application/controllers/ShowbuilderController.php +++ b/airtime_mvc/application/controllers/ShowbuilderController.php @@ -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'); diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 45ffbafd5..1a8821a41 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -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'] = ''; - + if($type == "au"){//&& isset( $audioResults )) { + $row['audioFile'] = $row['gunid'].".".pathinfo($row['filepath'], PATHINFO_EXTENSION); + $row['image'] = '
'; } else { $row['image'] = ''; @@ -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) { diff --git a/airtime_mvc/application/views/scripts/playlist/audio-preview-player.phtml b/airtime_mvc/application/views/scripts/playlist/audio-preview-player.phtml index ab33c2eca..a01b2e9ff 100644 --- a/airtime_mvc/application/views/scripts/playlist/audio-preview-player.phtml +++ b/airtime_mvc/application/views/scripts/playlist/audio-preview-player.phtml @@ -1,4 +1,5 @@
+ name" ?> fileName" ?>