XNP How-To

  • Craciun Dan

    Craciun Dan - 2007-01-18

    Note: This HOW-TO is also available in the XNP package.
    Version: 0.6 - Jan 18, 2007

    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.

    To use it, uncompress the xnp-0.6.0.tar.gz file, open XChat and go to Window -> Plugins and Scripts, select Load then navigate in the xnp-0.6.0 directory and select the xnp_0.6.0.pl file. The script should now be loaded. It is 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
    /XNPMODES echo in the current window which informations are turned ON and which are OFF
    /XNPHELP show help about the XNP script

    To load the script automatically when XChat starts, copy the xnp_0.6.0.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:


    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:


    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 Amarok 1.4.4 on XChat 2.6.8. For updates check the  homepage or the  official XChat scripts and plugins page.

    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).

    • sheex

      sheex - 2007-01-27

      How would you modify the "Uncle Rodney Says:" to display an action (/me) instead?

    • Craciun Dan

      Craciun Dan - 2007-02-01

      In the xnp.pl file, search for these two lines:

      $line_xnp = "\cC01Uncle Rodney Says: $title$artist$album$year$track$length$bitrate$size";
      Xchat::command("SAY $line_xnp");

      You have to modify the second one, and replace "SAY" with "ME", or any other action at your choice. It should look like:

      Xchat::command("ME $line_xnp");

      Repeat this for the other commands (you'll find cmd_xnps and cmd_xnpstats below the first one).

      I am working at a new version of XNP which will be made in C and will have the option to configure these through a simple command, menus or the configuration file. Until then, hope this helps.


Log in to post a comment.