1
0
mirror of https://github.com/danbee/mpd-client synced 2025-03-04 08:39:09 +00:00
mpd-client/models/song.rb
2013-10-17 18:21:17 +01:00

18 lines
446 B
Ruby

require './models/mpd_connection'
class Song < Struct.new(:artist, :album, :title, :current)
def initialize(song, current: false)
@song = song
self.artist = song.artist
self.album = song.album
self.title = song.title
self.current = current
end
def self.queue
current_song = MPDConnection.mpd.status[:songid]
MPDConnection.mpd.queue.map { |song| self.new(song, current: (song.id == current_song)) }
end
end