Skip to content

Generalize date-numbered episode search#403

Merged
rix1337 merged 1 commit into
devfrom
codex/generalize-date-numbering
Jun 27, 2026
Merged

Generalize date-numbered episode search#403
rix1337 merged 1 commit into
devfrom
codex/generalize-date-numbering

Conversation

@rix1337

@rix1337 rix1337 commented Jun 27, 2026

Copy link
Copy Markdown
Owner

What changed

  • Parse Sonarr year + MM/DD numbering once into a validated shared episode_date.
  • Centralize date query variants, title matching, exact-date validation, and Arr title canonicalization in shared utilities.
  • Enable existing date searches for BY, DD, DJ, DL, DT, DW, FX, HE, HS, MB, NK, NX, RM, SF, SJ, SL, WD, and WX.
  • Keep AL/AT disabled because their anime-specific numbering paths require numeric episodes; keep MX disabled because its API requires numeric season and episode; FF remains movie-only.
  • Remove WWE/RAW/SmackDown-specific production logic while preserving both motivating WWE series through generic schedule-word and mixed-case handling.

Why

PR #400 established date-numbered searching in DL, but left source-specific date fields and WWE-specific aliases. This follow-up makes date numbering a shared search capability without changing any source endpoint, HTTP method, parameter name, payload shape, or response parser.

Impact

  • Normal movie, season/episode, document, music, and feed paths remain unchanged when episode_date is absent.
  • No config or hostname changes.
  • Compatible TV sources reuse their existing IMDb/title lookup and candidate-result paths.

Verification

  • uv run python -X utf8 pre-commit.py: passed; 149 tests.
  • uv run ruff check .: passed.
  • uv run ruff format --check .: passed.
  • Latest main (c965cc5): 134 tests and Ruff passed in a detached worktree.
  • Identical nine-case non-date matching corpus on latest main and this branch: movie acceptance/rejection, exact/wrong TV episode, season pack, movie-as-TV rejection, document result, and episode-range acceptance/rejection.
  • Synthetic DL thread tests find and canonicalize both WWE RAW and WWE SmackDown date-numbered cases.
  • Production scan contains no WWE or SmackDown literals outside the untouched obfuscated asset.
  • Source transport diff audit found no endpoint/request/payload changes.

@rix1337 rix1337 changed the title [codex] Generalize date-numbered episode search Generalize date-numbered episode search Jun 27, 2026
@rix1337 rix1337 marked this pull request as ready for review June 27, 2026 10:19
@rix1337 rix1337 merged commit 06acc66 into dev Jun 27, 2026
12 checks passed
@rix1337 rix1337 deleted the codex/generalize-date-numbering branch June 27, 2026 10:20

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0024036c13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if not date_match:
return title

canonical_prefix = re.sub(r"[^\w]+", ".", str(search_string)).strip(".")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Strip query dates before canonicalizing release titles

When DL searches a date-numbered episode it iterates generated queries from date_numbering_search_strings(), including variants like Sample Show 2031.02.02/03/04, and passes that query into this helper. Because the prefix is built from the whole query, a match titled Sample.Show.2031.02.03.1080p-GRP can be returned as Sample.Show.2031.02.02.2031.02.03.1080p-GRP (or duplicate the same date), so the result name sent to Sonarr is malformed and may be rejected or misparsed.

Useful? React with 👍 / 👎.

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.

1 participant