Difference between revisions of "Radarr"
From Indie IT Wiki
Plittlefield (talk | contribs) |
Plittlefield (talk | contribs) |
||
Line 17: | Line 17: | ||
=== List Movies === | === List Movies === | ||
− | curl -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | + | curl -s -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" |
− | curl -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | .path' | + | curl -s -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | .path' |
=== Search Movie === | === Search Movie === | ||
− | curl -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | select(.path=="/data/media/movies/Movie Name (Year)")' | + | curl -s -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | select(.path=="/data/media/movies/Movie Name (Year)")' |
=== Find ID of Movie === | === Find ID of Movie === | ||
− | curl -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | select(.path=="/data/media/movies/Movie Name (Year)") | {Id: .id}' | + | curl -s -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | select(.path=="/data/media/movies/Movie Name (Year)") | {Id: .id}' |
− | curl -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | select(.path=="/data/media/movies/Movie Name (Year)") | .id' | + | curl -s -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | select(.path=="/data/media/movies/Movie Name (Year)") | .id' |
=== Delete Movie === | === Delete Movie === | ||
− | curl -X "DELETE" "<nowiki>http://192.168.0.252:7878/api/v3/movie/886?deleteFiles=true&addImportExclusion=false</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | + | curl -s -X "DELETE" "<nowiki>http://192.168.0.252:7878/api/v3/movie/886?deleteFiles=true&addImportExclusion=false</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" |
=== Find and Delete Movie === | === Find and Delete Movie === | ||
Line 39: | Line 39: | ||
With no BASH variable ... | With no BASH variable ... | ||
− | ID=$(curl -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | select(.path=="/data/media/movies/Movie Name (Year)") | .id'); echo "${ID}"; curl -X "DELETE" "<nowiki>http://192.168.0.252:7878/api/v3/movie/${ID}?deleteFiles=true&addImportExclusion=false</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | + | ID=$(curl -s -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | select(.path=="/data/media/movies/Movie Name (Year)") | .id'); echo "${ID}"; curl -s -X "DELETE" "<nowiki>http://192.168.0.252:7878/api/v3/movie/${ID}?deleteFiles=true&addImportExclusion=false</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" |
With a BASH variable ... | With a BASH variable ... | ||
− | MOVIEPATH="/data/media/movies/Movie Name (Year)"; ID=$(curl -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq --arg MOVIEPATH "$MOVIEPATH" '.[] | select(.path==$MOVIEPATH) | .id'); echo "${ID}"; curl -X "DELETE" "<nowiki>http://192.168.0.252:7878/api/v3/movie/${ID}?deleteFiles=true&addImportExclusion=false</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | + | MOVIEPATH="/data/media/movies/Movie Name (Year)"; ID=$(curl -s -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq --arg MOVIEPATH "$MOVIEPATH" '.[] | select(.path==$MOVIEPATH) | .id'); echo "${ID}"; curl -s -X "DELETE" "<nowiki>http://192.168.0.252:7878/api/v3/movie/${ID}?deleteFiles=true&addImportExclusion=false</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" |
=== Unmonitor Movie === | === Unmonitor Movie === | ||
Line 55: | Line 55: | ||
So, combined with my BASH variable snippets above ... | So, combined with my BASH variable snippets above ... | ||
− | MOVIEPATH="/data/media/movies/Movie Name (Year)"; ID=$(curl -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq --arg MOVIEPATH "$MOVIEPATH" '.[] | select(.path==$MOVIEPATH) | .id'); echo "${ID}"; curl -s -X "PUT" "<nowiki>http://192.168.0.252:7878/api/v3/movie/editor</nowiki>" -H "content-type: application/json" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxx" -d '{"movieIds": [ ${ID} ], "monitored": false }'; | + | MOVIEPATH="/data/media/movies/Movie Name (Year)"; ID=$(curl -s -X "GET" "<nowiki>http://192.168.0.252:7878/api/v3/movie</nowiki>" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq --arg MOVIEPATH "$MOVIEPATH" '.[] | select(.path==$MOVIEPATH) | .id'); echo "${ID}"; curl -s -X "PUT" "<nowiki>http://192.168.0.252:7878/api/v3/movie/editor</nowiki>" -H "content-type: application/json" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxx" -d '{"movieIds": [ ${ID} ], "monitored": false }'; |
=== Complete Script === | === Complete Script === |
Revision as of 15:30, 17 November 2024
Introduction
Radarr is an independent fork of Sonarr reworked for automatic downloading of movies.
Installation
https://github.com/Radarr/Radarr/wiki/Installation
Information
API
List Movies
curl -s -X "GET" "http://192.168.0.252:7878/api/v3/movie" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx"
curl -s -X "GET" "http://192.168.0.252:7878/api/v3/movie" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | .path'
Search Movie
curl -s -X "GET" "http://192.168.0.252:7878/api/v3/movie" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | select(.path=="/data/media/movies/Movie Name (Year)")'
Find ID of Movie
curl -s -X "GET" "http://192.168.0.252:7878/api/v3/movie" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | select(.path=="/data/media/movies/Movie Name (Year)") | {Id: .id}'
curl -s -X "GET" "http://192.168.0.252:7878/api/v3/movie" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | select(.path=="/data/media/movies/Movie Name (Year)") | .id'
Delete Movie
curl -s -X "DELETE" "http://192.168.0.252:7878/api/v3/movie/886?deleteFiles=true&addImportExclusion=false" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx"
Find and Delete Movie
With no BASH variable ...
ID=$(curl -s -X "GET" "http://192.168.0.252:7878/api/v3/movie" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq '.[] | select(.path=="/data/media/movies/Movie Name (Year)") | .id'); echo "${ID}"; curl -s -X "DELETE" "http://192.168.0.252:7878/api/v3/movie/${ID}?deleteFiles=true&addImportExclusion=false" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx"
With a BASH variable ...
MOVIEPATH="/data/media/movies/Movie Name (Year)"; ID=$(curl -s -X "GET" "http://192.168.0.252:7878/api/v3/movie" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq --arg MOVIEPATH "$MOVIEPATH" '.[] | select(.path==$MOVIEPATH) | .id'); echo "${ID}"; curl -s -X "DELETE" "http://192.168.0.252:7878/api/v3/movie/${ID}?deleteFiles=true&addImportExclusion=false" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx"
Unmonitor Movie
curl -s -X "PUT" "http://192.168.0.252:7878/api/v3/movie/editor" \ -H "content-type: application/json" \ -H "accept: application/json" \ -H "X-Api-Key: xxxxxxxxxxxxxx" \ -d '{"movieIds": [ ${ID} ], "monitored": false }';
So, combined with my BASH variable snippets above ...
MOVIEPATH="/data/media/movies/Movie Name (Year)"; ID=$(curl -s -X "GET" "http://192.168.0.252:7878/api/v3/movie" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxx" | jq --arg MOVIEPATH "$MOVIEPATH" '.[] | select(.path==$MOVIEPATH) | .id'); echo "${ID}"; curl -s -X "PUT" "http://192.168.0.252:7878/api/v3/movie/editor" -H "content-type: application/json" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxx" -d '{"movieIds": [ ${ID} ], "monitored": false }';
Complete Script
#!/bin/bash # ./radarr_delete_movie.sh "Movie Name (Year)" MOVIE="$1"; echo "MOVIE=${MOVIE}"; MOVIEPATH="/data/media/movies/$MOVIE"; echo "MOVIEPATH=$MOVIEPATH"; ID=$(curl -s -X "GET" "http://192.168.0.252:7878/api/v3/movie" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxx" | jq --arg MOVIEPATH "$MOVIEPATH" '.[] | select(.path==$MOVIEPATH) | .id'); echo "ID=${ID}"; sleep 10s; curl -s -X "DELETE" "http://192.168.0.252:7878/api/v3/movie/${ID}?deleteFiles=true&addImportExclusion=false" -H "accept: application/json" -H "X-Api-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxx"; exit;
Use in Tdarr
So, in theory, you should be able to use the variable "{{{args.inputFileObj._id}}}"
in Tdarr to get the path and then right at the end of your flow, you call this command. Maybe :)