Export to multiple txt files

Hi!

I'd like to export the content of %unsyncedlyrics% of a number of files. But I want an individual .txt-file for every respective music file. I've fiddled around with MP3-Tag a bit but I found no way to export to multiple .txt - files. By the way, this is the configuration I'm using:

$filename(C:\\%title% - %artist% - %album%.txt)$replace(%unsyncedlyrics%,eng||,)

All the best and thanks in advance!

Please search yourself.
http://www.google.de/search?q=site%3Aforum...+unsyncedlyrics

DD.20110112.1048.CET

It seems that this proposal still works as designed:
Exporting UNSYNCEDLYRICS to Individual Text Files

The following Mp3tag mte export file creates a command file, which - when running - creates multiple text files in the same folder, where the music files are stored.

$filename($left(%_workingpath%,2)\TEST\Export.USLT.cmd,ANSI)'@ECHO OFF'

$loop(%_folderpath%%_filename_ext%) $if(%UNSYNCEDLYRICS%,'SET FILEOUT='$replace(%_folderpath%%_filename%,'&','^&','%','%%')'.USLT.txt' 'IF EXIST "%FILEOUT%" DEL "%FILEOUT%" >NUL:' 'ECHO.FILEOUT: "%FILEOUT%"' $regexp($regexp($regexp($char(10)$replace(%UNSYNCEDLYRICS%,'|','^|','>','^>','<','^<','"','^"','&','^&','%','%%')$char(13),'\n','\nECHO.'),'\r','>>"%FILEOUT%"\r'),'^\n(.+)\r$','$1'),) $loopend() 'PAUSE'

Export_USLT_2.mte ( 491bytes ) Number of downloads: 68

DD.20110113.1046.CET

Because file names may occur, which do not work together with the above export script in the DOS command shell, I have changed the export script as following ...

01: $filename($getEnv('USERPROFILE')'\Desktop\Mp3tag.Report.USLT.ToFolderFile.cmd',ANSI)'@ECHO OFF'

02: 'CHCP 1252 1>NUL 2>NUL'
03: 'SET FILELIST="%USERPROFILE%\Desktop\Mp3tag.Report.USLT.List.txt"'
04: 'IF EXIST %FILELIST% DEL %FILELIST% >NUL'
05: $loop(%_path%)
06: $if(%UNSYNCEDLYRICS%,'SET FILEOUT="'$replace(%_folderpath%%_filename%,'%','%%')'.USLT.txt"'
07: 'IF EXIST %FILEOUT% ECHO.%FILEOUT%>>%FILELIST%'
08: 'IF EXIST %FILEOUT% DEL %FILEOUT%>NUL'
09: 'ECHO.FILEOUT: %FILEOUT%'
10: $regexp($regexp($regexp($char(10)$replace(%UNSYNCEDLYRICS%,'|','^|','>','^>','<','^<','"','^"','&','^&','%','%%')$char(13),'\n','\nECHO.'),'\r','>>%FILEOUT%\r'),'^\n(.+)\r$','$1'),)
11: $loopend()
12: 'CHCP 850 1>NUL 2>NUL'
13: 'PAUSE'
14: 'START "" %FILELIST%'

Export_CMD_USLT_Each_To_One_File.mte (724 Bytes)

DD.20120703.1040.CEST

Export_CMD_USLT_Each_To_One_File.mte (724 Bytes)

Thanks. I entered in much broader search terms so somehow I missed that topic.

I've modified your .mte slightly to adjust it to what I want it to do, but somehow I can't make it export to Unicode. Would you know a fix for that?

Well, I am glad that you got it right working for you!
Please let us know about your modifications, maybe some other can use it too, especially me.

See Mp3tag Export help manual, function $filename(), set second parameter to UTF-8 should create UTF-8 Unicode output.
See Mp3tag/Options/Export regarding usage of the BOM (Byte Order Mark).

DD.20110124.1610.CET

Well, I only modified the output path of the txt-files and added "eng||," to the replace function to remove the language markers inside ID-tags, so modification is maybe a little bit too broad a term.
Anyway, regarding Unicode:
When I change

$filename($left(%_workingpath%,2)\TEST\Export.USLT.cmd,ANSI)

to

$filename($left(%_workingpath%,2)\TEST\Export.USLT.cmd,utf-8)

the resulting .bat-file doesn't do anything at all.

Yes, you are right, my bad, I did not respect, that we are talking about DOS command files.
A command file should not, must not be coded as UTF-8, even if prepended with the correct BOM, it simply does not work.

So you have the problem how to export language specific special Unicode characters from the Mp3tag Uncode application down to DOS codepage related environment and up to some other Unicode related application.

Anyway this could be done, possibly with the loss of accuracy on special characters.
How this could be done is demonstrated in this cmd script in this thread:
batch file to check for missing covers

But there might be other ways to go. Maybe convert Unicode characters before exporting by function $ansi() or write an action group which converts some Unicode characters into a surrogate format U+0000 and re-convert them later back into Unicode characters.

The best solution would be, that the Mp3tag developer Florian implements a tag field related export action to ANSI/Unicode text file.

DD.20110128.2255.CET

Well, I don't know. I'm really a newbie when it comes to this kind of scripting stuff. So this is a little too complex for me. I guess I'll just use an Unicode converter (and correct the filenames that originally contained Unicode chars) after I've used your batch file for now and cross my fingers for future MP3tag features that make all this easier.

Thanks for all your help, though!!

Hi, you might try this approach if it suits you:

/t/17691/1

peilung