fix(movies): dedup playback sources by target (cross-mirror dupes)
Movie detail showed ~100 playback links (report 41ca1fa4) because the 3 dooplay mirrors (mangoporn/pandamovies/streamporn) each record the SAME hoster embed as a separate row (e.g. luluvid/e/X from all three). Dedup by real target (embed_url/stream_url/page_url) after the priority sort, keeping the highest-priority copy — one verified movie drops 101 -> 58 unique. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
78d26c4bc6
commit
b643b2cb77
1 changed files with 14 additions and 0 deletions
|
|
@ -251,6 +251,20 @@ def _movie_to_out(session: Session, movie: Movie, *, device_id: str = LEGACY_DEV
|
||||||
if has_subhost:
|
if has_subhost:
|
||||||
pb_rows = [p for p in pb_rows if p.origin not in _MOVIE_LANDING_HIDE]
|
pb_rows = [p for p in pb_rows if p.origin not in _MOVIE_LANDING_HIDE]
|
||||||
pb_rows = sorted(pb_rows, key=lambda p: _movie_origin_priority(p.origin))
|
pb_rows = sorted(pb_rows, key=lambda p: _movie_origin_priority(p.origin))
|
||||||
|
# Dedup po realnym celu: 3 mirrory dooplay (mangoporn/pandamovies/streamporn)
|
||||||
|
# zapisują TEN SAM embed hostera jako osobne wiersze (np. luluvid/e/X z każdego
|
||||||
|
# mirrora) → film miał ~100 linków, z czego ~połowa to ten sam film (bug-report
|
||||||
|
# 41ca1fa4). Zostawiamy pierwszy = najwyższy priorytet (sort wyżej).
|
||||||
|
seen_targets: set[str] = set()
|
||||||
|
deduped: list[MoviePlaybackSource] = []
|
||||||
|
for p in pb_rows:
|
||||||
|
target = (p.embed_url or p.stream_url or p.page_url or "").strip()
|
||||||
|
if target and target in seen_targets:
|
||||||
|
continue
|
||||||
|
if target:
|
||||||
|
seen_targets.add(target)
|
||||||
|
deduped.append(p)
|
||||||
|
pb_rows = deduped
|
||||||
playback_sources = [PlaybackSourceOut.model_validate(p) for p in pb_rows]
|
playback_sources = [PlaybackSourceOut.model_validate(p) for p in pb_rows]
|
||||||
|
|
||||||
is_fav = session.get(FavoriteMovie, (device_id, movie.id)) is not None
|
is_fav = session.get(FavoriteMovie, (device_id, movie.id)) is not None
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue