Show active HLS segment count in transcode card
Live TV and Direct Stream sessions never appear in the transcoding session list but do write segments to the ramdisk. Card now shows the active segment count so the ramdisk usage is explained.
This commit is contained in:
@@ -748,9 +748,23 @@ function vv_transcode_sessions(): array {
|
||||
$flipCount = (int)($raw['flip_count_hour'] ?? 0);
|
||||
$isRamdisk = str_contains($target, 'ramdisk');
|
||||
|
||||
// Count active session dirs in both known locations
|
||||
// Count active sessions: subdirs (legacy transcode) + unique hex prefixes (Live TV / Direct Stream HLS)
|
||||
$ramdiskPath = '/mnt/ramdisk_transcodes/transcoding-temp';
|
||||
$ramSessions = count(glob("$ramdiskPath/*/", GLOB_ONLYDIR) ?: []);
|
||||
$maxAge = (int)(vv_conf_vars()['TRANSCODE_MAX_AGE'] ?? 20);
|
||||
$activeFiles = 0;
|
||||
$cutoff = time() - $maxAge * 60;
|
||||
$flatPrefixes = [];
|
||||
if (is_dir($ramdiskPath)) {
|
||||
foreach (new DirectoryIterator($ramdiskPath) as $f) {
|
||||
if (!$f->isFile()) continue;
|
||||
if (preg_match('/^([0-9a-f]{16,})/', $f->getFilename(), $m)) {
|
||||
$flatPrefixes[$m[1]] = true;
|
||||
}
|
||||
if ($f->getMTime() >= $cutoff) $activeFiles++;
|
||||
}
|
||||
}
|
||||
$ramSessions += count($flatPrefixes);
|
||||
|
||||
// SSD path: first transcoding-temp mount that is not a RAM filesystem (tmpfs/ramfs)
|
||||
$ssdPath = '';
|
||||
@@ -800,6 +814,7 @@ function vv_transcode_sessions(): array {
|
||||
'last_flip_ago' => $lastFlip > 0 ? time() - $lastFlip : null,
|
||||
'ram_sessions' => $ramSessions,
|
||||
'ssd_sessions' => $ssdSessions,
|
||||
'active_files' => $activeFiles,
|
||||
'ramdisk' => $rd,
|
||||
'ssd' => $ssd,
|
||||
'last_rd_freed' => $lastRdFreed,
|
||||
|
||||
Reference in New Issue
Block a user