Add filtering for movie and series category IDs#64
Conversation
WalkthroughAdds two Plugin fields, Changes
Sequence Diagram(s)(omitted — changes are internal filtering additions without multi-component sequential interactions) Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 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.
🧹 Nitpick comments (1)
plugin.py (1)
1830-1856: Inconsistent indentation in field definitions.The field definitions for content filtering have 4-space indentation for dictionary keys, while all other fields in the
fieldslist use 8-space indentation. This is a stylistic inconsistency that should be corrected for maintainability.♻️ Fix indentation to match surrounding code
- "id": "filter_movie_ids", - "label": "Content Filter: Movie IDs", - "type": "string", - "default": "", - "help": "Comma-separated movie database IDs to include (e.g., '11730,14359'). Leave empty to include all.", -}, -{ - "id": "filter_movie_category_ids", - "label": "Content Filter: Movie Category IDs", - "type": "string", - "default": "", - "help": "Comma-separated provider category IDs (e.g., '12,15'). Movies from these categories will be included.", -}, -{ - "id": "filter_series_ids", - "label": "Content Filter: Series IDs", - "type": "string", - "default": "", - "help": "Comma-separated series database IDs to include (e.g., '1521,1797,2736'). Leave empty to include all.", -}, -{ - "id": "filter_series_category_ids", - "label": "Content Filter: Series Category IDs", - "type": "string", - "default": "", - "help": "Comma-separated provider category IDs (e.g., '3,9'). Series from these categories will be included.", -}, + { + "id": "filter_movie_ids", + "label": "Content Filter: Movie IDs", + "type": "string", + "default": "", + "help": "Comma-separated movie database IDs to include (e.g., '11730,14359'). Leave empty to include all.", + }, + { + "id": "filter_movie_category_ids", + "label": "Content Filter: Movie Category IDs", + "type": "string", + "default": "", + "help": "Comma-separated provider category IDs (e.g., '12,15'). Movies from these categories will be included.", + }, + { + "id": "filter_series_ids", + "label": "Content Filter: Series IDs", + "type": "string", + "default": "", + "help": "Comma-separated series database IDs to include (e.g., '1521,1797,2736'). Leave empty to include all.", + }, + { + "id": "filter_series_category_ids", + "label": "Content Filter: Series Category IDs", + "type": "string", + "default": "", + "help": "Comma-separated provider category IDs (e.g., '3,9'). Series from these categories will be included.", + },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@plugin.py` around lines 1830 - 1856, The four filter field dicts ("filter_movie_ids", "filter_movie_category_ids", "filter_series_ids", "filter_series_category_ids") are indented with 4 spaces while the surrounding entries use 8; update these entries so their opening braces and all keys use the same 8-space indentation as the other items in the fields list to restore consistent style (adjust the lines containing those id strings and their keys accordingly).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@plugin.py`:
- Around line 1830-1856: The four filter field dicts ("filter_movie_ids",
"filter_movie_category_ids", "filter_series_ids", "filter_series_category_ids")
are indented with 4 spaces while the surrounding entries use 8; update these
entries so their opening braces and all keys use the same 8-space indentation as
the other items in the fields list to restore consistent style (adjust the lines
containing those id strings and their keys accordingly).
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@plugin.py`:
- Around line 174-178: The category filter currently uses a raw join
(m3u_relations__category_id__in=...) which bypasses the constrained/eligible
relation predicate used when building base_qs; replace that category arm with
the same constrained relation queryset used earlier (i.e., reuse the
relation-filter expression or annotated relation queryset that was applied to
build base_qs) so the category match is scoped to the same eligible relations,
and make the identical change for the other occurrence around the 226-230 block.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
plugin.py (1)
156-172: Consider extracting ID parsing into a helper function.The same parsing pattern is duplicated for movies (lines 160-172) and series (lines 219-231). A small helper would reduce duplication:
♻️ Optional refactor
def _parse_id_list(csv_string: str) -> list[int]: """Parse comma-separated integer IDs, ignoring invalid values.""" if not csv_string: return [] return [ int(x.strip()) for x in csv_string.split(',') if x.strip().isdigit() ]Then use as:
movie_ids = _parse_id_list(filter_movie_ids_str) category_ids = _parse_id_list(filter_movie_category_ids_str)Also applies to: 216-231
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@plugin.py` around lines 156 - 172, The parsing logic for movie_ids and category_ids (the blocks using filter_movie_ids_str and filter_movie_category_ids_str) is duplicated later for series; extract it into a small helper like _parse_id_list(csv_string: str) -> list[int] that returns [] for falsy input and parses comma-separated integers while ignoring invalid tokens, then replace the inline list comprehensions for movie_ids, category_ids and the series equivalents with calls to _parse_id_list(filter_movie_ids_str), _parse_id_list(filter_movie_category_ids_str) (and the corresponding series variables) to remove duplication and centralize validation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@plugin.py`:
- Around line 156-172: The parsing logic for movie_ids and category_ids (the
blocks using filter_movie_ids_str and filter_movie_category_ids_str) is
duplicated later for series; extract it into a small helper like
_parse_id_list(csv_string: str) -> list[int] that returns [] for falsy input and
parses comma-separated integers while ignoring invalid tokens, then replace the
inline list comprehensions for movie_ids, category_ids and the series
equivalents with calls to _parse_id_list(filter_movie_ids_str),
_parse_id_list(filter_movie_category_ids_str) (and the corresponding series
variables) to remove duplication and centralize validation.
Allow filtering strm output by movie/series category IDs.
Summary by CodeRabbit