#!/usr/bin/python3 # https://wiki.servarr.com/en/sonarr/custom-scripts import os import configparser import requests from misskey import Misskey # Reading config config = configparser.ConfigParser() config.read(os.path.dirname(__file__) + '/config.ini') # Setting login variables server_token = config['server']['token'] server_url = config['server']['url'] mk = Misskey(server_url, i=server_token) if os.getenv('radarr_eventtype'): if os.getenv('radarr_eventtype') == 'Download': body = "New content added to Jellyfin: \n" body += "Movie: " + os.getenv('radarr_movie_title') + '\n' mk.notes_create( text=body, visibility="followers" ) if os.getenv('sonarr_eventtype'): if os.getenv('sonarr_eventtype') == 'Download': body = "New content added to Jellyfin: \n" series_title = os.getenv('sonarr_series_title') season_number = os.getenv('sonarr_episodefile_seasonnumber') episode_number = os.getenv('sonarr_episodefile_episodenumbers') episode_title = os.getenv('sonarr_episodefile_episodetitles') release_quality = os.getenv('sonarr_episodefile_quality') body += "%s - S%sE%s - %s [%s]\n" % (series_title, season_number, episode_number, episode_title, release_quality) mk.notes_create( text=body, visibility="followers" ) if os.getenv('sonarr_eventtype') == 'Test': mk.notes_create( text="Test from Jellybot.", visibility="followers" )