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));
 }
Esempio n. 2
0
 public static function OutputToM3u(&$pl, $ple, $ind = '')
 {
     $acOrPl = NULL;
     foreach ($ple['children'] as $ac) {
         switch ($ac['elementname']) {
             case "audioClip":
                 $r = PlaylistAudioClipExport::OutputToM3u($pl, $ac);
                 if (PEAR::isError($r)) {
                     return $r;
                 }
                 if (!is_null($r)) {
                     $acOrPl = $r;
                 }
                 break;
             case "playlist":
                 $gunid = $ac['attrs']['id'];
                 $pl2 = StoredFile::RecallByGunid($gunid);
                 if (is_null($pl2) || PEAR::isError($pl2)) {
                     return $pl2;
                 }
                 $r = $pl2->outputToM3u(FALSE);
                 if (PEAR::isError($r)) {
                     return $r;
                 }
                 if (!is_null($r)) {
                     $acOrPl = $r;
                 }
                 break;
         }
     }
     if (is_null($acOrPl)) {
         return '';
     }
     $playlength = ceil(Playlist::playlistTimeToSeconds($acOrPl['playlength']));
     $title = $acOrPl['title'];
     $uri = isset($acOrPl['uri']) ? $acOrPl['uri'] : '???';
     $res = "#EXTINF: {$playlength}, {$title}\n";
     $res .= "{$uri}\n";
     return $res;
 }
 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));
 }