Create single playlist where directory contains key value

hi

I wonder if it's possible to use mp3tag to scan my music directories and look for directory names containing a key value to allow a single playlist to be generated for say GENRE1 or GENRE2. So a directory might be:

artist - album [GENRE1] [GENRE2]

For speed it would be great to do this at the directory level only, to save the time and effort of reading files and extracting tags...

I think the first bit is straightforward using the F3 filter:

%_path% HAS "[GENRE1]"

and then generate a playlist using File->Playlist (Selected files).

Is it really that easy?

But the second bit to do it at high speed - my nas is quite slow... and genres can be well scattered.

cheers

You could extend the filter to
%_path% HAS "[GENRE1]" OR %_path% HAS "[GENRE2]"

(this list can become as long as required)

This would show all the files that either have GENRE1 or have GENRE2.
You can then create a playlist of all the selected or shown files.

I do not quite understand why you need to look at the path instead of the GENRE field.

And as for the speed: MP3tag has to read every file ... no matter whether you know that some genres can only pop up in certain folders. It would then be appropriate to load only those files into Mp3tag.

Thanks for that. Experimenting, I find that %_directory% may be a better variable than %_path% because it is the only the directory (does not include the filename like %_path%).

Albums can be in more than one genre... here's an example with three extra "genres" on top of the genre field which might be Jazz.

e.g. Anders Jormin - In Winds, In Light [BASS] [SCANDINAVIAN] [FLAC]

I just tried out mp3tag on a directory on my nas and it took 24 minutes to read 8392 files, so if there's any way to speed this up that would be good.

If you are somewhat familiar with the DOS commandline processor, then you may try out a command likle this ...

DIR /S /AD /B "M:\Music*.*" | FIND /I "[SomeText]" >"%USERPROFILE%\Desktop\Result.txt" & "%USERPROFILE%\Desktop\Result.txt"

... written into one line at the command prompt or written into a "script.cmd" file ...
... then to be executed.

Or use some good file manager like TotalCommander, which have more search and filter methods and can create output into list file.

DD.20131028.1625.CET

Edit:
I will try to explain what is going on there:

DIR /S /AD /B "M:\Music*.*"
This creates a list of all folders matching the given path and folder name mask.

It is possible to search for special foldernames like ...
DIR /S /AD /B "M:\Music*[GENRE1]."

The pipe symbol "|" transfers the output from the DIR command directly to the DOS filter command FIND.
| FIND /I "[SomeText]"
Here it is possible to search for special text on each line of the DIR list file.
This step does not need to be performed if step 1 has already delivered the required result.

Redirect the commandline output into a textfile.
>"%USERPROFILE%\Desktop\Result.txt"
This creates a text file right on the user's desktop.
The type of the file can be named ".m3u" instead of ".txt".

& "%USERPROFILE%\Desktop\Result.txt"
This immediately invokes the standard application related to the given file extension.
This step does not need to be performed.
Simply drag the newly created ".m3u" file from the Desktop into the Mp3tag application window.

A reduced version of the proposed DOS command looks like this ...
DIR /S /AD /B "M:\Music*[GENRE1]." >"%USERPROFILE%\Desktop\Playlist.m3u"

DD.20131028.1829.CET

hi detlev

looks interesting - will the dos command be able to find a directory which includes the target text, then output a playlist line for each mp3 or flac file in there?

cheers

The proposed DOS command creates a simple textfile with each line containing a folder path.
If you rename the textfile from type ".txt" to ".m3u", then Mp3tag can open the ".m3u" file directly and will load all related files.

See my edit in post #4 above.

DD.20131028.1753.CET

Thanks for explaining that.

Can you update these commands to find each directory containing [GENRE1] and then in each found directory, output the full path including filename of each mp3 or flac file (directories can contain other files e.g. jpg or txt).

A typical filename might be:

\\NAS\sonos\artist - album [GENRE1]\01 - song.mp3

I tried the your last command from above:

DIR /S /AD /B "%USERPROFILE%\Desktop\Music*[GENRE1]." >"%USERPROFILE%\Desktop\Playlist.m3u"

notes:

/S recursive
/AD directories only
/B bare format - no headers

out on a test music directory on my laptop (not on the NAS) and got this output in the m3u file:

C:\Users\xxx\Desktop\Music\Al Cohn - Al & Zoot [FLAC] [GENRE1]
C:\Users\xxx\Desktop\Music\Al Cohn - Tour De Force [GENRE1]

These are the correct directories but not the mp3 or flac files. Having said that will these work? I didn't think of that will try this now. I had assumed that individual mp3 or flac files would be needed but perhaps m3u will work at the directory level. Will try this now...

Well the directory level m3u works in foobar2000. Will try a test m3u on my music system....

The directory level m3u works in foobar2000 but not on my sonos music system.

It does look as if it needs individual entries for each mp3 or flac file as per the typical filename above.

Is that possible?

I've just re-read your last post. I think you're saying that I can load up the directory level m3u into mp3tag and from there create a playlist. I'm just going to try that. Sorry to be so thick.

Yes, this looks good.

A textfile of type ".m3u" containing such two lines ...

C:\Users\xxx\Desktop\Music\Al Cohn - Al & Zoot [FLAC] [GENRE1]
C:\Users\xxx\Desktop\Music\Al Cohn - Tour De Force [GENRE1]

... should be loaded without any problem by WinAmp, foobar2000, Mp3tag.

These applications can read the given folder paths and they will display a list of all assigned media type files from within the given folders paths.

This way would be the last resort.

DD.20131029.1350.CET

hi

I generated a [GENRE1] test playlist using your dos command to select the directories, then dragged that into mp3tag and generated a file level playlist. I then rescanned the library to end up with two m3u files in the sonos directory on the NAS, one at directory level and one at music file level. When selected to play, Sonos does nothing with the directory level version, and plays the file level one perfectly.

I'm perfectly happy with that result, in that I have a two stage working solution that I can do some real tagging with and try it out. Hopefully the dos stage will be quite fast, and the preselected directories will be processed reasonably quickly with mp3tag.

I think I will need to map the \\nas to a drive letter for the dos command to work, assuming I run the bat file from my desktop. I'll try that now.

Looks promising.

Thanks

Update: On an approx 8,000 track directory on the NAS, the batch scan took about 1 minute, so that's great. I tried it with a driver letter and it worked, and also with \\NAS so I'll stick with the \\NAS.

Also, I tried out chnaging the artist directory to artist [GENRE1] and that works fine too, so if I want to tag an artist I don't need to tag each album. That's excellent.

I'm just going to try out some real tagging on the NAS

Hmm, 1 Minute on the NAS drive seems to be quite slow.
On my local drive with about 7300 folders with different path depth (average 4 levels, maximal 7 levels deep) the DOS DIR command can create a ...
... complete list of all folderpath names into a textfile within about 6 seconds,
... complete list of about 20000 mp3 filepath names into a textfile within about 5 seconds,
... complete list of about 88000 filepath names into a textfile within about 8 seconds.

DD.20131029.1646.CET

hi

Just wanted to say thanks for your help in this. I've been setting [TAG] against directories and generating playlists by dragging the directory level m3u generated by dir into mp3tag to generate m3u at music file level, as required by sonos. It is very easy to use and relatively quick and it means I get slices through the music that I wouldn't normally play. For example I looked through some music directories and spotted some that I don't remember playing, so I marked the directories with [SELDOM] and there's a playlist.

Cheers