CC-3675: Playlist -> the files from Disconnected Mediafolder can still

be previewed (played)

- done
This commit is contained in:
James 2012-04-24 12:59:07 -04:00
parent a41f100545
commit 3c4d01aa93
4 changed files with 23 additions and 10 deletions

View File

@ -98,7 +98,7 @@ class AudiopreviewController extends Zend_Controller_Action
$pl = new Application_Model_Playlist($playlistID);
$result = Array();
foreach ( $pl->getContents() as $track ){
foreach ( $pl->getContents(true) as $track ){
$elementMap = array( 'element_title' => isset($track['CcFiles']['track_title'])?$track['CcFiles']['track_title']:"",
'element_artist' => isset($track['CcFiles']['artist_name'])?$track['CcFiles']['artist_name']:"",
@ -115,7 +115,7 @@ class AudiopreviewController extends Zend_Controller_Action
}
$result[] = $elementMap;
}
$this->_helper->json($result);
}

View File

@ -373,7 +373,7 @@ class ScheduleController extends Zend_Controller_Action
$this->view->switch_status = $switch_status;
$this->view->entries = $range;
$this->view->show_name = $show[0]["name"];
$this->view->show_name = isset($show[0])?$show[0]["name"]:"";
}
public function removeGroupAction()

View File

@ -140,18 +140,26 @@ class Application_Model_Playlist {
/**
* Get the entire playlist as a two dimentional array, sorted in order of play.
* @param boolean $filterFiles if this is true, it will only return files that has
* file_exists flag set to true
* @return array
*/
public function getContents() {
public function getContents($filterFiles=false) {
Logging::log("Getting contents for playlist {$this->id}");
$files = array();
$rows = CcPlaylistcontentsQuery::create()
->joinWith('CcFiles')
->orderByDbPosition()
->filterByDbPlaylistId($this->id)
->find($this->con);
$query = CcPlaylistcontentsQuery::create()
->filterByDbPlaylistId($this->id);
if($filterFiles){
$query->useCcFilesQuery()
->filterByDbFileExists(true)
->endUse();
}
$query->orderByDbPosition()
->leftJoinWith('CcFiles');
$rows = $query->find($this->con);
$i = 0;
$offset = 0;

View File

@ -114,7 +114,9 @@ function buildplaylist(p_url, p_playIndex) {
}
myPlaylist[index] = media;
_idToPostionLookUp[data[index]['element_id']] = data[index]['element_position'];
// we should create a map according to the new position in the player itself
// total is the index on the player
_idToPostionLookUp[data[index]['element_id']] = total;
total++;
}
@ -135,6 +137,9 @@ function buildplaylist(p_url, p_playIndex) {
*/
function play(p_playlistIndex){
playlistIndex = _idToPostionLookUp[p_playlistIndex];
if(playlistIndex == undefined){
playlistIndex = 0
}
//_playlist_jplayer.select(playlistIndex);
_playlist_jplayer.play(playlistIndex);
}