Combine -mediainfo with info of -rename dryrun

Any questions? Need some help?
Post Reply
davidh2k
Posts: 15
Joined: 21 Sep 2013, 16:50

Combine -mediainfo with info of -rename dryrun

Post by davidh2k »

Hello Forum,
hello rednoah

I have a small script for gathering a csv of my movies. I want to extend it with some fields that seem to be not available when I use

Code: Select all

-mediainfo
like

Code: Select all

{n}
to fetch the proper title of the movie, not just the

Code: Select all

{fn}
filename.





My script (removed unncessary bits, full command down below) as you can see I tried to incoorparate

Code: Select all

{n}
but as it turns out, this seems to be allways empty in the

Code: Select all

-mediainfo
use case.

Code: Select all

filebot -mediainfo -r --format "{n};{fn};person;{resolution};{vf};{vc};{cf};{hd};{ext};{mbps};{Video[0].StreamSizeString3};{gigabytes};{audio[0].Format};{audio[0].Channels};{audio[0].BitrateString};{audio[1].Format};{audio[1].Channels};{audio[1].BitrateString};{audio[2].Format};{audio[2].Channels};{audio[2].BitrateString};{audio[3].Format};{audio[3].Channels};{audio[3].BitrateString};{text[0].Format};{text[0].Language};{text[0].Title};{text[0].StreamSizeString3};{text[1].Format};{text[1].Language};{text[1].Title};{text[1].StreamSizeString3};{text[2].Format};{text[2].Language};{text[2].Title};{text[2].StreamSizeString3};{text[3].Format};{text[3].Language};{text[3].Title};{text[3].StreamSizeString3}" --file-filter f.video /volume1



Is there a way to combine information from a dryrun of

Code: Select all

-rename
and

Code: Select all

-mediainfo
into a single line/output?




Full command, yup, might be a bit overblown, but some files really have up to 10 Subtitles... I didn't check if those (two files) even have more.

Code: Select all

docker run --rm -it -v $(pwd):/volume1 -v /filebothdatapath/filebot/data:/data rednoah/filebot -mediainfo -r --format "{n};{fn};person;{resolution};{vf};{vc};{cf};{hd};{ext};{mbps};{Video[0].StreamSizeString3};{gigabytes};{audio[0].Format};{audio[0].Channels};{audio[0].BitrateString};{audio[1].Format};{audio[1].Channels};{audio[1].BitrateString};{audio[2].Format};{audio[2].Channels};{audio[2].BitrateString};{audio[3].Format};{audio[3].Channels};{audio[3].BitrateString};{text[0].Format};{text[0].Language};{text[0].Title};{text[0].StreamSizeString3};{text[1].Format};{text[1].Language};{text[1].Title};{text[1].StreamSizeString3};{text[2].Format};{text[2].Language};{text[2].Title};{text[2].StreamSizeString3};{text[3].Format};{text[3].Language};{text[3].Title};{text[3].StreamSizeString3};{text[4].Format};{text[4].Language};{text[4].Title};{text[4].StreamSizeString3};{text[5].Format};{text[5].Language};{text[5].Title};{text[5].StreamSizeString3};{text[6].Format};{text[6].Language};{text[6].Title};{text[6].StreamSizeString3};{text[7].Format};{text[7].Language};{text[7].Title};{text[7].StreamSizeString3};{text[8].Format};{text[8].Language};{text[8].Title};{text[8].StreamSizeString3};{text[9].Format};{text[9].Language};{text[9].Title};{text[9].StreamSizeString3};{text[10].Format};{text[10].Language};{text[10].Title};{text[10].StreamSizeString3}" --file-filter f.video /volume1 > /exportpath/filebot/data/mediainfo5.csv
Sample output:

Code: Select all

;Can.A.Song.Save.Your.Life!.2013.WEBDL-1080p;person;1920x1040;1080p;x264;mkv;HD;mkv;7.9 Mbps;3.47 GiB;6.2;DTS;6;1 509 kb/s;DTS;6;1 509 kb/s;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Cap.und.Capper.2.-.Hier.spielt.die.Musik.2006.Bluray-1080p;person;1920x1080;1080p;x264;mkv;HD;mkv;5.1 Mbps;1.79 GiB;2.6;AC-3;6;640 kb/s;AC-3;6;640 kb/s;;;;;;;UTF-8;de;Forced Subs;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Greetings
David
User avatar
rednoah
The Source
Posts: 22969
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Combine -mediainfo with info of -rename dryrun

Post by rednoah »

1.
If you have previously processed your files with FileBot, then movie metadata will have been stored to xattr, and that would then make movie metadata bindings work in subsequent -mediainfo calls:
viewtopic.php?t=324

:!: If your files have not previously been processed with FileBot, and thus do not have xattr metadata stored alongside each file, then movie metadata bindings will not work.


2.
If your files are reasonably well-named then you can probably instantly guess the movie name from the file name, e.g. just pick the substring before the year pattern:

Code: Select all

{ fn.before(/\d{4}/).normalizePunctuation() }
:idea: Please read the FAQ and How to Request Help.
davidh2k
Posts: 15
Joined: 21 Sep 2013, 16:50

Re: Combine -mediainfo with info of -rename dryrun

Post by davidh2k »

Thank you rednoah, in fact they have not been processed by filebot before, but rather radarr.

But thanks to your extended code snippet for the {fn} tag, it seems I get what I wanted. I'll let it run now and check if it works for the complete library.

Edit: It seems some don't seem to work, so I may shoot some examples when it's done the whole library.

Thank you very much. :)

Greetings
David
davidh2k
Posts: 15
Joined: 21 Sep 2013, 16:50

Re: Combine -mediainfo with info of -rename dryrun

Post by davidh2k »

Update: It just failed on 4 Movies. Any Idea why it may failed on those 4? Not a big of an issue though.

Image

Greetings
David
User avatar
rednoah
The Source
Posts: 22969
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Combine -mediainfo with info of -rename dryrun

Post by rednoah »

"just pick the substring before the year pattern" doesn't work if the movie name itself is a year pattern.

Easily fixed by requiring there to be a few extra characters before our year pattern:

Code: Select all

{ fn.before(/(?<=....)\d{4}/).normalizePunctuation() }
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Combine -mediainfo with info of -rename dryrun

Post by kim »

is your movies in own folder ?
just use

Code: Select all

{file.parentFile.name}
Post Reply