1
0
mirror of https://github.com/danbee/mpd-client synced 2025-03-04 08:39:09 +00:00

Change 'current' to 'playing'.

This commit is contained in:
Dan Barber 2013-10-18 13:30:28 +01:00
parent 7c73da211a
commit 71e689a880
3 changed files with 9 additions and 6 deletions

View File

@ -1,2 +1,2 @@
#queue .current
#queue .playing
font-weight: bold

View File

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

View File

@ -17,7 +17,9 @@
<h2>Queue</h2>
<ul id="queue">
{{#each controller}}
<li {{bindAttr class="current"}}>{{ artist }} - {{ title }}</li>
<li {{bindAttr class="playing"}}>{{ artist }} - {{ title }}</li>
{{else}}
<li>Play queue empty</li>
{{/each}}
</ul>
</script>