diff --git a/arr-mastodon.py b/arr-mastodon.py index 08b1a38..f3c91f5 100755 --- a/arr-mastodon.py +++ b/arr-mastodon.py @@ -5,29 +5,24 @@ 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'] -def toot(mastodon_url: str, body: str, mastodon_token: str): - headers = {} - headers["Authorization"] = f"Bearer {mastodon_token}" - - data = {} - data["status"] = body - - response = requests.post( - url=f"{mastodon_url}/api/v1/statuses", data=data, headers=headers - ) +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' - toot(server_url, body, server_token) + mk.notes_create( + text=body + ) if os.getenv('sonarr_eventtype'): @@ -41,9 +36,13 @@ if os.getenv('sonarr_eventtype'): 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) - toot(server_url, body, server_token) - + mk.notes_create( + text=body + ) + if os.getenv('sonarr_eventtype') == 'Test': - toot(server_url, "Test message", server_token) + mk.notes_create( + text="Test message from jellybot" + ) diff --git a/requirements.txt b/requirements.txt new file mode 100755 index 0000000..102236d --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +Misskey.py +configparser +requests