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:
parent
a246f85a5b
commit
a09b63b8d0
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -143,7 +143,7 @@
|
|||
#side_playlist h3 + h4 {
|
||||
margin:0 0 11px 0;
|
||||
}
|
||||
#spl_sortable a.big_play {
|
||||
#spl_sortable div.big_play {
|
||||
display:block;
|
||||
width:20px;
|
||||
height:50px;
|
||||
|
@ -155,21 +155,21 @@
|
|||
background: -moz-linear-gradient(top, #707070 0, #666666 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #707070), color-stop(100%, #666666));
|
||||
}
|
||||
#spl_sortable a.big_play:hover {
|
||||
#spl_sortable div.big_play:hover {
|
||||
border:1px solid #282828;
|
||||
background-color: #3b3b3b;
|
||||
background: -moz-linear-gradient(top, #3b3b3b 0, #292929 100%);
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0, #3b3b3b), color-stop(100%, #292929));
|
||||
}
|
||||
#spl_sortable a.big_play .ui-icon-play {
|
||||
#spl_sortable div.big_play .ui-icon-play {
|
||||
margin: 17px 0 0 1px;
|
||||
}
|
||||
|
||||
#spl_sortable a.big_play .ui-icon-pause {
|
||||
#spl_sortable div.big_play .ui-icon-pause {
|
||||
margin: 17px 0 0 1px;
|
||||
}
|
||||
|
||||
#spl_sortable a.big_play:hover .ui-icon-play, #spl_sortable a.big_play:hover .ui-icon-pause {
|
||||
#spl_sortable div.big_play:hover .ui-icon-play, #spl_sortable div.big_play:hover .ui-icon-pause {
|
||||
background-image:url(redmond/images/ui-icons_ff5d1a_256x240.png);
|
||||
}
|
||||
#spl_sortable .ui-icon-closethick {
|
||||
|
|
|
@ -160,7 +160,7 @@
|
|||
|
||||
//add the play function to the library_type td
|
||||
$(nRow).find('td.library_type').click(function(){
|
||||
open_audio_preview(aData.audioFile, iDataIndex);
|
||||
open_audio_preview(aData.track_title, aData.audioFile, aData.id);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
@ -360,7 +360,7 @@
|
|||
//define a play callback.
|
||||
if (oItems.play !== undefined) {
|
||||
callback = function() {
|
||||
open_audio_preview(data.audioFile, data.id);
|
||||
open_audio_preview(data.track_title, data.audioFile, data.id);
|
||||
};
|
||||
oItems.play.callback = callback;
|
||||
}
|
||||
|
@ -638,13 +638,13 @@
|
|||
|
||||
var audio_preview_window = null;
|
||||
|
||||
function open_audio_preview(filename, index) {
|
||||
url = 'Playlist/audio-preview-player/filename/'+filename+'/index/'+index;
|
||||
function open_audio_preview(name, filename, index) {
|
||||
url = 'Playlist/audio-preview-player/name/'+name+'/filename/'+filename+'/index/'+index;
|
||||
//$.post(baseUri+'Playlist/audio-preview-player', {fileName: fileName, cueIn: cueIn, cueOut: cueOut, fadeIn: fadeIn, fadeInFileName: fadeInFileName, fadeOut: fadeOut, fadeOutFileName: fadeOutFileName})
|
||||
if (audio_preview_window == null || audio_preview_window.closed){
|
||||
audio_preview_window = window.open(url, 'Audio Player', 'width=400,height=95');
|
||||
} else if (!audio_preview_window.closed) {
|
||||
audio_preview_window.play(filename);
|
||||
audio_preview_window.play(name, filename);
|
||||
} else {
|
||||
console.log("something else : "+baseUrl+url);
|
||||
}
|
||||
|
|
|
@ -1,69 +0,0 @@
|
|||
var audio_preview_window_p = null;
|
||||
|
||||
function playlistAudioPreviewEditor(filename, elemIndexString){
|
||||
|
||||
elemIndex =parseInt(elemIndexString)+1;//increment the index as tags start from 1 not 0
|
||||
|
||||
var cueIn = $("dd[id^=spl_cue_in_"+elemIndex+"]").find('span').html();
|
||||
console.log(cueIn);
|
||||
|
||||
var cueOut = $("dd[id^=spl_cue_out_"+elemIndex+"]").find('span').html();
|
||||
console.log("The cueOut is "+cueOut);
|
||||
|
||||
var fadeIn = $("dd[id^=spl_fade_in_"+elemIndex+"]").find('span').html();
|
||||
if (fadeIn == undefined){ console.log("undefined fadein"); fadeIn = $("dd[id^=spl_fade_in_main]").find('span').html();}
|
||||
console.log("The fadeIn is "+fadeIn);
|
||||
|
||||
var fadeInFileName = "";
|
||||
if (fadeIn != undefined && parseInt(fadeIn) > 0 ){
|
||||
//need to get the previous element in the playlist...but don't support previous playlist fading becuase thats not possible.
|
||||
|
||||
}
|
||||
console.log("The fadeInFileName is "+fadeInFileName);
|
||||
|
||||
var fadeOut = $("dd[id^=spl_fade_out_"+elemIndex+"]").find('span').html();
|
||||
if (fadeOut == undefined){ console.log("undefined fadeout"); fadeOut = $("dd[id^=spl_fade_out_main]").find('span').html();}
|
||||
console.log("The fadeOut is "+fadeOut);
|
||||
|
||||
var fadeOutFileName = "";
|
||||
if (fadeOut != undefined && parseInt(fadeOut) > 0 ){
|
||||
//need to get the next element in the playlist...but don't support next playlist fading becuase thats not possible.
|
||||
|
||||
}
|
||||
console.log("The fadeOutFileName is "+fadeOutFileName);
|
||||
|
||||
//Pop out a play list with cue in and cue out set.
|
||||
open_player();
|
||||
|
||||
//Set the play button to pause.
|
||||
var elemID = "spl_"+elemIndexString;
|
||||
$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause");
|
||||
|
||||
}
|
||||
|
||||
function open_audio_preview_old(filename, index) {
|
||||
console.log("hello world 2 "+filename+" help?");
|
||||
url = 'Playlist/audio-preview-player/filename/'+filename+'/index/'+index;
|
||||
//$.post(baseUri+'Playlist/audio-preview-player', {fileName: fileName, cueIn: cueIn, cueOut: cueOut, fadeIn: fadeIn, fadeInFileName: fadeInFileName, fadeOut: fadeOut, fadeOutFileName: fadeOutFileName})
|
||||
if (audio_preview_window == null || audio_preview_window.closed){
|
||||
console.log("opening : "+baseUrl+url);
|
||||
|
||||
audio_preview_window = window.open(url, 'Audio Player', 'width=400,height=95');
|
||||
|
||||
} else if (!audio_preview_window.closed) {
|
||||
console.log("refreshing : "+baseUrl+url);
|
||||
audio_preview_window.play(filename);
|
||||
} else {
|
||||
console.log("something else : "+baseUrl+url);
|
||||
}
|
||||
|
||||
//Set the play button to pause.
|
||||
var elemID = "spl_"+elemIndexString;
|
||||
$('#'+elemID+' div.list-item-container a span').attr("class", "ui-icon ui-icon-pause");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#library_type').bind('click', function(){
|
||||
console.log(data);
|
||||
});
|
|
@ -37,11 +37,12 @@ function audioPreview(filename, elemID){
|
|||
|
||||
$(document).ready(function(){
|
||||
var filename = $(".filename").text();
|
||||
play(filename);
|
||||
var name = $(".name").text();
|
||||
play(name, filename);
|
||||
});
|
||||
|
||||
function play(filename){
|
||||
var uri = "/api/get-media/file/" + filename;
|
||||
function play(name, filename){
|
||||
var uri = "/api/get-media/name/"+name+"/filename/" + filename;
|
||||
var ext = getFileExt(filename);
|
||||
|
||||
|
||||
|
|
|
@ -245,6 +245,16 @@ var AIRTIME = (function(AIRTIME){
|
|||
}
|
||||
}
|
||||
|
||||
function openAudioPreview(event) {
|
||||
event.stopPropagation();
|
||||
|
||||
var name = $(this).parent().find('.spl_title').text();
|
||||
var audioFile = $(this).attr('audioFile');
|
||||
var id = "";
|
||||
|
||||
open_audio_preview(name, audioFile, id);
|
||||
}
|
||||
|
||||
function editName() {
|
||||
var nameElement = $(this),
|
||||
playlistName = nameElement.text(),
|
||||
|
@ -343,6 +353,9 @@ var AIRTIME = (function(AIRTIME){
|
|||
$(el).delegate(".spl_cue",
|
||||
{"click": openCueEditor});
|
||||
|
||||
//add the play function to the play icon
|
||||
$(el).delegate(".big_play",
|
||||
{"click": openAudioPreview});
|
||||
}
|
||||
|
||||
//sets events dynamically for the cue editor.
|
||||
|
|
|
@ -92,7 +92,9 @@ div.jp-video div.jp-interface {
|
|||
span.filename {
|
||||
display:none;
|
||||
}
|
||||
|
||||
span.name {
|
||||
display:none;
|
||||
}
|
||||
/* @group CONTROLS */
|
||||
|
||||
div.jp-controls-holder {
|
||||
|
|
Loading…
Reference in New Issue