Class: CultomePlayer::DefaultPlayer

Inherits:
Object
  • Object
show all
Includes:
CultomePlayer
Defined in:
lib/cultome_player.rb

Constant Summary

Constants included from CultomePlayer

VERSION

Constants included from Player::Interactive

Player::Interactive::PROMPT

Constants included from Player::Interface::Helper

Player::Interface::Helper::VALID_SONG_ATTR

Instance Method Summary collapse

Methods included from CultomePlayer

#create_response, #execute, #failure, get_player, #success

Methods included from StateChecker

#current_album, #current_artist, #current_playlist, #current_song, #paused?, #playback_length, #playback_position, #playing?, #shuffling?, #stopped?

Methods included from Plugins

#clean_plugins, #init_plugins, #plugin_command_sintax, #plugin_config, #plugins_respond_to?

Methods included from Plugins::KeyboardSpecialKeys

#init_plugin_keyboard_special_keys

Methods included from Plugins::Gestures

#init_plugin_gestures

Methods included from Plugins::Points

#init_plugin_points

Methods included from Plugins::Alias

#command_alias, #description_alias, #respond_to?, #sintax_alias, #usage_alias

Methods included from Plugins::Help

#command_help, #description_help, #sintax_help, #usage_help

Methods included from Events

#emit_event, #listeners, #register_listener

Methods included from Media

#extract_from_mp3

Methods included from Player::Adapter

#player_running?

Methods included from Player::Adapter::Mpg123

#fb_in_player, #ff_in_player, #pause_in_player, #play_in_player, #quit_in_player, #repeat_in_player, #resume_in_player, #stop_in_player

Methods included from Player::Playlist

#playlist?, #playlists

Methods included from Player::Interactive

#begin_session, #execute_interactively, #in_session?, #last_command, #session_history, #set_last_command, #terminate_session

Methods included from Player::BuiltinHelp

#description_connect, #description_disconnect, #description_enqueue, #description_fb, #description_ff, #description_next, #description_pause, #description_play, #description_prev, #description_quit, #description_repeat, #description_search, #description_show, #description_shuffle, #description_stop, #usage_connect, #usage_cultome_player, #usage_disconnect, #usage_enqueue, #usage_fb, #usage_ff, #usage_next, #usage_pause, #usage_play, #usage_prev, #usage_quit, #usage_repeat, #usage_search, #usage_show, #usage_shuffle, #usage_stop

Methods included from Player::Interface::Helper

#connect_response_msg, #format_secs, #get_files_in_tree, #get_from_playlists, #get_progress_bar, #get_progress_bar_with_labels, #insert_song, #play_inline?, #play_queue, #player_object, #process_for_search, #search_songs_with, #select_songs_with, #update_song, #whole_library

Methods included from Player::Interface::Extended

#connect, #disconnect, #enqueue, #fb, #ff, #repeat, #search, #show, #shuffle

Methods included from Player::Interface::Basic

#next, #pause, #play, #prev, #quit, #stop

Methods included from Command::Reader

#command_reader, #read_command

Methods included from Command::Processor

#get_command_format, #get_tokens, #identify_tokens, #parse, #validate_command

Methods included from Command::Language

#semantics, #sintax, #token_identities

Methods included from Utils

#arrange_in_columns, #display, #display_over, #ensure_db_schema, #is_true_value?, #recreate_db_schema, #swallow_stdout, #to_display_list, #with_connection

Methods included from Environment

#command_pipe, #config_file, #current_env, #db_adapter, #db_file, #db_log_file, #env_config, #file_types, #load_environment_properties, #mplayer_pipe, #player_config, #prepare_environment, #save_player_configurations, #stdout

Constructor Details

#initialize(env) ⇒ DefaultPlayer

Returns a new instance of DefaultPlayer.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/cultome_player.rb', line 99

def initialize(env)
  prepare_environment(env)
  ensure_db_schema
  playlists.register(:current)
  playlists.register(:history)
  playlists.register(:queue)
  playlists.register(:focus)
  playlists.register(:search)

  register_listener(:playback_finish) do |song|
    r = execute("next").first
    display_over("#{r.message}\n#{c5(PROMPT)}")
  end

  init_plugins
  ObjectSpace.define_finalizer(self, proc{ clean_plugins })
end