From 062094cd818f9b1d489444c45e9b750755b97ecb Mon Sep 17 00:00:00 2001 From: Vincent Date: Sun, 15 Nov 2020 10:43:44 +0100 Subject: [PATCH] . --- .idea/workspace.xml | 23 ++++++++++++----------- config/media.php | 15 ++++++++++++++- scripts/lib/medialibrary.php | 6 +++--- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index f8c59a6..4bcb8eb 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,6 +3,7 @@ + @@ -1289,12 +1290,12 @@ - + - + diff --git a/config/media.php b/config/media.php index 0690f13..8013755 100644 --- a/config/media.php +++ b/config/media.php @@ -52,6 +52,8 @@ $shortcuts['media'][] = ['label' => 'Recharger', 'type' => 'url', 'href' => '/sc function getMediaFolderShortcuts($mediagroup, $parentId) { + + $res['sub-' . $parentId] = array(); if (!isset($mediagroup['items'])) { return $res; @@ -63,7 +65,18 @@ function getMediaFolderShortcuts($mediagroup, $parentId) $res['sub-' . $parentId][] = array('label' => $item['name'], 'type' => 'sub', 'sub' => $pid); $res = array_merge($res, getMediaFolderShortcuts($item, $pid)); } else { - $res['sub-' . $parentId][] = array('label' => $item['name'], 'type' => 'media', 'path' => $item['path']); + $unsupportedExt = []; + $unsupportedCodec = ['av1', 'hevc']; + if (config('VIDEOPLAYER') === 'shield') { + $unsupportedCodec = ['xvid']; + $unsupportedExt = ['avi']; + } + $e = explode('.', $item['path']); + $path = $item['path']; + if (in_array($e, $unsupportedExt) || in_array(getVideoCodec($item['path']), $unsupportedCodec)) { + $path = $item['x264path']; + } + $res['sub-' . $parentId][] = array('label' => $item['name'], 'type' => 'media', 'path' => $path); } } diff --git a/scripts/lib/medialibrary.php b/scripts/lib/medialibrary.php index c7070e0..5314852 100644 --- a/scripts/lib/medialibrary.php +++ b/scripts/lib/medialibrary.php @@ -18,7 +18,7 @@ function getMediaContents($dir, $context, $seen = null) continue; } $normPath = normPath($path); - $results[] = array('path' => $normPath, 'x264path' => getX264Version($path, false), 'srt' => hasSRT($normPath), 'seen' => seen($normPath), 'dir' => false, 'name' => mediaName(implode(' ', $e), $context, false, $path)); + $results[] = array('path' => $normPath, 'ext' => $ext, 'codec' => getVideoCodec($path), 'x264path' => getX264Version($path, false), 'srt' => hasSRT($normPath), 'seen' => seen($normPath), 'dir' => false, 'name' => mediaName(implode(' ', $e), $context, false, $path)); } } else if ($value != "." && $value != ".." && $value != '@eaDir') { $files = getMediaContents($path, $context, $seen); @@ -29,7 +29,7 @@ function getMediaContents($dir, $context, $seen = null) $results[] = $files[0]; } else { $normPath = normPath($path); - $results[] = array('path' => $normPath, 'x264path' => getX264Version($path, false), 'seen' => seen($normPath), 'dir' => true, 'id' => hash('sha256', $path), 'name' => mediaName($value, $context, true, $path), 'items' => $files); + $results[] = array('path' => $normPath, 'ext' => $ext, 'codec' => getVideoCodec($path), 'x264path' => getX264Version($path, false), 'seen' => seen($normPath), 'dir' => true, 'id' => hash('sha256', $path), 'name' => mediaName($value, $context, true, $path), 'items' => $files); } } } @@ -142,7 +142,7 @@ function mediaName($name, $context, $dir, $path) function transcodeOneVideo() { if (getState('night') == '1') { - return; + //return; } $list = getVideosList(true); -- 2.39.5