#1582 support for multiple playlist export added
This commit is contained in:
parent
c590b92db0
commit
c7ca61f5c3
5 changed files with 28 additions and 18 deletions
|
@ -833,7 +833,8 @@ class BasicStor extends Alib{
|
|||
* sub-playlists and media files (if desired)
|
||||
*
|
||||
* @param sessid - string, session ID
|
||||
* @param plid - string, playlist global unique ID
|
||||
* @param plids - array of strings, playlist global unique IDs
|
||||
* (one gunid is accepted too)
|
||||
* @param type - string, playlist format,
|
||||
* possible values: lspl | smil
|
||||
* @param standalone - boolean, if only playlist should be exported or
|
||||
|
@ -842,16 +843,21 @@ class BasicStor extends Alib{
|
|||
* fname string: readable fname,
|
||||
* token srring: access token
|
||||
*/
|
||||
function bsExportPlaylistOpen($plid, $type='lspl', $standalone=FALSE)
|
||||
function bsExportPlaylistOpen($plids, $type='lspl', $standalone=FALSE)
|
||||
{
|
||||
require_once"Playlist.php";
|
||||
$pl = $r = Playlist::recallByGunid($this, $plid);
|
||||
if(PEAR::isError($r)) return $r;
|
||||
if($standalone){
|
||||
$gunids = array(array('gunid'=>$plid, 'type'=>'playlist'));
|
||||
}else{
|
||||
$gunids = $r = $pl->export();
|
||||
if(!is_array($plids)) $plids=array($plids);
|
||||
$gunids = array();
|
||||
foreach($plids as $plid){
|
||||
$pl = $r = Playlist::recallByGunid($this, $plid);
|
||||
if(PEAR::isError($r)) return $r;
|
||||
if($standalone){
|
||||
$gunidsX = array(array('gunid'=>$plid, 'type'=>'playlist'));
|
||||
}else{
|
||||
$gunidsX = $r = $pl->export();
|
||||
if(PEAR::isError($r)) return $r;
|
||||
}
|
||||
$gunids = array_merge($gunids, $gunidsX);
|
||||
}
|
||||
$plExts = array('lspl'=>"lspl", 'smil'=>"smil", 'm3u'=>"m3u");
|
||||
$plExt = (isset($plExts[$type]) ? $plExts[$type] : "xml" );
|
||||
|
@ -891,7 +897,9 @@ class BasicStor extends Alib{
|
|||
copy($RADfname, "$tmpdc/{$it['gunid']}.$RADext");
|
||||
}
|
||||
}
|
||||
copy("$tmpdp/$plid.$plExt", "$tmpd/exportedPlaylist.$plExt");
|
||||
if(count($plids)==1){
|
||||
copy("$tmpdp/$plid.$plExt", "$tmpd/exportedPlaylist.$plExt");
|
||||
}
|
||||
$res = `cd $tmpd; tar cf $tmpf * --remove-files`;
|
||||
@rmdir($tmpdc); @rmdir($tmpdp); @rmdir($tmpd);
|
||||
unlink($tmpn);
|
||||
|
|
|
@ -669,7 +669,8 @@ class GreenBox extends BasicStor{
|
|||
* sub-playlists and media files (if desired)
|
||||
*
|
||||
* @param sessid - string, session ID
|
||||
* @param plid - string, playlist global unique ID
|
||||
* @param plids - array of strings, playlist global unique IDs
|
||||
* (one gunid is accepted too)
|
||||
* @param type - string, playlist format, values: lspl | smil | m3u
|
||||
* @param standalone - boolean, if only playlist should be exported or
|
||||
* with all related files
|
||||
|
@ -677,9 +678,9 @@ class GreenBox extends BasicStor{
|
|||
* fname string: readable fname,
|
||||
* token srring: access token
|
||||
*/
|
||||
function exportPlaylistOpen($sessid, $plid, $type='lspl', $standalone=FALSE)
|
||||
function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE)
|
||||
{
|
||||
return $this->bsExportPlaylistOpen($plid, $type, $standalone);
|
||||
return $this->bsExportPlaylistOpen($plids, $type, $standalone);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -673,7 +673,8 @@ class LocStor extends BasicStor{
|
|||
* sub-playlists and media files (if desired)
|
||||
*
|
||||
* @param sessid - string, session ID
|
||||
* @param plid - string, playlist global unique ID
|
||||
* @param plids - array of strings, playlist global unique IDs
|
||||
* (one gunid is accepted too)
|
||||
* @param type - string, playlist format, values: lspl | smil | m3u
|
||||
* @param standalone - boolean, if only playlist should be exported or
|
||||
* with all related files
|
||||
|
@ -682,9 +683,9 @@ class LocStor extends BasicStor{
|
|||
* token srring: access token
|
||||
* chsum string: md5 checksum,
|
||||
*/
|
||||
function exportPlaylistOpen($sessid, $plid, $type='lspl', $standalone=FALSE)
|
||||
function exportPlaylistOpen($sessid, $plids, $type='lspl', $standalone=FALSE)
|
||||
{
|
||||
$res = $r =$this->bsExportPlaylistOpen($plid, $type, $standalone);
|
||||
$res = $r =$this->bsExportPlaylistOpen($plids, $type, $standalone);
|
||||
if($this->dbc->isError($r)) return $r;
|
||||
$url = $this->getUrlPart()."access/".basename($res['fname']);
|
||||
$chsum = md5_file($res['fname']);
|
||||
|
|
|
@ -1170,7 +1170,7 @@ class XR_LocStor extends LocStor{
|
|||
* fields:
|
||||
* <ul>
|
||||
* <li> sessid : string - session id </li>
|
||||
* <li> plid : string - global unique id of Playlist</li>
|
||||
* <li> plids : array of strings - global unique IDs of Playlists</li>
|
||||
* <li> type : string - playlist format, values: lspl | smil </li>
|
||||
* <li> standalone : boolean - if only playlist should be exported or
|
||||
* with all related files </li>
|
||||
|
@ -1202,7 +1202,7 @@ class XR_LocStor extends LocStor{
|
|||
if(!$ok) return $r;
|
||||
if(!isset($t['standalone'])) $r['standalone']=FALSE;
|
||||
$res = $this->exportPlaylistOpen(
|
||||
$r['sessid'], $r['plid'], $r['type'], $r['standalone']
|
||||
$r['sessid'], $r['plids'], $r['type'], $r['standalone']
|
||||
);
|
||||
if(PEAR::isError($res)){
|
||||
return new XML_RPC_Response(0, 805,
|
||||
|
|
|
@ -135,7 +135,7 @@ $infos = array(
|
|||
'p'=>array('sessid', 'plid'), 'r'=>array('available', 'ownerid', 'ownerlogin')),
|
||||
|
||||
"exportPlaylistOpen" => array('m'=>"locstor.exportPlaylistOpen",
|
||||
'p'=>array('sessid', 'plid', 'type'),
|
||||
'p'=>array('sessid', 'plids', 'type'),
|
||||
'r'=>array('url', 'token')),
|
||||
"exportPlaylistClose" => array('m'=>"locstor.exportPlaylistClose",
|
||||
'p'=>array('token'), 'r'=>array('status')),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue