fix: Fixed cross-platform enrichment bug (hardcoded YouTube URLs for So…
All checks were successful
CI / test (push) Successful in 19s
All checks were successful
CI / test (push) Successful in 19s
- "src/services/scheduler.ts" - "src/services/missing-file-scanner.ts" GSD-Task: S08/T02
This commit is contained in:
parent
5d9cf148aa
commit
76e7611d8d
2 changed files with 14 additions and 6 deletions
|
|
@ -116,10 +116,16 @@ export class MissingFileScanner {
|
||||||
.from(systemConfig)
|
.from(systemConfig)
|
||||||
.where(eq(systemConfig.key, SCAN_LAST_RESULT_KEY));
|
.where(eq(systemConfig.key, SCAN_LAST_RESULT_KEY));
|
||||||
|
|
||||||
return {
|
let result: ScanResult = { checked: 0, missing: 0, duration: 0 };
|
||||||
lastRun: rows[0].value,
|
if (resultRows.length > 0) {
|
||||||
result: resultRows.length > 0 ? JSON.parse(resultRows[0].value) : { checked: 0, missing: 0, duration: 0 },
|
try {
|
||||||
};
|
result = JSON.parse(resultRows[0].value) as ScanResult;
|
||||||
|
} catch {
|
||||||
|
// Corrupt stored result — return default
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return { lastRun: rows[0].value, result };
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Private ──
|
// ── Private ──
|
||||||
|
|
|
||||||
|
|
@ -480,9 +480,11 @@ export class SchedulerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const videoUrl = `https://www.youtube.com/watch?v=${item.platformContentId}`;
|
// Use the item's original URL (platform-agnostic) instead of
|
||||||
|
// hardcoding YouTube — SoundCloud / generic items have their own URLs.
|
||||||
|
const contentUrl = item.url || `https://www.youtube.com/watch?v=${item.platformContentId}`;
|
||||||
const enrichResult = await execYtDlp(
|
const enrichResult = await execYtDlp(
|
||||||
['--dump-json', '--no-playlist', videoUrl],
|
['--dump-json', '--no-playlist', contentUrl],
|
||||||
{ timeout: 15_000 }
|
{ timeout: 15_000 }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue