Client:x2c - nesciens/xmms2-wiki GitHub Wiki
- Author: Daniel Waber
- Latest version: 0.1
- Homepage: http://forti.ath.cx:20480/pro/x2c http://rubyforge.org/frs/?group_id=3900
- Development language: Ruby
- User interface: Console
- Screenshots: 1 2
x2c is a small, interactive ruby command line client for xmms2
About
A small, interactive ruby command line client for xmms2
the client itself is an irb shell executing commands on the client object, which has been extended to get a powerful and easy interface to playback, playlists and collections. As it is all ruby, you can easily extend its functionality, create new aliases or functions, or create you own client on top of it.
Features
Features for non-rubyists, the basics
- usable without knowing ruby
- works an almost all terminal
- nice command-line interface with completion
- module support for new features
- already has cool module: vote, mlib, autodaemon, ...
- short tutorial to get into the feeling of the client
- help system, so you don't get lost ;)
Features for rubyists, advanced things
- cool stack feature
- highly configurable and extensible
- easy to modify for your own needs
- you can do cool things, as all is ruby
Getting started
You can download x2c at Rubyforge(tgzgem) or get the latest snaps at my hompage.
Simply extract the tar, move the x2c folder where you like it and run ./x2c or create a symlink to x2c. You also can use the gem to install x2c:
sudo gem install x2c-0.1.gem
Everything else should be straightforward, because of the help and tutorial features :)
Code snippets
skip sid
# little script you can call in post_deamon to make sids only play for 3m
def start_sid_skip
skipsid = nil
@sidskip = broadcast_playback_current_id.notifier do |r|
if skipsid
skipsid.kill
skipsid = nil
end
song = Song.new(r.value)
skipsid = Thread.new do
if song.chain =~ /sid/ && !song.info[:duration]
sleep 180
print "\r... skipping sid"
skip
end
end
end
puts "... sidskip started"
end
def stop_sid_skip
puts "... stopping sidskip"
@sidskip.disconnect
end
the mlib
# remove unwanted media
(url =~ '
file:///some/stage/music%
').list.each{|id| medialib_entry_remove(id)}
# tag media
(url =~ 'anArtist/%').list.each do |s|
if s.url =~ /\/(\w| )*\/(\w*) - (\w*)/
s.artist= $2
s.album = $1
s.title = $3
end
end
Volume fades
(0...100).each{|i| volume i; sleep 0.1}
(0...100).each{|i| volume 100-i; sleep 0.1}