feat: implement episode matching policy for improved media handling#574
Conversation
Added a new function to determine episode matching criteria based on media type, season, and episode number. Updated the stream function to utilize this policy, enhancing the handling of IMDB episode requests and refining the logic for rejecting unknown episode files.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughIntroduces a centralized Changes
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
comet/api/endpoints/stream.py (1)
743-757:⚠️ Potential issue | 🟡 MinorAccount-snapshot path ignores
allow_debrid_verified_season_packsand may drop valid season packs from the user's debrid library.The policy at L154–179 deliberately sets
reject_unknown_episode_files=Falsewhencached_only && has_debrid && !enable_torrentso that debrid-verified season packs can be surfaced. However, here you passreject_unknown_episode_files=is_imdb_episode_request(alwaysTruefor imdb episode requests), so in exactly that permissive mode, season packs already present in the user's debrid account snapshot are filtered out at torrent-level before any later file verification can occur.The inline comment notes this is deferred "until a later file-level debrid verification happens," but account-snapshot entries come from the debrid account itself — this is precisely where file-level verification would succeed. Consider passing the policy's
reject_unknown_episode_fileshere as well (or make the divergence explicit via a separate flag/policy output) so behavior stays consistent with the main scrape path.Proposed alignment
- # Account snapshots only expose torrent-level names, so keep strict - # episode gating until a later file-level debrid verification happens. - reject_unknown_episode_files=is_imdb_episode_request, + # Mirror the main scrape path so debrid-verified season packs from + # the account snapshot are not filtered out before file-level checks. + reject_unknown_episode_files=reject_unknown_episode_files,🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@comet/api/endpoints/stream.py` around lines 743 - 757, The account-snapshot call to get_account_torrents_for_media is using reject_unknown_episode_files=is_imdb_episode_request which causes debrid-verified season packs to be dropped; change the call to pass the policy-computed reject_unknown_episode_files value (the same variable set at L154–179, or introduce and pass a new explicit flag like allow_debrid_verified_season_packs/reject_unknown_episode_files_from_policy) so the account-snapshot path follows the same permissive behavior as the main scrape path and does not filter valid season packs prematurely; update the argument to get_account_torrents_for_media and any upstream variable names (e.g., reject_unknown_episode_files) accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@comet/api/endpoints/stream.py`:
- Around line 743-757: The account-snapshot call to
get_account_torrents_for_media is using
reject_unknown_episode_files=is_imdb_episode_request which causes
debrid-verified season packs to be dropped; change the call to pass the
policy-computed reject_unknown_episode_files value (the same variable set at
L154–179, or introduce and pass a new explicit flag like
allow_debrid_verified_season_packs/reject_unknown_episode_files_from_policy) so
the account-snapshot path follows the same permissive behavior as the main
scrape path and does not filter valid season packs prematurely; update the
argument to get_account_torrents_for_media and any upstream variable names
(e.g., reject_unknown_episode_files) accordingly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4fc29f32-ad05-49bd-81e5-f74bc0aa05e3
📒 Files selected for processing (1)
comet/api/endpoints/stream.py
Added a new function to determine episode matching criteria based on media type, season, and episode number. Updated the stream function to utilize this policy, enhancing the handling of IMDB episode requests and refining the logic for rejecting unknown episode files.
Summary by CodeRabbit