IPB

Welcome Guest ( Log In | Register )

Ripping wavpack images with integrated cuesheets with rubyripper using
LaserSokrates
post Jan 18 2013, 12:58
Post #1





Group: Members
Posts: 127
Joined: 9-March 06
From: NRW, Germany
Member No.: 28371



I recently decided to start ripping my CD collection or at least parts of it to a lossless format, and I chose wavpack because hardware compatibility is no issue for me and should I need it, I can just convert my saved tracks to mp3. However, as I was thinking more of images, I wanted to convert my disks to single .wv files with integrated cuesheet as I felt that'd be the closest I can get to a real image. If you are looking for instructions (can be applied to similiar scenarios as well) read on. Mods: if you think this belongs into the wiki, feel free to add it, I have no account there.

I will go into a bit of detail here to explain why I set all this up like I did. If you're just looking for the perhaps not-perfect solution, skip to the second-last codebox.

rubyripper supports creating cuesheets for rips and also wavpack as an external codec. However, these two programs both seem to suffer a bug each (or a bug and a not-too-well-advertised feature) that, in combination, prevents one from backing up his discs under Linux the way I described. According to the official wavpack documentation, wavpack's -w "Cuesheet=@*.cue" should make wavpack import subtrack information from a .cue file in the working directory. It did not for me. It wasn't a syntax error either, as I believe, because when I did -w "Cuesheet=@Exact Filename here.cue" it just worked. It was a single cue file in the working directory, but wavpack wouldn't read from it. Might be a shell problem, I don't really know, but I didn't like it.

So, to circumvent this (and also get a cleaner solution), wavpack is called with the exact filename of the cue file from rubyripper, which is "Artist - Album (other).cue" for me. So we just use this as our "other codec in rubyripper:
CODE
wavpack -hhm -w Cuesheet="%a - %b (other).cue" %i -o %o.wv

which unfortunately doesn't work.
To make it easier for the user, rubyripper replaces all variables with their proper values encapsulated in double quotes in order to retain spaces. However, as not to break anything, the user-supplied command-line has to be cleared of double-quotes beforehand. From rr_lib.rb:
CODE
        def checkOtherSettings
                copyString = ""
                lastChar = ""

                #first remove all double quotes. then iterate over each char
                @settings['othersettings'].delete('"').split(//).each do |char|
                        if char == '%' # prepend double quote before %
                                copyString << '"' + char
                        elsif lastChar == '%' # append double quote after %char
                                copyString << char + '"'
                        else
                                copyString << char
                        end
                        lastChar = char
                end

                # above won't work for various artist
                copyString.gsub!('"%v"a', '"%va"')

                @settings['othersettings'] = copyString

                puts @settings['othersettings'] if @settings['debug']
        end
(This codebox is supposed to be spoilered for readability.) This leads to wavpack being called with -w Cuesheet=@"Artist" - "Album" (other).cue ... with which, of course, wavpack doesn't know what to do.
The easiest solution now IMHO is a shell script like this:
CODE
#! /bin/bash
wavpack -hhm -w Cuesheet=@"$(echo $2 | sed s/.wv/' (other).cue'/g)" "$1" -o "$2"
(remember to make it executable!) which can then be called in rubyripper via
CODE
/path/to/yourscript.sh %i %o.wv
Of course, this only works if your .wv and .cue-files are named similiar. As I mainly backup albums, this works for me right now. I don't know how rubyripper decides how to name the cuesheets, so the script might be of limited usefulness. I spent quite some time on finding a solution nevertheless, and I thought it might be helpful for some as the scenario is not too uncommon. Perhaps some shell guru (or a programmer in a "real" language) can add some command line parsing and some extra features, I'd appreciate it smile.gif Hope I could help or inspire someone.

Now if another player besides foobar supported this, it'd be awesome. I have it running under wine here. Oh, how I would love to see a port.

Edit: title is truncated or I'm too tired to actually write one. Can a mod give this a proper name, pretty please? smile.gif

This post has been edited by LaserSokrates: Jan 18 2013, 13:02
Go to the top of the page
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 1st August 2014 - 03:08