36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/ektoplayer/views/playinginfo.rb', line 36
def attach(playlist, player)
player.events.on(:pause) { self.paused! }
player.events.on(:stop) { self.stopped! }
player.events.on(:play) { self.playing! }
player.events.on(:position_change) do
old_pos, old_length = @position, @length
@position = player.position.to_i
@length = player.length.to_i
if old_pos != @position or old_length != @length
if visible?
draw_position_and_length
refresh
end
end
end
playlist.events.on(:current_changed) {
self.track=(playlist[playlist.current_playing])
}
self.mouse.on(ICurses::BUTTON1_CLICKED) do |mevent|
player.toggle
end
end
|