feat(pinchflat): Media Profiles — named download presets per Library source

A MediaProfile bundles { kind, quality, options, outputTemplate, extraArgs }
that a Source points at via Source.profileId, overriding the global defaults
field-by-field for that source's downloads.

Backend mirrors CommandTemplate: profiles.ts (createJsonStore, PROFILES_MAX,
isProfileLike + sanitize), CRUD IPC (profiles:list/save/remove) + preload +
useProfiles store; Source.profileId + sources:set-profile. Pure resolution
in @shared/profileResolve.ts (profile → global, per field; unit-tested).
Applied in the sources-store enqueueItems; a per-download collectionOutput-
Template override threads to buildArgs so a profile's outputTemplate wins.

UI: ProfileManager (mirrors TemplateManager) in a new Settings → Advanced →
Media profiles card, plus a per-source Profile picker in the Library source
detail. Both live-verified in the preview; 354 tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-02 16:02:07 -04:00
parent a02953f6d1
commit ed1daf8bef
21 changed files with 685 additions and 14 deletions
+3 -1
View File
@@ -209,7 +209,9 @@ export function buildCommand(opts: StartDownloadOptions, cookiesFile?: string):
outDir,
opts.collection,
'%(title)s.%(ext)s',
settings.collectionOutputTemplate
// A per-download override (a Media Profile's outputTemplate) wins over the
// global collection-layout setting.
opts.collectionOutputTemplate ?? settings.collectionOutputTemplate
)
: join(outDir, filenameTemplate)
// Per-download override wins; otherwise use the persisted defaults.