Class: Xmms::Remote

# Xmms::Remote (Class)

In: | xmms.c
Parent: | Object

## Methods

[] add add_files add_url always_on_top= aot= balance balance= band clear connect del delete eject eq eq? eq_band eq_preamp eq_preamp= eq_visible= eq_visible? eq_win= eq_win_toggle equalizer equalizer? equalizer_band equalizer_preamp equalizer_preamp= equalizer_visible= equalizer_visible? equalizer_win= equalizer_win_toggle file get_balance get_eq get_eq_band get_eq_preamp get_equalizer get_equalizer_band get_equalizer_preamp get_info get_main_volume get_output_time get_playlist_file get_playlist_pos get_playlist_position get_playlist_time get_playlist_title get_pos get_position get_skin get_stereo_volume get_version get_volume info ins_url is_eq? is_eq? is_eq_win? is_equalizer? is_equalizer_visible? is_equalizer_win? is_main? is_main_visible? is_main_win? is_paused is_paused? is_pl? is_pl? is_pl_win? is_playing is_playing? is_playlist? is_playlist_visible? is_playlist_win? is_repeat? is_repeating? is_running? is_shuffle? is_shuffling? jump jump_to_time list main= main? main_visible= main_visible? main_volume main_volume= main_win= main_win_toggle new new next output_time pause paused? pl pl? pl_clear pl_del pl_time pl_visible= pl_visible? pl_win= pl_win_toggle play play_pause playing? playlist playlist? playlist_add playlist_add_url playlist_clear playlist_del playlist_delete playlist_file playlist_ins_url playlist_ins_url_string playlist_next playlist_pos playlist_pos= playlist_position= playlist_prev playlist_time playlist_title playlist_visible= playlist_visible? playlist_win= playlist_win_toggle pos pos= position position= preamp preamp= prefs prev quit repeat? repeating? running? set_always_on_top set_aot set_balance set_band set_eq set_eq_band set_eq_preamp set_equalizer set_equalizer_band set_equalizer_preamp set_main_volume set_playlist_pos set_playlist_position set_pos set_position set_skin set_stereo_volume show_prefs show_prefs_box shuffle? shuffling? skin skin= stereo_volume stereo_volume= stop time time= title to_time toggle_always_on_top toggle_aot toggle_repeat toggle_shuffle version volume volume=

## Public Class methods

connect(...)

Create a new Xmms::Remote object.

This method raises an ArgumentError exception if the number of arguments isn’t 0 or 1.

Examples:

      # standard setup (one running copy of XMMS)
      remote = Xmms::Remote.new

      # bind to the third instance of XMMS (for you nutcases who run
      # multiple instances of XMMS)
      session = 2
      remote = Xmms::Remote.new session

new(...)

Create a new Xmms::Remote object.

This method raises an ArgumentError exception if the number of arguments isn’t 0 or 1.

Examples:

      # standard setup (one running copy of XMMS)
      remote = Xmms::Remote.new

      # bind to the third instance of XMMS (for you nutcases who run
      # multiple instances of XMMS)
      session = 2
      remote = Xmms::Remote.new session

new(...)

Xmms::Remote constructor.

This function is currently just a placeholder.

## Public Instance methods

[](p1)

Return information about a specific song in the playlist.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      title, file, time = remote[45] # get info about the 45th song
      info = remote.get_entry 45 # get info about the 45th song

add(...)

Add one or more songs to the playlist.

This method raises an Xmms::Error exception if XMMS is not running, an ArgumentError exception if the number of arguments is less than 1, or a TypeError exception if the argument isn’t a String, True, or False.

Examples:

      # replace the current playlist with one song
      enqueue = false
      remote.add 'path/to/cool_song.mp3', enqueue

      # add several files to the current playlist
      files = %w{song01.mp3 song02.mp3 song03.mp3 song04.mp3 song05.mp3}
      remote.add *files

add_files(...)

Alias for add

add_url(p1)

Add a URL to the current playlist.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.add_url 'http://www.hhmecca.net/cool_song.mp3'

always_on_top=(p1)

Alias for toggle_aot

aot=(p1)

Alias for toggle_aot

balance()

Alias for get_balance

balance=(p1)

Set the balance level.

This method raises an Xmms::Error exception if XMMS is not running.

Note: as of XMMS 1.2.6 xmms_remote_set_balance() does not appear to work correctly when XMMS is paused or stopped, so this function doesn’t either.

Example:

      remote.balance = 23

band(p1)

Alias for get_eq_band

clear()

Clear the current playlist.

Examples:

      remote.clear

del(p1)

Alias for delete

delete(p1)

Delete the Nth element of the current playlist.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.delete 26  # delete the 26th playlist element

eject()

XMMS eject button (toggle add file dialog).

This method raises an Xmms::Error exception if XMMS is not running.

Example:

      remote.eject

eq()

Alias for get_eq

eq?()

Alias for is_eq_win?

eq_band(p1)

Alias for get_eq_band

eq_preamp()

Alias for get_eq_preamp

eq_preamp=(p1)

Alias for set_eq_preamp

eq_visible=(p1)

Alias for eq_win_toggle

eq_visible?()

Alias for is_eq_win?

eq_win=(p1)

Alias for eq_win_toggle

eq_win_toggle(p1)

Set the visibility of the equalizer window.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.set_equalizer_toggle true
      remote.equalizer_visible = true
      remote.eq_visible = true
      remote.eq = true

equalizer()

Alias for get_eq

equalizer?()

Alias for is_eq_win?

equalizer_band(p1)

Alias for get_eq_band

equalizer_preamp()

Alias for get_eq_preamp

equalizer_preamp=(p1)

Alias for set_eq_preamp

equalizer_visible=(p1)

Alias for eq_win_toggle

equalizer_visible?()

Alias for is_eq_win?

equalizer_win=(p1)

Alias for eq_win_toggle

equalizer_win_toggle(p1)

Alias for eq_win_toggle

file(...)

Alias for get_playlist_file

get_balance()

Get the balance level.

This method raises an Xmms::Error exception if XMMS is not running.

Note: as of XMMS 1.2.6 xmms_remote_get_balance() does not appear to work correctly when XMMS is paused or stopped, so this function doesn’t either.

Example:

      vol = remote.balance

get_eq()

Get the equalizer settings.

This method returns an array. The first element in the array is the preamp setting, and the second element in the array is an 10 element array of band settings. So the result would look something like this:

      [1.0, [0.0, -0.5, 0.9, 0.0, 0.0, 0.0, 0.2, 0.5, -0.1, 0.0]]

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      preamp, bands = remote.get_equalizer
      eq = remote.eq

get_eq_band(p1)

Get an equalizer band value.

Note: Legal band indices range from 0 to 9 instead of 1 to 10.

This method raises an Xmms::Error exception if XMMS is not running, and an ArgumentError exception if the band index is out of range.

Examples:

      band = remote.get_band 2
      band = remote.band 8

get_eq_preamp()

Get the equalizer preamp value.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      preamp = remote.get_preamp
      preamp = remote.preamp

get_equalizer()

Alias for get_eq

get_equalizer_band(p1)

Alias for get_eq_band

get_equalizer_preamp()

Alias for get_eq_preamp

get_info()

Get various information about the current song.

This method raises an Xmms::Error exception if XMMS is not running.

Returns an array of bitrate, frequency, and numchannels, respectively.

Examples:

      info = remote.info
      rate, freq, nch = remote.info

get_main_volume()

Get the main volume level.

This method raises an Xmms::Error exception if XMMS is not running.

Example:

      vol = remote.volume
      vol = remote.main_volume
      vol = remote.get_main_volume

get_output_time()

Alias for time

get_playlist_file(...)

Get the file path of a song.

This method raises an Xmms::Error exception if XMMS is not running, or an ArgumentError exception if the number of arguments isn’t 0 or 1.

Examples:

      # get the path of the current song
      path = remote.file

      # get the path of song 23 in the playlist
      path = remote.file 23

get_playlist_pos()

Alias for playlist_pos

get_playlist_position()

Alias for playlist_pos

get_playlist_time(...)

Get the duration of a song, in milliseconds

This method raises an Xmms::Error exception if XMMS is not running, or an ArgumentError exception if the number of arguments isn’t 0 or 1.

Examples:

      # get the duration of the current song
      time = remote.playlist_time

      # get the duration of song 23 in the playlist
      time = remote.playlist_time 23

get_playlist_title(...)

Get the title of a song.

This method raises an Xmms::Error exception if XMMS is not running, or an ArgumentError exception if the number of arguments isn’t 0 or 1.

Examples:

      # get the title of the current song
      path = remote.file

      # get the title of song 23 in the playlist
      path = remote.file 23

get_pos()

Alias for playlist_pos

get_position()

Alias for playlist_pos

get_skin()

Get the current skin file.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      skin = remote.get_skin
      skin = remote.skin

get_stereo_volume()

Get the stereo volume level.

This method raises an Xmms::Error exception if XMMS is not running.

Example:

      left, right = remote.get_stereo_volume
      left, right = remote.stereo_volume

get_version()

Get the version of XMMS.

Note that this is separate from Xmms::Remote::VERSION, which is the version of Xmms-Ruby.

Examples:

      version = remote.version
      version = remote.get_version

get_volume()

Alias for get_main_volume

info()

Alias for get_info

ins_url(p1, p2)

Insert a URL into the current playlist.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      # add a url after the 45th element in the playlist
      remote.ins_url 'http://www.hhmecca.net/cool_song.mp3', 45

is_eq?()

Alias for is_eq_win?

is_eq?()

Alias for is_eq_win?

is_eq_win?()

Get the visibility of the equalizer window.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      puts 'equalizer window visible' if remote.equalizer_visible?
      puts 'equalizer window visible' if remote.eq_visible?
      puts 'equalizer window visible' if remote.equalizer?
      puts 'equalizer window visible' if remote.eq?

is_equalizer?()

Alias for is_eq_win?

is_equalizer_visible?()

Alias for is_eq_win?

is_equalizer_win?()

Alias for is_eq_win?

is_main?()

Alias for is_main_win?

is_main_visible?()

Alias for is_main_win?

is_main_win?()

Get the visibility of the main window.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      puts 'main window visible' if remote.main_visible?
      puts 'main window visible' if remote.main?

is_paused()

Alias for paused?

is_paused?()

Alias for paused?

is_pl?()

Alias for is_pl_win?

is_pl?()

Alias for is_pl_win?

is_pl_win?()

Get the visibility of the playlist window.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      puts 'playlist window visible' if remote.playlist_visible?
      puts 'playlist window visible' if remote.pl_visible?
      puts 'playlist window visible' if remote.playlist?
      puts 'playlist window visible' if remote.pl?

is_playing()

Alias for playing?

is_playing?()

Alias for playing?

is_playlist?()

Alias for is_pl_win?

is_playlist_visible?()

Alias for is_pl_win?

is_playlist_win?()

Alias for is_pl_win?

is_repeat?()

Is the repeat flag set?

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      puts 'repeating' if remote.is_repeating?
      puts 'repeating' if remote.repeating?
      puts 'repeating' if remote.is_repeat?
      puts 'repeating' if remote.repeat?

is_repeating?()

Alias for is_repeat?

is_running?()

Is XMMS running?

Examples:

      puts 'xmms is running' if remote.is_running?
      puts 'xmms is running' if remote.running?

is_shuffle?()

Is the shuffle flag set?

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      puts 'shuffling' if remote.is_shuffling?
      puts 'shuffling' if remote.shuffling?
      puts 'shuffling' if remote.is_shuffle?
      puts 'shuffling' if remote.shuffle?

is_shuffling?()

Alias for is_shuffle?

jump(p1)

Alias for jump_to_time

jump_to_time(p1)

Jump to a specific time of the current song.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.jump 45   # jump 45 seconds into the current song
      remote.time = 45 # jump 45 seconds into the current song

list()

Alias for playlist

main=(p1)

Alias for main_win_toggle

main?()

Alias for is_main_win?

main_visible=(p1)

Alias for main_win_toggle

main_visible?()

Alias for is_main_win?

main_volume()

Alias for get_main_volume

main_volume=(p1)

Alias for set_main_volume

main_win=(p1)

Alias for main_win_toggle

main_win_toggle(p1)

Set the visibility of the main window.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.set_main_toggle true
      remote.main_visible = true
      remote.main = true

next()

Alias for playlist_next

output_time()

Alias for time

pause()

Pause current song.

This method raises an Xmms::Error exception if XMMS is not running.

Example:

      remote.pause

paused?()

Is XMMS paused?

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      puts 'paused' if remote.is_paused?
      puts 'paused' if remote.paused?

pl()

Alias for playlist

pl?()

Alias for is_pl_win?

pl_clear()

Alias for clear

pl_del(p1)

Alias for delete

pl_time(...)

Alias for get_playlist_time

pl_visible=(p1)

Alias for pl_win_toggle

pl_visible?()

Alias for is_pl_win?

pl_win=(p1)

Alias for pl_win_toggle

pl_win_toggle(p1)

Set the visibility of the playlist window.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.set_playlist_toggle true
      remote.playlist_visible = true
      remote.pl_visible = true
      remote.pl = true

play()

Play current song.

This method raises an Xmms::Error exception if XMMS is not running.

Example:

      remote.play

play_pause()

Toggle Play/Pause status.

This method raises an Xmms::Error exception if XMMS is not running.

Example:

      remote.play_pause

playing?()

Is XMMS playing?

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      puts 'playing' if remote.is_playing?
      puts 'playing' if remote.playing?

playlist()

Return the current playlist. If a block is given, pass each playlist element to the block.

This method raises an Xmms::Error exception if XMMS is not running.

Note: Returning the full array can be very slow for large playlists; use the block form instead.

Example:

      # print out info for each element in the playlist
      ary = remote.playlist
      ary.each do |ary|
        title, file, time = ary
        puts "'#{title}' (#{time}ms), #{file}"
      end

      # print out info for each element in the playlist (using block
      # syntax; much faster)
      remote.playlist { |e| puts "'#{e[0]}' (#{e[2]}), #{e[1]}" }

playlist?()

Alias for is_pl_win?

playlist_add(...)

Alias for add

playlist_add_url(p1)

Alias for add_url

playlist_clear()

Alias for clear

playlist_del(p1)

Alias for delete

playlist_delete(p1)

Alias for delete

playlist_file(...)

Alias for get_playlist_file

playlist_ins_url(p1, p2)

Alias for ins_url

playlist_ins_url_string(p1, p2)

Alias for ins_url

playlist_next()

Go to the next song.

This method raises an Xmms::Error exception if XMMS is not running.

Example:

      remote.next

playlist_pos()

Get the current playlist position.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      song_number = remote.position
      song_number = remote.get_pos
      song_number = remote.pos

playlist_pos=(p1)

Alias for set_playlist_pos

playlist_position=(p1)

Alias for set_playlist_pos

playlist_prev()

Go to the previous song.

This method raises an Xmms::Error exception if XMMS is not running.

Example:

      remote.prev

playlist_time(...)

Alias for get_playlist_time

playlist_title(...)

Alias for get_playlist_title

playlist_visible=(p1)

Alias for pl_win_toggle

playlist_visible?()

Alias for is_pl_win?

playlist_win=(p1)

Alias for pl_win_toggle

playlist_win_toggle(p1)

Alias for pl_win_toggle

pos()

Alias for playlist_pos

pos=(p1)

Alias for set_playlist_pos

position()

Alias for playlist_pos

position=(p1)

Alias for set_playlist_pos

preamp()

Alias for get_eq_preamp

preamp=(p1)

Alias for set_eq_preamp

prefs()

Alias for show_prefs

prev()

Alias for playlist_prev

quit()

Quit XMMS.

This method raises an Xmms::Error exception if XMMS is not running.

Example:

      remote.quit

repeat?()

Alias for is_repeat?

repeating?()

Alias for is_repeat?

running?()

Alias for is_running?

set_always_on_top(p1)

Alias for toggle_aot

set_aot(p1)

Alias for toggle_aot

set_balance(p1)

Set the balance level.

This method raises an Xmms::Error exception if XMMS is not running.

Note: as of XMMS 1.2.6 xmms_remote_set_balance() does not appear to work correctly when XMMS is paused or stopped, so this function doesn’t either.

Example:

      remote.balance = 23

set_band(p1, p2)

Alias for set_eq_band

set_eq(...)

Set the equalizer values.

This method takes either a preamp value and 10 band values, or a preamp value and an array of band values.

This method raises an Xmms::Error exception if XMMS is not running, and an ArgumentError exception if the number of arguments isn’t 2 or 11.

Examples:

      bands = [0.0, -0.5, 0.9, 0.0, 0.0, 0.0, 0.2, 0.5, -0.1, 0.0]
      remote.set_equalizer 0.0, bands

      remote.set_eq 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0

set_eq_band(p1, p2)

Set an equalizer band value.

Note: legal band indices range from 0 to 9 instead of 1 to 10.

This method raises an Xmms::Error exception if XMMS is not running, or an ArgumentError exception if the band index is out of range.

Example:

      remote.set_band 2, 0.5

set_eq_preamp(p1)

Set the equalizer preamp value.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.set_preamp 0.5
      remote.preamp = 0.5

set_equalizer(...)

Alias for set_eq

set_equalizer_band(p1, p2)

Alias for set_eq_band

set_equalizer_preamp(p1)

Alias for set_eq_preamp

set_main_volume(p1)

Set the main volume level.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.volume = 23
      remote.main_volume = 23
      remote.set_main_volume 23

set_playlist_pos(p1)

Set the current playlist position.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.pos = 45
      remote.position = 45
      remote.set_pos 45

set_playlist_position(p1)

Alias for set_playlist_pos

set_pos(p1)

Alias for set_playlist_pos

set_position(p1)

Alias for set_playlist_pos

set_skin(p1)

Set the current skin file.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.set_skin 'path/to/cool_skin.zip'
      remote.skin = 'path/to/cool_skin.zip'

set_stereo_volume(p1)

Set the stereo volume level.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.set_stereo_volume left, right

      stereo_volume = [10, 0]
      remote.set_stereo_volume *stereo_volume

show_prefs()

Show the preferences dialog.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.show_prefs
      remote.prefs

show_prefs_box()

Alias for show_prefs

shuffle?()

Alias for is_shuffle?

shuffling?()

Alias for is_shuffle?

skin()

Alias for get_skin

skin=(p1)

Alias for set_skin

stereo_volume()

Alias for get_stereo_volume

stereo_volume=(p1)

Alias for set_stereo_volume

stop()

Stop current song.

This method raises an Xmms::Error exception if XMMS is not running.

Example:

      remote.stop

time()

Get the output time of the current song.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      time = remote.time
      time = remote.output_time

time=(p1)

Jump to a specific time of the current song.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.jump 45   # jump 45 seconds into the current song
      remote.time = 45 # jump 45 seconds into the current song

title(...)

Alias for get_playlist_title

to_time(p1)

Alias for jump_to_time

toggle_always_on_top(p1)

Alias for toggle_aot

toggle_aot(p1)

Set the "always on top" flag.

This method raises an Xmms::Error exception if XMMS is not running.

Examples:

      remote.set_always_on_top true
      remote.always_on_top = true
      remote.aot = true

toggle_repeat()

Toggle the repeat flag.

This method raises an Xmms::Error exception if XMMS is not running.

Example:

      remote.toggle_repeat

toggle_shuffle()

Toggle the shuffle flag.

This method raises an Xmms::Error exception if XMMS is not running.

Example:

      remote.toggle_shuffle

version()

Alias for get_version

volume()

Alias for get_main_volume

volume=(p1)

Alias for set_main_volume

[Validate]