From 35f7eecda65c8a321e9f437ecae233e63aaf060b Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Thu, 9 Nov 2017 23:47:51 +0100 Subject: [PATCH] make transcoding cache configurable --- data/config.php.dist | 5 +++++ src/mediatomb.php | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/data/config.php.dist b/data/config.php.dist index 92b3db6..1720268 100644 --- a/data/config.php.dist +++ b/data/config.php.dist @@ -18,4 +18,9 @@ $clientSupport = [ 'audio/ogg' => true, ], ]; + +//if this is set, transcode caching is activated +$cacheDir = null; +//http-accessible cache dir URL +$cacheDirUrl = null; ?> diff --git a/src/mediatomb.php b/src/mediatomb.php index 532bbef..96be27c 100644 --- a/src/mediatomb.php +++ b/src/mediatomb.php @@ -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 - $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, -- 2.30.2