Skip to content

Commit

Permalink
[add] sonarr_list - More options
Browse files Browse the repository at this point in the history
* Add couple more options.

~ Added option to set quality profile ID (defaults to 1/any) -- You can find quality profile/profile ID at http://localhost:8989/api/profile?apikey={APIKEY}
~ Added option to set season folder -- True/False Default is False
~ Added option to set monitored status of whole series -- True/False Default is True

*** NOTE
One thing I don't understand is the why there is a profileId and a qualityProfileId as it seems only the profileId actually does anything, but I'm leaving it in as it seems it's part of the API call anyways versus profileId not being any part of the Sonarr API..

* Make option for rootFolderPath

~ The way I had to set this up was that it uses the ID instead of a string path and it would take the number from "rootFolderPath" config and subtract it by 1, so 1 = 0, 2 = 1, so on and so forth. You can find the rootFolderID here http://localhost:8989/api/rootfolder?apikey={APIKEY}

*** Note
Again I don't really know if this messes with anything for trakt/sonarr to only flexget. Doesn't mess anything up for trakt to sonarr though.

* Change from camel case to snake case

* Add seriesType option

~ Adds Option for seriesType, string value of standard, daily, or anime. (default value is standard)

## Currently working on getting an option to set tags, but it's being very tricky..

* Requested changes

~ Changed root_folder_path to be an int instead of a number, did the same to profile_id as it's supposed to be an int anyways as well..
~ Added an enum to series_type as it's a closed list

* Add option to set tags

Allows you to set tags | Has to be by ID and has to be set up like example [1,2,3,4,5] (replacing any numbers with your tag IDs) Tag ID's can be found at http://localhost:8989/api/tag?apikey=API | Requires you to have pre-setup any tags you plan on using. | Default value is [0] (not passing any tags)

* comment on how rootFolderPath is setup.

* Add something to comment.

* One more addition to comments.

* Make comments less than 120 chars & multi line.

I hope this is better >..<

* change a word in one of my comments.

* Fix codacy complaints
  • Loading branch information
JourneyOver authored and liiight committed Dec 19, 2017
1 parent ab779af commit be5f3ab
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions flexget/plugins/list/sonarr_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ class SonarrSet(MutableSet):
'include_data': {'type': 'boolean', 'default': False},
'search_missing_episodes': {'type': 'boolean', 'default': True},
'ignore_episodes_without_files': {'type': 'boolean', 'default': False},
'ignore_episodes_with_files': {'type': 'boolean', 'default': False}
'ignore_episodes_with_files': {'type': 'boolean', 'default': False},
'profile_id': {'type': 'integer', 'default': 1},
'season_folder': {'type': 'boolean', 'default': False},
'monitored': {'type': 'boolean', 'default': True},
# Users are passing actual RootFolderPath ID instead of starting from 0 and counting up.
# Passing root_folder_path as a String seems to make the script fail, so had to use int instead.
# Read comment on show['rootFolderPath'] for more information.
'root_folder_path': {'type': 'integer', 'default': 1},
'series_type': {'type': 'string', 'enum': ['standard', 'daily', 'anime'], 'default': 'standard'},
'tags': {'type': 'array', 'items': {'type': 'integer'}, 'default': [0]}
},
'required': ['api_key', 'base_url'],
'additionalProperties': False
Expand Down Expand Up @@ -193,9 +202,16 @@ def add_show(self, entry):
rootfolder = self.get_json(rootfolder_series_url, headers=rootfolder_series_headers)

# Setting defaults for Sonarr
show['profileId'] = 1
show['qualityProfileId '] = 1
show['rootFolderPath'] = rootfolder[0]['path']
show['profileId'] = self.config.get('profile_id')
show['qualityProfileId'] = self.config.get('profile_id')
show['seasonFolder'] = self.config.get('season_folder')
show['monitored'] = self.config.get('monitored')
show['seriesType'] = self.config.get('series_type')
show['tags'] = self.config.get('tags')
# Requires both rootFolder and path otherwise it fails.
# takes root_folder_path ID from config and subtracts 1 from it due to how script is setup
# since users are passing actual ID it won't be confusing to users
show['rootFolderPath'] = rootfolder[self.config.get('root_folder_path') - 1]['path']
show['addOptions'] = {"ignoreEpisodesWithFiles": self.config.get('ignore_episodes_with_files'),
"ignoreEpisodesWithoutFiles": self.config.get('ignore_episodes_without_files'),
"searchForMissingEpisodes": self.config.get('search_missing_episodes')}
Expand Down

0 comments on commit be5f3ab

Please sign in to comment.