Working on my first script

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Grassy
Posts: 5
Joined: 06 Oct 2016, 10:17

Working on my first script

Post by Grassy »

Hi guys,

I have been looking for a while for something to automate my media server a little better and I have just come across this tool, it looks amazing!

I have a few questions I couldn't find by looking at the AMC overview and other links on that page.

what does the non-strict argument do? '-action copy -non-strict'

Do I still need to specify '--output' when using '--def movieFormat' etc?

Is there anyway to run this as a service or should I just schedule a task and select 'Run whether a user is logged on or not'?

Would anyone be able to take a look at this code I put together reading a few things tonight:

Code: Select all

filebot -script fn:amc /D:\Temp --output /E: --def movieFormat="E:/Movies/{ny}/{fn}" 

seriesFormat="E:/TV Shows/{n}/Season {s}/{fn}" animeFormat="E:/Animated TV Shows/

{n}/Season {s}/{fn}" --action copy -non-strict --log-file amc.log --def 

excludeList=amc.txt
Thanks heaps!
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Working on my first script

Post by rednoah »

1.
-non-strict enables non-strict processing which means FileBot will do it's best to guess things. If you don't set the -non-strict flag it'll probably refuse to process certain ambiguous / badly named files. Run a few tests and look at what the output says. ;)

2.
--output is required and the amc script will throw an error if you don't specify a valid folder.

3.
Since when do Windows paths start with / before the drive letter?


Open CMD and run your filebot call (e.g. with --action test). 2 & 3 should give you errors right away. It's MOST HIGHLY RECOMMENDED to run some tests before you copy your command into your scheduler.


PS: I recommend keeping everything on the same filesystem (i.e. drive) so you can use --action hardlink.
:idea: Please read the FAQ and How to Request Help.
Grassy
Posts: 5
Joined: 06 Oct 2016, 10:17

Re: Working on my first script

Post by Grassy »

Thanks for your reply.

I will carry out a test run and see what happens, Would you be able to let me know why i still need to use the "output" parameter if i an using the '--def movieformat' etc?

Edit: What does '--action hardlink' do?
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Working on my first script

Post by rednoah »

1.
--output is used internally for various reasons so you must pass a valid --output folder. Not passing --output is the same as passing --output . so you better know what you're doing if you don't explicitly set the --output folder.

It'll also make your command-line call more clean:

Code: Select all

--output "E:" --def movieFormat="Movies/{ny}/{fn}" seriesFormat="TV Shows/{n}/Season {s}/{fn}" ...

2.
--action hardlink means that FileBot will create hardlinks so you can have the same file multiple times in different folders with different names without taking up extra disk space.

@see https://en.wikipedia.org/wiki/Hard_link
:idea: Please read the FAQ and How to Request Help.
Grassy
Posts: 5
Joined: 06 Oct 2016, 10:17

Re: Working on my first script

Post by Grassy »

Thanks for your reply, I have done some tests and it works awesome!

I have changed the script slightly to use the 'move' command and also got it to clean up the files after!

Code: Select all

filebot.launcher.exe -script fn:amc D:\Temp --output E: --def movieFormat="E:/Movies/{ny}/{fn}" seriesFormat="E:/TV Shows/{n}/Season {s}/{fn}" animeFormat="E:/Animated TV Shows/{n}/Season {s}/{fn}" --action move -non-strict --def deleteAfterExtract=y --def clean=y --log-file amc.log --def excludeList=amc.txt
Edit: I just re-read your reply, I am going to change the other paths to just be the working DIR since i don't need the drive letter again once specifying it using the '--output' command!

Cheers!
Grassy
Posts: 5
Joined: 06 Oct 2016, 10:17

Re: Working on my first script

Post by Grassy »

Hey,

Do i need to use '--def excludeList=amc.txt' if i am cleaning the folder using '--def deleteAfterExtract=y --def clean=y' as filebot will not be processing the same files over and over again?

Also can i specify a directory for this parameter '--log-file amc.log' i.e. '--log-file C:\Path\Goes\here\amc.log', can I do the same with '--def excludeList=amc.txt'?

Edit: I have noticed that the log file is growing quite fast... Do I need to keep a log if everything is working fine?

Thanks
User avatar
rednoah
The Source
Posts: 23953
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Working on my first script

Post by rednoah »

1.
Yes, you should do --def excludeList=amc.txt just in case you're messing up somewhere (e.g. by assuming that all files will always be moved, which is an incorrect assumption). ;)

2.
Yes, you can specify absolute paths, but wouldn't just trying it be faster than asking? :lol:

3.
Yes, you need the log because you need them after the fact if something strange has happened (again, you're assuming that everything will always be fine, which is an incorrect assumption). ;)

Any single file you rename with FileBot is probably larger than all the logs it'll ever write in your lifetime... "the log file is growing quite fast" is a really bad argument for not keeping logs. :lol:
:idea: Please read the FAQ and How to Request Help.
Grassy
Posts: 5
Joined: 06 Oct 2016, 10:17

Re: Working on my first script

Post by Grassy »

Haha, so very true! I am going to change the paths of the log file and exclude list just to make myself happy... and pretend I didn't just ask silly questions (it's really late :()
Post Reply