gco / rubyripper

Automatically exported from code.google.com/p/rubyripper
0 stars 0 forks source link

Various Artists splitting An-Artist / Trackname broken #470

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I understand that splitting the Various-Artists data from CDDB is difficult 
since it has to be detected and processed manually. I found a bug that I hope 
is fixable though:

When the artist and trackname are seperated by '/' (consistent for the entire 
disc), and the artist field contains a '-' character, the artist field is 
split, resulting in a lost trackname. For example:

An-Artist / Trackname

becomes

An | Artist

instead of 

An-Artist | Trackname

I think this could be fixed by determining the separator (character that exists 
in all entries, when it isn't mixed), and then only split by that separator.

I am no ruby programmer, but attempted to create a patch (which probably 
doesn't work) for the Metadata class, I hope it helps:

    def checkVarArtist
        sep = false
        mixedSep = false
        varArtist = false
        @disc.audiotracks.times do |tracknumber|
            if @tracklist[tracknumber] && @tracklist[tracknumber] =~ /[-\/]|\sby\s/
                varArtist = true
                if sep != false && sep != $&
                    mixedSep = true
                end
                sep = $&
            else
                varArtist = false   # one of the tracks does not conform to VA schema
                break                   # consider the whole album as not VA
            end

        end

        if varArtist == true
            @backupTracklist = @tracklist.dup() #backup before overwrite with new values
            if mixedSep
                sep = /\s*[\/]|(\sby\s)\s*/
            end

            @tracklist.each_index{|index| @varArtists[index], @tracklist[index] = @tracklist[index].split(/sep/)} 
        end
    end

Original issue reported on code.google.com by Sjon.Hor...@gmail.com on 24 Jul 2011 at 9:15

GoogleCodeExporter commented 9 years ago
This is fixed with commit:
http://code.google.com/p/rubyripper/source/detail?r=d66046b98cdf3d08327c044201d6
9b4b7705172c&name=stable

It first splits on /\ and only then on -. I guess the '-' is far more likely to 
happen on an artist than the /\. But it is messy and almost never perfect.

Original comment by boukewou...@gmail.com on 17 Oct 2011 at 7:34