From c58e6b9223e72a27a4c1a36fce448d3309dc1e0e Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Fri, 6 Jan 2023 12:33:30 -0500 Subject: [PATCH] test --- env_radarr | 39 +++++++++++++++++++++++++++++++++++++++ env_sonarr | 24 ++++++++++++++++++++++++ tdarr_inform.py | 43 +++++++++++++++++++------------------------ 3 files changed, 82 insertions(+), 24 deletions(-) create mode 100644 env_radarr create mode 100644 env_sonarr diff --git a/env_radarr b/env_radarr new file mode 100644 index 0000000..a1f48e2 --- /dev/null +++ b/env_radarr @@ -0,0 +1,39 @@ +SONARR_DELETEDPATHS +SONARR_DELETEDRELATIVEPATHS +SONARR_DOWNLOAD_ID +SONARR_EPISODEFILE_EPISODEAIRDATES +SONARR_EPISODEFILE_EPISODEAIRDATESUTC +SONARR_EPISODEFILE_EPISODECOUNT +SONARR_EPISODEFILE_EPISODENUMBERS +SONARR_EPISODEFILE_EPISODETITLES +SONARR_EPISODEFILE_ID +SONARR_EPISODEFILE_PATH +SONARR_EPISODEFILE_QUALITY +SONARR_EPISODEFILE_QUALITYVERSION +SONARR_EPISODEFILE_RELATIVEPATH +SONARR_EPISODEFILE_RELEASEGROUP +SONARR_EPISODEFILE_SCENENAME +SONARR_EPISODEFILE_SEASONNUMBER +SONARR_EPISODEFILE_SOURCEFOLDER +SONARR_EPISODEFILE_SOURCEPATH +SONARR_EVENTTYPE +SONARR_ISUPGRADE +SONARR_RELEASE_EPISODEAIRDATES +SONARR_RELEASE_EPISODEAIRDATESUTC +SONARR_RELEASE_EPISODECOUNT +SONARR_RELEASE_EPISODENUMBERS +SONARR_RELEASE_EPISODETITLES +SONARR_RELEASE_INDEXER +SONARR_RELEASE_QUALITY +SONARR_RELEASE_QUALITYVERSION +SONARR_RELEASE_RELEASEGROUP +SONARR_RELEASE_SEASONNUMBER +SONARR_RELEASE_SIZE +SONARR_RELEASE_TITLE +SONARR_SERIES_ID +SONARR_SERIES_IMDBID +SONARR_SERIES_PATH +SONARR_SERIES_TITLE +SONARR_SERIES_TVDBID +SONARR_SERIES_TVMAZEID +SONARR_SERIES_TYPE diff --git a/env_sonarr b/env_sonarr new file mode 100644 index 0000000..8763ac7 --- /dev/null +++ b/env_sonarr @@ -0,0 +1,24 @@ +RADARR_DOWNLOAD_CLIENT +RADARR_DOWNLOAD_ID +RADARR_EVENTTYPE +RADARR_ISUPGRADE +RADARR_MOVIE_ID +RADARR_MOVIE_IMDBID +RADARR_MOVIE_PATH +RADARR_MOVIE_TITLE +RADARR_MOVIE_TMDBID +RADARR_MOVIEFILE_ID +RADARR_MOVIEFILE_PATH +RADARR_MOVIEFILE_QUALITY +RADARR_MOVIEFILE_QUALITYVERSION +RADARR_MOVIEFILE_RELATIVEPATH +RADARR_MOVIEFILE_RELEASEGROUP +RADARR_MOVIEFILE_SCENENAME +RADARR_MOVIEFILE_SOURCEFOLDER +RADARR_MOVIEFILE_SOURCEPATH +RADARR_RELEASE_INDEXER +RADARR_RELEASE_QUALITY +RADARR_RELEASE_QUALITYVERSION +RADARR_RELEASE_RELEASEGROUP +RADARR_RELEASE_SIZE +RADARR_RELEASE_TITLE diff --git a/tdarr_inform.py b/tdarr_inform.py index 8027b26..1b26e02 100644 --- a/tdarr_inform.py +++ b/tdarr_inform.py @@ -1,7 +1,7 @@ #!/usr/bin/python3 import os -from sys import argv +# from sys import argv """ # title = show title @@ -44,34 +44,29 @@ def main(): logwrite = open(log_file, 'a') if "sonarr_eventtype" in os.environ: - logwrite.write("Recieved Event from Sonarr") + logwrite.write("Recieved Event from Sonarr\n") + ENV_FILE = os.path.join(SCRIPT_DIR, "env_sonarr") + elif "radarr_eventtype" in os.environ: + logwrite.write("Recieved Event from Sonarr\n") + ENV_FILE = os.path.join(SCRIPT_DIR, "env_radarr") - logwrite.write("argv %s\n" % argv) - - logwrite.close() - - # ENV_FILE = f"{SCRIPT_DIR}\\ARR_ENV.txt" - - # envs = {} + envs = {} # Checking all potentiall environment variables - # with open(ENV_FILE, 'r') as f: - # for line in f: - # env = line.rstrip() - # if env in os.environ: - # envs[env] = os.environ[env] + with open(ENV_FILE, 'r') as f: + for line in f: + env = line.rstrip() + if env in os.environ: + envs[env] = os.environ[env] + logwrite.write("%s %s" % (env, envs[env])) - # # No environment variables were found - # # Either the script was run manually as a test (ie Not ran by *arr) - # # or, something went wrong : ) - # if len(envs) == 0: - # raise Exception('No *arr Environment variables were found.') + # No environment variables were found + # Either the script was run manually as a test (ie Not ran by *arr) + # or, something went wrong : ) + if len(envs) == 0: + raise Exception('No *arr Environment variables were found.') - # envs is now a dictionary containing any *arr variables found - # Call your own script here, or do what you want with the environment variables found - # Information on what these variables could be can be found at: - # https://github.com/Radarr/Radarr/wiki/Custom-Post-Processing-Scripts - # https://github.com/Sonarr/Sonarr/wiki/Custom-Post-Processing-Scripts + logwrite.close() if __name__ == "__main__":