Sabnzbd AMC Script

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
azilko
Posts: 10
Joined: 04 Feb 2017, 21:51

Sabnzbd AMC Script

Post by azilko »

My code is,

Code: Select all

filebot -script fn:amc --output "K:/Downloads" --action copy --conflict skip -non-strict --log-file amc.log --def unsorted=y music=n artwork=n "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" --def excludeList=amc.txt
I've put this into a .bat file, and have told Sabnzbd+ to run it. When it runs, I get,
C:\Program Files (x86)\SABnzbd>filebot -script fn:amc --output "K:/Downloads" --action copy --conflict skip -non-strict --log-file amc.log --def unsorted=y music=n artwork=n "ut_label=S" "ut_title=K" "ut_file=D" --def excludeList=amc.txt
Locking C:\Users\Adam Zilko\AppData\Roaming\FileBot\logs\amc.log
Run script [fn:amc] at [Sat Feb 04 13:55:33 PST 2017]
Parameter: unsorted = y
Parameter: music = n
Parameter: artwork = n
Parameter: ut_label = S
Parameter: ut_title = K
Parameter: ut_file = D
Parameter: excludeList = amc.txt
Illegal usage: no input
Failure (~~_~~)
What am I doing wrong? (I've been messing with this for days now, and can't seem to get anything to work. Apologies if it's posted somewhere, I googled and searched, but am likely too new to know what I should be looking for.)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sabnzbd AMC Script

Post by rednoah »

How are SABnzbd integration scripts supposed to look like? It's different for every application. You can't just copy & paste the utorrent command template.

@see viewtopic.php?f=4&t=4239
:idea: Please read the FAQ and How to Request Help.
azilko
Posts: 10
Joined: 04 Feb 2017, 21:51

Re: Sabnzbd AMC Script

Post by azilko »

rednoah wrote:How are SABnzbd integration scripts supposed to look like? It's different for every application. You can't just copy & paste the utorrent command template.

@see viewtopic.php?f=4&t=4239
I don't know how they're supposed to look as I'm a noob to this app / scripting method. However, if you can help me make one real fast that'll work w/ Sabnzbd, or post a known working one here (and assist if I have any config questions), I'll kick you some cash via your donate link. How's $20 USD work for you?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sabnzbd AMC Script

Post by rednoah »

You could try a .bat script like this:

Code: Select all

SET NZB_OUTPUT_FOLDER=%1
SET NZB_JOB_NAME=%3
SET NZB_CATEGORY=%5

filebot -script fn:amc --output "K:/Downloads" --action copy -non-strict --log-file amc.log --def excludeList=amc.txt "ut_dir=%NZB_OUTPUT_FOLDER%" "ut_kind=multi" "ut_title=%NZB_JOB_NAME%" "ut_label=%NZB_CATEGORY%"
@see https://sabnzbd.org/wiki/scripts/post-p ... ng-scripts
:idea: Please read the FAQ and How to Request Help.
azilko
Posts: 10
Joined: 04 Feb 2017, 21:51

Re: Sabnzbd AMC Script

Post by azilko »

For,

Code: Select all

SET NZB_OUTPUT_FOLDER=%1
SET NZB_JOB_NAME=%3
SET NZB_CATEGORY=%5
Do I need to edit these somewhere? For example, do I need to add to this script a replacement for "%1, %3, and %5"? Or is that passed automatically?
azilko
Posts: 10
Joined: 04 Feb 2017, 21:51

Re: Sabnzbd AMC Script

Post by azilko »

Also, donation sent. Paid in EU, so you'll receive a bit more. Appreciate the help with this.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sabnzbd AMC Script

Post by rednoah »

Read the manual: https://sabnzbd.org/wiki/scripts/post-p ... ng-scripts

Create sabnzbd-postprocess.bat file with that bat script and set sabnzbd to call it. According to the manual, sabnzbd will call the script with the parameters %1 to %8.

If you test the script manually in CMD, then you need to pass parameters %1 to %8 in yourself as well.
:idea: Please read the FAQ and How to Request Help.
azilko
Posts: 10
Joined: 04 Feb 2017, 21:51

Re: Sabnzbd AMC Script

Post by azilko »

I ran that script, here's the error I continue to get,
C:\Program Files (x86)\SABnzbd>filebot -script fn:amc --output "K:/Downloads" --action copy --conflict skip -non-strict --log-file amc.log --def unsorted=y music=n artwork=n "ut_label=S" "ut_title=K" "ut_file=D" --def excludeList=amc.txt
Locking C:\Users\Adam Zilko\AppData\Roaming\FileBot\logs\amc.log
Run script [fn:amc] at [Sun Feb 05 12:32:54 PST 2017]
Parameter: unsorted = y
Parameter: music = n
Parameter: artwork = n
Parameter: ut_label = S
Parameter: ut_title = K
Parameter: ut_file = D
Parameter: excludeList = amc.txt
Illegal usage: no input
Failure (~~_~~)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sabnzbd AMC Script

Post by rednoah »

1.
Create a new .bat file. Open with a text editor. Paste the bat script:

Code: Select all

SET NZB_OUTPUT_FOLDER=%1
SET NZB_JOB_NAME=%3
SET NZB_CATEGORY=%5

filebot -script fn:amc --output "K:/Downloads" --action copy -non-strict --log-file amc.log --def excludeList=amc.txt "ut_dir=%NZB_OUTPUT_FOLDER%" "ut_kind=multi" "ut_title=%NZB_JOB_NAME%" "ut_label=%NZB_CATEGORY%"
2.
Move the .bat file to the Post-Processing Scripts Folder.

3.
Do something in SABnzbd to set the post process script. I have never used SABnzbd so I can't help you here.

4.
Do something that should set off the post process script. SABnzbd should have some sort of logging so you can see if your .bat has been called.
:idea: Please read the FAQ and How to Request Help.
azilko
Posts: 10
Joined: 04 Feb 2017, 21:51

Re: Sabnzbd AMC Script

Post by azilko »

Figured it out. Thanks for your help!! One last thing... How can I have filebot move the video file out of the folder and delete everything else, and have it download subtitles in english?

BTW, I had done everything in your last post, however, I think that I was trying to read from, and write to, the same directory. And one of the directories had a space in the folder name causing the script to crash.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sabnzbd AMC Script

Post by rednoah »

1.
See amc script reference:

Code: Select all

--action move --def clean=y --def subtitles=en

2.
What do the logs say?


3.
DO NOT use your Downloads folder as output folder.

Create a new folder K:/Media and then use it as output folder:

Code: Select all

--output "K:/Media"
:idea: Please read the FAQ and How to Request Help.
azilko
Posts: 10
Joined: 04 Feb 2017, 21:51

Re: Sabnzbd AMC Script

Post by azilko »

That was my issue, is that my output folder was downloads.

Can you post the full script incorporating this,
--action move --def clean=y --def subtitles=en
? I'm not sure what should be overwritten.

The script is also keeping the original file in the original dir. I assume that --action move will move it / remove the original?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sabnzbd AMC Script

Post by rednoah »

Code: Select all

filebot -script fn:amc --output "K:/Downloads" --action copy -non-strict --log-file amc.log --def excludeList=amc.txt "ut_dir=%NZB_OUTPUT_FOLDER%" "ut_kind=multi" "ut_title=%NZB_JOB_NAME%" "ut_label=%NZB_CATEGORY%"
+

Code: Select all

--action move --def clean=y --def subtitles=en
=

Code: Select all

filebot -script fn:amc --output "K:/Downloads" --action move -non-strict --log-file amc.log --def clean=y --def subtitles=en excludeList=amc.txt "ut_dir=%NZB_OUTPUT_FOLDER%" "ut_kind=multi" "ut_title=%NZB_JOB_NAME%" "ut_label=%NZB_CATEGORY%"
:idea: Please read the FAQ and How to Request Help.
azilko
Posts: 10
Joined: 04 Feb 2017, 21:51

Re: Sabnzbd AMC Script

Post by azilko »

Okay, so everything is working except the subtitles aren't downloading. I've verified that the filebot app (being run from the GUI) can find the subtitles. Here's the output of this script running,

Code: Select all

C:\Program Files (x86)\SABnzbd>SET NZB_OUTPUT_FOLDER=K:\CompletedMedia\Vikings.S04E19.On.The.Eve.720p.AMZN.WEBRip.DD5.1.x264-NTB 

C:\Program Files (x86)\SABnzbd>SET NZB_JOB_NAME=Vikings.S04E19.On.The.Eve.720p.AMZN.WEBRip.DD5.1.x264-NTB 

C:\Program Files (x86)\SABnzbd>SET NZB_CATEGORY=tvshows 

C:\Program Files (x86)\SABnzbd>filebot -script fn:amc --output "K:/Downloads" --action move -non-strict --log-file amc.log --def clean=y --def subtitles=en excludeList=amc.txt "ut_dir=K:\CompletedMedia\Vikings.S04E19.On.The.Eve.720p.AMZN.WEBRip.DD5.1.x264-NTB" "ut_kind=multi" "ut_title=Vikings.S04E19.On.The.Eve.720p.AMZN.WEBRip.DD5.1.x264-NTB" "ut_label=tvshows" 
Locking C:\Users\Adam Zilko\AppData\Roaming\FileBot\logs\amc.log
Run script [fn:amc] at [Mon Feb 06 09:16:00 PST 2017]
Parameter: clean = y
Parameter: subtitles = en
Parameter: excludeList = amc.txt
Parameter: ut_dir = K:\CompletedMedia\Vikings.S04E19.On.The.Eve.720p.AMZN.WEBRip.DD5.1.x264-NTB
Parameter: ut_kind = multi
Parameter: ut_title = Vikings.S04E19.On.The.Eve.720p.AMZN.WEBRip.DD5.1.x264-NTB
Parameter: ut_label = tvshows
Use excludes: K:\Downloads\amc.txt (21)
Input: K:\CompletedMedia\Vikings.S04E19.On.The.Eve.720p.AMZN.WEBRip.DD5.1.x264-NTB\eeT8eiP4aineoj0Phaet5iulahgh8E.mkv
Group: [tvs:vikings] => [eeT8eiP4aineoj0Phaet5iulahgh8E.mkv]
Get [English] subtitles for 1 files
Looking up subtitles by hash via OpenSubtitles
No matching subtitles found: K:\CompletedMedia\Vikings.S04E19.On.The.Eve.720p.AMZN.WEBRip.DD5.1.x264-NTB\eeT8eiP4aineoj0Phaet5iulahgh8E.mkv
Rename episodes using [TheTVDB]
Auto-detected query: [Vikings]
Fetching episode data for [Vikings]
Fetching episode data for [Vikings (2012)]
Fetching episode data for [Kings]
Fetching episode data for [The Vikings]
Fetching episode data for [Real Vikings]
[MOVE] Rename [K:\CompletedMedia\Vikings.S04E19.On.The.Eve.720p.AMZN.WEBRip.DD5.1.x264-NTB\eeT8eiP4aineoj0Phaet5iulahgh8E.mkv] to [K:\Downloads\TV Shows\Vikings\Season 04\Vikings - S04E19 - On the Eve.mkv]
Processed 1 files
Clean clutter files and empty folders
Delete K:\CompletedMedia\Vikings.S04E19.On.The.Eve.720p.AMZN.WEBRip.DD5.1.x264-NTB\eeT8eiP4aineoj0Phaet5iulahgh8E.sfv
Delete K:\CompletedMedia\Vikings.S04E19.On.The.Eve.720p.AMZN.WEBRip.DD5.1.x264-NTB
Done Òâ¥(´~áÔîÆÒâ~ÔîÆ´~á)ÒâÄ
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sabnzbd AMC Script

Post by rednoah »

No subtitles for this episode file have been added yet:

Code: Select all

No matching subtitles found: K:\CompletedMedia\Vikings.S04E19.On.The.Eve.720p.AMZN.WEBRip.DD5.1.x264-NTB\eeT8eiP4aineoj0Phaet5iulahgh8E.mkv
The amc script only performs hash lookup:
viewtopic.php?t=2615

The amc script does not do generic name lookup because good matches cannot be guaranteed in this case.
:idea: Please read the FAQ and How to Request Help.
Dckehtpc
Posts: 12
Joined: 21 Aug 2017, 20:14

Re: Sabnzbd AMC Script

Post by Dckehtpc »

Hi, I am trying to add this same script to my Sabnzbd for post processing. Do I just copy the script and create a .bat file then invoke this script from Sabnzbd by adding to the appropriate categories? I appreciate any help in getting started. Thank you
Dckehtpc
Posts: 12
Joined: 21 Aug 2017, 20:14

Re: Sabnzbd AMC Script

Post by Dckehtpc »

This is the script I am using:

SET NZB_OUTPUT_FOLDER=%1
SET NZB_JOB_NAME=%3
SET NZB_CATEGORY=%5

filebot -script fn:amc --output "S:\HTPC_Media\TV Shows" --action copy -non-strict --log-file amc.log --def excludeList=amc.txt "ut_dir=%NZB_OUTPUT_FOLDER%" "ut_kind=multi" "ut_title=%NZB_JOB_NAME%" "ut_label=%NZB_CATEGORY%"

Log File

Illegal Argument: java.nio.file.NoSuchFileException: C:\Program Files\SABnzbd\Shows\Preacher\Season (Shows\Preacher\Season)
Illegal Argument: java.nio.file.NoSuchFileException: C:\Program Files\SABnzbd\2 (2)
Illegal Argument: java.nio.file.NoSuchFileException: C:\Program Files\SABnzbd\ut_kind=multi (ut_kind=multi)
Illegal Argument: java.nio.file.NoSuchFileException: C:\Program Files\SABnzbd\ut_title=Preacher.S02E05.720p.WEB-DL.DD5.1.H264-RARBG (ut_title=Preacher.S02E05.720p.WEB-DL.DD5.1.H264-RARBG)
Illegal Argument: java.nio.file.NoSuchFileException: C:\Program Files\SABnzbd\ut_label=tv (ut_label=tv)
Illegal Argument: java.nio.file.NoSuchFileException: C:\Program Files\SABnzbd\test (test)
Run script [fn:amc] at [Tue Aug 22 11:02:56 CDT 2017]
Parameter: excludeList = amc.txt
Parameter: ut_dir = S:\HTPC_Media\TV
Argument[0]: File does not exist: Shows\Preacher\Season
Argument[1]: File does not exist: 2
Argument[2]: File does not exist: ut_kind=multi
Argument[3]: File does not exist: ut_title=Preacher.S02E05.720p.WEB-DL.DD5.1.H264-RARBG
Argument[4]: File does not exist: ut_label=tv
Argument[5]: File does not exist: test
Illegal usage: use either script parameters [dir:S:\HTPC_Media\TV] or file arguments [Shows\Preacher\Season, 2, ut_kind=multi, ut_title=Preacher.S02E05.720p.WEB-DL.DD5.1.H264-RARBG, ut_label=tv, test] but not both
Failure (°_°)
Run script [fn:amc] at [Tue Aug 22 11:09:33 CDT 2017]
Parameter: clean = y
Parameter: subtitles = en
Parameter: excludeList = amc.txt
Parameter: ut_dir =
Parameter: ut_kind = multi
Parameter: ut_title =
Parameter: ut_label =
Illegal usage: no input
Failure (°_°)

It looks look it is searching the wrong directories I have setup in Sabnzbd as follows

Completed Download Folder: S:\HTPC_Media\Unsorted_Media
Post processed folder: S:\HTPC_Media\TV Shows

How do I adjust my script so it points to the correct locations. Thanks for your great script and any help you can assist me with.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Sabnzbd AMC Script

Post by rednoah »

%NZB_OUTPUT_FOLDER% don't have the values you think they have. Presumably, they're already quoted, so you're unquoting them, leading to strange behavior.

i.e. you're doing this:

Code: Select all

--def "ut_dir="path/to/some/file""
:idea: Please read the FAQ and How to Request Help.
Dckehtpc
Posts: 12
Joined: 21 Aug 2017, 20:14

Re: Sabnzbd AMC Script

Post by Dckehtpc »

Thanks you. Where is that path coming from? Is that suppose to be my completed download folder for my TV Shows?

Also I dont understand where these commands are pointing to in my Sabnzbd setup:
SET NZB_OUTPUT_FOLDER=%1
SET NZB_JOB_NAME=%3
SET NZB_CATEGORY=%5
Dckehtpc
Posts: 12
Joined: 21 Aug 2017, 20:14

Re: Sabnzbd AMC Script

Post by Dckehtpc »

This is the wrong path for my media and I dont understand where it is getting this information

Illegal Argument: java.nio.file.NoSuchFileException: C:\Program Files\SABnzbd\Shows\Preacher\Season (Shows\Preacher\Season)

My media is located at S:\HTPC_Media\TV Shows\Preacher\Season 2
Dckehtpc
Posts: 12
Joined: 21 Aug 2017, 20:14

Re: Sabnzbd AMC Script

Post by Dckehtpc »

I am getting closer but I cant figure out how I am suppose to enter the paths correctly. I copied the follow cmd script below to see if I can get it to work and I get the following path errors. I read the following statements but it doesnt seem to be working. I think if you can lead me in the right direction here I can figure it out.

1. The folder paths to Location of Downloaded Files (--output) must not end with backslash \ because the value gets passed through as the %D token. So the final backslash \ will escape the double-quote " and mess up everything.

2. It is recommended to use / as separator and not \ since it's also used to escape characters, e.g. --

Script
filebot -script fn:amc --output "S:/TVShows" --action test -non-strict "S:/TVTest" --log-file amc.log --def excludeList=amc.txt


Log errors
Argument[0]: S:\HTPC_Media\TV Shows
Illegal usage: output folder must exist and must be a directory: S:\HTPC_Media\TV Shows
Dckehtpc
Posts: 12
Joined: 21 Aug 2017, 20:14

Re: Sabnzbd AMC Script

Post by Dckehtpc »

I think I have the paths figured out now and this is my latest issue

C:\Program Files\SABnzbd>filebot -script fn:amc --output "S:\TVTest" --action copy -non-strict --log-file amc.log --def excludeList=amc.txt "ut_dir=S:\TVShows\Alone.S04E06.HDTV.x264-KILLERS" "ut_kind=multi" "ut_title=Alone.S04E06.HDTV.x264-KILLERS" "ut_label=*"
'filebot' is not recognized as an internal or external command
Dckehtpc
Posts: 12
Joined: 21 Aug 2017, 20:14

Re: Sabnzbd AMC Script

Post by Dckehtpc »

Okay, I have figured most of this out. Please disregard my earlier post. I will let you know if I have any questions. Thanks again.
Post Reply