API changed!
Playlist-related methods parameters changed to be more consistent with other methods.
This commit is contained in:
parent
7fa94a3d5b
commit
02f7969fe3
|
@ -22,8 +22,8 @@
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: sebastian $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.35 $
|
Version : $Revision: 1.36 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/GreenBox.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/GreenBox.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -34,8 +34,8 @@ require_once "BasicStor.php";
|
||||||
*
|
*
|
||||||
* LiveSupport file storage module
|
* LiveSupport file storage module
|
||||||
*
|
*
|
||||||
* @author $Author: sebastian $
|
* @author $Author: tomas $
|
||||||
* @version $Revision: 1.35 $
|
* @version $Revision: 1.36 $
|
||||||
* @see BasicStor
|
* @see BasicStor
|
||||||
*/
|
*/
|
||||||
class GreenBox extends BasicStor{
|
class GreenBox extends BasicStor{
|
||||||
|
@ -388,26 +388,37 @@ class GreenBox extends BasicStor{
|
||||||
/**
|
/**
|
||||||
* Create a new empty playlist.
|
* Create a new empty playlist.
|
||||||
*
|
*
|
||||||
* @param sessid string, session ID
|
* @param parid int, parent id
|
||||||
* @param gunid string, playlist global unique ID
|
|
||||||
* @param fname string, human readable menmonic file name
|
* @param fname string, human readable menmonic file name
|
||||||
* @return string, playlist global unique ID
|
* @param gunid string, playlist global unique ID
|
||||||
|
* @param sessid string, session ID
|
||||||
|
* @return int, local id of created playlist
|
||||||
*/
|
*/
|
||||||
function createPlaylist($sessid, $gunid, $fname)
|
function createPlaylist($parid, $fname, $gunid, $sessid)
|
||||||
{
|
{
|
||||||
require_once"LocStor.php";
|
require_once"LocStor.php";
|
||||||
$lc =& new LocStor($this->dbc, $this->config);
|
$lc =& new LocStor($this->dbc, $this->config);
|
||||||
return $lc->createPlaylist($sessid, $gunid, $fname);
|
$gunid2 = $lc->createPlaylist($sessid, $gunid, $fname);
|
||||||
|
if(PEAR::isError($gunid2)) return $gunid2;
|
||||||
|
$id = $this->_idFromGunid($gunid2);
|
||||||
|
if(PEAR::isError($id)) return $id;
|
||||||
|
$hdid = $this->_getHomeDirId($sessid);
|
||||||
|
if(PEAR::isError($hdid)) return $hdid;
|
||||||
|
if($parid != $hdid && !is_null($parid)){
|
||||||
|
$r = $this->bsMoveFile($id, $parid);
|
||||||
|
}
|
||||||
|
if(PEAR::isError($r)){ return $r; }
|
||||||
|
return $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return playlist as XML string
|
* Return playlist as XML string
|
||||||
*
|
*
|
||||||
* @param sessid string, session ID
|
|
||||||
* @param id int, local object id
|
* @param id int, local object id
|
||||||
|
* @param sessid string, session ID
|
||||||
* @return string, XML
|
* @return string, XML
|
||||||
*/
|
*/
|
||||||
function getPlaylistXml($sessid, $id)
|
function getPlaylistXml($id, $sessid)
|
||||||
{
|
{
|
||||||
return $this->getMdata($id, $sessid);
|
return $this->getMdata($id, $sessid);
|
||||||
}
|
}
|
||||||
|
@ -415,11 +426,11 @@ class GreenBox extends BasicStor{
|
||||||
/**
|
/**
|
||||||
* Return playlist as hierarchical PHP hash-array
|
* Return playlist as hierarchical PHP hash-array
|
||||||
*
|
*
|
||||||
* @param sessid string, session ID
|
|
||||||
* @param id int, local object id
|
* @param id int, local object id
|
||||||
|
* @param sessid string, session ID
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getPlaylistArray($sessid, $id)
|
function getPlaylistArray($id, $sessid)
|
||||||
{
|
{
|
||||||
$gunid = $this->_gunidFromId($id);
|
$gunid = $this->_gunidFromId($id);
|
||||||
$pl =& StoredFile::recall($this, $id);
|
$pl =& StoredFile::recall($this, $id);
|
||||||
|
@ -431,11 +442,11 @@ class GreenBox extends BasicStor{
|
||||||
/**
|
/**
|
||||||
* Mark playlist as edited and return edit token
|
* Mark playlist as edited and return edit token
|
||||||
*
|
*
|
||||||
* @param sessid string, session ID
|
|
||||||
* @param id int, local object id
|
* @param id int, local object id
|
||||||
|
* @param sessid string, session ID
|
||||||
* @return string, playlist access token
|
* @return string, playlist access token
|
||||||
*/
|
*/
|
||||||
function lockPlaylistForEdit($sessid, $id)
|
function lockPlaylistForEdit($id, $sessid)
|
||||||
{
|
{
|
||||||
$gunid = $this->_gunidFromId($id);
|
$gunid = $this->_gunidFromId($id);
|
||||||
require_once"LocStor.php";
|
require_once"LocStor.php";
|
||||||
|
@ -448,11 +459,11 @@ class GreenBox extends BasicStor{
|
||||||
/**
|
/**
|
||||||
* Release token, regenerate XML from DB and clear edit flag.
|
* Release token, regenerate XML from DB and clear edit flag.
|
||||||
*
|
*
|
||||||
* @param sessid string, session ID
|
|
||||||
* @param token string, playlist access token
|
* @param token string, playlist access token
|
||||||
|
* @param sessid string, session ID
|
||||||
* @return string gunid
|
* @return string gunid
|
||||||
*/
|
*/
|
||||||
function releaseLockedPlaylist($sessid, $token)
|
function releaseLockedPlaylist($token, $sessid)
|
||||||
{
|
{
|
||||||
$gunid = $this->bsCloseDownload($token, 'metadata');
|
$gunid = $this->bsCloseDownload($token, 'metadata');
|
||||||
if(PEAR::isError($gunid)) return $gunid;
|
if(PEAR::isError($gunid)) return $gunid;
|
||||||
|
@ -467,12 +478,12 @@ class GreenBox extends BasicStor{
|
||||||
/**
|
/**
|
||||||
* Add audioclip specified by gunid to the playlist
|
* Add audioclip specified by gunid to the playlist
|
||||||
*
|
*
|
||||||
* @param sessid string, session ID
|
|
||||||
* @param token string, playlist access token
|
* @param token string, playlist access token
|
||||||
* @param acGunid string, global unique ID of added file
|
* @param acGunid string, global unique ID of added file
|
||||||
|
* @param sessid string, session ID
|
||||||
* @return string, generated playlistElement gunid
|
* @return string, generated playlistElement gunid
|
||||||
*/
|
*/
|
||||||
function addAudioClipToPlaylist($sessid, $token, $acGunid)
|
function addAudioClipToPlaylist($token, $acGunid, $sessid)
|
||||||
{
|
{
|
||||||
$plGunid = $this->_gunidFromToken($token, 'download');
|
$plGunid = $this->_gunidFromToken($token, 'download');
|
||||||
if(PEAR::isError($plGunid)) return $plGunid;
|
if(PEAR::isError($plGunid)) return $plGunid;
|
||||||
|
@ -563,12 +574,12 @@ class GreenBox extends BasicStor{
|
||||||
/**
|
/**
|
||||||
* Remove audioclip from playlist
|
* Remove audioclip from playlist
|
||||||
*
|
*
|
||||||
* @param sessid string, session ID
|
|
||||||
* @param token string, playlist access token
|
* @param token string, playlist access token
|
||||||
* @param plElGunid string, global unique ID of deleted playlistElement
|
* @param plElGunid string, global unique ID of deleted playlistElement
|
||||||
|
* @param sessid string, session ID
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function delAudioClipFromPlaylist($sessid, $token, $plElGunid)
|
function delAudioClipFromPlaylist($token, $plElGunid, $sessid)
|
||||||
{
|
{
|
||||||
$plGunid = $this->_gunidFromToken($token, 'download');
|
$plGunid = $this->_gunidFromToken($token, 'download');
|
||||||
if(PEAR::isError($plGunid)) return $plGunid;
|
if(PEAR::isError($plGunid)) return $plGunid;
|
||||||
|
@ -646,11 +657,11 @@ class GreenBox extends BasicStor{
|
||||||
/**
|
/**
|
||||||
* RollBack playlist changes to the locked state
|
* RollBack playlist changes to the locked state
|
||||||
*
|
*
|
||||||
* @param sessid string, session ID
|
|
||||||
* @param token string, playlist access token
|
* @param token string, playlist access token
|
||||||
|
* @param sessid string, session ID
|
||||||
* @return string gunid of playlist
|
* @return string gunid of playlist
|
||||||
*/
|
*/
|
||||||
function revertEditedPlaylist($sessid, $token)
|
function revertEditedPlaylist($token, $sessid)
|
||||||
{
|
{
|
||||||
$gunid = $this->bsCloseDownload($token, 'metadata');
|
$gunid = $this->bsCloseDownload($token, 'metadata');
|
||||||
if(PEAR::isError($gunid)) return $gunid;
|
if(PEAR::isError($gunid)) return $gunid;
|
||||||
|
@ -694,47 +705,16 @@ class GreenBox extends BasicStor{
|
||||||
return sprintf("%02d:%02d:%09.6f", $h, $m, $r);
|
return sprintf("%02d:%02d:%09.6f", $h, $m, $r);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------- */
|
|
||||||
/**
|
|
||||||
* Open a Playlist metafile for editing.
|
|
||||||
* Open readable URL and mark file as beeing edited.
|
|
||||||
*
|
|
||||||
* @param sessid string, session ID
|
|
||||||
* @param gunid string, playlist global unique ID
|
|
||||||
* @return struct
|
|
||||||
* {url:readable URL for HTTP GET, token:access token, chsum:checksum}
|
|
||||||
*/
|
|
||||||
function editPlaylist($sessid, $gunid)
|
|
||||||
{
|
|
||||||
require_once"LocStor.php";
|
|
||||||
$lc =& new LocStor($this->dbc, $this->config);
|
|
||||||
return $lc->editPlaylist($sessid, $gunid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Store a new Playlist metafile in place of the old one.
|
|
||||||
*
|
|
||||||
* @param sessid string, session ID
|
|
||||||
* @param playlistToken string, playlist access token
|
|
||||||
* @param newPlaylist string, new playlist as XML string
|
|
||||||
* @return string, gunid
|
|
||||||
*/
|
|
||||||
function savePlaylist($sessid, $playlistToken, $newPlaylist)
|
|
||||||
{
|
|
||||||
require_once"LocStor.php";
|
|
||||||
$lc =& new LocStor($this->dbc, $this->config);
|
|
||||||
return $lc->savePlaylist($sessid, $playlistToken, $newPlaylist);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a Playlist metafile.
|
* Delete a Playlist metafile.
|
||||||
*
|
*
|
||||||
|
* @param parid int, parent id
|
||||||
* @param sessid string, session ID
|
* @param sessid string, session ID
|
||||||
* @param gunid string, playlist global unique ID
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function deletePlaylist($sessid, $gunid)
|
function deletePlaylist($id, $sessid)
|
||||||
{
|
{
|
||||||
|
$gunid = $this->_gunidFromId($id);
|
||||||
require_once"LocStor.php";
|
require_once"LocStor.php";
|
||||||
$lc =& new LocStor($this->dbc, $this->config);
|
$lc =& new LocStor($this->dbc, $this->config);
|
||||||
return $lc->deletePlaylist($sessid, $gunid);
|
return $lc->deletePlaylist($sessid, $gunid);
|
||||||
|
@ -743,12 +723,13 @@ class GreenBox extends BasicStor{
|
||||||
/**
|
/**
|
||||||
* Check whether a Playlist metafile with the given playlist ID exists.
|
* Check whether a Playlist metafile with the given playlist ID exists.
|
||||||
*
|
*
|
||||||
|
* @param parid int, parent id
|
||||||
* @param sessid string, session ID
|
* @param sessid string, session ID
|
||||||
* @param gunid string, playlist global unique ID
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function existsPlaylist($sessid, $gunid)
|
function existsPlaylist($gunid, $sessid)
|
||||||
{
|
{
|
||||||
|
$gunid = $this->_gunidFromId($id);
|
||||||
require_once"LocStor.php";
|
require_once"LocStor.php";
|
||||||
$lc =& new LocStor($this->dbc, $this->config);
|
$lc =& new LocStor($this->dbc, $this->config);
|
||||||
return $lc->existsPlaylist($sessid, $gunid);
|
return $lc->existsPlaylist($sessid, $gunid);
|
||||||
|
@ -759,12 +740,13 @@ class GreenBox extends BasicStor{
|
||||||
* is available for editing, i.e., exists and is not marked as
|
* is available for editing, i.e., exists and is not marked as
|
||||||
* beeing edited.
|
* beeing edited.
|
||||||
*
|
*
|
||||||
|
* @param parid int, parent id
|
||||||
* @param sessid string, session ID
|
* @param sessid string, session ID
|
||||||
* @param gunid string, playlist global unique ID
|
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function playlistIsAvailable($sessid, $gunid)
|
function playlistIsAvailable($gunid, $sessid)
|
||||||
{
|
{
|
||||||
|
$gunid = $this->_gunidFromId($id);
|
||||||
require_once"LocStor.php";
|
require_once"LocStor.php";
|
||||||
$lc =& new LocStor($this->dbc, $this->config);
|
$lc =& new LocStor($this->dbc, $this->config);
|
||||||
return $lc->playlistIsAvailable($sessid, $gunid);
|
return $lc->playlistIsAvailable($sessid, $gunid);
|
||||||
|
|
Loading…
Reference in New Issue