-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstorage.php
More file actions
53 lines (45 loc) · 1.43 KB
/
storage.php
File metadata and controls
53 lines (45 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
$config = require __DIR__ . '/vod-config.php';
$vodPath = $config['vod']['unc_path'];
if (!is_dir($vodPath)) {
echo "❌ Verzeichnis nicht erreichbar: $vodPath";
exit;
}
function format_tb($bytes) {
return round($bytes / 1024 ** 4, 2);
}
function folder_size($dir) {
$size = 0;
$items = @scandir($dir);
if (!$items) return 0;
foreach ($items as $item) {
if ($item === '.' || $item === '..') continue;
$fullPath = $dir . DIRECTORY_SEPARATOR . $item;
if (is_file($fullPath)) {
$size += @filesize($fullPath);
} elseif (is_dir($fullPath)) {
$size += folder_size($fullPath);
}
}
return $size;
}
// === Tatsächliche Größe des VOD-Ordners ===
$vodSizeBytes = folder_size($vodPath);
// === Anzahl .mp4-Dateien im VOD-Ordner (nur oberste Ebene) ===
$vodCount = 0;
$entries = @scandir($vodPath);
if ($entries) {
foreach ($entries as $file) {
$filePath = $vodPath . DIRECTORY_SEPARATOR . $file;
if (is_file($filePath) && strtolower(pathinfo($filePath, PATHINFO_EXTENSION)) === 'mp4') {
$vodCount++;
}
}
}
// === Laufwerksinfos ===
$total = @disk_total_space($vodPath);
$free = @disk_free_space($vodPath);
echo "🗄️ Gesamtspeicher: " . format_tb($total) . " TB | ";
echo "🎞️ VODs: $vodCount | ";
echo "❌ Belegt: " . format_tb($vodSizeBytes) . " TB | ";
echo "✅ Frei: " . format_tb($free) . " TB | ";