I'm trying to find all media that has spanish language soundtracks. In a previous topic, I was taught that -a anf -G1 can identify the language of the tracks. After fiddling around with find, I saw the helpful tip on the front page that I should probably look into -ext and -if, so here I am ;-)
Running this command:
exiftool -a -g1 -ext m4v -MediaLanguageCode -System:FileName *
I get this:
<snip>
======== ULTIMATE AVENGERS 1.m4v
---- System ----
File Name : ULTIMATE AVENGERS 1.m4v
---- Track2 ----
Media Language Code : eng
---- Track3 ----
Media Language Code : spa
---- Track4 ----
Media Language Code : und
======== Ultimate Avengers II.m4v
---- System ----
File Name : Ultimate Avengers II.m4v
---- Track1 ----
Media Language Code : und
---- Track2 ----
Media Language Code : und
</snip>
So, now I just want the ones that have a 'spa' track. I tried this:
exiftool -a -g1 -ext m4v -MediaLanguageCode -System:FileName -if "$MediaLanguageCode eq 'spa'" *
and this:
exiftool -a -g1 -ext m4v -MediaLanguageCode -System:FileName -if "$MediaLanguageCode == 'spa'" *
but neither returned any results. Perhaps I misunderstand the -if option. Any hints?
thanks,
(extremely awesome tool, btw)
The problem is that if you just specify "$MediaLanguageCode" it will pull out only one of them (likely not the one you wanted). Unfortunately, to do what you want is a bit painful, but can be done:
exiftool -if "$track1:MediaLanguageCode eq 'spa' or $track2:MediaLanguageCode eq 'spa' or $track3:MediaLanguageCode eq 'spa' or $track4:MediaLanguageCode eq 'spa'" ...
- Phil