Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Request: Batch file to extract CUESHEET+EACLOG? (Read 7551 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Request: Batch file to extract CUESHEET+EACLOG?

Hi,

I have several dozens of rips in which I embedded the EAC log and the cue sheet, and unfortunately I deleted all the original .log and .cue files. Now I want to have them back in order to back them up in archives for safe keeping.

So I've been searching for a windows batch file here that would make this task much simpler (drag'n'drop the audio files on the script), but without success.

I would like to write such a script myself, but I have no clue about windows command shell scripting, it's so different from unix shell scripting...  So if there's somone around who would be willing to write such a batch script for me (and for whom else it may be useful) that would be terrific!

IMHO these are some minimum criterias in order to make it easy to use:
  • Batch script should create the cue sheet and eac log files with the same basename as the audio file. For instance the audio file is "Boards of Canada - 1998 - Music has the Rights to Children.wv" and the cue sheet would then be named "Boards of Canada - 1998 - Music has the Rights to Children.cue".
  • If there's one of the two tags missing then creating the according file should silently be omitted. So a smart script that only does the things it is able to do without complaining about missing tags.
  • A version that does the opposite would be nice, too: Embedding <basename>.cue and <basename>.log into <basename>.wv|ape|flac|[...]. Also only doing the things it can do without complaining, if there's only a log file only EACLOG tag gets written, and so on...
  • works with multiple audio files
  • I guess the tag.exe v2.0.46b1 is the tagger of choice  I've noticed some problems with the string  "; " in EAC logs, which got fixed in that beta release.
  • easy way to edit the paths to the executables and also the standard tag field names (I use CUESHEET and EACLOG by the way) at the beginning of the batch file

Cheers!

Request: Batch file to extract CUESHEET+EACLOG?

Reply #1
It seems you can't display single tag fields with tag.exe, only all tag fields at once. Am I right?

If so, is there a way to / a NT command line tool around that will save the contents of single tag fields to an external file?

EDIT:

I just found out that Mp3Tag can be used for my task. This is even better than a batch script! Why haven't I thought about this in the first place?!? 

Anyway, it's as simple as writing an export configuration. This simple line here will do the trick for the EAC log:
Code: [Select]
$filename(log)$loop(%_path%)%eaclog%$loopend()

and
Code: [Select]
$filename(cue)$loop(%_path%)%cuesheet%$loopend()

for the cue sheet respectively. So far this only works with single selected files, but I'm sure I'll get it to work with a list of many files as well.

Piece of cake...

Request: Batch file to extract CUESHEET+EACLOG?

Reply #2
I guess the tag.exe v2.0.46b1 is the tagger of choice  I've noticed some problems with the string  "; " in EAC logs, which got fixed in that beta release.
Ah, yes.  Thanks for reminding me about that one.  That really should be released.  For those interested Fandango highlighted the issue that Tag uses ";" as a delimiter for tag values; however EAC log files often contain ";".  I have therefore changed the delimiter to "<#>" to stop confusion.  Does anyone actually use this feature anyway?

I'm glad you have found a solution.  FYI, you can easily export the CUESHEET tag using Tag.exe (>= 2.0.45):

Code: [Select]
--tocue <scheme>  : output cuesheet tag to file, name generated from <scheme>
--tocuen <name>   : output cuesheet tag to file <name>
--tocuea          : output cuesheet tag to file, name generated from source

However, there is no similar way to export EACLOG.  One general solution would be to provide a switch like --export <tag>, e.g.: TAG.EXE --export EACLOG myfile.wv.  This could write only that tag to STDOUT which could then be redirected to a text file, e.g.: TAG.EXE --export EACLOG myfile.wv > log.txt.  Dunno.
I'm on a horse.

Request: Batch file to extract CUESHEET+EACLOG?

Reply #3
In fact, I've just done it, although I've used the far more confusing switch --tostdoutn, e.g.:

TAG.EXE --tostdoutn EACLOG myfile.wv>log.txt

Or:

Code: [Select]
@ECHO OFF
SET tmp="%TEMP%\tmp.txt"
FOR /R %%G in (*.wv) DO CALL :GetTags "%%G"
DEL %tmp%
GOTO:EOF
:GetTags
    TAG.EXE --tostdoutn EACLOG --hideinfo --hidetags --hidenames %1>%tmp%
    CALL :RenameTemp %tmp% "%~dpn1.log"
    TAG.EXE --tostdoutn CUESHEET --hideinfo --hidetags --hidenames %1>%tmp%
    CALL :RenameTemp %tmp% "%~dpn1.cue"
GOTO:EOF
:RenameTemp
    IF %~z1 NEQ 0 MOVE %1 %2
GOTO:EOF


Download 2.0.46b2 if you feel like playing.
I'm on a horse.

Request: Batch file to extract CUESHEET+EACLOG?

Reply #4
Oh, that's fantastic! Thanks a million.

Request: Batch file to extract CUESHEET+EACLOG?

Reply #5
Does that mean you've tried it?

Well, better late than never I guess.  It seemed like it could be useful, so I thought I'd give it a go anyway.

The only thing I don't really like is that it is really only useful when dealing with one file.  The benefit of --tocue/a/n is that it will work even if you do TAG --recursive --tocuea *.wv.  That said, this technique allows you to deal with the output pretty much as you like (redirect to file; pass to another app; etc.).
I'm on a horse.

Request: Batch file to extract CUESHEET+EACLOG?

Reply #6
Please Note:

I created 2.0.46b2 on XP at work, and it worked fine.  I tried it here at home on Win 2K and it crashed.

I have fixed the bug and re-uploaded.  The zip file is the same, but you will notice when running that the fixed version is labelled 2.0.46b2a.
I'm on a horse.

Request: Batch file to extract CUESHEET+EACLOG?

Reply #7
Thank you so much Synthetic Soul for adding this switch also, it's very much appreciated  It's really nice to be able to extract embedded cuesheets and now also embedded EAC log files with the use of batch files, instead of having to do it manually through copy/paste in fb2k. Again, thank you very much for your continued efforts of making TAG.EXE even better than it allready was.

CU - Martin.

Request: Batch file to extract CUESHEET+EACLOG?

Reply #8
Thanks Martin H, it's good to know that it will be useful to some people.

I thought of another use this morning: extracting the value of core tags, like Artist and Album, for use elsewhere in a batch file, e.g.:

Code: [Select]
@ECHO OFF

SET file=myfile.mp3

CALL :GetTag ARTIST %file%
CALL :GetTag ALBUM %file%
CALL :GetTag TITLE %file%
CALL :GetTag TRACK %file%

ECHO %ARTIST%
ECHO %ALBUM%
ECHO %TITLE%
ECHO %TRACK%

PAUSE

GOTO:EOF

:GetTag
    TAG.EXE --tostdoutn %1 --hideinfo --hidetags --hidenames %2>"%TEMP%\tmp.txt"
    SET /P %1=<"%TEMP%\tmp.txt"
    DEL "%TEMP%\tmp.txt"
GOTO:EOF

Using this technique you can easily create a batch file variable, with the same name as the tag, set to the content of the tag.

Could be useful...
I'm on a horse.