Add podcast proxy support for Martin
[noxon-gateway.git] / src / podcasts.php
index 68d133ce057f4dd34e581b39b852689bc7d7978d..707d3506f229d87468cacbb42d9a5cc471495481 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 function sendPodcast($path)
 {
-    global $varDir, $host1;
+    global $varDir, $host1, $enablePodcastProxy;
 
     $file = urldecode($path);
     if (strpos($file, '..') !== false) {
@@ -21,7 +21,11 @@ function sendPodcast($path)
     
     $sx = simplexml_load_file($cacheFile);
     $listItems = array();
-    addPreviousItem($listItems, $path);
+
+    $urlHandler = $host1 . 'deredirect.php';
+    if ($enablePodcastProxy) {
+        $urlHandler = $host1 . 'proxy.php';
+    }
 
     foreach ($sx->channel->item as $item) {
         $title = (string) $item->title;
@@ -30,12 +34,12 @@ function sendPodcast($path)
 
         $listItems[] = getEpisodeItem(
             $title,
-            $host1 . 'play-url?url=' . urlencode($url),
+            $urlHandler . '?url=' . urlencode($url),
             $desc,
             'MP3'
         );
     }
-    sendListItems($listItems);
+    sendListItems($listItems, buildPreviousItem($path));
 }
 
 
@@ -66,4 +70,4 @@ function downloadIfNewer($url, $file)
     }
 }
 
-?>
\ No newline at end of file
+?>