Skip to content

Rank a REPACK or PROPER above the release it replaces - #597

Open
xbmc4lyfe wants to merge 1 commit into
mainfrom
repack-ranks-first
Open

xbmc4lyfe wants to merge 1 commit into
mainfrom
repack-ranks-first

Conversation

@xbmc4lyfe

Copy link
Copy Markdown
Collaborator

Summary

A REPACK or PROPER now always ranks just above the release it replaces, whatever either one's copy count. Before, the first post of a release and its REPACK tied on every relevance criterion up to the copy count, so the first post (listed longer, by more indexers) led the picker even though the picker struck it through. Seen with two CiNEPHiLES releases: the plain one had 10 copies, the REPACK 5, and the struck-through plain one was #1.

Before After
before after

Before: the struck 6-copy first post leads, its 2-copy REPACK is second, and the single-copy PROPER sits at the bottom (the single-copy demotion). After: each replacement sits right above the release it replaces; everything else keeps its place.

flowchart TD
    A[Relevance sort, copies tiebreak, odd-size demotion] --> B{Any REPACK or PROPER<br/>replacing a listed release?}
    B -->|no, most lists| Z[Order unchanged]
    B -->|yes| C[release_supersede.replacements:<br/>replaced row -> replacing row]
    C --> D{Replacement ranks below<br/>the release it replaces?}
    D -->|no| Z
    D -->|yes| E[Move all of the replacement's copies<br/>to just above the replaced release's first row]
    classDef step fill:#1E1E2E,color:#FFFFFF,stroke:#4A9EFF
    classDef keep fill:#34D399,color:#151520
    classDef move fill:#FBBF24,color:#151520
    class A,C step
    class Z keep
    class E move
Loading

Changes

  • filter._lift_replacements runs after the relevance sort (only for sort order 0). It uses the same rule the picker uses to strike a row through (release_supersede): same group, same release in everything but the tag, a REPACK/PROPER the name certainly carries. Another group's REPACK, or an "unsure" tag, moves nothing.
  • release_supersede.replacements returns the replacing row along with its tag; superseded_rows is built on it, so striking and ranking can't disagree.
  • A replacement is moved, never the replaced release: a better release (higher resolution, HDR, and so on) above both stays above, and an unrelated release between them keeps its place relative to the replaced one.
  • Fails closed: if the check can't read the rows, the order is left as sorted (debug log).
  • Docs: Sorting page sentence and screenshot; CHANGELOG entry.

Testing

  • just test passes (5231 passed)
  • just lint passes
  • Tested in Kodi: native Kodi 20.5 in a test VM with a fake Hydra listing Metropolis (1927) with a 6-copy plain release and its 2-copy REPACK, a 3-copy plain release and its 1-copy PROPER; screenshots above are main vs this branch.
  • New tests/test_filter_repack_rank.py (fewer copies, single copy, PROPER, another group's REPACK not lifted, better release stays above, already first, no REPACK untouched); four of them fail without the change.
  • Updated CHANGELOG.md and docs-site/ (just docs builds)

The replaced first post and its REPACK are the same release apart from the
tag, so relevance tied them up to the copy count and the first post, listed
longer by more indexers, led the picker struck through. After the relevance
sort, a replacement that ranks below a release it replaces moves, with all
its copies, to just above that release, whatever its copy count. Nothing
else changes order.
@xbmc4lyfe xbmc4lyfe self-assigned this Nov 29, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T00:05:51.760605Z 50b8b8f Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@xbmc4lyfe

Copy link
Copy Markdown
Collaborator Author

@codex review

@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 50b8b8f874

ℹ️ 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".

@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: Python

Python / code-coverage/pytest

main b70e1a7 repack-ranks-first 50b8b8f +/-
92% 92% 0%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant