Help - Search - Members - Calendar
Full Version: C++ code to replace spaces in cuesheet
Hydrogenaudio Forums > Hydrogenaudio Forum > General Audio
canadiandude
Hi, I have been testing various programs that interact with EAC via external compressor to achieve a directory as follows:
%artist-%album-%albumyear-[FLAC]\%tracknumber-%artist-%tracktitle (with the spaces replaced with underscores)
*with a generated non-compliant cuesheet of name 00-%artist-%album with correct filenames
^with sfv of filename 00-%artist-%album
^with m3u of filename 00-%artist-%album

*This is the most important thing I would like to achieve
^These are minor bonuses that would be nice

Note:various artist CD's would follow similarly however instead of artist, diskartist would be used

I just decided to make my own program, you just drag and drop the old CUE and this one fixes it

code is below as you can see this will only run on windows but I assume if you saw that you can figure out what the equivalent delete and copy functions are on the Linux console

CODE
#include <iostream>
#include <cstring>
#include <string>
#include <fstream>


int main(int argc, char *argv[])
{
    if (argc != 2)
    {
        std::cout << "Wrong number of parameters!\n";
        system("pause");
        return 1;
    }

    std::ifstream in(argv[1]);

    if (!in)
    {
        std::cout << "File failed to open!\n";
        system("pause");
        return 1;
    }

    std::ofstream out("parse.bak");
    char buf[80];

    while (!in.eof())
    {
        in.getline(buf, 80);
        if (char *p = strstr(buf, "FILE"))
        {
            p += 6;
            while(1)
            {
                if (*p == '\"') break;
                else if (*p == ' ') *p = '_';
                p++;
            }
        }
        out << buf << '\n';
    }

    out.close();
    in.close();

    std::string syscall;

    syscall = "del ";
    syscall += "\"";
    syscall += argv[1];
    syscall += "\"";
    system(syscall.c_str());

    syscall = "copy parse.bak ";
    syscall += "\"";
    syscall += argv[1];
    syscall += "\"";
    system(syscall.c_str());

    syscall = "del parse.bak ";
    system(syscall.c_str());

    std::cout << "Success!";

    return 0;
}
Fandango
???
canadiandude
QUOTE(Fandango @ Jan 13 2007, 17:03) *

???


i dont know how to answer that but as of now my only solution is writing a c++ program which takes a cue file like this
looks for lines that start with
FILE "
then a while loop that looks for spaces replaces them with underscores then looks for the ending " and then goes to the next line until the end of file is hit

CODE
REM GENRE "Alt. Rock"
REM DATE 2003
REM DISCID 9808520B
REM COMMENT "ExactAudioCopy v0.95b4"
PERFORMER "Scott Sullivan"
TITLE "The Crushwater Symphony"
FILE "01-Scott Sullivan-Black Sand Beach.flac" WAVE
  TRACK 01 AUDIO
    TITLE "Black Sand Beach"
    PERFORMER "Scott Sullivan"
    INDEX 01 00:00:00
FILE "02-Scott Sullivan-New Holland.flac" WAVE
  TRACK 02 AUDIO
    TITLE "New Holland"
    PERFORMER "Scott Sullivan"
    INDEX 01 00:00:00
  TRACK 03 AUDIO
    TITLE "Shade is Made"
    PERFORMER "Scott Sullivan"
    INDEX 00 03:43:69
FILE "03-Scott Sullivan-Shade is Made.flac" WAVE
    INDEX 01 00:00:00
FILE "04-Scott Sullivan-Living.flac" WAVE
  TRACK 04 AUDIO
    TITLE "Living"
    PERFORMER "Scott Sullivan"
    INDEX 01 00:00:00
FILE "05-Scott Sullivan-Seatown.flac" WAVE
  TRACK 05 AUDIO
    TITLE "Seatown"
    PERFORMER "Scott Sullivan"
    INDEX 01 00:00:00
FILE "06-Scott Sullivan-Tubes and Silver Bells.flac" WAVE
  TRACK 06 AUDIO
    TITLE "Tubes and Silver Bells"
    PERFORMER "Scott Sullivan"
    INDEX 01 00:00:00
  TRACK 07 AUDIO
    TITLE "ParaChute"
    PERFORMER "Scott Sullivan"
    INDEX 00 02:14:26
FILE "07-Scott Sullivan-ParaChute.flac" WAVE
    INDEX 01 00:00:00
  TRACK 08 AUDIO
    TITLE "Fit in the Riddle"
    PERFORMER "Scott Sullivan"
    INDEX 00 04:42:27
FILE "08-Scott Sullivan-Fit in the Riddle.flac" WAVE
    INDEX 01 00:00:00
  TRACK 09 AUDIO
    TITLE "The Big Ten Easy"
    PERFORMER "Scott Sullivan"
    INDEX 00 03:19:24
FILE "09-Scott Sullivan-The Big Ten Easy.flac" WAVE
    INDEX 01 00:00:00
FILE "10-Scott Sullivan-Empire.flac" WAVE
  TRACK 10 AUDIO
    TITLE "Empire"
    PERFORMER "Scott Sullivan"
    INDEX 01 00:00:00
  TRACK 11 AUDIO
    TITLE "Scarlet Utopia"
    PERFORMER "Scott Sullivan"
    INDEX 00 04:39:16
FILE "11-Scott Sullivan-Scarlet Utopia.flac" WAVE
    INDEX 01 00:00:00
canadiandude
posted code
Synthetic Soul
Topic renamed and moved.

I just don't understand what this has to do with FLAC, or you backup procedure. NB: I am not asking to know!

Very confused thread...
Gambit
wtf is this thread about?

/me joins the confusion
Fandango
He wants to automate the process of creating "scene" releases. The underscores, the checksum files, seperate tracks are all strong hints at "scene rules".

Seems like he had everything hooked up except for a script/program to process the CUE sheets.

But in the end I don't really see the point of this thread... was this initially a request for such a tool or a release thread for your code? Your posts don't say anything explicitely about what you actually want to achieve with the thread (not the tool, you already explained that).

Although this code by itself might be useful for some people, I think a little bit more information about your whole setup would make it even more useful for more people (in case anyone is interested in this for educational purposes!). laugh.gif
LaserSokrates
Might be a little OT, but I never got it what these "scene standards" are for, not even what they say. Personally I'd say they're useless, and so is this program for the public.

What's the point in using LAME 3.90.3 anyway? Do they also use it under Windows 95 for the nostalgic feeling?
canadiandude
Basically, I just wanted to know if there was a program like MAREO, WACK, etc that would allow me to achieve a rip as described above. I would honestly look harder but after trying about 4 or 5 I just gave up and stuck with AutoFLAC (as i dont need to rip to more than one format)
I just like the look of "scene" releases, don't ask me why ohmy.gif

As of now what I am doing is using AutoFLAC to create individual files (for rockbox) with a non-compliant CUEsheet so that at the end of the day I have something that I will never need to re-rip (for ease since i generally take extremely good care of my CD's). after using AutoFLAC, I drag the cue file into that little C++ proggy I made and then I just create an SFV, rename the log, m3u, and cue such they it is 00-Artist-Album [with underscores, that way those files are always at the top of the window when sorting by name] and then I enjoy
you get something that looks like this (the extra folder is to remind me what Offset was used) blah blah
IPB Image

you see less of 3.90.3 and more 3.97 final, I saw one alpha of 3.98 even :S.

In the event that I ever need to burn a CD from one of my images (which thanks to todays DVD players wont work there so i will sooner or later have to resort to fiberoptic>reciever) I either use AutoFLAC or I just fire up CUE Tools make a single file + CUE (compensate for my writers offset with silence since it doesn't support overwriting) and burn.

Sorry if I was a bit confusing, I can see how there is much room for interpretation.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.