Got rid of function getAudioClipInfo().
This commit is contained in:
parent
fa186be7a1
commit
228aca224e
1 changed files with 44 additions and 41 deletions
|
@ -431,23 +431,26 @@ class Playlist {
|
||||||
* @return true|PEAR_Error
|
* @return true|PEAR_Error
|
||||||
* TRUE on success
|
* TRUE on success
|
||||||
*/
|
*/
|
||||||
public function addAudioClip($ac_id, $p_position=NULL, $p_fadeIn=NULL, $p_fadeOut=NULL, $p_clipLength=NULL, $p_cuein=NULL, $p_cueout=NULL)
|
public function addAudioClip($p_mediaId, $p_position=NULL, $p_fadeIn=NULL, $p_fadeOut=NULL, $p_clipLength=NULL, $p_cuein=NULL, $p_cueout=NULL)
|
||||||
{
|
{
|
||||||
$_SESSION['debug'] = "in add";
|
$_SESSION['debug'] = "in add";
|
||||||
|
|
||||||
//get audio clip.
|
//get audio clip.
|
||||||
$ac = StoredFile::Recall($ac_id);
|
$media = StoredFile::Recall($p_mediaId);
|
||||||
if (is_null($ac) || PEAR::isError($ac)) {
|
if (is_null($media) || PEAR::isError($media)) {
|
||||||
return $ac;
|
return $media;
|
||||||
}
|
}
|
||||||
// get information about audioClip
|
// get information about audioClip
|
||||||
$acInfo = $this->getAudioClipInfo($ac);
|
// $acInfo = $this->getAudioClipInfo($ac);
|
||||||
if (PEAR::isError($acInfo)) {
|
// if (PEAR::isError($acInfo)) {
|
||||||
return $acInfo;
|
// return $acInfo;
|
||||||
}
|
// }
|
||||||
extract($acInfo); // 'acGunid', 'acLen', 'acTit', 'elType'
|
// extract($acInfo); // 'acGunid', 'acLen', 'acTit', 'elType'
|
||||||
|
$metadata = $media->getMetadata();
|
||||||
|
$length = $metadata["length"];
|
||||||
|
|
||||||
if (!is_null($p_clipLength)) {
|
if (!is_null($p_clipLength)) {
|
||||||
$acLen = $p_clipLength;
|
$length = $p_clipLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
// insert at end of playlist.
|
// insert at end of playlist.
|
||||||
|
@ -459,18 +462,18 @@ class Playlist {
|
||||||
|
|
||||||
// insert default values if parameter was empty
|
// insert default values if parameter was empty
|
||||||
$p_cuein = !is_null($p_cuein) ? $p_cuein : '00:00:00.000000';
|
$p_cuein = !is_null($p_cuein) ? $p_cuein : '00:00:00.000000';
|
||||||
$p_cueout = !is_null($p_cueout) ? $p_cueout : $acLen;
|
$p_cueout = !is_null($p_cueout) ? $p_cueout : $length;
|
||||||
|
|
||||||
$acLengthS = $clipLengthS = self::playlistTimeToSeconds($acLen);
|
$mediaLengthSec = $clipLengthSec = self::playlistTimeToSeconds($length);
|
||||||
if (!is_null($p_cuein)) {
|
if (!is_null($p_cuein)) {
|
||||||
$clipLengthS = $acLengthS - self::playlistTimeToSeconds($p_cuein);
|
$clipLengthSec = $mediaLengthSec - self::playlistTimeToSeconds($p_cuein);
|
||||||
}
|
}
|
||||||
if (!is_null($p_cueout)) {
|
if (!is_null($p_cueout)) {
|
||||||
$clipLengthS = $clipLengthS - ($acLengthS - self::playlistTimeToSeconds($p_cueout));
|
$clipLengthSec = $clipLengthSec - ($mediaLengthSec - self::playlistTimeToSeconds($p_cueout));
|
||||||
}
|
}
|
||||||
$p_clipLength = self::secondsToPlaylistTime($clipLengthS);
|
$p_clipLength = self::secondsToPlaylistTime($clipLengthSec);
|
||||||
|
|
||||||
$res = $this->insertPlaylistElement($this->id, $ac_id, $p_position, $p_clipLength, $p_cuein, $p_cueout, $p_fadeIn, $p_fadeOut);
|
$res = $this->insertPlaylistElement($this->id, $p_mediaId, $p_position, $p_clipLength, $p_cuein, $p_cueout, $p_fadeIn, $p_fadeOut);
|
||||||
if (PEAR::isError($res)) {
|
if (PEAR::isError($res)) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
@ -862,29 +865,29 @@ class Playlist {
|
||||||
* <li>elType string - audioClip | playlist</li>
|
* <li>elType string - audioClip | playlist</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
private function getAudioClipInfo($p_media)
|
// private function getAudioClipInfo($p_media)
|
||||||
{
|
// {
|
||||||
$ac_id = $p_media->getId();
|
// $ac_id = $p_media->getId();
|
||||||
|
//
|
||||||
$r = $p_media->getMetadataValue('dcterms:extent');
|
// $r = $p_media->getMetadataValue('dcterms:extent');
|
||||||
if (isset($r)) {
|
// if (isset($r)) {
|
||||||
$acLen = $r;
|
// $acLen = $r;
|
||||||
} else {
|
// } else {
|
||||||
$acLen = '00:00:00.000000';
|
// $acLen = '00:00:00.000000';
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
$r = $p_media->getMetadataValue('dc:title');
|
// $r = $p_media->getMetadataValue('dc:title');
|
||||||
if (isset($r)) {
|
// if (isset($r)) {
|
||||||
$acTit = $r;
|
// $acTit = $r;
|
||||||
} else {
|
// } else {
|
||||||
$acTit = $acGunid;
|
// $acTit = $acGunid;
|
||||||
}
|
// }
|
||||||
$elType = $p_media->getType();
|
// $elType = $p_media->getType();
|
||||||
$trTbl = array('audioclip'=>'audioClip', 'webstream'=>'audioClip','playlist'=>'playlist');
|
// $trTbl = array('audioclip'=>'audioClip', 'webstream'=>'audioClip','playlist'=>'playlist');
|
||||||
$elType = $trTbl[$elType];
|
// $elType = $trTbl[$elType];
|
||||||
|
//
|
||||||
return compact('acGunid', 'acLen', 'acTit', 'elType');
|
// return compact('acGunid', 'acLen', 'acTit', 'elType');
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue