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" ?>
diff --git a/airtime_mvc/application/views/scripts/playlist/update.phtml b/airtime_mvc/application/views/scripts/playlist/update.phtml
index 35efc766c..3557d207c 100644
--- a/airtime_mvc/application/views/scripts/playlist/update.phtml
+++ b/airtime_mvc/application/views/scripts/playlist/update.phtml
@@ -5,10 +5,9 @@ if (count($items)) : ?>
" unqid="">
-
', '');">
-
-
+
">
+
+
diff --git a/airtime_mvc/public/css/playlist_builder.css b/airtime_mvc/public/css/playlist_builder.css
index cef0a7eba..931bc8ff0 100644
--- a/airtime_mvc/public/css/playlist_builder.css
+++ b/airtime_mvc/public/css/playlist_builder.css
@@ -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 {
diff --git a/airtime_mvc/public/js/airtime/library/library.js b/airtime_mvc/public/js/airtime/library/library.js
index 9037c7ceb..bc895b20b 100644
--- a/airtime_mvc/public/js/airtime/library/library.js
+++ b/airtime_mvc/public/js/airtime/library/library.js
@@ -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);
}
diff --git a/airtime_mvc/public/js/airtime/library/preview.js b/airtime_mvc/public/js/airtime/library/preview.js
deleted file mode 100644
index 13e4b39e5..000000000
--- a/airtime_mvc/public/js/airtime/library/preview.js
+++ /dev/null
@@ -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);
-});
\ No newline at end of file
diff --git a/airtime_mvc/public/js/airtime/library/preview_jplayer.js b/airtime_mvc/public/js/airtime/library/preview_jplayer.js
index 6835123a6..15c53f9ec 100644
--- a/airtime_mvc/public/js/airtime/library/preview_jplayer.js
+++ b/airtime_mvc/public/js/airtime/library/preview_jplayer.js
@@ -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);
diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js
index e90aeaa33..dd30cc53d 100644
--- a/airtime_mvc/public/js/airtime/library/spl.js
+++ b/airtime_mvc/public/js/airtime/library/spl.js
@@ -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.
diff --git a/airtime_mvc/public/js/jplayer/skin/jplayer.audio-preview.blue.monday.css b/airtime_mvc/public/js/jplayer/skin/jplayer.audio-preview.blue.monday.css
index 61daa3a11..ca518c523 100644
--- a/airtime_mvc/public/js/jplayer/skin/jplayer.audio-preview.blue.monday.css
+++ b/airtime_mvc/public/js/jplayer/skin/jplayer.audio-preview.blue.monday.css
@@ -92,7 +92,9 @@ div.jp-video div.jp-interface {
span.filename {
display:none;
}
-
+span.name {
+ display:none;
+}
/* @group CONTROLS */
div.jp-controls-holder {