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,
|
||||
|
||||
@@ -1518,6 +1518,15 @@ function vvPollMonitor() {
|
||||
// Active sessions from shared streams data
|
||||
const activeSessions = vvLastSessions.filter(s => s.is_tc);
|
||||
const typeLabel = t => ({ LiveTvProgram:'Live TV', Movie:'Movie', Episode:'TV', Audio:'Music' }[t] ?? t);
|
||||
const activeFiles = tc.active_files ?? 0;
|
||||
|
||||
let activeSegHtml = '';
|
||||
if (activeFiles > 0) {
|
||||
activeSegHtml = `<div style="margin-top:8px;border-top:1px solid #2a2a2a;padding-top:6px;display:flex;align-items:center;justify-content:space-between;">
|
||||
<span style="font-size:10px;color:#555;">Active segments</span>
|
||||
<span style="font-size:10px;"><span style="color:#4caf50;font-weight:600;">${activeFiles}</span><span style="color:#444;font-size:9px;margin-left:4px;">Live TV / Direct Stream</span></span>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
let sessHtml = '';
|
||||
if (activeSessions.length) {
|
||||
@@ -1576,7 +1585,7 @@ function vvPollMonitor() {
|
||||
<div style="background:#1a1a1a;border-radius:3px;height:6px;overflow:hidden;">
|
||||
<div style="width:${ssdPct}%;height:100%;background:hsl(${ssdHue},70%,45%);border-radius:3px;transition:width 0.4s;"></div>
|
||||
</div>
|
||||
</div>${sessHtml}`;
|
||||
</div>${activeSegHtml}${sessHtml}`;
|
||||
}
|
||||
|
||||
// ── Containers and VMs ──────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user