Class: Moc::Controller::Status::Live

Inherits:
Object
  • Object
show all
Defined in:
lib/LOLastfm/checkers/moc.rb

Instance Method Summary collapse

Instance Method Details

#to_songObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/LOLastfm/checkers/moc.rb', line 14

def to_song
  return unless song

  file = song.file
  tags = song.tags

  if file.start_with?('http://') || file.start_with?('ftp://')
    comment = file
  else
    path = file
  end

  LOLastfm::Song.new(true,
    track:   tags.track,
    title:   tags.title,
    artist:  tags.artist,
    album:   tags.album,
    length:  tags.time,
    comment: comment,
    path:    path,
    stream:  !!comment
  )
end