/*//. Query XMMS (qxmms) / ../ Written by Bob `tIKi_mAn` Majdak Jr. / ../ bob@opsat.net - http://www.opsat.net / ../ Released under the GNU GPL for Linux / ../ Program information and versions .//*/
Copyright © 2006 Bob Majdak Jr
This program is GNU GPL licenced.
See licence.txt for information.
//. Info
This program is a small command line application that queries Xmms about what it is currently
doing. Assuming you compiled and installed Xmms on your own, I would imagine you should have
no problems compiling this program. However it requires libxmms and if you used an install
package for your distro you might not have it, you'll have to dig around for an Xmms Devel
pack. I don't know if the pre-compiled qxmms can work without libxmms installed, never tried.
Perhaps someone can report back to me on this. I'm guessing no.
The whole point of having a command line Xmms query tool is so that it can be used in other
things not just randomly typing `qxmms` in a command line to see what is playing. That would
be more work than just reading the Xmms window. :p
For example, I currently have Xmms running a modified song_change plugin so that on
Play, Pause, Stop or Song Change it runs a PHP script at the command line that I wrote...
`php /home/bob/.xmms/blog_update.php`
blog_update.php:3:preg_match("/\"(.)\" \"(.)\" \"(.)\" \"(.)\" \"(.*)\"/",`qxmms -tbslrLQ`,$string);
which in turn updates an online script which shows on my blog what is 'Now Playing', as well as
if the player is Playing, Paused, or Stopped. This isn't a PHP tutorial, but that example line
gives me an array built like this:
$string = Array(
[0] => '"Brooke Valentine - Girlfight (Explicit Extended)" "128kbps" "44.1khz" "4:11" "Playing"',
[1] => 'Brooke Valentine - Girlfight (Explicit Extended)',
[2] => '128kbps',
[3] => '44.1khz',
[4] => '4:11',
[5] => 'Playing'
);
I now have a near limitless amount of possibilities that can be had with this information in PHP,
and you could use this anywhere. For example I use this in a Perl script that X-Chat uses.
`/mp3`
<@bob> [XMMS]3663. Brooke Valentine - Girlfight (Explicit Extended)[4:11][160kbps 44.1khz]
<@bob> writing the qxmms readme file. kthx lol.
//. Quick Start
Unpackage the qxmms-x.x.tar.bz2. If you downloaded the pre-compiled binary then there you go,
run it right where you unpackaged it. You could move or link it to /usr/bin/ or ~/bin or
wherever you have setup to hold binaries so you can execute them from any directory with ease.
If you want to compile it, then just type "make" and it should compile it. Then follow the
above paragraph.
In the following examples I am going to assume you have copied the qxmms binary to /usr/bin.
Also, all commands are typed at a shell, be it an xterm,konsole,Eterm... whatever.
Do not type the quoting marks when typing these commands.
Typing `qxmms`
Returns `Sugar Ray - When It's Over`
That Simple.
As of version 1.03, qxmms has the ability to do minor remote control functions such as, Play, Pause,
Stop, Next Track, Previous Track, Add Track, and Set Volume. To perform a command, use like so.
Typing `qxmms play`
Will cause Xmms to begin playback, as though you clicked the Play button yourself.
//. A little less quick of a start.
Without any switches, only the Xmms display title is returned. This is usually 'artist - title'
but can be tweaked in the Xmms preferences I believe.
When you add switches, qxmms instead only displays the requested information. For example:
Typing `qxmms -t`
Returns `Venga Boys - We are going to Ibiza`
`t` is obviously the switch for the title. Adding switches gives you more info.
Typing `qxmms -tbsl`
Returns `ATB - Long Way Home 192 44.1 5:17`
`b` is the bitrate, `s` the sample rate, `l` the track length.
There are also what I call modifier switches, which are uppercase.
Typing `qxmms -tbslL`
Returns `ATB - Long Way Home 192kbps 44.1khz 5:17`
`L` is the modifier to add the labels in on elements that would be labeled, like the bitrate being labeled
in kilobits per second (kbps).
Commands always are executed before Xmms is queried.
Typing `qxmms -t next`
Will change to the next track in the playlist, and then return it's title.
//. Quick Help
Printing Options
p - track number in playlist.
b - bitrate.
s - sample rate.
t - track title.
f - track filename.
c - channels (Mono/Stereo).
l - current track length.
n - current position in track.
r - running state.
v - current volume.
Print Modifier Options
L - print labels (khz/kbps/%).
S - print times in seconds.
Q - print quotes around each string.
Other Options
h - display this help and exit.
V - print program version and exit.
Commands
play - start playback.
pause - pause playback.
stop - stop playback.
next - next track in playlist.
prev - previous track in playlist.
addfile <filename> - addfile to end of playlist.
volume <0-100> - set volume (in percent).
volume <up|down> - increment volume 5%.
jump <> - jump to number in playlist.
seek <min>:<sec> - jump to time in current tune.
seek <forward|back> <> - seek in direction # seconds.
skin <path_to_skin> - change xmms skins
//. Changelog
v1.0 - 20050617
+ Initial Release.
v1.01 - 20050726
+ Add running state query, switch r. (Playing, Paused, Stopped)
v1.02 - 20050826
! Fixed bug in time calculations caused by loss of precision.
v1.03 - 20050115
& Some restructuring and 'upgrading' to code complexity.
+ Added remote controls, play, pause, stop. next, prev, addfile, volume, jump.
+ Added switch v to return current volume, V now program version.
+ Added GNU type --version command.
v1.04 - 20060204
+ Added command 'skin' for changing xmms skins.
