Sha256: 66bf31e9b5a807c4e72d27ffca8a3698483cca32bbc62282099821d9c7d3008f
Contents?: true
Size: 1.5 KB
Versions: 1
Compression:
Stored size: 1.5 KB
Contents
require 'playa/playlist_view' require 'playa/progress_view' require 'playa/status_view' module Playa class Controller include Vedeu def initialize(args = []) @player = Player.new event :update do PlaylistView.render(menu) StatusView.render end event :progress_update, 0.5 do ProgressView.render(@player) trigger(:refresh) end event :select do |track| trigger(:play, track) end event :complete do trigger(:menu_next) trigger(:select, menu.current_item) end event :key do |key| case key when :left then trigger(:rewind) when :right then trigger(:forward) when ' ' then trigger(:toggle) when :up then trigger(:menu_prev) when :down then trigger(:menu_next) when 'q' then trigger(:_exit_) when :enter trigger(:menu_select) trigger(:select, menu.current_item) end trigger(:update) end @player.events.on(:position_change) { trigger(:progress_update) } @player.events.on(:complete) { trigger(:complete) } @args = args @playlist_view = PlaylistView.render(menu) @status_view = StatusView.render @progress_view = ProgressView.render(@player) end private attr_reader :args def menu @_menu ||= Vedeu::Menu.new(tracks) end def tracks @_tracks ||= TrackCollection.new(args).tracks end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
playa-0.0.7 | lib/playa/controller.rb |