summaryrefslogtreecommitdiff
path: root/public
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-06-16 17:21:56 +0400
committerilotterytea <iltsu@alright.party>2025-06-16 17:21:56 +0400
commitcbba97e43ce50f41cb2e6697bb6e49ac678d4ccf (patch)
tree091c0ca3f2508b609002de0c5080ca7fb6e93dc1 /public
parent70310678444a43c1ef3f460d9761ad0c2818f001 (diff)
fix: duration can be N/A
Diffstat (limited to 'public')
-rw-r--r--public/index.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/public/index.php b/public/index.php
index 9a0e293..b9c9857 100644
--- a/public/index.php
+++ b/public/index.php
@@ -88,7 +88,11 @@ if (FILE_CATALOG_FANCY_VIEW && $file_id) {
} else if (str_starts_with($file['mime'], 'video/')) {
$info = shell_exec('ffprobe -v error -select_streams v:0 -show_entries stream=width,height,duration -of csv=p=0 ' . escapeshellarg($file_path));
[$width, $height, $duration] = explode(',', trim($info));
- $file['resolution'] = sprintf('%sx%s (%s seconds)', $width, $height, round($duration, 2));
+ if ($duration == 'N/A') {
+ $file['resolution'] = sprintf('%sx%s', $width, $height);
+ } else {
+ $file['resolution'] = sprintf('%sx%s (%s seconds)', $width, $height, round($duration, 2));
+ }
} else if (str_starts_with($file['mime'], 'audio/')) {
$file['resolution'] = round(trim(shell_exec('ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 ' . escapeshellarg($file_path))), 2) . ' seconds';
} else if (str_starts_with($file['mime'], 'text/')) {