From c7ca61f5c39b2a55337130eff5984fba7f880bd0 Mon Sep 17 00:00:00 2001 From: tomash Date: Thu, 9 Mar 2006 02:08:33 +0000 Subject: [PATCH] #1582 support for multiple playlist export added --- .../modules/storageServer/var/BasicStor.php | 26 ++++++++++++------- .../modules/storageServer/var/GreenBox.php | 7 ++--- .../src/modules/storageServer/var/LocStor.php | 7 ++--- .../storageServer/var/xmlrpc/XR_LocStor.php | 4 +-- .../storageServer/var/xmlrpc/xr_cli_test.php | 2 +- 5 files changed, 28 insertions(+), 18 deletions(-) diff --git a/livesupport/src/modules/storageServer/var/BasicStor.php b/livesupport/src/modules/storageServer/var/BasicStor.php index 43803ec4e..1e943f562 100644 --- a/livesupport/src/modules/storageServer/var/BasicStor.php +++ b/livesupport/src/modules/storageServer/var/BasicStor.php @@ -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); diff --git a/livesupport/src/modules/storageServer/var/GreenBox.php b/livesupport/src/modules/storageServer/var/GreenBox.php index ec08d9abe..3304b7189 100644 --- a/livesupport/src/modules/storageServer/var/GreenBox.php +++ b/livesupport/src/modules/storageServer/var/GreenBox.php @@ -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); } /** diff --git a/livesupport/src/modules/storageServer/var/LocStor.php b/livesupport/src/modules/storageServer/var/LocStor.php index 25161ef8f..1e516e88b 100644 --- a/livesupport/src/modules/storageServer/var/LocStor.php +++ b/livesupport/src/modules/storageServer/var/LocStor.php @@ -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']); diff --git a/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php b/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php index 1e9115f7e..8b027170b 100644 --- a/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php +++ b/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php @@ -1170,7 +1170,7 @@ class XR_LocStor extends LocStor{ * fields: *