Playlist creation using an Export script

Hello community,

I have been using Mp3tag for a while to manage my music collection, but I have previously not used the more advanced features such as Actions and Scripting. I have to admit, I am really struggling in trying to understand their usage. If my questions seem a bit basic, then please forgive my ignorance...

My objective is to create various playlists based on criteria such as a specific artist (eg. Roxy Music), a genre (eg. Pop), or a time span (1990-1999).

Having read through the many community posts, my understanding is that the recommended approach would be to create an Export script.

I have started to create a simple playlist creation script as shown below to scan (loop) through my music collection. I am using the $if function to select entries matching a specific artist (in this case, Roxy Music).

#EXTM3U
$loop(%_path%)
$if($eql(%artist%,'Roxy Music'),Match,NoMatch)
.....
$loopend()

I am struggling with the syntax of the $if function above. The "Match" and "NoMatch" shown above are simply placeholders to help you understand what I am trying to do.

When the $if function returns true (ie. Match, an entry is found that matches the desired artist), then the following lines should be written to the playlist file:

#EXTINF:%_length_seconds%,%artist% - %title%
..\FLAC%artist%%album%%_filename_ext%

When the $if function returns false (ie. NoMatch) then nothing should be written to the playlist file.

I would really appreciate some guidance on how to correctly code the script.

Thanks very much for your efforts!

TBH: I find the idea to create an export script with a more or less complicated conditional query in it rather awkward.
I would use a filter with
%artist% HAS "Roxy Music"
or even
%artist% IS Roxy Music
and then apply a generic export script for a playlist or use the already out-of-the box function
File>Playlist (all files)
or
File>Playlist (selected files).
If you use the filtern then you don't have to edit the export script for every new criterion.

If you insist on an export script, and you want to get the same order as the file list, then don't use
$loop(_path%) but $loop(1) - otherwise the files will be arranged by path which may not be what you like.

Hi Ohrenkino...
Thanks for the quick response and your recommendations.
I have done some initial testing using filters and they appear to work just fine. It is definitely much easier to use filters than to create export scripts.
I think the filters will be quite sufficient for my needs.
Thanks again!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.