Class: Playa::Track
- Inherits:
-
Object
- Object
- Playa::Track
- Defined in:
- lib/playa/models/track.rb
Instance Method Summary collapse
- #album ⇒ Object
- #artist ⇒ Object
- #attributes ⇒ Object
- #bitrate ⇒ Object
- #duration ⇒ Object
- #filename ⇒ Object
-
#initialize(file) ⇒ Track
constructor
A new instance of Track.
- #title ⇒ Object
- #track_number ⇒ Object
Constructor Details
#initialize(file) ⇒ Track
Returns a new instance of Track.
3 4 5 |
# File 'lib/playa/models/track.rb', line 3 def initialize(file) @file = file end |
Instance Method Details
#album ⇒ Object
31 32 33 |
# File 'lib/playa/models/track.rb', line 31 def album .tag.album || '' end |
#artist ⇒ Object
27 28 29 |
# File 'lib/playa/models/track.rb', line 27 def artist .tag.artist || '' end |
#attributes ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/playa/models/track.rb', line 7 def attributes { filename: filename, title: title, artist: artist, album: album, track_number: track_number, duration: duration, bitrate: bitrate } end |
#bitrate ⇒ Object
43 44 45 |
# File 'lib/playa/models/track.rb', line 43 def bitrate .bitrate || 0 end |
#duration ⇒ Object
39 40 41 |
# File 'lib/playa/models/track.rb', line 39 def duration .length || 0 end |
#filename ⇒ Object
19 20 21 |
# File 'lib/playa/models/track.rb', line 19 def filename .filename end |
#title ⇒ Object
23 24 25 |
# File 'lib/playa/models/track.rb', line 23 def title .tag.title || filename # TODO: this will include the path end |
#track_number ⇒ Object
35 36 37 |
# File 'lib/playa/models/track.rb', line 35 def track_number .tag.tracknum || 0 end |