make transcoding cache configurable
authorChristian Weiske <cweiske@cweiske.de>
Thu, 9 Nov 2017 22:47:51 +0000 (23:47 +0100)
committerChristian Weiske <cweiske@cweiske.de>
Thu, 9 Nov 2017 22:47:51 +0000 (23:47 +0100)
data/config.php.dist
src/mediatomb.php

index 92b3db6d4dfac33f759c33d1bd7a30809b4eeea3..1720268a06edc9338e2f3efca93ccb31d44afea3 100644 (file)
@@ -18,4 +18,9 @@ $clientSupport = [
         'audio/ogg' => true,
     ],
 ];
         'audio/ogg' => true,
     ],
 ];
+
+//if this is set, transcode caching is activated
+$cacheDir = null;
+//http-accessible cache dir URL
+$cacheDirUrl = null;
 ?>
 ?>
index 532bbef892ed36d7fc2adc71863907e93c713a14..96be27c0114ba8c5bd75cf79c909b5e120fa7f68 100644 (file)
@@ -68,8 +68,13 @@ function mediatombAddFile(&$listItems, $item)
     if (!clientSupportsType($di->mimetype)) {
         //client wants transcoded file
         //noxon iRadio cube does not want to play .ogg files
     if (!clientSupportsType($di->mimetype)) {
         //client wants transcoded file
         //noxon iRadio cube does not want to play .ogg files
-        $itemUrl = $host1 . 'transcode-nocache.php'
-            . '?url=' . urlencode($itemUrl);
+        if (isset($GLOBALS['cacheDir']) && $GLOBALS['cacheDir'] != '') {
+            $itemUrl = $host1 . 'transcode-cache.php'
+                . '?url=' . urlencode($itemUrl);
+        } else {
+            $itemUrl = $host1 . 'transcode-nocache.php'
+                . '?url=' . urlencode($itemUrl);
+        }
     }
     $listItems[] = getEpisodeItem(
         $item->title,
     }
     $listItems[] = getEpisodeItem(
         $item->title,