mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-02 20:30:10 +00:00
Add Plex format coercion (.mp4 → .m4b)
Implement Plex-compatible file-extension coercion to avoid Plex silently ignoring .mp4 (and single-file .m4a) audiobooks (issue #166). Adds a DB migration and configuration key (plex_format_coercion_enabled, default true), exposes a toggle in the setup wizard and Admin Paths settings, and persists/reads the setting in the admin/setup APIs. Introduces src/lib/utils/format-coercion.ts (coerceToPlexCompatible) and related constants in src/lib/constants/audio-formats.ts (PLEX_COMPATIBLE_EXTENSIONS, COERCION_RENAME_MAP, DRM_EXTENSIONS, TRANSCODE_REQUIRED_EXTENSIONS). The organize-files processor now runs coercion after organizing/tagging and before generating the filesHash and triggering scans; coercion is idempotent, never overwrites existing targets, logs warnings on DRM/transcode/permission errors, and is non-fatal. Adds unit tests for the coercion util and updates processor & setup UI tests. Updates documentation (TABLEOFCONTENTS, file-organization, fixes/file-hash-matching, settings-pages) describing behavior, config, and constraints.
This commit is contained in:
@@ -23,6 +23,7 @@ const PathsHarness = ({
|
||||
downloadDir: '/downloads',
|
||||
mediaDir: '/media/audiobooks',
|
||||
metadataTaggingEnabled: true,
|
||||
plexFormatCoercionEnabled: true,
|
||||
chapterMergingEnabled: false,
|
||||
...initialState,
|
||||
});
|
||||
@@ -84,7 +85,11 @@ describe('PathsStep', () => {
|
||||
<PathsHarness
|
||||
onNext={vi.fn()}
|
||||
onBack={vi.fn()}
|
||||
initialState={{ metadataTaggingEnabled: false, chapterMergingEnabled: false }}
|
||||
initialState={{
|
||||
metadataTaggingEnabled: false,
|
||||
plexFormatCoercionEnabled: false,
|
||||
chapterMergingEnabled: false,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -97,4 +102,18 @@ describe('PathsStep', () => {
|
||||
expect(metadataToggle).toBeChecked();
|
||||
expect(chapterToggle).toBeChecked();
|
||||
});
|
||||
|
||||
it('renders plex format coercion toggle with default checked and toggles state', async () => {
|
||||
render(<PathsHarness onNext={vi.fn()} onBack={vi.fn()} />);
|
||||
|
||||
const coercionToggle = screen.getByLabelText('Coerce file formats for Plex compatibility');
|
||||
|
||||
expect(coercionToggle).toBeChecked();
|
||||
|
||||
fireEvent.click(coercionToggle);
|
||||
expect(coercionToggle).not.toBeChecked();
|
||||
|
||||
fireEvent.click(coercionToggle);
|
||||
expect(coercionToggle).toBeChecked();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user