Genre From Filename?


#1

Hello All,

I was wondering if anyone can maybe point me in the right direction here.

Is it possible to create an action that will update the genre for an album from the title of a text file?

For example, say I have an album in a directory and I have one text file called:
00 ~ Genre ~ Electronic - Minimal-Tech House.txt

Would it be possible to update genre to "Electronic - Minimal-Tech House". I can't think of a way to do it.

Again, any pointers would be much appreciated.


#2

So, you have used a file name to store information that should appear inside a file?
MP3tag has some functions that consider the filename (of mp3 files) and/or the directory name.
As -so I take it - the genre is something to be valid for all the files in a directory, I suggest that you use the means of the filesystem to transfer the information.
So write yourself a batch job that
a) finds all the 00-Files and writes them to a file
(open a cmd window, execute
dir /s 00*.txt > genrefiles.txt
then edit the file genrefiles.txt so that you append the directory names by the filename, e.g.
Beatles - Revolver
becomes
Beatles - Revolver _ 00 - Genre - Beat Music
use the dos-commands
cd
ren
to rename the directories.
THen open MP3tag and use the function "Filename - Tag" with a mask like
%dummy% - %dummy% _ 00 - Genre - %genre%

So: To my opinion this will take an awful lot of time and I think you are much better off to scan through the directories manually and enter the genre manually also.


#3

Interesting proposal by ohrenkino!
This folder renaming trick sounds to be feasable.

But the cmd.exe command line needs some refinement.
Example:
cmd.exe /cdir /b/s/-p "O:\TEST\00 ~ Genre ~*.txt" >>O:\TEST\ListOfGenreFiles.txt

This will create a text file, which contains a list of filepathes.
Example:
O:\TEST\T1\Divers\00 ~ Genre ~ Electronic - Minimal-Tech House.txt
O:\TEST\T1\Rock\00 ~ Genre ~ Rock - Alternative.txt

Then you can use this list as input for another batch command file, which does the job of renaming the folder:
Read each line.
Get old folderpath.
Replace "\00" with " ~ 00".
Replace ".txt" with "" (... or suppress file extension).
Create new folderpath.
Do the folder renaming from old folderpath to new folderpath.

Example:
Rename
O:\TEST\T1\Divers
to
O:\TEST\T1\Divers ~ 00 ~ Genre ~ Electronic - Minimal-Tech House

Rename
O:\TEST\T1\Rock
to
O:\TEST\T1\Rock ~ 00 ~ Genre ~ Rock - Alternative

Make sure, that you have a second batch command file, which is able to revert the folder renaming afterwards, after the GENRE tag fields have been set.

The GENRE tag field can be set from partly content of the pseudo tag field _DIRECTORY.

Example using action "Format value" along with function regexp():
Tag field: GENRE
Format string: $regexp(%_DIRECTORY%,'^(.+?) ~ (.+?) ~ (.+?) ~ (.+?)$','$4')
will set the tag field GENRE to:
Electronic - Minimal-Tech House

Example using action "Guess values":
Source format: %_DIRECTORY%
Guessing pattern: %DUMMY% ~ %DUMMY% ~ %DUMMY% ~ %GENRE%
will set the tag field GENRE to:
Electronic - Minimal-Tech House

The last step is to rename the folders back to their original folder name.
This can be done eiither from inside of Mp3tag by setting the pseudo tag field _DIRECTORY to a value created from other tag fields, or from outside of Mp3tag by an external batch command file.

DD.20100702.1619.CEST


#4

Awesome & thank you both very much for your time.

I successfully changed my directories to include the genre in the directory name and then re-tagged everything with a guess value that picked up the genre. Don't know why I didn't think of that - it is a much easier solution.

MP3Tag is sure a swell program -- I can't believe how much time I have spent manually tagging things before.

Again, thanks.