diff --git a/arr-mastodon.py b/arr-mastodon.py index 7f75c15..79cf766 100755 --- a/arr-mastodon.py +++ b/arr-mastodon.py @@ -3,6 +3,7 @@ # https://wiki.servarr.com/en/sonarr/custom-scripts import os +from os import environ import configparser import requests @@ -33,15 +34,17 @@ if os.getenv('radarr_eventtype'): if os.getenv('sonarr_eventtype'): if os.getenv('sonarr_eventtype') == 'Download': body = "New content added to Jellyfin: \n" - body += 'Series: ' + os.getenv('sonarr_series_title') + '\n' - body += 'Season: ' + os.getenv('sonarr_episodefile_seasonnumber') + '\n' - if os.getenv('sonarr_release_absoluteepisodenumbers'): - body += 'Season: ' + os.getenv('sonarr_release_absoluteepisodenumbers') + '\n' - elif os.getenv('sonarr_release_episodenumbers'): - body += 'Episode: ' + os.getenv('sonarr_release_episodenumbers') + '\n' + + series_title = environ.get('Sonarr_Series_Title') + season_number = environ.get('Sonarr_EpisodeFile_SeasonNumber') + episode_number = environ.get('Sonarr_EpisodeFile_EpisodeNumbers') + episode_title = environ.get('Sonarr_EpisodeFile_EpisodeTitles') + release_quality = environ.get('Sonarr_EpisodeFile_Quality') + body += "%s - S%sE%s - %s [%s]\n" % (series_title, season_number, episode_number, episode_title, release_quality) + + toot(server_url, body, server_token) if os.getenv('sonarr_eventtype') == 'Test': toot(server_url, "Test message", server_token) -