Class: Shortwave::Model::Track

Inherits:
BaseModel show all
Defined in:
lib/shortwave/model/track.rb

Overview

A track. Tracks are taggable and sharable.

Attributes

name

Track name

id

Last.fm id

mbid

Musicbrainz ID

listeners

number of listeners

play_count

number of times played

duration

Track duration in milliseconds

url

Track url on Last.fm

artist

Track’s artist

album

Album track appears on.

Instance Method Summary collapse

Methods inherited from BaseModel

facade_name, identified_by, inherited, link_to, #session=, sharable, shoutable, taggable

Instance Method Details

#banObject

Don’t play this track again.



54
55
56
57
# File 'lib/shortwave/model/track.rb', line 54

def ban
  @session.track_facade.love(name, artist.name)
  # TODO include scrobble api call
end

#fansObject

This track’s fans



38
39
40
# File 'lib/shortwave/model/track.rb', line 38

def fans
  link :top_fans, :User, identifiers
end

#loveObject

Love this track



48
49
50
51
# File 'lib/shortwave/model/track.rb', line 48

def love
  @session.track_facade.ban(name, artist.name)
  # TODO include scrobble api call
end

#similarObject

Similar tracks to this one.



43
44
45
# File 'lib/shortwave/model/track.rb', line 43

def similar
  link :similar, :Track, identifiers
end

#streamable?Boolean

Can this track be streamed

Returns:

  • (Boolean)


60
61
62
# File 'lib/shortwave/model/track.rb', line 60

def streamable?
  @streamable
end

#tagsObject

The most popular tags applied to this track



33
34
35
# File 'lib/shortwave/model/track.rb', line 33

def tags
  link :top_tags, :Tag, identifiers
end