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: Embed Cuesheets into Monkey Audio Files (Read 10671 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Embed Cuesheets into Monkey Audio Files

PLEASE GET THE NEWEST VERSION! (1.02)
addcuesheet.rb v.1.02

It fixes several bugs. (thanks to Supacon!)


This script is to speed up ripping whole albums into a monkey audio (APE) file and embedding the cuesheet into it.  You rip all CDs you want to with their cuesheets, run the script and the cuesheets are embedded in the APEs.

(So you don't have to do the embedding by hand anymore)

You'll need:
- The script which you can obtain from Here (also read the instructions! You need to set the script up before usage!)

- Ruby (of course!) Ruby is a scripting language. You need it for this script. A link is provided on above page.
- APE files and CUESHEET files (ripped with EAC for instanceI
- Foobar2000

The script searches for corresponding ape and cue files, processes the cue file and embeds it in the APE file via the commandline. (foobar2000.exe /tag:FORMAT:CUESHEET: ...)

Please post your opinion about it. (And possible errors. (Please send the original cuesheet file and the problem) Please use copies to experiment).

Release history:
v 1.1: ; is replaced too. Also cues and logs are moved if you want to automagically.
v 1.2: [ and ] % are replaced correctly; warning if foobar2000.exe not found by script.

Embed Cuesheets into Monkey Audio Files

Reply #1
Nice idea. Will play around with this a bit as soon as I have some ripping to do.

This might also be a good place to mention that there is a new foo_ape.dll included in Case's special installer installer available here. It is also available by itself as a dll here.

The changes mainly involve things how file tagging is handled on ape files with embeded cuesheets. It is now possible to directly add and edit global file tags in the ape tags of ape files with embedded cuesheets.  In the old version it was still nessecary to remove the cuesheet tag before any editing on global file tags could be done.

I personally use this to add tags to the files that otherwise would not be cue sheet compliant.

Big thanks to Case for going through the effort of implementing this.

Embed Cuesheets into Monkey Audio Files

Reply #2
What is the difference between Case's special installer and the other "normal" special installer? I just uninstalled Foobar2000 and installed the special installer by Case's and most of the stuff was done for me . Anyway back on topic. That looks like a great script, thanks! I must try it out soon .

Embed Cuesheets into Monkey Audio Files

Reply #3
Quote
What is the difference between Case's special installer and the other "normal" special installer?

Case's special installer is maintained by Case (as the name already implies  ) and the normal one is maintained by someone else.

Case's special installer is usually a lot more up to date when it comes to component versions.  AFAIK it also contains a slightly different selection of components.

Apologies to Bella for the offtopic posts in this thread. Feel free to request me to split them if you want to.

Embed Cuesheets into Monkey Audio Files

Reply #4
Forgive my ignorance.  What are the advantages of using a CUE embeded APE?  When I use CUE and APE files now (like for audio books)  I have a several APE files (one for each CD) and I combine the multiple CUE sheets into a single CUE that combines all of the APE files.  So I load the CUE into foobar.  I think I can see the advantage with a "normal" CD, just one APE file, right?  Instead of a CUE and APE.  Would this be of any help to me with my audio books?  For instance, when I use the CUE with multiple APE files I am able to have a continuous track number listing and can compensate for a leading introduction for the 2,3,4th (etc.) disc in the series (I just put the time that I want to start at in the CUE, just past the intro).  Thanks for helping the dumb and blind.

Embed Cuesheets into Monkey Audio Files

Reply #5
I'm too drunk to bother to actually read your post; but in the broad + wide; are ape w/ embedded cue usable. Probably not. For me it's a usable storage medium, but it won't work outside of fb2k. Hey I love it, but stay away, it won't work for you anyways, let me keep it 
"ONLY THOSE WHO ATTEMPT THE IMPOSSIBLE WILL ACHIEVE THE ABSURD"
        - Oceania Association of Autonomous Astronauts

Embed Cuesheets into Monkey Audio Files

Reply #6
PLEASE GET THE NEWEST VERSION 1.1!! It fixes the ; bug

  Actually I wrote it for myself, to organise my music collection.
Instead of like earlier, I've extracted all CDs to single files, I now have one file per CD.
(and not two files. If I just add my music harddrive I don't get single APEs in addition to their CUESHEETS, so you don't have to manually re-organise where your CUESHEETS are, where your single music files are and where your CUE'd music is.)

Ok it is NOT compatible with other software AFAIK than Foobar. But then again, why would anyone want to use anything else :-)

It is of course also possible for you to keep your CUE files and put them into a separate folder if you really would want to use the APEs with another program.

And also it is of course possible to extract the CUE from the APE using Foobar. ... While it's not possible to resurrect a lost CUESHEET which got deleted by accident or something.

Perhaps you're questioning: why put the whole CD into an APE? ... that is a philosophical question rather... I just like to have a CD in a file and to sort by these files instead of a complete structure (less work while ripping)... and also it's a nice thing to have actually a continous file for Pink Floyd's and other albums IMHO.

---

Ok, sorry if I got a bit emotional about this, but I deem it a great thing that Foobar offers the opportunity. 

As for the Audiobook CD's it would of course be possible to have several APE's (one per CD) with the CUESHEET embedded, and you could call the CDs '01' '02' etc, then the right order would be preserved when adding (as Foobar would externally add each CD's contents after each other).  Then of course you would have to manually add all the CDs for the audiobook if listening to it, instead of one file.

But I think you want to add an audiobook by adding a simple file your current strategy is better.  For one CD of course you have one file instead of two, it's the reason I wrote it :-)

That is, unless you really want ONE file per audiobook. Then it would be possible to use the monkeyaudio's encoder and put all 3, 4 etc CDs  contents (which you have extracted already) and merge them all into one big APE file. Then you could use my script to add the CUESHEET of them (Hmm... how would you obtain that? I don't know) and to have really one file per audiobook....


Thanks for your interest,
Bella.

Embed Cuesheets into Monkey Audio Files

Reply #7
 
Possibly your files can break if using advanced (read: longer than one line) tags to your EMBEDDED CUESHEET MONKEY AUDIO FILE!

e.g. %lyrics% tag breaks the file. you have to remove the tag from the file, nuke your database and reembed the cuesheet! which you still have hopefully!!

Embed Cuesheets into Monkey Audio Files

Reply #8
Thanks for the handy script, Bella.  Tonight I was just wondering if one could embed cuesheets in ape like you can with flac, and now you answered my question.

It'd be nice to modify this program to work differently, so that it looks first at the cuesheet, then looks first for an ape filename in the cuesheet (which is the way foobar works, usually), then looks for a file with the same base filename and a cuesheet extension.

I personally find it impractical to temporarily rename my cuesheets to the *.ape.cue format before using this script.

One of these days I need to get a system that will allow me to stick the cd in the drive and rip to a properly tagged ape+embedded cuesheet with one easy click. 

As it stands now, I have to rip the CD to a wav and cue with EAC, modify the file extension within the cuesheet to .ape, fill in artist, album, year and genre tags in Winamp, and then rename the cuesheet to *.cue.ape, and run Bella's script.

The results are good, but it would be nice if EAC would do most of these steps right on its own...  maybe I need to work on a way to do this.

Embed Cuesheets into Monkey Audio Files

Reply #9
Okay. I've been learning the basics of Ruby, and I still don't know what the heck I'm doing, but here's the mod I wanted, if anyone else out there can use it.  It's a small change to line 49:

   #calculate the name of the file (-.cue)
   #workon = cuesheet[0..-5]

   #Mod to use cuesheets without the extra extension
   workon = cuesheet[0..-4]+"ape"

The next thing I want to figure out is how to make the program check if the file exists when using the first routine, and if not, try the second one.

I now need to learn how, in ruby, to check for the existence of a file.  But I hadn't even heard of this language until a couple hours ago... I'll see what I can do.

Embed Cuesheets into Monkey Audio Files

Reply #10
Quote
One of these days I need to get a system that will allow me to stick the cd in the drive and rip to a properly tagged ape+embedded cuesheet with one easy click. [{POST_SNAPBACK}][/a]
I feel I have achieved this with my scripts:

[a href="http://synthetic-soul.mysite.wanadoo-members.co.uk/cd_backup.html]http://synthetic-soul.mysite.wanadoo-membe.../cd_backup.html[/url]

Edit:

I'd be very interested to hear if you have any suggestions for improvement, or additional requirements.  I recently finished backing up 319 CDs using these scripts (well, they were tweaked numerous times during the 2 month process), but I'm keen to keep the site updated as a guide for others with the same, or similar, requirements.

NB: The process uses an updated version of Tag, which allows you to set tags from the contents of a text file, e.g.: CUESHEET from .cue file.

Edit 2:

I see from this post that you are currently experimenting with wapet.  FYI: I also adapted this to set tags from the contents of a text file. My version can be found here:

http://synthetic-soul.mysite.wanadoo-membe...o.uk/wapet.html
I'm on a horse.

Embed Cuesheets into Monkey Audio Files

Reply #11
Ugh.  I just found out something about this script that ruined my day...
I fixed it though.
It doesn't support square brackets (in my case, used to denote mix information or edit or version info about a song).

Here's the fix:
Code: [Select]
    mycue.gsub!('(', "<(>")
    mycue.gsub!(')', "<)>")
    mycue.gsub!('[', "<[>")
    mycue.gsub!(']', "<]>")
    mycue.gsub!("'", "$char(39)")
    mycue.gsub!(";", "$char(59)")
    mycue.gsub!('"', "$char(34)")
    mycue.gsub!('/', "$char(47)")
    mycue.gsub!("\r", "$crlf()")
    #now final-replace
    mycue.gsub!('<(>', "'('")
    mycue.gsub!('<)>', "')'")
    mycue.gsub!('<[>', "'['")
    mycue.gsub!('<]>', "']'")


This should be implemented in a new version of the code.

Embed Cuesheets into Monkey Audio Files

Reply #12
Now that I've fixed this problem with the script, how can I undo the cuesheets (remove them from the apes) without completely removing all the tags from the files?  I have about thirty albums that are tagged this way now, so I want something fairly automatic.  If this isn't so easy, it's no biggie, really, but I was hoping there was a way.

Embed Cuesheets into Monkey Audio Files

Reply #13
Er... sorry about asking stupid questions before trying the obvious.
The masstagger in foobar worked okay... I just dropped in every album,
set it to delete cuesheet, then reloaded all the albums,
set Artist to "Various", delete tracknumber, delete anything else specific to a single song, and then re-run the ruby script.

I think I've got this all cleaned up now.

Embed Cuesheets into Monkey Audio Files

Reply #14
I hope you also get to like Ruby :-)

For all: I've written a quick script which removes all the cuesheet + album + artist + album artist tags from all ape files in the same directory.

(Before I read the post, that you've removed by masstagger ... which is also possible of course and perhaps even to be preferred!)

Anyways, get it here:
http://f.lavadots.com/release/removecuesheet.rb


Don't forget to nuke the database before you look at the files! The database messes up updates with CUESHEETS...
But beware, the database holds your normalisation etc values ... so they will be lost if you nuke the database!!


EAC ripped to ape.cue so I just set it to this.
Its no problem finding out whether a file exists with Ruby

File.exist?("filename") is a boolen value.
Code: [Select]
puts File.exist?("myfile.ape")

Puts "true"  or "false".

Have fun experimenting with Ruby, and as soon as I get around to it I will include your modifications in the main release...

Automating the tasks  could be done with different solutions ... but it would take time which I am sorry, I have not at the moment, so you're on your own ...
But there's always the "programming ruby" handbook :-) And I'll try to answer questions which arise.

  Bella.

Embed Cuesheets into Monkey Audio Files

Reply #15
Quote
Ugh.  I just found out something about this script that ruined my day...
I fixed it though.
It doesn't support square brackets (in my case, used to denote mix information or edit or version info about a song).

Here's the fix:
Code: [Select]
    mycue.gsub!('(', "<(>")
    mycue.gsub!(')', "<)>")
    mycue.gsub!('[', "<[>")
    mycue.gsub!(']', "<]>")
    mycue.gsub!("'", "$char(39)")
    mycue.gsub!(";", "$char(59)")
    mycue.gsub!('"', "$char(34)")
    mycue.gsub!('/', "$char(47)")
    mycue.gsub!("\r", "$crlf()")
    #now final-replace
    mycue.gsub!('<(>', "'('")
    mycue.gsub!('<)>', "')'")
    mycue.gsub!('<[>', "'['")
    mycue.gsub!('<]>', "']'")


This should be implemented in a new version of the code.
[a href="index.php?act=findpost&pid=255288"][{POST_SNAPBACK}][/a]


You're right. Actually the code can be shortened a bit:
Code: [Select]
    mycue.gsub!('(', "<(>")
    mycue.gsub!(')', "<)>")
    mycue.gsub!("'", "$char(39)")
    mycue.gsub!(";", "$char(59)")
    mycue.gsub!('"', "$char(34)")
    mycue.gsub!('/', "$char(47)")
    mycue.gsub!("\r", "$crlf()")
    #now final-replace
    mycue.gsub!('<(>', "'('")
    mycue.gsub!('<)>', "')'")
    mycue.gsub!('[', "'['")
    mycue.gsub!(']', "']'")


The first part
Code: [Select]
    mycue.gsub!('(', "<(>")
    mycue.gsub!(')', "<)>")

is there to protect the statements
Code: [Select]
[code]
    mycue.gsub!("'", "$char(39)")
    mycue.gsub!(";", "$char(59)")
    mycue.gsub!('"', "$char(34)")
    mycue.gsub!('/', "$char(47)")
    mycue.gsub!("\r", "$crlf()")

with round brackets in them (so they don't get replaced in the after - run. I need to do these replacements afterwards because the ' sign needs to be replaced beforehand... I spent around 4 hours figuring this thing out)

Bella

Embed Cuesheets into Monkey Audio Files

Reply #16
Thanks for the update Bella.

Another thing I just noticed is that percent signs will break the insertion of cuesheets...

adding this in the right place should fix it:
mycue.gsub!('%', "$char(37)")

I wonder if there are more problems that either of us has not yet noticed?

I tend to rip a wide variety of music, so I will notice these things rather quickly, I guess.

Embed Cuesheets into Monkey Audio Files

Reply #17
@Supacon: There are probably some other mistakes ... I've released v 1.02 which fixes all the bugs you have pointed out to me.

@All: What "features" would you like to see in the script? Maybe a fancy GUI ;-) ?

You definitely should get 1.02. (see first post)

- Bella

Embed Cuesheets into Monkey Audio Files

Reply #18
Cool.  Thanks for the update.

As for new features, I'd like it if it could be a little smarter with trying to find the original file that the cuesheet is for (ie, use the file that the cuesheet points to, or look for a file with the same base name, or such).

Making a GUI would be neat, where you could drag and drop your cuesheets into it, but not necessary for my uses, really. (Asking me for new features is usually a bad idea... I'll write you a book, but I'm too tired ATM, so I'll restrain myself now).

BTW, how hard is it to write GUI ruby stuff?

Embed Cuesheets into Monkey Audio Files

Reply #19
Quote
@All: What "features" would you like to see in the script? Maybe a fancy GUI ;-) ?
[a href="index.php?act=findpost&pid=256595"][{POST_SNAPBACK}][/a]


Other formats. Wavpack would be *nice*.

Embed Cuesheets into Monkey Audio Files

Reply #20
Isn't adding other formats as simple as changing the extension ape (in the script) to whatever your heart fancies?  This program isn't tag specific because it uses foobar to handle tagging, right?

Embed Cuesheets into Monkey Audio Files

Reply #21
Quote
Isn't adding other formats as simple as changing the extension ape (in the script) to whatever your heart fancies?  This program isn't tag specific because it uses foobar to handle tagging, right?
[{POST_SNAPBACK}][/a]



Eh, where?

[a href="http://f.lavadots.com/release/addcuesheet.rb]http://f.lavadots.com/release/addcuesheet.rb[/url]

I see no mention in this script at all. Or is there more buried deep in the bowels of Ruby that i just do not care to dig for?

Embed Cuesheets into Monkey Audio Files

Reply #22
Quote
Quote
Isn't adding other formats as simple as changing the extension ape (in the script) to whatever your heart fancies?  This program isn't tag specific because it uses foobar to handle tagging, right?
[{POST_SNAPBACK}][/a]



Eh, where?

[a href="http://f.lavadots.com/release/addcuesheet.rb]http://f.lavadots.com/release/addcuesheet.rb[/url]

I see no mention in this script at all. Or is there more buried deep in the bowels of Ruby that i just do not care to dig for?
[a href="index.php?act=findpost&pid=259778"][{POST_SNAPBACK}][/a]



Sorry guys to keep you waiting :-)

It's all there in
Code: [Select]
#calculate the name of the file (-.cue)
    workon = cuesheet[0..-5]


You can try to fix it up by yourself. This code piece tells ruby to cut of the last  4 chars (-1 means to the last char) of the cuesheet's name. It's the way my EAC works.

For instance if your cue files are like
something.cue and  audio like something.audio you can rewrite this code like this

Code: [Select]
   workon = cuesheet[0..-3] + 'audio'


(cut off cue and add audio)

Yes, it uses Foobar to handle the actual embedding, so it should work with all files which support encoding. Testers welcome :-)

Sorry, I'll release something new before next year, I hope!

Nice christmas to you 

Bella