Permalink
Browse files

Added fix to strip out spurious whitespace on tags

  • Loading branch information...
1 parent fde5163 commit 2ce4249fe9c5d07530220f58928b9f879fce2b7f @paulcbetts committed Dec 3, 2007
Showing with 7 additions and 2 deletions.
  1. +3 −2 lib/song.rb
  2. +4 −0 lib/utility.rb
View
@@ -64,6 +64,7 @@ def [](key)
def []=(key, val)
case key
when :ext
+ # This is a generated property - don't let anyone set it
nil
when :path
@data[key] = Pathname.new val
@@ -78,10 +79,10 @@ def []=(key, val)
h = @data[:hours].to_i; m = @data[:minutes].to_i; s = @data[:seconds].to_i
@data[:length] = (h*3600+m*60+s).to_s
when :artist
- @data[key] = val
+ @data[key] = super_chomp(val)
@data.delete :canonical_artist if @data.has_key? :canonical_artist
else
- @data[key] = val
+ @data[key] = super_chomp(val)
end
end
View
@@ -122,3 +122,7 @@ def filelist_from_root(path)
list
end
+
+def super_chomp(s)
+ s.gsub(/\W*$/, '').gsub!(/^\W*(\w.*)$/, '\1') || ''
+end

0 comments on commit 2ce4249

Please sign in to comment.