feat: auto-use cached HQ video file without upgrade prompt
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -262,6 +262,22 @@ export async function beginDownload() {
|
|||||||
|
|
||||||
session.processingStep = 'downloading';
|
session.processingStep = 'downloading';
|
||||||
|
|
||||||
|
// --- Check export (HQ) cache first ---
|
||||||
|
const exportCached = await checkCachedDownload(session.title, 'export').catch(() => null);
|
||||||
|
if (exportCached) {
|
||||||
|
// HQ file already on disk — use it directly, skip preview entirely
|
||||||
|
session.exportFilePath = exportCached;
|
||||||
|
session.exportProgress = 1.0;
|
||||||
|
session.exportStatus = 'complete';
|
||||||
|
session.previewFilePath = exportCached;
|
||||||
|
session.previewProgress = 1.0;
|
||||||
|
session.previewStatus = 'complete';
|
||||||
|
session.activeVideoPath = exportCached;
|
||||||
|
// No upgrade toast — we're already at best quality
|
||||||
|
triggerPostDownloadProcessing(exportCached);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// --- Preview download (low-res, fast) ---
|
// --- Preview download (low-res, fast) ---
|
||||||
const previewCached = await checkCachedDownload(session.title, 'preview').catch(() => null);
|
const previewCached = await checkCachedDownload(session.title, 'preview').catch(() => null);
|
||||||
if (previewCached) {
|
if (previewCached) {
|
||||||
@@ -305,20 +321,11 @@ export async function beginDownload() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// --- Export download (best quality, background) ---
|
// --- Export download (best quality, background) ---
|
||||||
const exportCached = await checkCachedDownload(session.title, 'export').catch(() => null);
|
// Only start if not already cached (we handled cached case above with early return)
|
||||||
if (exportCached) {
|
|
||||||
session.exportFilePath = exportCached;
|
|
||||||
session.exportProgress = 1.0;
|
|
||||||
session.exportStatus = 'complete';
|
|
||||||
if ((session.processingStep as ProcessingStep) === 'done') {
|
|
||||||
session.showUpgradeToast = true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
session.exportStatus = 'downloading';
|
session.exportStatus = 'downloading';
|
||||||
session.exportProgress = 0;
|
session.exportProgress = 0;
|
||||||
session.exportFilePath = null;
|
session.exportFilePath = null;
|
||||||
|
|
||||||
// Fire-and-forget — runs in background
|
|
||||||
runDownload(
|
runDownload(
|
||||||
session.url,
|
session.url,
|
||||||
EXPORT_FORMAT,
|
EXPORT_FORMAT,
|
||||||
@@ -346,4 +353,3 @@ export async function beginDownload() {
|
|||||||
console.error('Export download failed:', e);
|
console.error('Export download failed:', e);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user