In: |
xmms.c
|
Parent: | Object |
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
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
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 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 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'
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
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
XMMS eject button (toggle add file dialog).
This method raises an Xmms::Error exception if XMMS is not running.
Example:
remote.eject
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
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 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 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 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 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 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 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 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 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 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 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 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
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
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?
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?
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 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 XMMS running?
Examples:
puts 'xmms is running' if remote.is_running? puts 'xmms is running' if remote.running?
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?
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
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
Pause current song.
This method raises an Xmms::Error exception if XMMS is not running.
Example:
remote.pause
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?
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 current song.
This method raises an Xmms::Error exception if XMMS is not running.
Example:
remote.play
Toggle Play/Pause status.
This method raises an Xmms::Error exception if XMMS is not running.
Example:
remote.play_pause
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?
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]}" }
Go to the next song.
This method raises an Xmms::Error exception if XMMS is not running.
Example:
remote.next
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
Go to the previous song.
This method raises an Xmms::Error exception if XMMS is not running.
Example:
remote.prev
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 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 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 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 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 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 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 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 the preferences dialog.
This method raises an Xmms::Error exception if XMMS is not running.
Examples:
remote.show_prefs remote.prefs
Stop current song.
This method raises an Xmms::Error exception if XMMS is not running.
Example:
remote.stop
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
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
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 the repeat flag.
This method raises an Xmms::Error exception if XMMS is not running.
Example:
remote.toggle_repeat
Toggle the shuffle flag.
This method raises an Xmms::Error exception if XMMS is not running.
Example:
remote.toggle_shuffle