l3uddz / traktarr

Script to add new series & movies to Sonarr/Radarr based on Trakt lists.
GNU General Public License v3.0
584 stars 53 forks source link

SeriesType not set correctly for anime #63

Closed mediabot closed 5 years ago

mediabot commented 5 years ago

When adding Anime using CLI traktarr does not change the SeriesType to Anime. You still have to go into Sonarr and manually change the series type from standard to anime

abdel-m commented 5 years ago

Hello, I simply added the code at line 314 of Traktarr.py file :

seriesType = "standard"
if any("anim" in s for s in series['show']['genres']):
          seriesType = "anime"

log.info("Series type = " + seriesType)

Replace line 320 by

if sonarr.add_series(series['show']['ids']['tvdb'], series['show']['title'],
             series['show']['ids']['slug'], profile_id, cfg.sonarr.root_folder, use_tags,
             not no_search, seriesType):

And I modified the fonction add_series from media/Sonarr.py file like this :

def add_series(self, series_tvdbid, series_title, series_title_slug, profile_id, root_folder, tag_ids=None,
                   search_missing=False, series_type='standard'):
payload = self._prepare_add_object_payload(series_title, series_title_slug, profile_id, root_folder)

payload = dict_merge(payload, {
            'tvdbId': series_tvdbid,
            'tags': [] if not tag_ids or not isinstance(tag_ids, list) else tag_ids,
            'seasons': [],
            'seasonFolder': True,
            'seriesType': series_type,
            'addOptions': {
                'searchForMissingEpisodes': search_missing
            }
})

return self._add_object('api/series', payload, identifier_field='tvdbId', identifier=series_tvdbid)

Actually, i can't make a pull request, if someone can do it for me :D