Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added fix to strip out spurious whitespace on tags

  • Loading branch information...
commit 2ce4249fe9c5d07530220f58928b9f879fce2b7f 1 parent fde5163
@paulcbetts authored
Showing with 7 additions and 2 deletions.
  1. +3 −2 lib/song.rb
  2. +4 −0 lib/utility.rb
View
5 lib/song.rb
@@ -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
4 lib/utility.rb
@@ -122,3 +122,7 @@ def filelist_from_root(path)
list
end
+
+def super_chomp(s)
+ s.gsub(/\W*$/, '').gsub!(/^\W*(\w.*)$/, '\1') || ''
+end
Please sign in to comment.
Something went wrong with that request. Please try again.