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: Convert Cue Sheets (single -> multiple file) (Read 21597 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Convert Cue Sheets (single -> multiple file)

Reply #25
I'm also thinking about creating a cue converter that makes compliant sheets from noncompliant sheets assuming that tracks were ripped with gaps appended.  It will basically stip all 00 indices and reformat.
I would also be interested in this one (foobar still can't handle nc, right?).
Has this batch-file emerged yet?
Ask and ye shall receive...

Code: [Select]
@ECHO OFF

CD /D "%~dp1"

SET _outfile="%~dpn1 (compliant).cue"
SET _tempfile=%TEMP%\~cueconv.tmp
IF EXIST %_tempfile% DEL %_tempfile%
SET _out=%_tempfile%
SET _line=
SET _skip=
SET _track=0
GOTO start

:get_next_line
SET _prev_line=%_x%
SET /A _line+=1
SET _skip=skip=%_line%

:start
FOR /F "usebackq tokens=1,2* %_skip%" %%X IN (%1) DO (
  SET _x=%%X
  SET _y=%%Y
  SET _z=%%Z
  GOTO generate_cue
)
IF EXIST %_tempfile% (
  TYPE %_tempfile%>>%_outfile%
  DEL %_tempfile%
)
GOTO end

:generate_cue
IF %_x% == TRACK GOTO track
IF %_x% == FILE GOTO file
IF %_x% NEQ INDEX GOTO other
IF %_y% == 00 GOTO 00_index
:other
IF %_track% NEQ 0 (
  IF %_x% NEQ FILE SET _x=    %_x%
)
IF DEFINED _z (
  ECHO %_x% %_y% %_z%>>%_out%
  GOTO get_next_line
)
IF DEFINED _y (
  ECHO %_x% %_y%>>%_out%
  GOTO get_next_line
)
ECHO %_x%>>%_out%
GOTO get_next_line

:track
SET /A _track+=1
IF %_prev_line% == INDEX SET _out=%_tempfile%
ECHO  TRACK %_y% AUDIO>>%_out%
GOTO get_next_line

:file
IF %_out% == %_outfile% GOTO other
TYPE %_tempfile%>>%_outfile%
DEL %_tempfile%
ECHO %_x% %_y% %_z%>>%_outfile%
SET _out=%_outfile%
GOTO get_next_line

:00_index
SET _00_index=%_x% %_y% %_z%
SET /A _line+=1
SET _skip=skip=%_line%
FOR /F "usebackq tokens=1* %_skip%" %%X IN (%1) DO (
  SET _x=%%X
  SET _y=%%Y
  GOTO got_next_line
)
:got_next_line
IF %_x% == FILE (
  ECHO %_x% %_y%>>%_outfile%
  TYPE %_tempfile%>>%_outfile%
  DEL %_tempfile%
  SET _out=%_outfile%
  GOTO get_next_line
)
ECHO    %_00_index%>>%_out%
ECHO    %_x% %_y%>>%_out%
GOTO get_next_line

:end
I'm reluctant to put up the other scripts I have made because they require specific helper programs and I'm not presently in the frame of mind to fix any bugs that may arise.  Besides, Moitah's tools are far superior than mine in doing these tasks, unless batchability is still an essential requirement.

Convert Cue Sheets (single -> multiple file)

Reply #26
Thanks again,

it's just nice to have it as batch - I can fiddle with this.
My C# doesn't go so far that I could fiddle with Moitah's stuff (good tool to have though).