Skip to content

fix: correct Prowlarr capabilities #879

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions src/program/services/scrapers/prowlarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,32 @@ def _get_indexer_from_json(self, json_content: str) -> list[ProwlarrIndexer]:
"""Parse the indexers from the XML content"""
indexer_list = []
for indexer in json.loads(json_content):
indexer_list.append(ProwlarrIndexer(title=indexer["name"], id=str(indexer["id"]), link=indexer["infoLink"], type=indexer["protocol"], language=indexer["language"], movie_search_capabilities=(s[0] for s in indexer["capabilities"]["movieSearchParams"]) if len([s for s in indexer["capabilities"]["categories"] if s["name"] == "Movies"]) > 0 else None, tv_search_capabilities=(s[0] for s in indexer["capabilities"]["tvSearchParams"]) if len([s for s in indexer["capabilities"]["categories"] if s["name"] == "TV"]) > 0 else None))
has_movies = any(
category["name"] == "Movies"
for category in indexer["capabilities"]["categories"]
)
has_tv = any(
category["name"] == "TV"
for category in indexer["capabilities"]["categories"]
)

indexer_list.append(
ProwlarrIndexer(
title=indexer["name"],
id=str(indexer["id"]),
link=indexer["infoLink"],
type=indexer["protocol"],
language=indexer["language"],
movie_search_capabilities=(
list(indexer["capabilities"]["movieSearchParams"])
if has_movies else None
),
tv_search_capabilities=(
list(indexer["capabilities"]["tvSearchParams"])
if has_tv else None
)
)
)

return indexer_list

Expand Down Expand Up @@ -262,4 +287,4 @@ def _log_indexers(self) -> None:
if not indexer.movie_search_capabilities:
logger.debug(f"Movie search not available for {indexer.title}")
if not indexer.tv_search_capabilities:
logger.debug(f"TV search not available for {indexer.title}")
logger.debug(f"TV search not available for {indexer.title}")