Class: Sh::Song
Instance Method Summary collapse
Instance Method Details
#lookup! ⇒ Object
177 178 179 180 181 182 183 184 |
# File 'lib/sh_database.rb', line 177 def lookup! begin return Fingerprint.identify! self rescue Exception Log.debug "Couldn't identify song from fingerprint", $! return false end end |
#to_html ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/sh_database.rb', line 164 def to_html t = title t = "Unknown" if not t or t.strip == "" t = CGI.escapeHTML t ar = artist.name ar = "Unknown" if not ar or ar.strip == "" ar = CGI.escapeHTML ar al = album.title al = "Unknown" if not al or al.strip == "" al = CGI.escapeHTML al return "<b>#{t}</b> by <i>#{ar}</i> from <i>#{al}</i>" end |
#to_s ⇒ Object
160 161 162 |
# File 'lib/sh_database.rb', line 160 def to_s return "%s, %s, %.2d - %s" % [artist, album, track_num, title] end |
#validate ⇒ Object
186 187 188 |
# File 'lib/sh_database.rb', line 186 def validate errors[:path] << "must exist" unless path and File.exists?(path) end |