Possible to selectively write mediainfo using mi.groovy?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
PersnicketyEcon
Posts: 7
Joined: 12 Jan 2020, 22:47

Possible to selectively write mediainfo using mi.groovy?

Post by PersnicketyEcon »

Seeing DevXen's use of text files here: DevXen's Enhanced TV SHOW Perfection Naming Scheme I was wondering what the best way to generate such a .csv (or .tsv) would be. (Not necessarily for name checking, but possibly.)

I know there is the "mi.groovy" script shown here: Media Index TSV, but that contains far more info than I am looking for. I also saw a way to call specific MediaInfo parameters using the bindings as shown here: MediaInfo Inspector

I'm probably blind and/or thick, but is there a way to use

Code: Select all

filebot -script fn:mi --output /path/to/MediaIndex.tsv /path/to/media/
but with only certain MediaInfo properties?

Primarily I'm just looking to have a glorified file list, something between a simple output of the file directory and the full "MediaIndex.TSV" above.

Among other possibilities, one use case example: my naming scheme usually includes something like

Code: Select all

Firefly S01E01 Serenity [Internal] [42 Min] [2002.12.20] [WEB-DL] [AVC 720p AAC 2ch]
If I have another 720p file, but maybe HDTV, FileBot wouldn't see that as a duplicate. I thought maybe if I had a text file (a la .excludes) to match against that had the attributes I don't want duplicated, say only one HDTV version or only one 720p version, that would be beneficial.

That's just one thing I might want to use it for.

Am I thinking too much/little? :?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Possible to selectively write mediainfo using mi.groovy?

Post by rednoah »

You can print -mediainfo for each file like this:

Code: Select all

filebot -mediainfo -r /input

You can use --format for custom format as usual:

Code: Select all

filebot -mediainfo -r /input --format "{f} | {vc} | {vf} | {ac} | {af}"
:idea: Please read the FAQ and How to Request Help.
PersnicketyEcon
Posts: 7
Joined: 12 Jan 2020, 22:47

Re: Possible to selectively write mediainfo using mi.groovy?

Post by PersnicketyEcon »

Thanks. I probably wasn't clear though. After a cup of coffee, I decided to just try using my own edit of mi.groovy wherein I commented out the attributes I didn't want. (I'm advanced like that.) I was being lazy and was wondering if there was a switch I could use similar to what you showed me with --format, but on the mi script instead. So sort of like:

Code: Select all

filebot -script fn:mi --output /output/path/file.tsv  /input/path --format "{f} | {vc} | {vf} | {ac} | {af}"
I tried a few things but none of them worked. So why recreate the wheel...

Code: Select all

...
...
def model = [
	'Name': 'fn',
	'Container': 'cf',
	'Resolution': 'resolution',
	'Video Codec': 'vc',
	'Video Format': 'vf',
	'Audio Codec': 'ac',
//	'Audio Channels': 'channels',
//	'Audio Languages': 'audioLanguages',
//	'Subtitle Languages': 'textLanguages',
	'Duration': 'hours',
	'File Size': 'megabytes',
//	'Path': 'f.canonicalPath',
//	'Original Name': 'original',
//	'Extended Attributes': 'json'
...
...
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Possible to selectively write mediainfo using mi.groovy?

Post by rednoah »

Not really, since half the mi script is already the definition of column headers and cell formats. Plus, anything you can do with the venerable mi script can also be done with -mediainfo commands and IO redirection > file.

Modifying the mi script is the way to go. It's kept simple and easy to modify by design, so you can modify it to fit your needs easily. ;)
:idea: Please read the FAQ and How to Request Help.
Post Reply