aniping.back_end.sonarr

class aniping.back_end.sonarr.Sonarr(config, plugin_manager)

Sonarr backend plugin.

This plugin implements the sonarr backend for finding and downloading shows.

add_update_show(beid, subgroup)

Adds or edits a show in sonarr, then calls for a scan.

Parameters:
  • beid (int) – The TVDB ID of the show we’re adding or editing.
  • subgroup (str) – The subgroup we’re using for this show.
api_key

str – Returns the configured sonarr api key.

check_auth(username, password)

Checks if a user gives a correct username and password.

User and pass are checked back against sonarr, we do not handle our own authentication. Unfortunately, particularly with the form authentication, this is a bit fragile.

Parameters:
  • username (str) – The username to check.
  • password (str) – The password to check.
Returns:

bool.

  • True – user is authenticated
  • False – user is not authenticated or an error occurred

fanart(beid)

Returns a list of fanart URLs based on search results.

Parameters:beid (int) – The TVDB ID for the show to get fanart from.
Returns:list. All fanart urls in the results.
get_show(beid)

Gets a specific show from sonarr.

Because sonarr doesn’t have internal IDs we can always use, we use the TVDB id to find a show, which should be just as unique. All this function does is call back_end.search with a tvdb: search keyword.

Parameters:beid (int) – The TVDB ID for the show.
Returns:dict. A dictionary describing the show in sonarr’s format.
get_watching_shows()

Get all of the shows we’re downloading in sonarr.

This is basically just a list of shows in sonarr, because it doesn’t store shows that are not being downloaded.

Returns:list. A list of dictionaries decribing shows in sonarr’s format.
name

str – Returns the plugin’s name.

remove_show(beid)

Remove a given show from sonarr.

It will not delete files. The backend ID we’re given is not the ID we need, so the show is looked up first. It will only delete shows if the DELETE_SHOWS config value is set.

Parameters:beid (int) – The TVDB ID of the show.
search(term)

Searches sonarr for a particular show.

This searches whatever indexers sonarr has configured.

Parameters:term (str) – The title of the show we’re searching for.
Returns:list. A list of dictionaries describing the show in sonarr’s format.
subgroup_selected(beid)

Uses results from search to determine which subgroup is selected.

We base it on the tags. Right now, the first tag is assumed to be the subgroup.

Parameters:beid (int) – The tvdb id of the show to get the subgroup for.
Returns:str. The first tag on the show, which we assume to be the subgroup. None if none is found.
url

str – Returns the configured url of the sonarr instance.