Script for transferring data to a %comment% from a "descript.ion" file

I often make comments in this convenient file descript.ion, total commander displays it perfectly, how to transfer the content to audio files?

See the help on the function to import data from a textfile

The fact is that the file "descript.ion" has many lines and only one can be pulled out in the comments, I do not know how. I hope you understand me and have had experience using comments "descript.ion"

I comment on the artist folder as follows

(Melodic Death Metal, Death Metal, Gothenburg Metal) (Sweden • Göteborg, Västra Götalands län • 1991)

I comment on the album folder as follows

(Album, 2xCD, All Media, Limited Edition) (Century Media) (19439786782) (Europe) (20 Nov 2020) (Rock) (Melodic Death Metal)

I want to spread genres, locations, and comments on the release by tags of audio files

To import data from a source text file, you have to have one line of text per target file. Each line has to feature unique separators between the fields.
The data in the source files could be used either ...
... the order and number of records matches the order and number of the selected target files. In this case you only have to supply the list of fields which should get the data. If this is only the field COMMENT, you may use just %comment%.
... the order and number do not match but each record has one field that contains the filename with extension. In this case MP3tag aligns the data form the source file with the target file.

If you need further help you would have to supply at least one sample record and the list of fields separated by the unique separator.

"Aesma Daeva" (USA) (Symphonic Metal, Gothic metal)
Aetherian (Melodic Death Metal) (Greece)
Aeveron (Melodic Death Metal, Melodic Black Metal) (Germany)
"After Forever" (Holland) (Symphonic Metal, Power Metal, Gothic metal, Progressive Metal)
Akando (Melodic Death Metal, Power Metal) (Germany)
Akrea (Germany) (Melodic Death Metal, Death Metal, Melodic Black Metal)

There are thousands of such lines in a single text file. The structure is the same, each line has at the beginning the name of the file (folder) and a comment related to it, which appears either when you hover the mouse or when you configure the columns in total commander

So you have a filename, some data.
Do you have a unique separator between the fields?

Thank you so much for dealing with my problem, but for understanding you need to use the comments file, it's really very convenient, all the information about the folder is in front of your eyes. The principle is this-the file descript.ion is at the root of the folder and everything that is in it is commented in one file, the text. Based on the capabilities of mp3tag, it will not be possible to extract a certain string, you need to use third-party methods, can you understand better than me?

If the records in the source file match in sequence and number the selected target files, then you can easily import the data with
Converter>Text file-Tag
Field List: %comment%
or even
Field List: %dummy% %comment%
(you have to try it)
If you need the filename to align each source file record with a target file then you have to edit the source file so that the filename is separated from the data for the field COMMENT by a unique separator character. The space character is not unique.
A good one is the pipe character | .
So, the example string from the source file:
01.mp3 Spiderwebs
should become
and the import file list then looks like this:
This should put "Spiderwebs" into the field COMMENT in the file 01.mp3.

This I understood, quite accessible. The problem is that in the descript.ion file there is a whole list of performers, I do not understand how to write a command to select the desired line from the whole list. The usual command adds non-reliable performers and unnecessary comments sequentially to each audio file

It would be best to see a real line (or even better: several lines) from a sample data file.
Then tell us which parts of a line you want to transfer to COMMENT, which ones you want to transfer to other fields and which you don't want at all.

for example, here are 4 lines out of several hundred (as I already mentioned-one comment file contains a list for all folders in the root directory)

"Dark Tranquillity" (Melodic Death Metal, Death Metal, Gothenburg Metal) (Sweden • Göteborg, Västra Götalands län • 1991)
"Dark the Suns" (Gothic Metal, Melodic Death Metal, Symphonic Metal) (Finland • Keski-Suomi, Valkeakoski, Pirkanmaa/Jyväskylä • 2005)
Battlelore (Epic Symphonic Metal, Folk Metal, Gothic Metal, Melodic Death Metal) (Finland • Lappeenranta, Etelä-Karjala • 1999)
"Before the Dawn" (Melodic Death Metal, Gothic Metal) (Finland • Nastola, Päijät-Häme • 1999-2013)

Accordingly, the first phrase is the artist (in the case of a double name, it is enclosed in quotation marks) the second phrase in parentheses is the %genre% the third in parentheses is the %location%

The problem is to assign tags to a specific artist from the list, that is, to find exactly Battlelore, and not something else

If your descript.ion file complies with the linked specification then it should feature the filename somewhere - to be honest: I don't see a filename in any of the lines.

The function to import data from a text file also has a mode when there is no filename.
Then the number and order of the selected files has to match the number and order of the records in the data file.
So to get "Battleore" from the 3rd line into the correct file, the target file has to be the 3rd in the list of selected files. (And, naturally, line 1 is imported in the 1st target file, line 2 in the 2nd and so on).
So, you have to take care the the data source complies with these rules. MP3tag cannot "guess" which record belongs to which file.

There is no file name, there are only the names of the performers ' folders, for example, Battlelore, the format of these messages does not display the entire width, 4 lines were meant here. In the Battlelore folder is the album folder with the name year-name, and in it the audio files in which I rename the tags. In general, I think you also have nothing unusual in the structure

Sorry, this goes around in circles.
I have told several times the requirements of the data source: one line per file (=1 record)
If the data source does not comply with this: hard luck, you have to do something about it. If you don't then you cannot import data from the file in a way that you expect.

I see. Thanks. Maybe someone with the help of third party code for example on python will send the desired string

Doing it with Mp3tag can work like this:

Set a filter that only one file per directory is displayed, i.e. "$num(%track%,1)" IS 1

Now use "Convert > text file - tag" to import one line in each file to a temporary field like %line_temp%

Then use this Export config to create one file for each line named like the directory name from the descript.ion file:

$filename($repl($regexp(%line_temp%,'^("[^"]+"|[^ ]+) .+',$1),",).txt,utf-8)$regexp(%line_temp%,'^(?(?=")"[^"]+" |[^ ]+ )',)

Now you can display all files again and use the Action "Import text file"
Field: a field of your choice
String: ..\%_directory%.txt

You have these parts now in your tag field:
(Melodic Death Metal, Death Metal, Gothenburg Metal) (Sweden • Göteborg, Västra Götalands län • 1991)

and can use further actions to put it in the fields of your choice.

1 Like