Move all or none from CLI

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
IfThenERROR
Posts: 7
Joined: 18 Jun 2017, 23:45

Move all or none from CLI

Post by IfThenERROR »

Hello all,

I've written a script that automatically processes recorded video files and in the course of that calls the filebot CLI to rename and move the files with clean filenames. The renaming part works well in general, but I encountered a specific problem, I could not solve yet.

The script passes two files to filebot – a video file and a corresponding .edl file (a marker to skip commercials). Now in certain situations a .edl file at the target destination exists, but no video file. Then filebot moves the video file and leaves the .edl in place, no matter what setting for --conflict I choose. Unfortunately this doesn't make any sense since the .edl belongs to and works with just that one specific video.

Does anybody know how to make filebot process either ALL passed files or NONE if any conflict appears? Alternatively if filebot would not move the files at all, but instead return the new path and filename according to the naming settings it would also solve this.

I'm sure this would both be possible with a script, but before digging into the groovy language I'd prefer a CLI option.

Many thanks in advance! :D

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

Re: Move all or none from CLI

Post by rednoah »

Thanks for the post! Before a real human comes by, please make sure your report has all the following points checked:
  • What are you trying to do achieve? What's not working? What have you tried so far?
  • Include screenshots, logs or filenames (i.e. demonstrate the issue)
  • Include basic information (i.e. sysinfo output)
:idea: Please read How to Request Help and Fix Problems, Report Bugs, Get Features
: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: Move all or none from CLI

Post by rednoah »

This log shows that FileBot works as expected:

Code: Select all

filebot -rename Logan.mkv Logan.edl --conflict override --db TheMovieDB --output OUTPUT

Code: Select all

Rename movies using [TheMovieDB]
Auto-detect movie from context: [Logan.mkv]
[MOVE] from [Logan.mkv] to [OUTPUT/Logan (2017).mkv]
[OVERRIDE] Delete [OUTPUT/Logan (2017).edl]
[MOVE] from [Logan.edl] to [OUTPUT/Logan (2017).edl]
Processed 2 files

The command and console output is pretty useful, eh? ;)
:idea: Please read the FAQ and How to Request Help.
IfThenERROR
Posts: 7
Joined: 18 Jun 2017, 23:45

Re: Move all or none from CLI

Post by IfThenERROR »

Hi Rednoah,

thank you for the super fast reply!

Of course I can provide a sample:

Code: Select all

filebot --output "/home/osmc/TV/" --lang "de" --encoding Windows-1252 --action move --conflict fail --db TheTVDB --q "The Mentalist" -rename "/home/osmc/TV/The Mentalist - Unangreifbar.mkv" "/home/osmc/TV/The Mentalist - Unangreifbar.edl" -non-strict -no-xattr --format "./{n.ascii()} ({y})/{s00e00}.{t.ascii()}"

Code: Select all

Rename episodes using [TheTVDB]
Fetching episode data for [The Mentalist]
[MOVE] From [/home/osmc/TV/The Mentalist - Unangreifbar.mkv] to [/media/TVRecorder-NAS/TV/./The Mentalist (2008)/S05E07.Unangreifbar.mkv]
Processed 1 files
File already exists: /media/TVRecorder-NAS/TV/./The Mentalist (2008)/S05E07.Unangreifbar.edl
Failure (°_°)

The file S05E07.Unangreifbar.edl already exists in the target directory, so the video file is moved, while the corresponding .edl is not.

Just to be clear, my question was not about an unexpected behaviour from filebot. It does exactly what it is supposed to do! The question is, if there is a CLI parameter, to modify the behaviour to only move either all files if there are no conflicts, or no file at all if there is any conflict.
Or alternatively a command to move no file at all, but instead output the determined new filename and path in a way that can be used in a shell script.
Cheers!

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

Re: Move all or none from CLI

Post by rednoah »

I see. You want FileBot to treat these files as a single unit. Unfortunately, that's not supported. In this case, your only option is --conflict override, or building some more complex logic around the filebot calls to do all the pre- and post-checks you want. For example, you could process files into a temporary directory first, and then compare that to your real output folder to see if there's any overlaps, and then decided to move or not to move based on that.
:idea: Please read the FAQ and How to Request Help.
IfThenERROR
Posts: 7
Joined: 18 Jun 2017, 23:45

Re: Move all or none from CLI

Post by IfThenERROR »

Thank you!

Using a temporary dir might be the way to go then. I'll look further into that.

And thanks for this lovely piece of software, Filebot really makes life way easier!

Cheers Malte
Post Reply