Skip to content

Feature Request - Search #95

@timjolson

Description

@timjolson

I do not see a search method for sonarr or radarr. Both single items and bulk search would be great additions.
For reference, my basic implementation is below.

sonarr_data = [] # list of id(s) to search for
radarr_data = [] # list of id(s) to search for

def make_sonarr_query(self, searchlist):
        return {
                'name': 'EpisodeSearch',
                'episodeIds': searchlist
        }
def make_radarr_query(self, searchlist):
        return {
                'name': 'MoviesSearch',
                'movieIds': searchlist
        }

# common headers for both radarr and sonarr
headers = {
        'X-Api-Key': self.api_key,
        'Content-Type': 'application/json'
        }
command_url = f"{self.host}/api/v3/command"

# trigger the api to search
command_response = requests.post(command_url, headers=headers, json=make_sonarr_query(sonarr_data), timeout=1.0)
command_response = requests.post(command_url, headers=headers, json=make_radarr_query(radarr_data), timeout=1.0)

# check response
if command_response.status_code == 201:
        logger.debug(f"Search triggered successfully.")
        return len(searchlist)
else:
        logger.error(f"Failed to trigger search with code {command_response.status_code}.")
        logger.error(command_response.text)
        return 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions