Permalink
Browse files

Revert "Revert "Added fix to strip out spurious whitespace on tags""

This reverts commit d1a163d.
  • Loading branch information...
1 parent d1a163d commit 61887df1820cacb9cb6ccccc50cd2ef7a5a9301e @paulcbetts committed Dec 11, 2007
Showing with 7 additions and 2 deletions.
  1. +3 −2 lib/song.rb
  2. +4 −0 lib/utility.rb
View
@@ -65,6 +65,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
@@ -80,10 +81,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 61887df

Please sign in to comment.