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:
parent
7c73da211a
commit
71e689a880
@ -1,2 +1,2 @@
|
||||
#queue .current
|
||||
#queue .playing
|
||||
font-weight: bold
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user