Filebot & SABnzbd+

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
jacox
Posts: 7
Joined: 16 Feb 2014, 15:57

Filebot & SABnzbd+

Post by jacox »

So I've been trying desperately to finish the final piece of my media nirvana puzzle.

Currently I have the following setup which works perfectly. SABnzbd + Couchpotato + Sickbeard. This is all setup perfectly for my needs.

My issue is with movies. Currently SABnzbd is setup so that when a movie has finished downloading, it notifies Couchpotato which Couchpotato then moves the downloaded movie from my temporary download location, to its final resting place in /media/D2/Movies/.

This works great and I have a large collection of movies. Recently I discovered FileBot, and renamed all of my movies and sorted them accordingly using this expression:

Code: Select all

//Volumes/Movies (2)/{n.upperInitial()} ({y})/{n.upperInitial().space('.')}.{y}.{vf}.{vc}
I have been running FileBot on my Mac over an ethernet network. My server runs Ubuntu Linux. I have now installed FileBot on my server in my quest for automation nirvana and want to achieve the following. After SABnzbd finishes downloading the movie it runs a script which initiates FileBot to run my rename expression. Simple?

SABnznd allows for external scripts to be run. However, I have no idea how to go about this..

Where do I start?
User avatar
rednoah
The Source
Posts: 23939
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot & SABnzbd+

Post by rednoah »

Well, you'd start with opening the cmdline and playing with filebot. Once you are able to run a command that renames/moves files as you want from a fixed folder you just have to paste it into whatever-tool and replace the fixed folder with some variables that should be provided to by given tool.
:idea: Please read the FAQ and How to Request Help.
jacox
Posts: 7
Joined: 16 Feb 2014, 15:57

Re: Filebot & SABnzbd+

Post by jacox »

I've given up with integrating this into SABnazbd for the time being. For the time being I just want to figure out the correct command to use in the CLI.

I want to use this expression:

Code: Select all

{n.upperInitial()} ({y})/{n.upperInitial().space('.')}.{y}.{vf}.{vc}
.

My movies are automatically placed into a folder and I just want to run this expression on each new movie that is copied to this folder. But i'm not sure how?

From what I've read and attempted to understand it would go something like this:

Code: Select all

filebot -rename . --format "{n.upperInitial()} ({y})/{n.upperInitial().space('.')}.{y}.{vf}.{vc}"
I will be adding the test action for the first run. I have run this as is, and it just says no new media files. There are two new movies that have yet to be name correctly in the folder however? Am i missing something obvious here?
jacox
Posts: 7
Joined: 16 Feb 2014, 15:57

Re: Filebot & SABnzbd+

Post by jacox »

This script seems to do the trick:

Code: Select all

filebot -script fn:renall "path/to/movies" -non-strict --db TheMovieDB --def target=folder
In test mode it detects that there are already correctly named movies in the folder and skips them, while picking up the two new movies. It only seems to rename movies though, but I want it to rename the files using the expression I posted earlier.

This is so confusing..
User avatar
rednoah
The Source
Posts: 23939
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot & SABnzbd+

Post by rednoah »

. is resolved by the shell to all files in the current folder, and you are apparently in a folder where there are no media files when calling this.

Just pass in an absolute path to where the media files are, and set -r if the files are in sub-folders.
:idea: Please read the FAQ and How to Request Help.
jacox
Posts: 7
Joined: 16 Feb 2014, 15:57

Re: Filebot & SABnzbd+

Post by jacox »

Ok. I am using this script which seems to be picking up the new movies and renaming them accordingly:

Code: Select all

filebot -script fn:renall . --db TheMovieDB -non-strict -r --format "{n.upperInitial()} ({y})/{n.upperInitial().space('.')}.{y}.{vf}.{vc}" --action test
This is perfect. However, it is also renaming all of my scraped metadata. How can I tell the script to just rename the .movie file and nothing else. I have hundreds of movies, all with scraped metadata. I don't want to rename this.

Here is what I mean:

Code: Select all

Auto-detect movie from context: [/media/D4/Movies/Afternoon Delight/Afternoon Delight 2013- resolution bluray.mkv]
[TEST] Rename [/media/D4/Movies/Afternoon Delight/Afternoon Delight 2013- resolution bluray.mkv] to [Afternoon Delight (2013)/Afternoon.Delight.2013.1080p.x264.mkv]
Processed 1 files
Rename movies using [TheMovieDB]
[TEST] Rename [/media/D4/Movies/Aladdin (1992)/Aladdin.1992.1080p.x264.nfo] to [Aladdin (1992)/Aladdin.1992.1080p.x264.nfo]
[TEST] Rename [/media/D4/Movies/Aladdin (1992)/Aladdin.1992.1080p.x264.mkv] to [Aladdin (1992)/Aladdin.1992.1080p.x264.mkv]
[TEST] Rename [/media/D4/Movies/Aladdin (1992)/Aladdin.1992.1080p.x264-banner.jpg] to [Aladdin (1992)/Aladdin.1992.1080p.x264.jpg]
[TEST] Rename [/media/D4/Movies/Aladdin (1992)/Aladdin.1992.1080p.x264-fanart.jpg] to [Aladdin (1992)/Aladdin.1992.1080p.x264.jpg]
[TEST] Rename [/media/D4/Movies/Aladdin (1992)/Aladdin.1992.1080p.x264-landscape.jpg] to [Aladdin (1992)/Aladdin.1992.1080p.x264.jpg]
[TEST] Rename [/media/D4/Movies/Aladdin (1992)/Aladdin.1992.1080p.x264-poster.jpg] to [Aladdin (1992)/Aladdin.1992.1080p.x264.jpg]
Processed 6 files
User avatar
rednoah
The Source
Posts: 23939
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot & SABnzbd+

Post by rednoah »

You would have to only pass in the video files and not the extras, and for that you'd probably need to modify the script or be very smart with passing cmdline arguments.
:idea: Please read the FAQ and How to Request Help.
jacox
Posts: 7
Joined: 16 Feb 2014, 15:57

Re: Filebot & SABnzbd+

Post by jacox »

Well in that case I give up. Back to the GUI for me.
User avatar
rednoah
The Source
Posts: 23939
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot & SABnzbd+

Post by rednoah »

Shouldn't be too hard, just find and xargs:
http://en.wikipedia.org/wiki/Xargs
:idea: Please read the FAQ and How to Request Help.
jacox
Posts: 7
Joined: 16 Feb 2014, 15:57

Re: Filebot & SABnzbd+

Post by jacox »

I've come up with this.

Code: Select all

find "." -iname "*.mkv" -execdir filebot --db TheMovieDB -non-strict -r --format "{n.upperInitial()} ({y})/{n.upperInitial().space('.')}.{y}.{vf}.{vc}" --action test
I haven't had a chance to test it yet, but I will tonight.
User avatar
rednoah
The Source
Posts: 23939
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot & SABnzbd+

Post by rednoah »

That'll probably work but i think it'll call filebot for every single file so it's a bit inefficient. I think with xargs you can make it work so that it's called with many file arguments in one call.
:idea: Please read the FAQ and How to Request Help.
ihearall
Posts: 2
Joined: 24 Feb 2014, 05:53

Re: Filebot & SABnzbd+

Post by ihearall »

Hey jacox,

I have also been playing with SABnzbd+ and Sickbeard so I figured I would give you what I have:
https://www.dropbox.com/s/ozmowx6aahtjl ... cripts.zip
In this are 3 things:
- A modified amc.groovy that I played with until it suited my needs
(only things you should need to change are under this heading
// series/anime/movie format expressions
def format = [
simply put you format, I have 2 drives one for TV Series T:/ and one for movies M:/ so you would need to change these to suit your setup)
I also needed to modify the Cleaner.groovy file so it would call in the correct functions
- And so you can run filebot from SABnzbd a .bat file which you need to open in notepad (or whtaever coder you use) and change the script location.

The only issue that I have with this is that for some reason the amc script is refusing to accept anything with a blank space:

Code: Select all

C:\Program Files (x86)\SABnzbd>filebot -script "U:/Script/amc.groovy" --output "T:/" --action move -non-strict ""U:\Complete\Top Gear.21x03.720p HDTV x264-FoV"" --def subtitles=en clean=y 
Parameter: subtitles = en
Parameter: clean = y
Location: U:\Complete\Top
Location: C:\Program Files (x86)\SABnzbd\Gear.21x03.720p
Location: C:\Program Files (x86)\SABnzbd\HDTV
Location: C:\Program Files (x86)\SABnzbd\x264-FoV
Exception: File not found: U:\Complete\Top
Failure (~_~)
Launch4j: Failed to run the given command.
As we can see in this error log. Any Ideas Rednoah??????

Hope this helps..........
User avatar
rednoah
The Source
Posts: 23939
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot & SABnzbd+

Post by rednoah »

Since when does cmd support any kind of ""..."" double double quote magic?

Trick question. It obviously doesn't.
:idea: Please read the FAQ and How to Request Help.
ihearall
Posts: 2
Joined: 24 Feb 2014, 05:53

Re: Filebot & SABnzbd+

Post by ihearall »

Unfortunately true it could never handle ""xxxxxxxxxxxx"", but for the life of me I cannot figure out where the "" is coming from because as you can see if the folder path does not contain any spaces everything is passed on fine:

Code: Select all

C:\Program Files (x86)\SABnzbd>filebot -script "U:/Script/amc.groovy" --output "T:/" --action move -non-strict "U:\Complete\The.Walking.Dead.S04E10.HDTV.XviD-EVO" --def subtitles=en clean=y 
Parameter: subtitles = en
Parameter: clean = y
Location: U:\Complete\The.Walking.Dead.S04E10.HDTV.XviD-EVO
Input: U:\Complete\The.Walking.Dead.S04E10.HDTV.XviD-EVO\The.Walking.Dead.S04E10.HDTV.XviD-EVO.avi
Group: [tvs:The Walking Dead] => [The.Walking.Dead.S04E10.HDTV.XviD-EVO.avi]
Probably should have said something along these lines in the last post to avoid confusion............... ahh 20/20 hindsight

I was wondering if you had any idea's on how this could be solved, SABnzbd has an option to change the files themselves so there are no spaces, just not the parent folder unfortunately. I've run out of ideas......

Maybe a script before the amc.groovy that removes spaces, but while I can modify code reasonably well, creating it from scratch is out of my league (unless is fortran or MatLAB or any other scientific/math based code)
User avatar
rednoah
The Source
Posts: 23939
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Filebot & SABnzbd+

Post by rednoah »

No idea where those extra "..." quotes are coming from. As long as the correct cmdline is called it'll work. I guess you'll have to just try step by step which program is passing in the wrong arguments, and fix that, or think of some work around. Seems like things are put into quotes twice. FileBot can't do that cause by the time filebot is called the arguments are already split up and it'd be hard to guess what it should have been.
:idea: Please read the FAQ and How to Request Help.
Post Reply