Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Looking to **upgrade from V1 to V2**? Look [here](#upgrading-from-v1-to-v2)

Decluttarr is a helper tool that works with the *arr-application suite, and automates the clean-up for their download queues, keeping them free of stalled / redundant downloads.

It supports [Radarr](https://github.com/Radarr/Radarr/), [Sonarr](https://github.com/Sonarr/Sonarr/), [Readarr](https://github.com/Readarr/Readarr/), [Lidarr](https://github.com/Lidarr/Lidarr/), and [Whisparr](https://github.com/Whisparr/Whisparr/).
It supports [Radarr](https://github.com/Radarr/Radarr/), [Sonarr](https://github.com/Sonarr/Sonarr/), [Sportarr](https://github.com/Sportarr/Sportarr/), [Readarr](https://github.com/Readarr/Readarr/), [Lidarr](https://github.com/Lidarr/Lidarr/), and [Whisparr](https://github.com/Whisparr/Whisparr/).

Feature overview:

Expand Down Expand Up @@ -276,6 +276,10 @@ services:
- base_url: "http://sonarr2:8989"
api_key: "$SONARR_API_KEY"

# SPORTARR: >
# - base_url: "http://sportarr:1867"
# api_key: "$SPORTARR_API_KEY"

# RADARR: >
# - base_url: "http://radarr:7878"
# api_key: "$RADARR_API_KEY"
Expand Down
3 changes: 3 additions & 0 deletions config/config_example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ instances:
- base_url: "http://sonarr:8989"
api_key: "xxxx"
# timeout: 30 # Optional: Overrides general timeout for this instance.
# sportarr:
# - base_url: "http://sportarr:1867"
# api_key: "xxxx"
radarr:
- base_url: "http://radarr:7878"
api_key: "xxxx"
Expand Down
1 change: 1 addition & 0 deletions src/deletion_handler/deletion_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ async def get_folders_to_watch_for_arr(self, arr):
folders_to_watch = []
if arr.arr_type not in (
"sonarr",
"sportarr",
"radarr",
): # only working for sonarr / radarr for now
return folders_to_watch
Expand Down
2 changes: 1 addition & 1 deletion src/jobs/search_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async def _log_items(self, items):
title = item.get("title", "Unknown")
logger.verbose(f"- {title}")

elif self.arr.arr_type == "sonarr":
elif self.arr.arr_type in ("sonarr", "sportarr"):
logger.debug(
"search_handler.py/_log_items: Getting series information for better display in output"
)
Expand Down
7 changes: 7 additions & 0 deletions src/settings/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Paths:
class ApiEndpoints:
radarr = "/api/v3"
sonarr = "/api/v3"
sportarr = "/api/v3"
lidarr = "/api/v1"
readarr = "/api/v1"
whisparr = "/api/v3"
Expand All @@ -31,6 +32,7 @@ class ApiEndpoints:
class MinVersions:
radarr = "5.10.3.9171"
sonarr = "4.0.9.2332"
sportarr = "4.0.0.0"
lidarr = "2.11.1.4621"
readarr = "0.4.15.2787"
whisparr = "2.0.0.548"
Expand All @@ -41,6 +43,7 @@ class MinVersions:
class FullQueueParameter:
radarr = "includeUnknownMovieItems"
sonarr = "includeUnknownSeriesItems"
sportarr = "includeUnknownSeriesItems"
lidarr = "includeUnknownArtistItems"
readarr = "includeUnknownAuthorItems"
whisparr = "includeUnknownSeriesItems"
Expand All @@ -49,6 +52,7 @@ class FullQueueParameter:
class DetailItemKey:
radarr = "movie"
sonarr = "episode"
sportarr = "episode"
lidarr = "album"
readarr = "book"
whisparr = "episode"
Expand All @@ -57,6 +61,7 @@ class DetailItemKey:
class DetailItemSearchCommand:
radarr = "MoviesSearch"
sonarr = "EpisodeSearch"
sportarr = "EpisodeSearch"
lidarr = "AlbumSearch"
readarr = "BookSearch"
whisparr = None
Expand All @@ -65,8 +70,10 @@ class DetailItemSearchCommand:
class RefreshItemKey:
radarr = "movie"
sonarr = "series"
sportarr = "series"


class RefreshItemCommand:
radarr = "RefreshMovie"
sonarr = "RefreshSeries"
sportarr = "RefreshSeries"
11 changes: 9 additions & 2 deletions src/settings/_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def config_as_yaml(self, *, hide_internal_attr=True):
}

outputs = []
for arr_type in ["sonarr", "radarr", "readarr", "lidarr", "whisparr"]:
for arr_type in ["sonarr", "sportarr", "radarr", "readarr", "lidarr", "whisparr"]:
arrs = self.get_by_arr_type(arr_type)
if arrs:
output = get_config_as_yaml(
Expand Down Expand Up @@ -176,7 +176,7 @@ def __init__(self, settings, arr_type: str, base_url: str, api_key: str, timeout
self.detail_item_id_key = self.detail_item_key + "Id"
self.detail_item_ids_key = self.detail_item_key + "Ids"
self.detail_item_search_command = getattr(DetailItemSearchCommand, arr_type)
if self.arr_type in ("radarr", "sonarr"):
if self.arr_type in ("radarr", "sonarr", "sportarr"):
self.refresh_item_key = getattr(RefreshItemKey, arr_type)
self.refresh_item_id_key = self.refresh_item_key + "Id"
self.refresh_item_command = getattr(RefreshItemCommand, arr_type)
Expand Down Expand Up @@ -221,6 +221,13 @@ def _check_min_version(self, status):
def _check_arr_type(self, status):
"""Check if the ARR instance is of the correct type."""
actual_arr_type = status["appName"]
if self.arr_type == "sportarr":
# Sportarr's Sonarr-compatible API reports appName "Sonarr" (other
# consumers validate on that), so its identity marker is the extra
# sportarrVersion field a real Sonarr never sends.
if "sportarrVersion" in status:
return
actual_arr_type = "Sonarr"
if actual_arr_type.lower() != self.arr_type:
logger.error("!! %s Error: !!", self.name)
logger.error(
Expand Down
2 changes: 1 addition & 1 deletion src/settings/_user_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"SEARCH_UNMET_CUTOFF",
"SEARCH_MISSING",
],
"instances": ["SONARR", "RADARR", "READARR", "LIDARR", "WHISPARR"],
"instances": ["SONARR", "SPORTARR", "RADARR", "READARR", "LIDARR", "WHISPARR"],
"download_clients": ["QBITTORRENT"],
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ async def retry_degraded_instances(settings, watch_manager=None):
)
if (
watch_manager
and getattr(unit, "arr_type", None) in ("sonarr", "radarr")
and getattr(unit, "arr_type", None) in ("sonarr", "sportarr", "radarr")
and settings.jobs.detect_deletions.enabled
):
await watch_manager.setup_for_arr(unit)
Expand Down
Loading