Add next scheduled download information

This commit is contained in:
Ryan Whytsell 2025-10-21 12:48:22 -04:00
parent 0ba2d85006
commit 8bb3d1f9a7
Signed by: Epithium
GPG Key ID: 940AC18C08E925EA
3 changed files with 12 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import { DownloadProgress } from "../types";
let schedulerTask: cron.ScheduledTask | null = null;
let isDownloading = false;
let currentProgress: DownloadProgress | null = null;
let nextScheduledDownload: Date | null = null;
function getRandomVariance(varianceMinutes: number): number {
return Math.floor(Math.random() * varianceMinutes * 2) - varianceMinutes;
@ -159,6 +160,7 @@ export function startScheduler() {
const varianceMinutes = parseFloat(config.varianceMinutes || "30");
const nextRun = calculateNextRun(intervalMinutes, varianceMinutes);
nextScheduledDownload = nextRun;
console.log(`Next download scheduled for: ${nextRun.toLocaleString()}`);
const delay = nextRun.getTime() - Date.now();
@ -193,6 +195,7 @@ export function getSchedulerStatus() {
varianceMinutes: parseFloat(config.varianceMinutes || "30"),
isDownloading,
currentProgress,
nextScheduledDownload: nextScheduledDownload?.toISOString() || null,
};
}

View File

@ -338,6 +338,14 @@ function VideosPage() {
</ul>
)}
</div>
{schedulerStatus?.enabled && schedulerStatus.nextScheduledDownload && (
<div className="mt-4 pb-6 text-center">
<p className="text-xs text-gray-400 dark:text-gray-600">
Next scheduled download: {new Date(schedulerStatus.nextScheduledDownload).toLocaleString()}
</p>
</div>
)}
</div>
);
}

View File

@ -50,6 +50,7 @@ export interface SchedulerStatus {
varianceMinutes: number;
isDownloading: boolean;
currentProgress: DownloadProgress | null;
nextScheduledDownload: string | null;
}
export interface DownloadProgress {