Assuming that you are currently in the subdirectory with music files, and those files are of type .ogg and you want to create a playlist file named _great.m3u which contains the names of the songs with “World of Warcraft” in the album name, this one liner creates such a file:
exiftool -p '$filename' -if '$album =~ /World of Warcraft/' *.ogg 2> /dev/null > _great.m3u
Assuming that you then wanted to add the files of type mp3 from the artist E.S. Posthumus, this one liner adds to that file:
exiftool -p '$filename' -if '$artist =~ /E.S. Posthumus/' *.mp3 2> /dev/null >> _great.m3u
Assuming that you then wanted to add files of type mp3 with the Genre of “Classical”, this one liner adds these to that file:
exiftool -p '$filename' -if '$genre =~ /Classical/' *.mp3 2> /dev/null >> _great.m3u
Assuming that you then wanted to add files of type mp3 with the Comment of “VIVA EL PRESIDENTE!”, this one liner adds these to that file:
exiftool -p '$filename' -if '$comment =~ /VIVA EL PRESIDENTE!/' *.mp3 2> /dev/null >> _great.m3u
exiftool is the wonderful utility written and maintained by Phil Harvey
-p '$filename' prints the file name. We later strip off the other stuff by redirecting stderr to null. That’s the
2> /dev/null part.
-if '$album =~ /World of Warcraft/' and
-if '$artist =~ /E.S. Posthumus/' are matches against a regular expression.
=~ says we are doing a match and the text between the slashes are what need to be present for the match to report true.
> _great.m3u overwrites the existing file, but then
>> _great.m3u appends to it.
Care to guess who purchased the collector’s editions of some of the games so I could get a CD of the game music (or files from Steam)?
One thing (I don’t know that it’s a problem, really) is that Artist =~ /E.S. Posthumus/ will find the same file as Genre =~ /Classical/ so the same songs end up in the playlist twice. Maybe I just like E.S. Posthumus so much that I want their chance of being picked by the shuffler better than average. 😉
But if that’s not your bag, this will make a new file (with a new name) which contains only unique song file names:
sort _great.m3u --unique --output=_great-unique.m3u
If you happen to have your own NextCloud with the Music Player app, you can import this _great-unique.m3u file directly into a new playlist.