From 7919c4a521a4306c21495f9842fc28c488295db1 Mon Sep 17 00:00:00 2001 From: salty Date: Sat, 19 Feb 2022 16:16:52 +0100 Subject: [PATCH] add sonarr season folder option. Credit goes to https://github.com/l3uddz/traktarr/pull/148 close #131 --- README.md | 4 ++++ media/sonarr.py | 4 ++-- misc/config.py | 1 + sample/config.json | 1 + traktarr.py | 2 ++ 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 35f579f..bdbbd96 100644 --- a/README.md +++ b/README.md @@ -334,6 +334,7 @@ You can repeat this process for as many users as you like. "language": "English", "quality": "HD-1080p", "root_folder": "/tv/", + "season_folder": true, "tags": [], "url": "http://localhost:8989/" }, @@ -981,6 +982,7 @@ Sonarr configuration. "language": "English", "quality": "HD-1080p", "root_folder": "/tv/", + "season_folder": true, "tags": [], "url": "http://localhost:8989" }, @@ -994,6 +996,8 @@ Sonarr configuration. `root_folder` - Root folder for TV shows. +`season_folder` - Sort episodes into season folders. + `tags` - Assign tags to shows. Tags need to be created in Sonarr first. - Examples: diff --git a/media/sonarr.py b/media/sonarr.py index ad21481..c5ff4cc 100644 --- a/media/sonarr.py +++ b/media/sonarr.py @@ -43,14 +43,14 @@ class Sonarr(PVR): @backoff.on_predicate(backoff.expo, lambda x: x is None, max_tries=4, on_backoff=backoff_handler) def add_series(self, series_tvdb_id, series_title, series_title_slug, quality_profile_id, language_profile_id, - root_folder, tag_ids=None, search_missing=False, series_type='standard'): + root_folder, season_folder=True, tag_ids=None, search_missing=False, series_type='standard'): payload = self._prepare_add_object_payload(series_title, series_title_slug, quality_profile_id, root_folder) payload = dict_merge(payload, { 'tvdbId': series_tvdb_id, 'tags': [] if not tag_ids or not isinstance(tag_ids, list) else tag_ids, 'seasons': [], - 'seasonFolder': True, + 'seasonFolder': season_folder, 'seriesType': series_type, 'addOptions': { 'searchForMissingEpisodes': search_missing diff --git a/misc/config.py b/misc/config.py index dc54796..da029ed 100644 --- a/misc/config.py +++ b/misc/config.py @@ -95,6 +95,7 @@ class Config(object, metaclass=Singleton): 'language': 'English', 'quality': 'HD-1080p', 'root_folder': '/tv/', + 'season_folder': True, 'tags': [], 'url': 'http://localhost:8989/' }, diff --git a/sample/config.json b/sample/config.json index 4b5c265..332a3cc 100644 --- a/sample/config.json +++ b/sample/config.json @@ -106,6 +106,7 @@ "quality": "HD-1080p", "url": "http://localhost:8989/", "root_folder": "/tv/", + "season_folder": true, "tags": {} }, "omdb": { diff --git a/traktarr.py b/traktarr.py index 1f69cce..c9c417a 100755 --- a/traktarr.py +++ b/traktarr.py @@ -257,6 +257,7 @@ def show( quality_profile_id, language_profile_id, cfg.sonarr.root_folder, + cfg.sonarr.season_folder, tag_ids, not no_search, series_type, @@ -656,6 +657,7 @@ def shows( quality_profile_id, language_profile_id, cfg.sonarr.root_folder, + cfg.sonarr.season_folder, tag_ids, not no_search, series_type,