Kids Movies

Running FileBot from the console, Groovy scripting, shell scripts, etc
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Kids Movies

Post by Jerome2626 »

Hi I have been using Filebot on Windows with bat file which has been working, butI have now switched over to Unraid and have installed Filebot Docker and bought a Filebot license. I really want it to work on Unraid.

I have also SABnzbd and Sonarr dockers which I would like to use it with.

I have these folders

Code: Select all

/mnt/user/Film (Movies)
/mnt/user/KidsFilm (Kids Movies)
/mnt/user/Serier (Series)
/mnt/user/KidsSerier (Kids Series)

/mnt/user/downloads/complete/film (Movies)
/mnt/user/downloads/complete/serier (Series)

I see 2 scenarios:

1. That when Sab places DL in complete folder Filebot AMC should see these two folders (movies/tv) and then rename, move and find artwork for the items and place it in /mnt/user where I have Movies/Tv libraries.
The problem with this solution is that I have 2 libraries for kids also, which if I use this solution Filebot would not be able to place the files in the correct folders.

2. Is that I will have 4 scripts, 1 for each categori and use the scripts when Sabnzbd finishes downloading.
This would be the ideal solution.

I would like for Filebot to rename, find subtitles in da, en, find artwork and move files to correct loacation.
I'm guessing refresh of Plex libraries would also be perfect as a final touch.

The naming I would like:

Code: Select all

Movies: Moviename (year)\Moviename (year).ext
Series: Seriesname (year)\Seriesname (year) sx0e episode name quality.ext
for instance The Series Title (2010) 1x01 Episode Title (1) HDTV-720p
My earlier bat files was this below for reference:

Movies:

Code: Select all

@ECHO OFF
cd /d %1
cls
CALL d:\Programmer\Java_64\bin\java.exe -jar d:\Programmer\Filebot\filebot.jar -rename -r -non-strict \\unraid\downloads\complete\ --db TheMovieDB --format "\\Unraid\Film\{n} ({y})/{n} ({y}){' CD'+pi}{'.'+lang}"
CALL d:\Programmer\Java_64\bin\java.exe -jar d:\Programmer\Filebot\filebot.jar -script fn:suball "\\Unraid\Film" -get-subtitles --lang da,en -non-strict --def maxAgeDays=7
CALL "d:\Programmer\Ember Media Manager\Ember Media Manager.exe" -updatemovies -scrapemovies newauto all -nowindow
CALL "C:\Program Files (x86)\cURL\curl.exe" http://XXX:3240/library/sections/03/refresh?X-Plex-Token=XXX
Series:

Code: Select all

@ECHO OFF
cd /d %1
cls
CALL d:\Programmer\Java_64\bin\java.exe -jar d:\Programmer\Filebot\filebot.jar -rename -r -non-strict \\unraid\downloads\complete\serier\ --db TheTVDB --format "\\UNRAID\Serier\{n}\Season {s}/{n} {sxe} {t}"
CALL d:\Programmer\Java_64\bin\java.exe -jar d:\Programmer\Filebot\filebot.jar -script fn:suball "\\Unraid\Serier" -get-subtitles --lang da,en -non-strict --def maxAgeDays=7
CALL "d:\Programmer\Ember Media Manager\Ember Media Manager.exe" -profile "default" -updatetvshows -scrapetvshows newskip all -nowindow
CALL "C:\Program Files (x86)\cURL\curl.exe" http://www.xxx:32400/library/sections/01/refresh?X-Plex-Token=xxx
Thanks for the help.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Really need help with scripting:

Post by rednoah »

The amc script will do everything you want. Making multiple filebot -script fn:amc ... calls with different --def ut_label parameters for each of your movie / series folders is probably a good idea.



:!: The use of java -jar filebot.jar is unsupported and bad practice. Use filebot instead, because filebot.exe will initialize the process with various default system properties the lack of which will lead to untested code paths / non-standard behaviour.
:idea: Please read the FAQ and How to Request Help.
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

Thanks for the help. In regards to the Java commands and bat files these are the old files where the Filebot docker will not use these. What I'm seeking help for is converting it to shell scrip or something I can pass to Sabnzbd so Filebot can do the work. Thanks for the help and the great program.
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

Can anyone help with this. I'm seeking a shell script for Sabnzbd for the things I mentioned above?
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

Will this work in a bash?

Code: Select all

filebot.sh -script fn:amc /mnt/disks/WDC_WD30EZRX-00D8PB0_WD-WCC4N7VXZ3TR/downloads/complete/Film --output /mnt/user/Film/{n} ({y})/{n} ({y}){' CD'+pi}{'.'+lang} --action move --def "ut_label=movie" --def artwork=y --def subtitles=da,en --log-file amc.log --conflict override -non-strict
Also where do I see if my license is activated in the Unraid docker?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Really need help with scripting:

Post by rednoah »

1.
Please read Cmdline and Argument Passing for details.


2.
FileBot is a command-line tool. Run. Read the output. Repeat. You will find the answer to all your questions in the console output when you run filebot. ;)
:idea: Please read the FAQ and How to Request Help.
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

Thanks for the answer.
I've used many hours and I got it somehow working:

Code: Select all

/opt/filebot/filebot -script fn:amc /mnt/disks/WDC_WD30EZRX-00D8PB0_WD-WCC4N7VXZ3TR/downloads/complete/film --output /mnt/user/Film/ --action test -non-strict --conflict override --lang da --def "ut_label=movie" --def movieFormat="/mnt/user/Film/{n} ({y})/{n} ({y}){' CD'+pi}{'.'+lang}" --def artwork=y --def subtitles=da,en --log-file amc.log --def clean=y
This is working

but
2 questions:

1. How do I get it to working in Sabnzbd script.
I've tried:

Code: Select all

#!/bin/sh

 
FILE_PATH="$1"
FILE_NAME="$3"
FILE_CATEGORY="$5"

/opt/filebot/filebot -script fn:amc /mnt/disks/WDC_WD30EZRX-00D8PB0_WD-WCC4N7VXZ3TR/downloads/complete/film --output /mnt/user/Film/ --action test -non-strict --conflict override --lang da --def "ut_label=movie" --def movieFormat="/mnt/user/Film/{n} ({y})/{n} ({y}){' CD'+pi}{'.'+lang}" --def artwork=y --def subtitles=da,en --log-file amc.log --def clean=y
but doesn't work

How do I convert it to a working script. I've made it executable.


2. In the first script when searching for subtitles I get the following error:

Code: Select all

No matching subtitles found: /mnt/disks/WDC_WD30EZRX-00D8PB0_WD-WCC4N7VXZ3TR/downloads/complete/film/Name of movie (2019) - 1080p - RAPiD/Name of movie (2019).mkv
I've put in my credentials at OpenSubtitles, and the srt is on OpenSubtitles. Is it because it searches for complete library + moviename?
Thanks for the help again.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Really need help with scripting:

Post by rednoah »

1.
What does the console output say when it doesn't work?


2.
The amc script will only search for subtitles in strict mode, i.e. Exact Search: Lookup by Hash.
:idea: Please read the FAQ and How to Request Help.
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

1. It gave this:

Code: Select all

/bin/sh: 0: Illegal option -
When I try bash it says:

Code: Select all

Cannot run script /config/scripts/Film.sh
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Really need help with scripting:

Post by rednoah »

Google:

Code: Select all

/bin/sh: 0: Illegal option -
Find:
https://github.com/carlossg/docker-mave ... -527748335



TL;DR You're accidentally using Windows Line Endings \r\n because you're using Windows and a bad editor. You need to use Unix Line Endings \n for shell scripts. This is usually default, unless you're using Windows Notepad something.
:idea: Please read the FAQ and How to Request Help.
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

Thanks I have now tried once more to convert it this and get the following error:

Code: Select all

/mnt/disks/WDC_WD30EZRX-00D8PB0_WD-WCC4N7VXZ3TR/downloads/complete/scripts/test.sh: line 8: /opt/filebot/filebot: No such file or directory
/mnt/disks/WDC_WD30EZRX-00D8PB0_WD-WCC4N7VXZ3TR/downloads/complete/scripts/test.sh: line 21: --def: command not found
I'm really lost here, since I've tried everything. Have made Sabnzbd priveliged also.

Code: Select all

#!/bin/sh
or (tried both same error)
#!/bin/bash


# SABnzbd Post Processing Script - www.Filebot.net "AMC" Script

FILE_PATH=$1
FILE_NAME=$3

   /opt/filebot/filebot -script \
   fn:amc \
   /mnt/disks/WDC_WD30EZRX-00D8PB0_WD-WCC4N7VXZ3TR/downloads/complete/film \
   --output /mnt/user/Film/ \
   --log-file amc.log \
   --action move \
   --conflict override -non-strict \
   --lang da \
   --def "ut_label=movie" \
   --def movieFormat="/mnt/user/Film/{n} ({y})/{n} ({y}){' CD'+pi}{'.'+lang}" \
   --def artwork=y \
   --def subtitles=da,en \
   --log-file amc.log \ 
   --def clean=y \
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Really need help with scripting:

Post by rednoah »

Code: Select all

/opt/filebot/filebot: No such file or directory
:arrow: the path the the executable is wrong

Code: Select all

--def: command not found
:arrow: something is wrong, and that something leads to the shell interpreting the --def argument as if it's a new command, so best guess you're using \ wrong somewhere. Might be easier to do it all in a single line.



:!: Looks like you're having a hard time with the basics. I highly recommend having a Linux-savvy friend help you out in person in real-time. Forums back-and-forth doesn't work well if you're gonna need help every single step of the way. ;)
:idea: Please read the FAQ and How to Request Help.
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

I fixed the --def command, that was missing an \ in the end.
However I'm afraid the following is not related to the missing Linux skills, since I can run the command in shell and it's working.

I'm guessing it's because SABNzbd is one docker and Filebot is another and I want to call Filebot executable from another docker with perhaps some missing access.
/config/scripts/test.sh: line 8: /opt/filebot/filebot: No such file or directory

If you have other ideas please let me know.

I would also be interested if Filebot could separate normal movies and Kids movies in one command together with series, then I could just use standard Filebot Docker.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Really need help with scripting:

Post by rednoah »

1.
It's fundamentally impossible for one container to execute commands in another. For all accounts and purposes, two containers are like two physically different machines. Please read up on docker and the concept of containerization before using docker.


2.
FileBot can sort movies into arbitrary folder structures based on arbitrary rules. What defines Kids Movies as opposed to Normal Movies is something that you have to codify in your custom format. There are various examples here in the forums.
:idea: Please read the FAQ and How to Request Help.
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

1. Thanks yes I know that but what I was hoping for was perhaps some kind of symbolic links could help and with right previlidges but I guess not.

2. Is there an example where it is incorporated in the AMC?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Really need help with scripting:

Post by rednoah »

1.
No, because containers are "physically separate" so Machine A can't remotely executed code on Machine B, just like a random hacker on the internet can't remotely executed random code on your local machine.

:idea: You can of course configure Machine A to log into Machine B via SSH and then run commands and stuff like that. But that's complicated and out of scope here.


2.
Yes, you will find many example here in the forums. The amc script manual does include a section on using custom formats.
:idea: Please read the FAQ and How to Request Help.
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

So I want to sort the 3 categories in 1 call using label and move it to 3 separate directories, how do I do that?

Code: Select all

--def "ut_label=Kids" should go to /mnt/user/Kids
--def "ut_label=Movies" should go to /mnt/user/Movies
--def "ut_label=Series" should go to /mnt/user/Series
How do I get it into this script?

Code: Select all

/opt/filebot/filebot -script fn:amc /mnt/disks/WDC_WD30EZRX-00D8PB0_WD-WCC4N7VXZ3TR/downloads/complete/film --output /mnt/user/Film/ --action test -non-strict --conflict override --lang da --def "ut_label=movie" --def movieFormat="/mnt/user/Film/{n} ({y})/{n} ({y}){' CD'+pi}{'.'+lang}" --def artwork=y --def subtitles=da,en --log-file amc.log --def root=y --def clean=y
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Really need help with scripting:

Post by rednoah »

If you're using --def ut_label to force movie / series mode then you'd have to make different calls for different label + input folder combinations.


:idea: Note that --def ut_label is for Movie / Series auto-detection only, and thus only allows you to either force Movie mode or Series mode. If no label is specified, then the built-in auto-detection will take care of that decision.


:idea: Note that Kids is not a valid label and thus will be ignored. Kids Movies would still fall within the Movie category as far as auto-detection is concerned. If you want a Kids Movies output folder, then you'd either specify that via --output, but that of course assumes that all input files are Kids Movies. You can also make that distinction in the format.



EDIT:

TL;DR depending on wether you have one input folder that contains all your files, or you have 3 separate input folders for your 3 separate categories, the best approach is going to be vastly different, e.g. --def ut_label is useful only if you know in advance that the input folder is going to be all movies / all episodes / etc.
:idea: Please read the FAQ and How to Request Help.
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

Thanks for the explanation. So to sum up. I can't do it in 1 call the things I want?
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

I have a Downloads/completed folder where I have 2 subfolders inside. Movies and Series.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Really need help with scripting:

Post by rednoah »

Jerome2626 wrote: 11 Mar 2020, 13:48 Thanks for the explanation. So to sum up. I can't do it in 1 call the things I want?
You can. You just can't use --def ut_label because you don't want to force neither Movie mode nor Series mode because your one input folder contains both. But that's fine. FileBot will just use auto-detection, and since your folders are named Movies and Series, FileBot won't have a hard time there.
:idea: Please read the FAQ and How to Request Help.
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

But the problem is I have Kids which still should have its own folder and if I can't label/mark the kids files then how would Filebot place it in its own folder in the same calæ. Sorry for not understanding that.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Really need help with scripting:

Post by rednoah »

There are many movies in your Movies folder. If you were to organize files manually, how would you know which arbitrary movie file in your Movies folder is a Kids Movie?
:idea: Please read the FAQ and How to Request Help.
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

What I thought about doing is get Sabnzbd to presort and add a custom name to the movie to mark it as "Kid" tag, place it in the same download output folder as the other movies/series and let Filebot pick them up, rename and place them in the correct folders and get Metadata for it. Does that makes sense?
Jerome2626
Posts: 25
Joined: 07 Mar 2020, 12:56

Re: Really need help with scripting:

Post by Jerome2626 »

If you still think that can be made by 1 AMC call then that would be nice.
Post Reply