Skip to content

Commit

Permalink
Double-click songs in the queue AND IT PLAYS THEM :DDDD
Browse files Browse the repository at this point in the history
  • Loading branch information
danopia committed May 17, 2010
1 parent 8ecdbdc commit 369998d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion mplayer.rb
Expand Up @@ -51,7 +51,7 @@ def stop

@client.display.panes[:np].controls[:song_name].text = 'Nothing'
@client.display.panes[:np].controls[:cue].value = 0
@client.display.panes[:np].controls[:cue2].value = 0
@client.display.panes[:np].controls[:cue].value2 = 0
@client.display.panes[:np].controls[:position].text = ''
@client.display.dirty! :np
end
Expand Down
5 changes: 3 additions & 2 deletions queue.rb
Expand Up @@ -80,8 +80,9 @@ def [] index
@songs[index]
end

def play_radio
@played = []
def play_radio startIndex=0
@played = @songs.keys[0, startIndex]

loop {
toplay = (@songs.keys - @played).first
if toplay
Expand Down
29 changes: 23 additions & 6 deletions remora
Expand Up @@ -78,13 +78,30 @@ begin
control :songs, Luck::ListBox, 1, 1, -1, -1 do
number!

on_submit do |list, song| # TODO: Song is a String here, of just the title
next unless song.is_a? GrooveShark::Song
on_submit do |list, title| # TODO: Song is a String here, of just the title
index = list.data.index(title)
song = client.queue[index]

if client.now_playing
client.player.stop
end

pane = Remora::SongInfoPane.new(display, song)
display.pane :songinfo, pane
display.modal = pane
display[:songinfo, :close].focus!
Thread.new do
begin
client.queue.play_radio index
rescue => ex
display.close
puts ex.class, ex.message, ex.backtrace
exit
end
end

#~ next unless song.is_a? GrooveShark::Song
#~
#~ pane = Remora::SongInfoPane.new(display, song)
#~ display.pane :songinfo, pane
#~ display.modal = pane
#~ display[:songinfo, :close].focus!
end
end
end
Expand Down

0 comments on commit 369998d

Please sign in to comment.