chore: Add outputTemplate column to format_profiles schema and app.outp…

- "src/db/schema/content.ts"
- "src/types/index.ts"
- "src/db/repositories/system-config-repository.ts"
- "src/db/repositories/format-profile-repository.ts"
- "drizzle/0014_adorable_miek.sql"

GSD-Task: S02/T01
This commit is contained in:
jlightner 2026-04-04 05:20:18 +00:00
parent 61105a74b0
commit e6371ba196
9 changed files with 1046 additions and 6 deletions

View file

@ -0,0 +1 @@
ALTER TABLE `format_profiles` ADD `output_template` text;

File diff suppressed because it is too large Load diff

View file

@ -99,6 +99,13 @@
"when": 1775279021003,
"tag": "0013_flat_lady_deathstrike",
"breakpoints": true
},
{
"idx": 14,
"version": "6",
"when": 1775279888856,
"tag": "0014_adorable_miek",
"breakpoints": true
}
]
}

View file

@ -334,7 +334,7 @@ describe('DownloadService', () => {
containerFormat: 'mkv',
isDefault: false,
subtitleLanguages: null,
embedSubtitles: false, embedChapters: false, embedThumbnail: false, sponsorBlockRemove: null,
embedSubtitles: false, embedChapters: false, embedThumbnail: false, sponsorBlockRemove: null, outputTemplate: null,
createdAt: '',
updatedAt: '',
};
@ -388,7 +388,7 @@ describe('DownloadService', () => {
containerFormat: null,
isDefault: false,
subtitleLanguages: null,
embedSubtitles: false, embedChapters: false, embedThumbnail: false, sponsorBlockRemove: null,
embedSubtitles: false, embedChapters: false, embedThumbnail: false, sponsorBlockRemove: null, outputTemplate: null,
createdAt: '',
updatedAt: '',
};
@ -642,7 +642,7 @@ describe('DownloadService', () => {
containerFormat: null,
isDefault: false,
subtitleLanguages: null,
embedSubtitles: false, embedChapters: false, embedThumbnail: false, sponsorBlockRemove: null,
embedSubtitles: false, embedChapters: false, embedThumbnail: false, sponsorBlockRemove: null, outputTemplate: null,
createdAt: '',
updatedAt: '',
};
@ -686,7 +686,7 @@ describe('DownloadService', () => {
containerFormat: 'mkv',
isDefault: false,
subtitleLanguages: null,
embedSubtitles: false, embedChapters: false, embedThumbnail: false, sponsorBlockRemove: null,
embedSubtitles: false, embedChapters: false, embedThumbnail: false, sponsorBlockRemove: null, outputTemplate: null,
createdAt: '',
updatedAt: '',
};
@ -738,7 +738,7 @@ describe('DownloadService', () => {
containerFormat: null,
isDefault: false,
subtitleLanguages: null,
embedSubtitles: false, embedChapters: false, embedThumbnail: false, sponsorBlockRemove: null,
embedSubtitles: false, embedChapters: false, embedThumbnail: false, sponsorBlockRemove: null, outputTemplate: null,
createdAt: '',
updatedAt: '',
};

View file

@ -148,7 +148,7 @@ function makeProfile(overrides: Partial<FormatProfile> = {}): FormatProfile {
containerFormat: 'mp4',
isDefault: false,
subtitleLanguages: null,
embedSubtitles: false, embedChapters: false, embedThumbnail: false, sponsorBlockRemove: null,
embedSubtitles: false, embedChapters: false, embedThumbnail: false, sponsorBlockRemove: null, outputTemplate: null,
createdAt: '',
updatedAt: '',
...overrides,

View file

@ -192,6 +192,7 @@ function mapRow(row: typeof formatProfiles.$inferSelect): FormatProfile {
embedChapters: row.embedChapters,
embedThumbnail: row.embedThumbnail,
sponsorBlockRemove: row.sponsorBlockRemove ?? null,
outputTemplate: row.outputTemplate ?? null,
createdAt: row.createdAt,
updatedAt: row.updatedAt,
};

View file

@ -10,6 +10,7 @@ type Db = LibSQLDatabase<typeof schema>;
export const APP_CHECK_INTERVAL = 'app.check_interval';
export const APP_CONCURRENT_DOWNLOADS = 'app.concurrent_downloads';
export const APP_OUTPUT_TEMPLATE = 'app.output_template';
export const YTDLP_LAST_UPDATED = 'ytdlp.last_updated';
// ── Read / Write ──
@ -86,6 +87,7 @@ export async function seedAppDefaults(db: Db): Promise<void> {
const defaults: Array<{ key: string; value: string }> = [
{ key: APP_CHECK_INTERVAL, value: appConfig.scheduler.defaultCheckInterval.toString() },
{ key: APP_CONCURRENT_DOWNLOADS, value: appConfig.concurrentDownloads.toString() },
{ key: APP_OUTPUT_TEMPLATE, value: '{platform}/{channel}/{title}.{ext}' },
];
for (const { key, value } of defaults) {

View file

@ -43,6 +43,7 @@ export const formatProfiles = sqliteTable('format_profiles', {
embedChapters: integer('embed_chapters', { mode: 'boolean' }).notNull().default(false),
embedThumbnail: integer('embed_thumbnail', { mode: 'boolean' }).notNull().default(false),
sponsorBlockRemove: text('sponsor_block_remove'), // comma-separated categories: 'sponsor,selfpromo,interaction,intro,outro,preview,music_offtopic,filler'
outputTemplate: text('output_template'), // per-profile path template override e.g. '{platform}/{channel}/{title}.{ext}'
createdAt: text('created_at')
.notNull()
.default(sql`(datetime('now'))`),

View file

@ -144,6 +144,7 @@ export interface FormatProfile {
embedChapters: boolean;
embedThumbnail: boolean;
sponsorBlockRemove: string | null; // comma-separated: 'sponsor,selfpromo,interaction,intro,outro,preview,music_offtopic,filler'
outputTemplate: string | null; // per-profile path template override e.g. '{platform}/{channel}/{title}.{ext}'
createdAt: string;
updatedAt: string;
}