fix: validate season number when matching episode torrents#1368
fix: validate season number when matching episode torrents#1368thescottthompson wants to merge 1 commit intorivenmedia:mainfrom
Conversation
Previously, when filtering torrents for an Episode item, the code only checked if the episode number matched (e.g., E12). This caused torrents from different seasons (e.g., S12E12) to be incorrectly attached to episodes from other seasons (e.g., S15E12). The fix adds season validation when torrent.data.episodes is present: - Check that the episode number matches (existing behavior) - Also verify that the season number matches if available This prevents mismatches like: - Bob's Burgers S15E12 getting streams for S12E12, S13E12, S14E12 - Grey's Anatomy S22E05 getting streams for S12E05 Without this fix, episodes get stuck in "Scraped" state because all attached streams fail with "No valid files found" - the torrent contains the right episode number but from the wrong season. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
WalkthroughRefines Episode matching logic in torrent processing to require both episode and season verification, preventing cross-season mismatches. Extends season alignment validation when season data exists without episode information. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I'll take a look at this sometime this week. This is definitely a bug as it should only find the same episode, or same season content.. other episodes, and even other seasons shouldn't show up when searching by season/episode. |
|
Can you list some torrent examples as well. It's possible they got mis-parsed as well. |
Summary
Problem
When scraping for episodes like
Bob's Burgers S15E12, the parser would attach torrents from other seasons (e.g.,S12E12,S13E12,S14E12) because it only checked the episode number.This caused episodes to get stuck in "Scraped" state with downloads failing with "No valid files found" - the torrent contained the right episode number but from the wrong season.
Evidence from DEBUG logs
Before the fix, searching for
Bob's Burgers S15E12returned:None of the 5 streams were actually for S15!
Other examples observed:
Bob's Burgers S11E20got streams for S12E20, S13E20, S15E20Grey's Anatomy S22E05got stream for S12E05Grey's Anatomy S17E09got stream for S14E09Solution
When
torrent.data.episodesis present, the code now:torrent.data.seasonsis availableTest plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes