function selectAudio(&$prg)
{
    global $config;
    $files = $prg->listAudioFiles('TRUE', 'kbps DESC');
    foreach ($files as $f) {
        if ($f['download_access'] == 't') {
            //$f['url'] = $config['rootUrl'] . '/getFile.php/' . $f['filename'] . '?audio=1&id=' . $prg->id . '&filename=' . $f['filename'];
            //$f['url'] = $config['rootUrl'] . '/getFile.php?audio=1&id=' . $prg->id . '&filename=' . $f['filename'];
            $baseUrl = sotf_Node::getHomeNodeRootUrl($prg);
            $f['url'] = $baseUrl . '/getFile.php/fid__' . $f['id'];
            return $f;
        }
    }
    /*
    if(!$retval) {
    	 foreach($files as $f) {
    		if($f['stream_access']=='t') {
    		  $f['url'] = $config['rootUrl'] . '/listen.php?id=' . $prg->id . '&fileid=' . $f['id'];
    		  return $f;
    		}
    	 }
    }
    */
    return NULL;
}
 /** static */
 function redirectToHomeNode($obj, $script)
 {
     global $page;
     $url = sotf_Node::getHomeNodeRootUrl($obj);
     $oldParams = substr(strstr(myGetenv("REQUEST_URI"), '.php'), 4);
     $url = $url . "/{$script}" . $oldParams;
     $page->redirect($url);
     exit;
 }
function selectAudioVideo(&$prg)
{
    global $config;
    $files = $prg->listAudioFiles('TRUE', 'kbps DESC');
    if (is_array($files)) {
        foreach ($files as $f) {
            if ($f['download_access'] == 't') {
                /* sun 8.2.06 added to format properly the enclosure url --rama */
                $station = sotf_Utils::makeValidName($prg->get('station'), 23);
                $series = sotf_Utils::makeValidName($prg->get('series'), 23);
                $title = sotf_Utils::makeValidName($prg->get('title'), 30);
                if ($station != "" && $series != "" && $title != "") {
                    $fname = "{$station}-{$series}-{$title}";
                } elseif ($station != "" && $title != "") {
                    $fname = "{$station}-{$title}";
                } elseif ($title != "") {
                    $fname = $title;
                }
                /* end properly format enclosure url */
                //$f['url'] = $config['rootUrl'] . '/getFile.php/' . $f['filename'] . '?audio=1&id=' . $prg->id . '&filename=' . $f['filename'];
                //$f['url'] = $config['rootUrl'] . '/getFile.php?audio=1&id=' . $prg->id . '&filename=' . $f['filename'];
                $baseUrl = sotf_Node::getHomeNodeRootUrl($prg);
                //$f['url'] = $baseUrl . '/getFile.php/fid__' . $f['id'].".mp3"; // wreutz: very dirty hack for ipooder to work on os x
                //MODIFIED BY Martin Schmidt
                $f = array_merge($f, sotf_AudioFile::decodeFormatFilename($f['format']));
                if ($prg->isVideoPrg() && $f['format'] == "mp4") {
                    //echo "drinnen";
                    $f['url'] = $baseUrl . '/getFile.php/' . 'fid__' . $f['id'] . '__' . $fname . ".mp4";
                    return $f;
                } else {
                    if ($prg->isAudioPrg()) {
                        $f['url'] = $baseUrl . '/getFile.php/' . 'fid__' . $f['id'] . '__' . $fname . ".mp3";
                        //rjankowski changed order to get parsed by getFile.php
                        return $f;
                    }
                }
                //////////////////////////
                // rama: included $fname as formatted name $station-$series-$title
            }
        }
    }
    /*
    if(!$retval and is_array($files)) {
    	 foreach($files as $f) {
    		if($f['stream_access']=='t') {
    		  $f['url'] = $config['rootUrl'] . '/listen.php?id=' . $prg->id . '&fileid=' . $f['id'];
    		  return $f;
    		}
    	 }
    }
    */
    return NULL;
}
Exemple #4
0
         }
     }
     $mainContentFiles[$i] = array_merge($mainContentFiles[$i], sotf_AudioFile::decodeFormatFilename($mainContentFiles[$i]['format']));
     //ADDED BY Martin Schmidt
     //print_r($mainContentFiles[$i]);
     if ($prg->isVideoPrg() && $mainContentFiles[$i]['format'] == "flv" && $mainContentFiles[$i]['download_access'] == 't') {
         $flv_path = sotf_Node::getHomeNodeRootUrl($prg) . '/getFile.php/' . 'fid__' . $mainContentFiles[$i]['id'] . '__' . $fname . ".flv";
         $flv_found = true;
         //$_SESSION['flv_path'] = $flv_path;
     }
     $smarty->assign('FLV_PATH', $flv_path);
     /////////////////////
     //ADDED BY Klaus Temper
     //print_r($mainContentFiles[$i]);
     if ($mainContentFiles[$i]['format'] == "mp3" && $mainContentFiles[$i]['download_access'] == 't') {
         $mp3_path = sotf_Node::getHomeNodeRootUrl($prg) . '/getFile.php/' . $mainContentFiles[$i]['filename'] . '?audio=1&id=' . $mainContentFiles[$i]['prog_id'] . '&filename=' . $mainContentFiles[$i]['filename'];
         $mp3_found = true;
     }
     $smarty->assign('mp3_PATH', $mp3_path);
     /////////////////////
     $d = getdate($mainContentFiles[$i]['play_length']);
     $d['hours']--;
     $mainContentFiles[$i]['playtime_string'] = ($d['hours'] ? $d['hours'] . ':' : '') . sprintf('%02d', $d['minutes']) . ':' . sprintf('%02d', $d['seconds']);
 }
 $smarty->assign('FLV_FOUND', $flv_found);
 $smarty->assign('AUDIO_FILES', $mainContentFiles);
 if ($prg->isVideoPrg()) {
     $smarty->assign('VIDEO_PRG', 'true');
 }
 // other files
 $otherFiles = $prg->getAssociatedObjects('sotf_other_files', 'filename');
    exit;
}
// delete prog
$delprog = sotf_Utils::getParameter('delprog');
$prgid = sotf_Utils::getParameter('prgid');
if ($delprog) {
    $prg =& $repository->getObject($prgid);
    $prg->delete();
    $page->redirect(mygetenv('PHP_SELF') . "#progs");
    exit;
}
// generate output
$smarty->assign('STATION_ID', $stationid);
$smarty->assign('STATION', $st->get('name'));
$smarty->assign('STATION_DATA', $st->getAllWithIcon());
$smarty->assign('HOME_URL', sotf_Node::getHomeNodeRootUrl($st));
if ($st->isLocal()) {
    $smarty->assign('IS_LOCAL', 1);
}
$smarty->assign('ROLES', $st->getRoles());
if ($st->getJingle()) {
    $smarty->assign('JINGLE', 1);
}
if ($entered) {
    $smarty->assign('ENTERED', $entered);
}
if (!$start) {
    $start = 0;
}
$seriesList = $st->listSeries();
if (!empty($seriesList)) {
Exemple #6
0
 //ADDED BY Martin Schmidt
 for ($i = 0; $i < $to; $i++) {
     if ($prg->isLocal()) {
         // if local, we check if file disappeared in the meantime
         $path = $prg->getFilePath($mainContentFiles[$i]);
         if (!is_readable($path)) {
             debug("DISAPPEARED FILE", $path);
             unset($mainContentFiles[$i]);
             continue;
         }
     }
     $mainContentFiles[$i] = array_merge($mainContentFiles[$i], sotf_AudioFile::decodeFormatFilename($mainContentFiles[$i]['format']));
     //ADDED BY Martin Schmidt
     //print_r($mainContentFiles[$i]);
     if ($prg->isVideoPrg() && $mainContentFiles[$i]['format'] == "flv" && $mainContentFiles[$i]['download_access'] == 't') {
         $flv_path = sotf_Node::getHomeNodeRootUrl($prg) . '/getFile.php/' . 'fid__' . $mainContentFiles[$i]['id'] . '__' . $fname . ".flv";
         $flv_found = true;
         //$_SESSION['flv_path'] = $flv_path;
     }
     $smarty->assign('FLV_PATH', $flv_path);
     /////////////////////
     $d = getdate($mainContentFiles[$i]['play_length']);
     $d['hours']--;
     $mainContentFiles[$i]['playtime_string'] = ($d['hours'] ? $d['hours'] . ':' : '') . sprintf('%02d', $d['minutes']) . ':' . sprintf('%02d', $d['seconds']);
 }
 $smarty->assign('FLV_FOUND', $flv_found);
 $smarty->assign('AUDIO_FILES', $mainContentFiles);
 if ($prg->isVideoPrg()) {
     $smarty->assign('VIDEO_PRG', 'true');
 }
 // other files