Help

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
yay101
Posts: 6
Joined: 18 Dec 2011, 13:02

Help

Post by yay101 »

Hey! I am currently trying to make a script that takes all files in a folder "/media/uuid/tv/in" Then runs a rename on the files treating them individually and pushes them to "/media/uuid/tv/out" In the folder / rename structure

"./{n}/Season {s.pad(2)}/{n} - {s.pad(2)}{e.pad(2)} - {t}"

However after spending a few hours not understanding the premade scripts, or more why they actually ork and where they are putting the files i decided to post and ask instead of wasting more time.

For more specifics i would like these files to be checked with tvdb.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help

Post by rednoah »

What do you mean by treating files individually? Can we assume there is only TV show episodes in the folder or movies as well?

You can try this, writing from the top of may have to fix typos

"/media/uuid/tv/in".listFiles{ it.isVideo() }.each {
rename(file:it, db:"thetvdb", format:"/media/uuid/tv/out/{n}/Season {s.pad(2)}/{n} - {s.pad(2)}{e.pad(2)} - {t}", strict:true)
}
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help

Post by rednoah »

btw default values are set by the cmdline call eg -script abc --format ... But can be overriden in the script by just giving it as parameter rename(format:..)
:idea: Please read the FAQ and How to Request Help.
yay101
Posts: 6
Joined: 18 Dec 2011, 13:02

Re: Help

Post by yay101 »

By individually i mean i don't want the program assuming they are all episodes of the same show. Movies will be given their own script.

Having that command used so cleanly, i can now better understand this so thanks. i shall play around with this when i get out of class in a few hours.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help

Post by rednoah »

Allowing multiple shows by folder can be enabled by allowing -non-strict matching. Don't even need a script for that, just filebot -rename -non-strict ...
:idea: Please read the FAQ and How to Request Help.
yay101
Posts: 6
Joined: 18 Dec 2011, 13:02

Re: Help

Post by yay101 »

Got an error when i ran that script, it didn't seem to like the list files command. Or perhaps the run closure argument, whatever that is behind the scenes.

You can see the output of the terminal attached and i typed the script, spaces and all as it was displayed in this thread.

Okay sweet, so if i change the strict at the end of the script to non strict it should be fine? Otherwise i will remove it and just add the command to my .sh for launching filebot.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help

Post by rednoah »

In the script strict:true should be fine as well since each files is treated individually. But for the usecase you just told me you don't need scripting at all, the normal cmdline -rename should be a me to handle that if you enable comprehensive matching via -non-strict

I'm writing this on my phone so I can't test anything, but should work like this.
:idea: Please read the FAQ and How to Request Help.
yay101
Posts: 6
Joined: 18 Dec 2011, 13:02

Re: Help

Post by yay101 »

Hey mate, you were right. It is indeed far easier to just use the CLI.

My CLI currently reads:
java -jar ~/FileBot.jar -rename "/media/d371490f-2a37-4a19-a988-08b48f538ef4/Tv/In" --db thetvdb -non-strict --log all --output "/media/d371490f-2a37-4a19-a988-08b48f538ef4/Tv/Out/" --format "{n}/Season {s.pad(2)}/{n} - {s.pad(2)}{e.pad(2)} - {t}"

It is meant to follow the output command and put it in the out folder however currently it is just renaming and putting them back in the right folder in the in folder.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help

Post by rednoah »

The --format option defines the whole path, not just the filename.

--output is not what you think, only for -get-subtitles and -create-sfv
:idea: Please read the FAQ and How to Request Help.
yay101
Posts: 6
Joined: 18 Dec 2011, 13:02

Re: Help

Post by yay101 »

Cheers, that definitely helps.
Post Reply