Exporting UNSYNCEDLYRICS to Individual Text Files

I've recently converted my entire music collection to 128kbps to save some room (it has cut the size of the collection from 25GB to 15GB - recommended if you're not an audiophile) using dbPowerAmp. Now, DBPA saves the id3v2 tag when converting, including even the album art, but it DOES NOT include lyrics. I'm looking for a way to transfer the UNSYNCEDLYRICS from the old files to the new ones. I solved half the problem, as MP3TAG allows an action that copies a text file (%artist% - %title%.txt) to the UNSYNCEDLYRICS field. But, I need a way to first create those some-4000 text files, each named %artist% - %title%.txt according to the song - which isn't possible (as far as I can tell), because you can't use "export" with more than one output file.

Or... Can you?

(Other methods of completing this mission are obviously also welcome)

Lots and lots of thanks.

I don't think that this is possible via exporting an importing lyrics to and from text files.

Another solution is to copy the tags of the old files via [Ctrl+C] and paste them to the new files via [Ctrl+V].

Hope this helps.

Kind regards,
Florian

Well, Florian, if you would change export script syntax a little bit, then it should be possible.
Example:

$loop(%_path%)$filename(%_path%.USLT.txt,ANSI,n)%unsyncedlyrics%$loopend()

Change
$filename(filepath,encodingtype)
to
$filename(filepath,encodingtype[,writetype])

  • let $filename() be freely applied by user anywhere in the export script where it is needed (not only at the beginning of the script)
  • add a third optional parameter which controls creating of a new file (always overwrite existing file) resp. appending to an existing file (if file not exist, then create file); with optional parameter "n" for "new" and "a" for "append".

DD.20080530.0709.CEST

Sure, adding more features to the export language could overcome this current limitation. Unfortunately, adding new features to the language it's not planned at the moment.

Kind regards,
Florian

Well, the major point was to get it done in some kind of automated procedure, so copy/paste will be a last resort.

I guess I'll just have a friend of mine write me something in Java for this.

Thanks for the replies, though.

As a first step you may use an export script e. g.

$filename(Z:\OutAllLyrics.txt,ANSI)$loop(%_folderpath%%_filename_ext%)### %_folderpath%%_filename%.USLT.txt
%UNSYNCEDLYRICS%
$loopend()

Afterwards split the output file into separated files going down along the lines and repeatingly use an inserted pathname to create a new file which you can fill with the following lyrics sequence.

Unfortunately you cannot use simple DOS command language for this purpose, because the command FOR loop skips empty lines.

DD.20080606.0728.CEST

There is a 3 step workaround.

  1. For all selected mp3 files run one export script, which extracts the unsyncedlyrics tag field contents from each mp3 file and creates one DOS batch command file for all.
    When this command file runs afterwards it will create automatically named text files, each containing the unsyncedlyrics tag field contents of one mp3 file.
    This part of the process slightly modifies the data for safe processing through the DOS command interpreter.

  2. Run external command file.
    This will create one text file per unsyncedlyrics tag field contents in the same folder where the source mp3 file resides.
    This part of the process slightly modifies the data by appending a space character at end of each line.

  3. Import unsyncedlyrics text file/s contents into some tag field into some mp3 file/s.
    Remove data modifications to get an identically copy of the original unsyncedlyrics tag field contents.

ad 1. Export script "Export USLT":

$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,\n'ECHO.'),\r,' >>"%FILEOUT%"'\r),^\n(.+)\r$,$1),)
$loopend()
'PAUSE'

Note: Adapt working folder path to your needs.
Caution: Previewing export output command file will instantly run the command file.

ad 2. Example part of command file:

SET FILEOUT=O:\TEST\T\80er\01.USLT.txt
IF EXIST "%FILEOUT%" DEL "%FILEOUT%" >NUL:
ECHO.FILEOUT: "%FILEOUT%"
ECHO.eng^|^|A beautiful and blinding morning >>"%FILEOUT%"
ECHO.The world outside begins to breathe >>"%FILEOUT%"
ECHO.See clouds arriving without warning >>"%FILEOUT%"
ECHO.I need you here to shelter me >>"%FILEOUT%"
ECHO. >>"%FILEOUT%"
ECHO.And I know that only time will tell us how >>"%FILEOUT%"
ECHO.To carry on without each other >>"%FILEOUT%"
ECHO. >>"%FILEOUT%"

ad 3. Import actionsgroup "Import USLT.mta":

Begin Actionsgroup Import USLT

Action #1
Actiontype 14: Import text file
Field: USLT
Filename: %_folderpath%%_filename%.USLT.txt

Action #2
Actiontype 4: Replace with regular expression
Field: USLT
Regular expression: ÷\r
Replace matches with: \r

[_] case sensitive comparison

Action #3
Actiontype 4: Replace with regular expression
Field: USLT
Regular expression: \r\n\Z
Replace matches with:

[_] case sensitive comparison

Note: Replace one special character ÷ with one space character.
End Actionsgroup Import USLT (3 Actions)

Note: Adapt the tag field name to your needs.

DD.20080611.1705.CEST