Add next scheduled download information
This commit is contained in:
parent
0ba2d85006
commit
8bb3d1f9a7
|
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ export interface SchedulerStatus {
|
|||
varianceMinutes: number;
|
||||
isDownloading: boolean;
|
||||
currentProgress: DownloadProgress | null;
|
||||
nextScheduledDownload: string | null;
|
||||
}
|
||||
|
||||
export interface DownloadProgress {
|
||||
|
|
|
|||
Loading…
Reference in New Issue