git.cweiske.de
/
noxon-gateway.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix podcast redirection
[noxon-gateway.git]
/
src
/
mediatomb.php
diff --git
a/src/mediatomb.php
b/src/mediatomb.php
index d80e20ee8681f85fc41bc931d9e81fe05cc92fcb..ffc123a38f621624e365733fee172be5b8813132 100644
(file)
--- a/
src/mediatomb.php
+++ b/
src/mediatomb.php
@@
-25,6
+25,11
@@
function mediatombBrowse(Services_MediaTomb $smt, $fullPath, $prefix)
$path = substr($fullPath, strlen($prefix));
$container = $smt->getContainerByPath($path);
$path = substr($fullPath, strlen($prefix));
$container = $smt->getContainerByPath($path);
+ if ($container === null) {
+ sendMessage('Error accessing ' . $fullPath);
+ return;
+ }
+
$listItems = array();
$it = $container->getItemIterator(false);
$listItems = array();
$it = $container->getItemIterator(false);
@@
-65,10
+70,16
@@
function mediatombAddFile(&$listItems, $item)
$di = $item->getDetailedItem();
$itemUrl = $item->url;
$di = $item->getDetailedItem();
$itemUrl = $item->url;
- if ($di->mimetype !== 'audio/mpeg') {
+ if (!clientSupportsType($di->mimetype)) {
+ //client wants transcoded file
//noxon iRadio cube does not want to play .ogg files
//noxon iRadio cube does not want to play .ogg files
- $itemUrl = $host1 . 'transcode-nocache.php'
- . '?url=' . urlencode($itemUrl);
+ if (isset($GLOBALS['enableCache']) && $GLOBALS['enableCache']) {
+ $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,
@@
-78,6
+89,20
@@
function mediatombAddFile(&$listItems, $item)
);
}
);
}
+function clientSupportsType($mimetype)
+{
+ if ($mimetype === 'audio/mpeg') {
+ return true;
+ }
+ $ip = $_SERVER['REMOTE_ADDR'];
+ if (isset($GLOBALS['clientSupport'][$ip][$mimetype])
+ && $GLOBALS['clientSupport'][$ip][$mimetype] === true
+ ) {
+ return true;
+ }
+ return false;
+}
+
/**
* Single file mode - shows directories that only have a single file in them.
* Each audio file gets its own virtual directory, containing only the
/**
* Single file mode - shows directories that only have a single file in them.
* Each audio file gets its own virtual directory, containing only the