How to Force FileBot to update Sonarr/Radarr
How to Force FileBot to update Sonarr/Radarr
Hi all,
First of all, thanks for the help!
Okey, I got a problem here guys. Let me try to explain this.
I run Sonarr/Radarr local server, then an external server for FileBot and Sabnzbd.
Sonarr/Radarr push the file to Sabnzbd, and then I use fn:amc to rename and move the file where I want it.
So far, so good. (I wish that AMC got Sonarr/Radarr support.. )
But here is the issue. Sonarr/Radarr only updated all series every 30 mins or something. So, how can I get filebot to notify Sonarr/Radarr to only update the "item" that FileBot just finished?
For the past 3 days I have tried to figure out how to do this, but I'm stuck
PS! Im not a "scripter", but sometimes I understand how things are linked together.. Sometimes
//I have a "quick fix". This command will refresh all Series, but, I don't like it.
//"curl http://192.168.1.100:9000/api/command -X POST -d '{"name": "RefreshSeries"}' --header "X-Api-Key:APIKEY""
Probably someone here can help me
First of all, thanks for the help!
Okey, I got a problem here guys. Let me try to explain this.
I run Sonarr/Radarr local server, then an external server for FileBot and Sabnzbd.
Sonarr/Radarr push the file to Sabnzbd, and then I use fn:amc to rename and move the file where I want it.
So far, so good. (I wish that AMC got Sonarr/Radarr support.. )
But here is the issue. Sonarr/Radarr only updated all series every 30 mins or something. So, how can I get filebot to notify Sonarr/Radarr to only update the "item" that FileBot just finished?
For the past 3 days I have tried to figure out how to do this, but I'm stuck
PS! Im not a "scripter", but sometimes I understand how things are linked together.. Sometimes
//I have a "quick fix". This command will refresh all Series, but, I don't like it.
//"curl http://192.168.1.100:9000/api/command -X POST -d '{"name": "RefreshSeries"}' --header "X-Api-Key:APIKEY""
Probably someone here can help me
Re: How to Force FileBot to update Sonarr/Radarr
You can use --def exec to hook your curl call into the amc script.
Solutions that are simple and independently testable are beautiful.
Solutions that are simple and independently testable are beautiful.
Please read the FAQ and How to Request Help.
Re: How to Force FileBot to update Sonarr/Radarr
ahh! Thats new to me! Then I starting to see how I should do it.
So, this should work?
But, how can I force the curl to only update this specific movie or show?
I found something on the Sonarr.tv forum, but don't understand how I can make this script to work with FileBot.
Thanks for your help, I really appreciate it
So, this should work?
Code: Select all
filebot -script fn:amc --log-file amc.log --action copy -non-strict --conflict skip -non-strict "$HOME/test/LAlala/"
--def "seriesFormat=$HOME/media/'TV Shows'/{n}/{'Season '+s.pad(2)}/{n} - {S00E00} - {t}"
--def "movieFormat=$HOME/media/Movies/{n} [{y}]"
--def clean=y
--def exec="curl http://192.168.1.100:9000/api/command -X POST -d '{"name": "RefreshSeries"}' --header "X-Api-Key:APIKEY""
I found something on the Sonarr.tv forum, but don't understand how I can make this script to work with FileBot.
Code: Select all
#!/bin/bash
seriesID=$(curl -s http://10.10.10.11:8989/api/series -H 'X-Api-Key: 5215023779d84ad391719fc703bba5ba' --compressed | jq -rs --arg seriestitle $seriesName '.[]| .[] | select(.title == $seriestitle ) | .id')
curl -s http://10.10.10.11:8989/api/command -H 'X-Api-Key: 5215023779d84ad391719fc703bba5ba' --data-binary '{ "name": "rescanSeries", "seriesId" : "'$seriesID'" }'
Re: How to Force FileBot to update Sonarr/Radarr
I believe you can use the second script you mentioned as exec argument and use variables to pass the series name.
Something like
and in the second script add a line like
Something like
Code: Select all
--def exec="/path/to/myscript.sh {n}"
Code: Select all
seriesName=${1}
I only work in black and sometimes very, very dark grey. (Batman)
Re: How to Force FileBot to update Sonarr/Radarr
I'd also recommend writing your own update-sonarr.sh script to make the --def exec command as simple as possible, and the update-sonarr.sh script independently testable:
e.g.
Nested "..." don't work the way you think, i.e. you can't nest them without escaping them. Please read Cmdline and Argument Passing for details.
e.g.
Code: Select all
--def exec="/path/to/update-sonarr.sh {quote n}"
Nested "..." don't work the way you think, i.e. you can't nest them without escaping them. Please read Cmdline and Argument Passing for details.
Please read the FAQ and How to Request Help.
-
- Posts: 107
- Joined: 12 Apr 2020, 04:02
Re: How to Force FileBot to update Sonarr/Radarr
Did you ever found how to do this? Trying to do the exact same thing.eikum wrote: ↑02 Apr 2020, 20:04 ahh! Thats new to me! Then I starting to see how I should do it.
So, this should work?But, how can I force the curl to only update this specific movie or show?Code: Select all
filebot -script fn:amc --log-file amc.log --action copy -non-strict --conflict skip -non-strict "$HOME/test/LAlala/" --def "seriesFormat=$HOME/media/'TV Shows'/{n}/{'Season '+s.pad(2)}/{n} - {S00E00} - {t}" --def "movieFormat=$HOME/media/Movies/{n} [{y}]" --def clean=y --def exec="curl http://192.168.1.100:9000/api/command -X POST -d '{"name": "RefreshSeries"}' --header "X-Api-Key:APIKEY""
I found something on the Sonarr.tv forum, but don't understand how I can make this script to work with FileBot.Thanks for your help, I really appreciate itCode: Select all
#!/bin/bash seriesID=$(curl -s http://10.10.10.11:8989/api/series -H 'X-Api-Key: 5215023779d84ad391719fc703bba5ba' --compressed | jq -rs --arg seriestitle $seriesName '.[]| .[] | select(.title == $seriestitle ) | .id') curl -s http://10.10.10.11:8989/api/command -H 'X-Api-Key: 5215023779d84ad391719fc703bba5ba' --data-binary '{ "name": "rescanSeries", "seriesId" : "'$seriesID'" }'
Re: How to Force FileBot to update Sonarr/Radarr
Late to the game here, but I use this script:
https://github.com/JourneyDeprecated/fi ... arr.groovy
Just save the script as a file somewhere that Filebot has access to. Update the URLs and API keys for both Sonarr and Radarr.
Then add this to the end of your AMC script replacing the directory/filename as needed:
You may or may not need escape characters ("\" or "\\") in front of the "=" depending on how you are calling Filebot and what OS you are using.
My call actually looks like this since it is within the Docker run command:
https://github.com/JourneyDeprecated/fi ... arr.groovy
Code: Select all
// TVDB/TMDB ID
def id = id as int
// Video Type
def type = type
// Sonarr API Configuration
if (type =~ /Episode/) {
def url = new URL('http://localhost:8989')
def header = ['X-Api-Key': 'PLACEAPIKEYHERE']
def sonarrSeriesId = new JsonSlurper()
.parseText(new URL(url, '/api/series')
.get(header)
.text)
.find {
it.tvdbId == id
}.id
println new URL(url, '/api/command').post(
JsonOutput.toJson(
[name: 'rescanSeries', seriesId: sonarrSeriesId]
).getBytes('UTF-8'),
'application/json',
header
).text
}
// Radarr API Configuration
if (type =~ /Movie/) {
def url = new URL('http://localhost:7878')
def header = ['X-Api-Key': 'PLACEAPIKEYHERE']
def radarrMovieId = new JsonSlurper()
.parseText(new URL(url, '/api/movie')
.get(header)
.text)
.find {
it.tmdbId == id
}.id
println new URL(url, '/api/command').post(
JsonOutput.toJson(
[name: 'rescanMovie', movieId: radarrMovieId]
).getBytes('UTF-8'),
'application/json',
header
).text
}
Then add this to the end of your AMC script replacing the directory/filename as needed:
Code: Select all
--def exec="/data/scripts/Update_Sonarr_Radarr.groovy --def type={type} id={id}"
My call actually looks like this since it is within the Docker run command:
Code: Select all
-exec filebot -script /data/scripts/Update_Sonarr_Radarr.groovy --def type\\={type} id\\={id}
Re: How to Force FileBot to update Sonarr/Radarr
Note that making your *.groovy script executable only works if you also add the correct shebang in the first line so that the system can run the script with the appropriate executable:
1st line:
https://github.com/filebot/scripts/blob ... nfo.groovy
Code: Select all
/data/scripts/Update_Sonarr_Radarr.groovy
Code: Select all
#!/usr/bin/env filebot -script
Please read the FAQ and How to Request Help.