Skip to content

Share Sonarr and Radarr codec mappings - #3675

Draft
mjc wants to merge 31 commits into
morpheus65535:developmentfrom
mjc:share-arr-codec-mappings
Draft

mjc wants to merge 31 commits into
morpheus65535:developmentfrom
mjc:share-arr-codec-mappings

Conversation

@mjc

@mjc mjc commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

This, like the others, depends on the previous PRs so it looks huge. it's like +471-121, where 195 of those added lines are exhaustive property tests.

--

Move Sonarr and Radarr codec normalization into one module. Both parsers use shared alias and encoder tables, with separate handlers for Radarr’s metadata-dependent mappings. Remove the old converter modules.

Match codec names and supporting metadata without regard to case. Keep unknown codec strings unchanged, and preserve the existing results when Radarr metadata is missing or cannot identify a codec.

Tests cover aliases, nullable inputs, audio metadata combinations, MPEG layer precedence, video encoder prefixes and suffixes, and unknown Unicode names. Generated compatibility properties preserve the existing mappings; separate properties cover case-insensitive matching, including every casing combination of Sonarr’s known aliases, prefixes and suffixes.

Nearly all of these tests were based on the original code - the only thing that should have changed is that it now is case insensitive.

@mjc
mjc force-pushed the share-arr-codec-mappings branch from 48ed69f to c66f82f Compare October 21, 2026 14:47
@mjc
mjc marked this pull request as draft October 21, 2026 16:50
@mjc
mjc force-pushed the share-arr-codec-mappings branch from c66f82f to d058254 Compare October 21, 2026 22:59
mjc added 13 commits October 21, 2026 22:59
Validate JSON directly into slotted dataclasses. Preserve strict fields, scalar conversions, incomplete records and Requests JSON error handling, and replace the msgspec dependency with the vendored Pydantic version.
Search for nonstandard number literals before checking their separators. Avoid a full-buffer regex scan and keep titles containing Infinity or NaN on the typed decoder path.
Probe the selected Requests JSON parser once. Keep the compatibility check for rejecting backends and avoid scanning response buffers when both parsers accept nonstandard numbers.
Keep numeric-string and float conversions as fallbacks. Share byte-count conversion with incomplete movie recovery and cover large integers and floating-point truncation.
Validate movie recovery facts directly, use native defaults for invalid fields and payloads, and avoid reparsing JSON after record validation fails. Keep overview strings on the native validation path.
mjc added 4 commits October 22, 2026 11:13
Keep at most 128 argument combinations per codec function and remove the extra handler calls and encoder loop. Preserve case-insensitive matching, unknown values, and metadata precedence. Cover Unicode matching and cache eviction.
Use one bounded cache lookup per episode file. Keep the individual normalization rules and cover mixed, missing, and unknown codec pairs.
@mjc
mjc force-pushed the share-arr-codec-mappings branch from dbb4ea8 to 4d05b72 Compare October 22, 2026 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants