Linux Scripts & Plugins

Scripts
SCRIPTS  


XNP How-To

Note: This How-To is available in the XNP package and on the Project LSP SourceForge.net page.
Version: 0.8b - Jan 09, 2008 (Updated for XNP 0.8.3)

XNP is an XChat Now Playing script for Amarok capable of showing detailed informations about the current playing track and the music collection indexed by Amarok. It displays the title, artist, album, year, length, bitrate and size of the track with the possibility to choose which one to be displayed or not. It is highly configurable through various commands and has also a graphical menus interface.

Manual Installation
To install the script manually, uncompress the xnp-0.8.3.tar.gz file by typing in a shell: tar -xf xnp-0.8.3.tar.gz Then open XChat and go to Window -> Plugins and Scripts..., click on Load... then change the working directory to the xnp-0.8.3 directory and select the xnp.pl file. The script should now be loaded. If it doesn't load make sure you have the Perl plugin installed. You might want to copy the xnp-help directory into your ~/.xchat2 directory and have Firefox installed to if you want to be able to use the /XNPHOWTO and /XNPFAQ commands.

Automatic Installation
To install the script automatically, use the install_xnp.sh script from the xnp-0.8.3 directory.

XNP is highly configurable through either the XNP menu or the following commands:

/XNP message the current channel/query
/XNPS message the current channel/query in a very simplistic format
/XNPSTATS message the current channel/query informations about the Amarok collection
/XNPINFO echo in the current window informations about the current playing track and collection
/TOGGLE_ALBUM toggle displaying the album
/TOGGLE_YEAR toggle displaying the year
/TOGGLE_TRACK toggle displaying the track
/TOGGLE_LENGTH toggle displaying the length
/TOGGLE_BITRATE toggle displaying the bitrate
/TOGGLE_SIZE toggle displaying the size
/TOGGLE_SHOW_MENU toggle the XNP menu ON/OFF
/ALL_ON toggle ON displaying all the informations
/ALL_OFF toggle OFF displaying all the informations
/BROWSER1 change the help browser to Firefox
/BROWSER2 change the help browser to Epiphany
/BROWSER3 change the help browser to Konqueror
/BROWSER4 change the help browser to Opera
/XNPHOWTO open the XNP How-To
/XNPFAQ open the XNP FAQ
/XNPVOL change Amarok volume to any value (ie. /XNPVOL 73)
/XNPMUTE mute Amarok
/XNPMAX change Amarok volume to maximum (100%)
/XNPVOL1 change Amarok volume to 10%
/XNPVOL2 change Amarok volume to 20%
/XNPVOL3 change Amarok volume to 30%
/XNPVOL4 change Amarok volume to 40%
/XNPVOL5 change Amarok volume to 50%
/XNPVOL6 change Amarok volume to 60%
/XNPVOL7 change Amarok volume to 70%
/XNPVOL8 change Amarok volume to 80%
/XNPVOL9 change Amarok volume to 90%
/XNPPLAY start playing a track in Amarok
/XNPPAUSE pause Amarok
/XNPSTOP stop Amarok
/XNPPREV select/play previous track in Amarok
/XNPNEXT select/play next track in Amarok
/XNPRUN run Amarok
/XNPQUIT quit Amarok
/XNPMODES echo in the current window which informations are ON and which are OFF
/XNPABOUT show the about message box
/XNPHELP show help about the XNP script

The default browser for viewing the XNP help files is Firefox, to change it edit your ~/.xchat2/xnp.conf file.

To load the script automatically when XChat starts, copy the xnp.pl file into your ~/.xchat2/ directory, where ~ is your home directory. .xchat2 is a hidden directory so make sure that you set your file browser to display hidden files.

First time the script runs, it will create a default configuration file (xnp.conf) into your ~/.xchat2/ directory that looks like this:

show_album=1
show_year=1
show_track=1
show_length=1
show_bitrate=1
show_size=1
show_menu=1
browser=firefox

This means that all the informations will be displayed. Edit this file by hand carefully (by using value 1 (one) to enable an option and value 0 (zero) to disable an option). For example if you want to display only the album and the year edit it like this:

show_album=1
show_year=1
show_track=0
show_length=0
show_bitrate=0
show_size=0
show_menu=1
browser=firefox

The same thing can be accomplished by using the commands /TOGGLE_TRACK, /TOGGLE_LENGTH, /TOGGLE_BITRATE and /TOGGLE_SIZE. Notice that it doesn't support comments, so do NOT use pound (#) signs to comment anything in the configuration file. If you, by mistake, edit it wrong the script will replace the corrupted file with a default one. The configuration commands do not apply to the /XNPINFO command.

If you want only a minimalistic display use the /XNPS command. It will only display the playing status in the format "Uncle Rodney Says: Artist - Title".

XNP was tested with XChat 2.8.4 and Amarok 1.4.8. For updates please check the homepage.

Known Bugs
- the /XNPSTATS command will show 0 compilations on Amarok 1.3.9. This is not the script's fault, DCOP returns 0 instead of the real value.
- the /XNP command will return (No Year Field) and (No Track Field) if they are equal with zero (0).
- the XNP menu isn't deleted when the script is unloaded. You can delete it manually using /MENU DEL XNP.

For suggestions, feature requests and bug reports please contact me at christmas_cpp@yahoo.com or use the Project LSP SourceForge.net page.

Creative Commons License
Copyright (C) 2006-2008 Craciun Dan under the terms of the Creative Commons Attribution-ShareAlike 2.5 License.
Including:

* Tutorials on compiling and installing several packages in Debian Lenny
* Using CLI tools in Linux
* XChat tips & tricks
* Bash tutorials and tips & tricks
* Linux-related reviews
* KDE-related tutorials
* More to come!