Exemple #1
0
 public function getLength()
 {
     $res = CcPlaylistQuery::create()->findPK($this->id)->computeLength();
     if (is_null($res)) {
         return '00:00:00';
     }
     // calling two functions to format time to 1 decimal place
     $sec = Playlist::playlistTimeToSeconds($res);
     $res = Playlist::secondsToPlaylistTime($sec);
     return $res;
 }
 public static function convert2lspl(&$gb, &$tree, &$gunids, $parr, $ind = '')
 {
     extract($parr);
     $uri = $tree->attrs['src']->val;
     $gunid = isset($gunids[basename($uri)]) ? $gunids[basename($uri)] : NULL;
     $ind2 = $ind . INDCH;
     if ($tree->name != 'audio') {
         return PEAR::raiseError("SmilPlaylist::parse: audio tag expected");
     }
     if (isset($tree->children[2])) {
         return PEAR::raiseError(sprintf("SmilPlaylist::parse: unexpected tag %s in tag audio", $tree->children[2]->name));
     }
     $res = '';
     $fadeIn = 0;
     $fadeOut = 0;
     foreach ($tree->children as $i => $ch) {
         $ch =& $tree->children[$i];
         $r = SmilPlaylistAnimateElement::convert2lspl($gb, $ch, &$gunids, $parr, $ind2);
         if (PEAR::isError($r)) {
             return $r;
         }
         switch ($r['type']) {
             case "fadeIn":
                 $fadeIn = $r['val'];
                 break;
             case "fadeOut":
                 $fadeOut = $r['val'];
                 break;
         }
     }
     if ($fadeIn > 0 || $fadeOut > 0) {
         $fiGunid = StoredFile::CreateGunid();
         $fadeIn = Playlist::secondsToPlaylistTime($fadeIn);
         $fadeOut = Playlist::secondsToPlaylistTime($fadeOut);
         $fInfo = "{$ind2}<fadeInfo id=\"{$fiGunid}\" fadeIn=\"{$fadeIn}\" fadeOut=\"{$fadeOut}\"/>\n";
     } else {
         $fInfo = '';
     }
     $plElGunid = StoredFile::CreateGunid();
     $acGunid = $gunid;
     $type = 'audioClip';
     if (preg_match("|\\.([a-zA-Z0-9]+)\$|", $uri, $va)) {
         switch (strtolower($ext = $va[1])) {
             case "lspl":
             case "xml":
             case "smil":
             case "m3u":
                 $type = 'playlist';
                 $acId = $gb->bsImportPlaylistRaw($gunid, $aPath, $uri, $ext, $gunids, $subjid);
                 if (PEAR::isError($acId)) {
                     return $r;
                 }
                 //break;
             //break;
             default:
                 $ac = StoredFile::RecallByGunid($gunid);
                 if (is_null($ac) || PEAR::isError($ac)) {
                     return $ac;
                 }
                 $r = $ac->md->getMetadataElement('dcterms:extent');
                 if (PEAR::isError($r)) {
                     return $r;
                 }
                 $playlength = $r[0]['value'];
         }
     }
     $title = basename($tree->attrs['src']->val);
     $offset = Playlist::secondsToPlaylistTime($tree->attrs['begin']->val);
     $clipStart = Playlist::secondsToPlaylistTime($tree->attrs['clipStart']->val);
     $clipEnd = Playlist::secondsToPlaylistTime($tree->attrs['clipEnd']->val);
     $clipLength = Playlist::secondsToPlaylistTime($tree->attrs['clipLength']->val);
     $res = "{$ind}<playlistElement id=\"{$plElGunid}\" relativeOffset=\"{$offset}\" clipStart=\"{$clipStart}\" clipEnd=\"{$clipEnd}\" clipLength=\"{$clipLength}\">\n" . "{$ind2}<{$type} id=\"{$acGunid}\" playlength=\"{$playlength}\" title=\"{$title}\"/>\n" . $fInfo . "{$ind}</playlistElement>\n";
     return $res;
 }
 public function findPlaylistsAction()
 {
     $post = $this->getRequest()->getPost();
     $show = new ShowInstance($this->sched_sess->showInstanceId);
     $playlists = $show->searchPlaylistsForShow($post);
     foreach ($playlists['aaData'] as &$data) {
         // calling two functions to format time to 1 decimal place
         $sec = Playlist::playlistTimeToSeconds($data[4]);
         $data[4] = Playlist::secondsToPlaylistTime($sec);
     }
     //for datatables
     die(json_encode($playlists));
 }
 public function contentsAction()
 {
     $post = $this->getRequest()->getPost();
     $datatables = StoredFile::searchFilesForPlaylistBuilder($post);
     //format clip lengh to 1 decimal
     foreach ($datatables["aaData"] as &$data) {
         $sec = Playlist::playlistTimeToSeconds($data[5]);
         $data[5] = Playlist::secondsToPlaylistTime($sec);
     }
     die(json_encode($datatables));
 }