Filebot and Sonarr

Any questions? Need some help?
Post Reply
KRONZO
Posts: 30
Joined: 31 Dec 2017, 23:20

Filebot and Sonarr

Post by KRONZO »

I know this is not really a filebot problem but I'm guessing im not the only one with this setup so maybe someone here have a solution and i do not understand anything at all about how this works.

I have filebot process my files from sonarr's downloads and put them into sonarrdone so i need to get the sonarr Downloadedepisodescan to work because this way sonarr still updates to new files and remove junk files this is what i have that for now i paste into powershell

Code: Select all

$url = "http://85.218.238.147:8989/api/command"
$json = '{"name": "downloadedepisodesscan","path": "D:\utorrent\sonarrdone","importMode":"Move"}' 

Write-Host "Publishing update $version ($branch) to: $url"
Invoke-RestMethod -Uri $url -Method Post -Body $json -Headers @{"X-Api-Key"="6557deb88ff247f3835fd3857824bf32"}
but it gives an error in Sonarr
Error occurred while executing task DownloadedEpisodesScan: value [D:/utorrent/sonarrdone] is not a valid Windows path. paths must be a full path eg. C:\Windows
Parameter name: path
I have also tried d:\utorrent\sonarr this gives error in powershell but if i escape it goes through and gives the same invalid path error

im running on windows 10 and utorrent 3.2.2 and i have posted in sonarr forums too but I must admit my hopes lies here

here is some links to how it should work
https://github.com/Sonarr/Sonarr/wiki/C ... isodesscan
https://forums.sonarr.tv/t/sonarr-fileb ... on/13654/2

hope someone here can help
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot and Sonarr

Post by rednoah »

What is the actual value of the JSON string you're sending?

Code: Select all

echo $json
\ is usually used to escape characters in String literals, so \ is not \ and may be interpreted by PowerShell in some special way.
:idea: Please read the FAQ and How to Request Help.
KRONZO
Posts: 30
Joined: 31 Dec 2017, 23:20

Re: Filebot and Sonarr

Post by KRONZO »

hey rednoah

sorry for the late reply, just came back from the cinema, Jumanji is okay ;)

you are right about escaping, i did it wrong! once i escaped correctly and input the entire path with the file to import, I got it to work but this means i need to get the path input someway and i hope since the files have just been processed by filebot it is possible? i Hope you are willing to help because i'm not good enough to do it by myself.

this is the output from powershell with the "script"

Code: Select all

PS C:\Users\KRONZO> $url = "http://85.211.227.147:8989/api/command"
PS C:\Users\KRONZO> $json = '{"name": "downloadedepisodesscan","path": "D:\\utorrent\\sonarrdone\\The Big Bang Theory S1
0E24 The Long Distance Dissonance [1080p] [HDTV].mkv","importMode":"Move","downloadClientId":"{infohash}"}'
PS C:\Users\KRONZO>
PS C:\Users\KRONZO> Write-Host "Publishing update $version ($branch) to: $url"
Publishing update  () to: http://85.211.227.147:8989/api/command
PS C:\Users\KRONZO> Invoke-RestMethod -Uri $url -Method Post -Body $json -Headers @{"X-Api-Key"="992e65448ca34910b0f9e7a
4ebe201e5"}


name                : DownloadedEpisodesScan
body                : @{sendUpdatesToClient=False; sendUpdates=False; path=D:\utorrent\sonarrdone\The Big Bang Theory S
                      10E24 The Long Distance Dissonance [1080p] [HDTV].mkv; downloadClientId={infohash}; importMode=mo
                      ve; updateScheduledTask=True; completionMessage=Completed; name=DownloadedEpisodesScan; trigger=m
                      anual}
priority            : normal
status              : queued
queued              : 2018-01-04T21:45:56.5529728Z
trigger             : manual
state               : queued
manual              : True
startedOn           : 2018-01-04T21:45:56.5529728Z
sendUpdatesToClient : False
updateScheduledTask : True
id                  : 1348
my setup is like this if a utorrent download have sonarr label, then eventghost fires a filebot amc script to rename and move to D:\SonarrDone and then this powershell script would tell sonarr to import the files.
Im hoping this can all be done in or with filebot somehow?

thank you
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot and Sonarr

Post by rednoah »

I'm actually not sure what you're missing. So the PowerShell code you have so far works and does what you want?

I think you're looking for the --def exec option. You can use it to call a command for each processed file or folder.
:idea: Please read the FAQ and How to Request Help.
KRONZO
Posts: 30
Joined: 31 Dec 2017, 23:20

Re: Filebot and Sonarr

Post by KRONZO »

I'm Sorry i should have explained better.
yes it does work if i do it all manually but the idea is it should happen automatically so i need a way to get the path input to the powershell script.
so when --def exec runs the powershell script it should run with the full path to the file.

I hope this makes sence
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot and Sonarr

Post by rednoah »

Yes, you can do that.

You can get started with this, do a test run, look at the console output, and then modify to your needs:

Code: Select all

--def exec="echo {quote f}"
:idea: Please read the FAQ and How to Request Help.
KRONZO
Posts: 30
Joined: 31 Dec 2017, 23:20

Re: Filebot and Sonarr

Post by KRONZO »

hey
again thanks for the help.
Do you mind explaning a little bit more in depth, i dont know what to do with --def exec="echo {quote f}"

and i have no idea how to begin with getting the path into the shell script
i'm hoping for your patience
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot and Sonarr

Post by rednoah »

The first step is to set up a test folder, and then run the script on the test folder.

e.g.

Code: Select all

filebot -script fn:amc --output "/path/to/output" --action copy -non-strict "/path/to/input"
Running a command manually will looks something like this:
Image

You run the command, and then you look at the output. Now you know what's going on, and you can add additional options to see what changes.

e.g.

Code: Select all

filebot -script fn:amc --output "/path/to/output" --action copy -non-strict "/path/to/input" --def exec="echo {quote f}"
Rinse and repeat. The console output will tell you exactly what's going on and what this --def exec does.


:idea: If you look at the console output, and you have questions, then please copy & paste the console output, and then I'll explain the relevant lines that are still unclear.
:idea: Please read the FAQ and How to Request Help.
KRONZO
Posts: 30
Joined: 31 Dec 2017, 23:20

Re: Filebot and Sonarr

Post by KRONZO »

Thank you very much i will sit sown and play with this
I will be back for more, but am very gratefull for the help
Post Reply