Skip to content

Commit

Permalink
feat(filter-missing): adds argument for filtering radarr by "missing"…
Browse files Browse the repository at this point in the history
… status

partially closes #8
  • Loading branch information
zakkarry committed Feb 24, 2024
1 parent 13428e6 commit 18a5d3c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions retraktarr/api/arr.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_id(self, arr, search_term, endpoint, term):

# if it can't find an id for the term error and exit
if id_dict.get(search_term) is None:
print(f"{arr} Error: No matching tag found.")
print(f"{arr} Error: No matching {endpoint if (endpoint != "qualityprofile") else "quality profile"} found.")
sys.exit(1)

# return the id
Expand All @@ -93,6 +93,7 @@ def get_list(self, args, arr):
item.get("qualityProfileId"),
item.get("title"),
item.get("tags"),
item.get("hasFile") if (arr == "Radarr") else None
]
arr_ids = list(arr_data.keys())

Expand All @@ -113,7 +114,10 @@ def get_list(self, args, arr):
arr_ids = list(
filter(lambda item: tag_id in arr_data.get(item, [None])[4], arr_ids)
)

if arr == "Radarr" and args.missing:
arr_ids = list(
filter(lambda item: arr_data.get(item, [None])[5] == False, arr_ids)
)
# if imdb id is in arr, add it to the imdb id list
arr_imdb = [
value[1][0]
Expand Down
6 changes: 5 additions & 1 deletion retraktarr/retraktarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ def main():
action="store_true",
help="Synchronize only monitored content with Trakt.tv",
)
parser.add_argument(
"--missing",
action="store_true",
help="Synchronize only missing Radarr content with Trakt.tv",
)
parser.add_argument(
"--qualityprofile",
"-qp",
Expand Down Expand Up @@ -159,7 +164,6 @@ def main():
args, arr_api.endpoint["Radarr"][0]
)
arr_ids, arr_imdb, arr_data = arr_api.get_list(args, "Radarr")

print("[Radarr]")
trakt_api.add_to_list(
args,
Expand Down

0 comments on commit 18a5d3c

Please sign in to comment.