feat: Wire FormatProfile.outputTemplate into DownloadService with conte…
- "src/services/download.ts" - "src/services/file-organizer.ts" GSD-Task: S02/T03
This commit is contained in:
parent
71175198bd
commit
fb731377bd
2 changed files with 11 additions and 2 deletions
|
|
@ -73,11 +73,17 @@ export class DownloadService {
|
|||
await this.rateLimiter.acquire(platform as Platform);
|
||||
|
||||
// Build yt-dlp args
|
||||
const template = formatProfile?.outputTemplate ?? undefined;
|
||||
const outputTemplate = this.fileOrganizer.buildOutputPath(
|
||||
platform,
|
||||
channelName,
|
||||
contentItem.title,
|
||||
this.guessExtension(contentItem.contentType, formatProfile)
|
||||
this.guessExtension(contentItem.contentType, formatProfile),
|
||||
template,
|
||||
{
|
||||
contentType: contentItem.contentType,
|
||||
id: contentItem.platformContentId,
|
||||
}
|
||||
);
|
||||
const args = this.buildYtDlpArgs(
|
||||
contentItem,
|
||||
|
|
|
|||
|
|
@ -78,7 +78,8 @@ export class FileOrganizer {
|
|||
channelName: string,
|
||||
title: string,
|
||||
ext: string,
|
||||
template?: string
|
||||
template?: string,
|
||||
extra?: { contentType?: string; id?: string }
|
||||
): string {
|
||||
const safeExt = ext.startsWith('.') ? ext.slice(1) : ext;
|
||||
const now = new Date();
|
||||
|
|
@ -91,6 +92,8 @@ export class FileOrganizer {
|
|||
date: now.toISOString().slice(0, 10), // YYYY-MM-DD
|
||||
year: String(now.getFullYear()),
|
||||
month: String(now.getMonth() + 1).padStart(2, '0'),
|
||||
...(extra?.contentType != null ? { contentType: extra.contentType } : {}),
|
||||
...(extra?.id != null ? { id: extra.id } : {}),
|
||||
};
|
||||
|
||||
const resolved = this.resolveTemplate(template ?? DEFAULT_OUTPUT_TEMPLATE, vars);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue