[HELP] Excluding All Non-Media Files In CLI

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Deadmano
Posts: 21
Joined: 20 Jan 2013, 21:20

[HELP] Excluding All Non-Media Files In CLI

Post by Deadmano »

Hey Noah!

It's been a while since I've posted on your forums, and I must say I'm loving the new change, especially the new updates to FileBot!! :mrgreen: Recently I've decided to give full reins to FileBot, and start with the CLI, however I'm having a slight issue... Before I was used to dragging in files and manually excluding ones I don't want (.nfo, .srt .etc) however with the CLI it will just mass move everything it matches to...

Now I read up on a forum post somewhere that you linked to a file I just had to edit with;

Code: Select all

input = input.findAll{ it.isVideo() }
However I don't seem to be getting it right...

All I want is to be able to ONLY move video files (.mp4, .avi, .mkv) etc and leave behind the subtitles, nfo's, etc.

My CLI currently is;

Code: Select all

filebot -rename "H:/Movies To Sort/" --db IMDB --format "H:/Movies/{imdb.genres.take(1).join(' ')}/{n.replaceAll(':', replacement = ' -')} ({y})" --conflict skip
This basically renames files in the specified folder, switches to IMDB for its matching, then a bit of tricks you taught me to get it to use the genre as a folder name, finally skips all conflicts. Does a great job, except for the manual processing afterwards. :(

I'm hoping you'll have an easy enough fix for me to implement.

All of the best, and long live FileBot!! :mrgreen:
User avatar
rednoah
The Source
Posts: 23942
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [HELP] Excluding All Non-Media Files In CLI

Post by rednoah »

1.
You could do that with a Groovy script one-liner. So you would just do filebot -script and then the rest is in your groovy script. So you have to "port" your command-line to Groovy syntax.

2.
On Unix you can easily use find | xargs to run your filebot command on a specific set of files.
:idea: Please read the FAQ and How to Request Help.
Deadmano
Posts: 21
Joined: 20 Jan 2013, 21:20

Re: [HELP] Excluding All Non-Media Files In CLI

Post by Deadmano »

rednoah wrote:1.
You could do that with a Groovy script one-liner. So you would just do filebot -script and then the rest is in your groovy script. So you have to "port" your command-line to Groovy syntax.

2.
On Unix you can easily use find | xargs to run your filebot command on a specific set of files.
Hey Noah! :D

I'm nowhere near as a code lord such as yourself! So I honestly would not know where to start. :( Isn't there a line I can quickly call from a .groovy script that you're aware of, like the one I mentioned above? Everything works perfectly, I just want it to ignore all non-media files. Any references you can point me to in that case so I can try figure it out on my own? :)

Thanks in advance! :mrgreen:
User avatar
rednoah
The Source
Posts: 23942
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [HELP] Excluding All Non-Media Files In CLI

Post by rednoah »

Windows or Linux? Method 1 or 2?

Here's Method 1 since it works for both.

Method 1:
Create new .groovy file, and paste:

Code: Select all

rename(file: args.getFiles{ it.isVideo() }, db:'IMDb', format: '''H:/Movies/{imdb.genres.take(1).join(' ')}/{n.replaceAll(':', ' -')} ({y})''')
Run script with filebot:

Code: Select all

filebot -script myscript.groovy /path/to/input
:idea: Please read the FAQ and How to Request Help.
Deadmano
Posts: 21
Joined: 20 Jan 2013, 21:20

Re: [HELP] Excluding All Non-Media Files In CLI

Post by Deadmano »

rednoah wrote:Windows or Linux? Method 1 or 2?

Here's Method 1 since it works for both.

Method 1:
Create new .groovy file, and paste:

Code: Select all

rename(file: args.getFiles{ it.isVideo() }, db:'IMDb', format: '''H:/Movies/{imdb.genres.take(1).join(' ')}/{n.replaceAll(':', ' -')} ({y})''')
Run script with filebot:

Code: Select all

filebot -script myscript.groovy /path/to/input
Thank you Noah! This is exactly what I had wanted to achieve! :D I was almost there, haha, but with your help it now works 100% as expected, still have to manually move the bulk renamed movies into the actual movies folders but that is far better than having a repeat of when I had Sickbeard try to automate things and remove ALL my content!! :o Loving the new Filebot version and interface by the way, I hope FileBot endures on forever, and as usual I am spreading the word and hopefully more donations do roll in so you can continue doing your awesome work! :)
Post Reply