Skip to content

Commit

Permalink
- Documentation updated for v0.8.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
dcampillo committed Nov 4, 2022
1 parent c1d7c7c commit 08adbba
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ Sonarr/Radarr custom scripts to unmomitor episodes or movies after import.
- The script have been tested with Python 3.8.x and 3.9.x

## Installation
Starting with version 0.7b, all external requirements have been removed

You can use the script with or without a configuration file:
Update each script accordingly:

1. Place the scripts in a folder accessible by Radarr or Sonarr
2. !! For "Linux", make the script executable
3. Update variable 'SONARR_HOST' and 'SONARR_API_KEY' in "sonarr-unmonitor.py" for Sonarr
4. Update variable 'RADARR_HOST' and 'RADARR_API_KEY' in "radarr-unmonitor.py" for Radarr
3. Update setting 'ARR_HOST' with a valid URL with 'http://' or 'https://'
4. Update setting 'ARR_API_KEY' with the corresponding KEY


## Sonarr / Radarr configuration
1. Add a new connection (Settings -> Connections -> Custom Scripts)
1. Add a new connection (Settings -> Connect -> Custom Scripts)
2. Give a name to your connection
3. Check the Notification Trigger "on import"
4. Select your script
Expand Down
5 changes: 3 additions & 2 deletions radarr-unmonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ def main():
if ARR_API_KEY != "":
print("CONFIG_CHECK: API key is present")
else:
sys.stderr.write("CONFIG_CHECK API_KEY: API Key '' is a NOT VALID API KEY!".format(hostcheck=ARR_HOST))
sys.stderr.write("CONFIG_CHECK API_KEY: API Key '' is a NOT VALID API KEY!")
sys.exit("CONFIG_CHECK_ERROR")

if re.match("^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)$", ARR_HOST):
print("CONFIG_CHECK: '{hostcheck}' is valid!".format(hostcheck=ARR_HOST))
else:
Expand All @@ -71,7 +72,7 @@ def main():
movieId = environ.get("radarr_movie_id")
if movieId:
setMonitoring(movieId, False)
print("Movie ID {movieid} unmonitored!".format(movieId=movieId))
print("Movie ID {movieid} unmonitored!".format(movieid=movieId))

if __name__ == "__main__":
main()
16 changes: 9 additions & 7 deletions sonarr-unmonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,20 @@ def main():
print("Checking config")
if ARR_API_KEY != "":
print("CONFIG_CHECK: API key is present")
else:
sys.stderr.write("CONFIG_CHECK API_KEY: API Key '' is a NOT VALID API KEY!")
sys.exit("CONFIG_CHECK_ERROR")

if re.match("^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)$", ARR_HOST):
print("CONFIG_CHECK HOST: '{hostcheck}' is valid!".format(hostcheck=ARR_HOST))
else:
sys.stderr.write("CONFIG_CHECK_ERROR: {hostcheck} is NOT VALID!".format(hostcheck=ARR_HOST))
sys.exit("CONFIG_CHECK_ERROR")
if re.match("^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)$", ARR_HOST):
print("CONFIG_CHECK HOST: '{hostcheck}' is valid!".format(hostcheck=ARR_HOST))
else:
sys.stderr.write("CONFIG_CHECK_ERROR: {hostcheck} is NOT VALID!".format(hostcheck=ARR_HOST))
sys.exit("CONFIG_CHECK_ERROR")
else:
epId = environ.get('sonarr_episodefile_episodeids')
if epId:
setMonitoring(epId, False)
logMsg = "Sonarr post-import: Episode ID = {0}"
logging.info(logMsg.format(epId))
print("Sonarr post-import: Episode ID = {episodeid}".format(episodeid=epId))

if __name__ == "__main__":
main()

0 comments on commit 08adbba

Please sign in to comment.