About

AMIP - Advanced mIRC integration plug-in
About

Advanced mIRC Integration Plug-In (AMIP)
©Serge Baranov
2001 - 2005

v2.53
(26.02.2006)

Release focus:
new features testing, fixing bugs
(complete ChangeLog)

Author: | Serge Baranov (AKA [Commando], AKA CrazyCoder)
E-Mail: | coder@tools-for.net
ICQ: | 12467890
IRC: | irc.freenode.net, #amip (nick: [Serge])
WWW: | http://amip.tools-for.net

For quick start please refer to this section.

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Feel free to redistribute this software. Please include this file in your distribution with saving all copyrights.

Third-party products used in AMIP:

RCF: Remote Call Framework is used as a Transport between AMIP and another applications, such as mIRC and jIRCii. AMIP server allows to control and query your player remotely (http://www.codeproject.com/threads/RMI_For_Cpp.asp).

AAC/MP4 decoders (http://www.rarewares.org/aac.html)

libflac: for reading flac metadata and format specific info (http://flac.sourceforge.net/)

Tag: Tag is a command line util for displaying and managing tags in audio files. Some parts of this utility are used in AMIP to read APE and FLAC tags (http://www.neilpopham.pwp.blueyonder.co.uk/tag.html).

ogg/vorbis library: to make AMIP support vorbis comments (http://www.xiph.org/ogg/).
id3lib: id3lib is a software library for manipulating ID3v1/v1.1 and ID3v2 tags.
id3lib 3.0.x conforms to all ID3v2 standards up to and including the ID3v2.3.0
informal standard. (http://id3lib.sourceforge.net).

PCRE: Regular expression support is provided by the PCRE library package,
which is open source software, written by Philip Hazel, and copyright
by the University of Cambridge, England. (ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/).

EncSpot: Open source mp3 analyzer (thanks for some pieces of code used in AMIP) (http://www.guerillasoft.com/).

STLport: Full ANSI C++ Standard library (http://www.stlport.org).

CStdString: This is a string class derived from the Standard C++ Library basic_string<> template. It makes basic_string as easy to use as MFC's CString but does not depend on MFC or any other proprietary class library. (http://home.earthlink.net/~jmoleary/projects.htm).
AMIP - Advanced mIRC integration plug-in


ChangeLog

ChangeLog
 [+] - Added   [*] - Fixed/Changed  [-] - Removed

 2.53
 ----------------------------
    [*] /dde mplug cfgdump not working when auto
        announcement is disabled
    [*] FLAC 1.1.2
    [+] $strip(pattern,subject) - removes all matches to
        pattern from subject
    [+] $regrep(pattern,replacement,subject) - searches
        subject for matches to pattern and replaces them
        with replacement
    [+] $strrep(search,replace,subject) - this function
        returns a string with all occurences of search in
        subject replaced with the given replace value
    [*] iTunes: statically linked with mfc71 lib, no more
        mfc71.dll dependancy
    [*] If you need comma inside function, you can escape
        it with backslash
    [+] %player variable, can be
        Winamp/QCD/foobar2000/iTunes
    [+] Timer Callback - commands placed there will be
        invoked every second by default
    [+] Simple Shared memory API (FileMapping), AMIP can
        now publish a shared memory structure with song
        info. Details coming soon. The following command
        was added: /shmem(file,type,action) where file is
        the name of memory mapped file (e.g. amip_api);
        type can be 'delphi' (without quotes) for
        pascal/delphi style TStrings and anything else for
        C style strings; action is either 'update' or
        'clear', update updates the memory mapped file,
        clear clears it. Example that can be placed into
        the new Timer Callback:
        /shmem(fb2k_cm2,delphi,update), in the Exit
        Callback: /shmem(fb2k_cm2,delphi,clear)
    [+] MSN Messenger 7 beta support (you need 7.0.604 or
        7.0.0632), see screenshot:
        http://www.rzone.ru/photo/msn7.png
    [+] AMIP updates MSN Messenger info automatically, but
        if you want to do it on different events, use
        /msn(update) and /msn(clear) commands in the
        presets
    [+] %fpath - directory containing file (NOT including
        trailing backslash)
    [+] Title bar integration has been rewritten, now it's
        possible to change font and color (via AMIP
        Configurator)
    [*] Ctrl+J dialog possible deadlock fixed (if parse
        delay is 0 and you end dialog while song is being
        parsed)
    [*] Pipe replacement should work properly now (see bug
        #4015)
    [*] Fixed exit on invalid tags when memory allocation
        fails
    [+] !!! Remote Server API to control and query AMIP
        from another apps (via sockets). SDK coming soon
    [+] !!! Socket Transport is introduced in addition to
        DDE and FileMapping. mIRC native socket transport
        DLL for AMIP is coming soon, command line Remote
        AMIP controller is also on the way
    [+] Remote Call Framework (RCF) is built-in for Remote
        API and Socket transport
    [+] /msn(manual)title::artist::album command, use in
        event handlers to change text in MSN Messenger
        depending on the player state, relace title,
        artist and album with AMIP variables. Sample is
        here: http://amip.tools-
        for.net/config/msnmanual.png
    [+] /socket(host,port,timeout)message - sends message
        to AMIP Remote client with the specified host,
        port and timeout. You can place this in the preset
        and on the client invoke the announce preset N
        command. This allows to use multiple clients with
        different hosts/ports
    [*] autoplay parameter behavior has changed. If it's
        off then after searching from mIRC no local
        playlist will be created now
    [+] Options to disable socket connections for N
        seconds if X subsequent connections failed
    [+] clearqueue command to reset local playlist
    [+] $regmatch(subject, pattern, group) -- matches
        subject against regexp pattern and returns the
        contents of parenthesis group, use group = 0 for
        entire match. Sample:
        $regmatch(text::other,\(.*?\)::.*,1) will return
        'text'. Don't forget that parenthesis inside
        functions must be escaped with backslashes
    [*] Fixed %fupdir bug (not matching directories with
        dots), new regexps for %fdir and %fupdir should
        work better. Thanks to FollowTheZeETeR for
        noticing =)
    [+] /msn(alt)format command. Sends string formatted
        according to 'format' to the MSN Messenger
    [+] !!! WMA metadata support for .wma and .asf files.
        %asf flag and %wma (yes/no) variable. %1-%7, %br,
        %sr, %typ, %sl, %min, %sec, %wma_rt (rating), %VBR
        (yes/no), %ENC. No need for WMA libs, AMIP is
        using its own metadata reading code
    [*] MSN Messenger integration now behaves like Windows
        Media Player (clears info on stop)
    [*] $ue now uses %20 for space instead of +
    [+] Callbacks/Listeners API via sockets
    [+] Track number field added to the end of shmem
        structure
    [+] 'control exit' API call to close player. Supports
        Winamp, ITunes, QCD/QMP, Fooobar (/dde mplug
        control exit or /dll ac mexec control exit)
    [*] QMP Support, installer can now install AMIP for
        Quintessential Media Player
    [*] SocketServer API fixes to allow multiple ac.dll
        and AMIP instances (no more hangups)
    [*] iTunes: proper shutdown handling
    [+] Option to set AMIP's DDE server name
        (CFG_DDESERVER)
    [+] 'control minimize' and 'control restore' API
        functions to Minimize/Restore Player window.
        Winamp 2/5 only!
    [+] 'disabletransports' config option. Disables all
        transports, only listeners will work
    [+] !!! Application specific clipboard presets. You
        can also control which keys to send after paste by
        putting in key_down(code) and key_up(code)
        commands, one per line. For example, to press
        enter put the following commands: key_down(0x0d)
        key_up(0x0d) - simulates Enter. Key codes can be
        in hex or in dec
    [+] iTunes: support for stream song titles, %s
        contains song name now, also there is separate
        variable for this: %itstream
    [*] Search dialog crashed recent Winamp versions when
        no songs were selected
    [*] libogg/libvorbis 1.1 (SVN revision 9541)
    [*] Separate callback for Play status change, since
        old Play callback was invoked also on song change.
        Now it's called Play & Change in AMIP Configurator
    [+] 'reindexq' API command to reindex playlist in
        async mode without progress dialog
    [+] 'reindexa' API command to reindex playlist in
        async mode, but with progress dialog
    [+] %indexed variable, mainly for API so that you can
        check how many songs are really indexed and
        reindex if this number doesn't match the lenght of
        the playlist
    [*] Fixed getting Monkey Audio 3.99 song length
        (thanks Trazi for reporting)
    [*] FB2K: %psec and %sl return actual values instead
        of 0 when player is paused
    [*] use dot instead of comma in the %fl
    [+] 'formatpreset n' API function, returns song info
        formatted using n'th AMIP preset
    [*] fixed getting ogg song length
    [*] STLport 5.0
    [+] VC8 performance optimized build (instead of VC7
        size optimized)
    [*] Exit callback not sending info to clients (thanks
        to voks for report)
    [*] Foobar version crashing in some rare cases (again,
        thanks voks)
    [+] MediaMonkey compatibility
    [*] Migrated to RCF 0.1, SDK API is now incompatible
        with previous builds
    [*] Fixed %stat, %tstat and %playing not available for
        the first time after player start (thanks voks)
    [+] listindexformat config variable, sets printf
        format for the search dialog when index numbers
        are enabled, must contain placeholders for %d and
        %s in exactly this order. Modify with care, refer
        to the printf format specification documentation.
        Default format is now "%d. %s"
    [+] %stream flag, set to 1 when playing live stream
        (when song length is 0), otherwise is empty
    [*] /dde mplug search didn't index playlist (reported
        by voks)
    [*] PCRE 6.5
    [*] Fixed version string format from Winamp
    [*] Changed callbacks behavior, now they will announce
        to clients even when automatic mode is disabled

 2.52
 ----------------------------
    [+] In addition to /flash(LAMP) command introduced in
        2.48 there is now the same command but with
        extended syntax: /flash(NUM,0,200,5) - will start
        flashing NUMLOCK with the initial delay 0, in each
        state (ON/OFF) lamp will be 200ms and will flash 5
        times
    [*] !!! iTunes 4.7 or later is required to run
    [+] iTunes: you can now quit without warning
    [*] iTunes: options dialog can be invoked in the AMIP
        Visualizer stub (round Options button on top-
        right)
    [*] iTunes: all memory leaks should be fixed now
    [*] Fixed conditional $-functions
    [+] ! /dde mplug announce - will announce current song
        to mIRC using current preset (FINALLY!) Works even
        if IRC Integration is disabled
    [+] ! /dde mplug announce preset N - same as announce,
        but use preset N (1..5)
    [+] ! /dde mplug announcesong N - announces song N by
        invoking current preset
    [+] ! /dde mplug announcesong N X - announces song N
        by invoking preset X (1..5)
    [*] Fixed the potential null-pointer during the locale
        initialization (fatal error during initialization)
    [*] Updated zlib to 1.2.1
    [*] Updated FLAC to 1.1.1
    [*] fixed 0 bitrate for flac and ape files (#04003)
    [+] %rawlen - raw file size as returned by ftell
    [*] Options redesign (and File Chooser is added now)!
    [*] Enable IRC option renamed to Announce
        automatically because it's what it does now
    [*] !!! Automatic announcement is disabled now by
        default
    [*] New default presets
    [+] !!! Official AMIP IRC channel: irc.freenode.net
        #amip

 2.51
 ----------------------------
    [*] FB2K: AMIP could crash player if playlist item
        deleted - fixed
    [*] (post-release fix) Fix the problem with updating
        stream titles when file check option is enabled
        (pattern match condition was incorrect)

 2.50
 ----------------------------
    [*] Ogg Vorbis libraries synced with SVN (1.1 version)
    [*] Fixed bug with non-working cache
    [*] CFG_CHECKFILE now defaults to 0

 2.49
 ----------------------------
    [*] id3lib synced with id3lib-stable CVS

For complete changelog please see
http://amip.tools-for.net/changelog.htm


Using Plug-In

Quick Start

Intro

  1. "How do I install this?"
  2. "I want AMIP to announce automatically when song changes in Winamp"
  3. "I want to announce manually, only when I press hotkey in mIRC or type some command, how can I accomplish this?"
  4. "I want to announce automatically, but only to the particular channels"
  5. "Automatic announcement to all the channels"
  6. Does AMIP support Trillian, ICQ, my_another_very_cool_client?
  7. Integrating with mail clients and with anything else which can read from files
  8. "I can't see AMIP output in mIRC, please help!"
  9. Conditional statements
  10. Searching for the song really quickly
  11. Displaying song info in the active window title (experimental)
  12. Conclusion
  13. Uninstalling

0. Intro

Thank you for using AMIP! I hope you'll enjoy it! To make your life easier I wrote this quick start. It is based on the questions I frequently receive by e-mail or from AMIP forums.

These common questions (and of course my answers) will help you to set up plug-in very quickly. You will also know about some advanced AMIP features. So, let's start.

If you want to get access to all the AMIP options, please use AMIP Configurator, it is available from http://amip.tools-for.net/config/ , built-in options dialog allows to configure basic options only.

1. Installation "How do I install this?"

I assume that you've already installed it =), the main problem users usually get is installing AMIP Winamp 2 version on Winamp 3 and vice versa. There are 2 AMIP versions, each should be installed on the appropriate Winamp version. Please note, that AMIP Winamp 2 version will also probably work on Apollo. Actually, the installer is smart enough not to allow you to install on the improper Winamp version.

2. "I want AMIP to announce automatically when song changes in Winamp"

Probably it is not very wise way of configuration, because it can spam channels, but it is the default one and the most simple, so it is good to start with. See chapter 3 below for manual announcing.

To open options you can just type /dde mplug options in the IRC client. The other way is to browse Winamp preferences and find them there (Options | Preferences | Plug-ins | General Purpose, Advanced mIRC Integration Plug-in, for Winamp 2.x and Preferences | AMIP Wrapper for Winamp 3.x).

From AMIP version 2.30 I've changed the default output string format to:

//describe $active np: %name [%min:%sec~m/%br~Kbps/%sr~KHz]

This is more polite version, because it announces song info only to the active channel and doesn't advertise AMIP's homepage (Now you have to tell all your friends about AMIP manually :)).

Let's see what each part of this string does.

//describe - It is mIRC command, the same as /me but allows to specify the channel or nick

$active - mIRC variable which stands for the active channel you are currently chatting in. It can also be the query nick name.

All the rest part of this string is what you will get as your action text in the IRC client. This text contains variables which start with % sign, all the variables are described in this manual, for example:

%name is a song artist and title separated by " - ", if there is no tag, file name will be used as a value. It is quite universal and will work for most of files, you'll always see something as a value of this variable.

%min:%sec~m - for example the output of this will be 06:31m, please note that it is necessary to separate variable name from the rest of the text by ~ character. If you need to print ~ character in the IRC client, you need to use ~~ sequence in the preset.

%br is a bitrate, %sr is a sample rate. There are more than 100 another variables available for using in the presets.

Please note that the above string will work fine in mIRC 6, however if you will use /me instead of /describe $active it will not work. The problem is that mIRC 6 interprets the string passed by AMIP like if it was typed in the Status window, but mIRC 5.x automatically passes it to the active window.

Feel free to change the above string to anything you like. Read the appropriate sections of this manual to know how to use colors and other text attributes.

3. "I want to announce manually, only when I press hotkey in mIRC or type some command, how can I accomplish this?"

Well, this question is the most common one, so read very carefully =)

The first thing you probably want to do is to stop automatic announcing. There are several ways. You can just disable IRC integration or remove all the text from the preset. In the second case please be sure to choose some other preset than the first one, because the first one will be restored to the default value.

OK, now AMIP doesn't announce automatically and we need to make mIRC to announce when we press hotkey (or type some command). Fortunately AMIP is flexible enough to pass its variables to mIRC upon request. For the detailed information you can refer to the mIRC Scripting section, here I will describe the basics.

The easiest way is to use $dde variable with format option. Open mIRC aliases editor and type in the following:

F12 /me $dde(mPlug,format,"np:_%name_[%min:%sec~m/%br~Kbps/%sr~KHz]")

Now every time you hit F12, you'll get just the same as described in the previous chapter.

F12 is the hotkey, you can use some command instead of this, for example /mp3, /me is a mIRC command to say what you are doing. $dde has 3 arguments: mPlug is the AMIP dde server name, format is AMIP internal command, it tells AMIP that it should interpret the third parameter as a usual preset. The third parameter is the text with variables you want to be printed in mIRC. There is one important limitation, you can't use spaces in this parameter, all spaces must be replaced with the underscores. You can use all the other AMIP variables in it like in the usual preset.

In the mIRC scripting section you will find the complete script sample using this approach. It sets mIRC variables to AMIP variables using $dde and then build output line using only scripting language. This one is for advanced users who are keen at mIRC scripting. You can get full control over the AMIP options, get all the variables, control Winamp from your script, etc.

4. "I want to announce automatically, but only to the particular channels"

It is very simple. Open AMIP Options, you will see the channels list on the right, add channels to it using "+" button. Be sure to enter channel names with # character, like "#mycoolchannel".

Now, in the active preset change the command to /cme to announce in the form of action or to /msg to announce as a usual typed text. For example, the default string from chapter one in this case will look like:

/cme np: %name [%min:%sec~m/%br~Kbps/%sr~KHz]

Now AMIP will announce only to the specified list of channels, in despite of the channel you are currently chatting in (the active one).

5. "Automatic announcement to all the channels"

Be extremely careful! You can flood a lot of channels and you can get banned very quickly!
Now, if you realise what you are doing, here are the sample strings for you (first for action, second for the simple message):

/ame np: %name [%min:%sec~m/%br~Kbps/%sr~KHz]

/amsg np: %name [%min:%sec~m/%br~Kbps/%sr~KHz]

6. Does AMIP support Trillian, ICQ, my_another_very_cool_client?

The answer is yes! Every application in which you can paste from clipboard is automatically supported by AMIP.

All that you need is to specify preset #5 in AMIP Options, let's set it to "np: %name [%min:%sec~m/%br~Kbps/%sr~KHz]". It is not necessary to make this preset active.

Now press Ctrl+Alt+Z and the song info formatted according to the preset #5 will be pasted in the window just after the cursor.

By default AMIP uses Ctrl+V sequence for pasting, however if your applications doesn't accept Ctrl+V, but supports Shift+Insert, you need to press Ctrl+Alt+Z twice quickly. AMIP will switch keystroke for this particular application to Shift+Insert and will remember the name of this application. You will see window flashing when the keystroke is switched. To switch the keystroke back, just hit Ctrl+Alt+Z twice again. After some seconds the original content of the clipboard is automatically restored.

Probably you want to change Ctrl+Alt+Z shortcut to something else. Currently it is not possible directly from the options, however you can change it in the plugin.ini located in the Winamp plugins directory.
Make sure that Winamp is closed, open plugin.ini with your favorite text editor, find the line PasteHotkey=... and change the keystroke. Here is the brief description of special keys and modifiers which can be used:

control
shift
alt
win

backspace
tab
return
pause
escape
space
pageup
pagedown
end
home
left
up
right
down
printscreen
insert
delete

and the usual letters, digits and Fxx keys from F1 to F11. Note that F12 is reserved in latest Windows versions, however F12 can be used in combination with some modifier, like control f12.

For example you want to use Win+S as a paste shortcut, make the following change:

PasteHotkey=win s

7. Integrating with mail clients and with anything else which can read from files

Open AMIP Options, you will see MAIL integration controls group.

Specify the file you want AMIP to write to, for example e:\song.txt. Configure presets for each player state and that is all.

Now in your mail client find an option which allows to include text file as a part of your signature. Specify the there the same file.

Please note that you can write to multiple lines in the file by using \n as a line separator in the file presets.

8. "I can't see AMIP output in mIRC, please help!"

The main problem is that DDE Server name in mIRC Options doesn't match DDE Server name in the AMIP Options, make them equal, restart both mIRC and AMIP and all should work (In mIRC this setting is located under File | Options | General | Servers | DDE Server, also check that it is enabled).

Actually DDE communication is not the best way to pass info to mIRC, and AMIP supports the better way, which is faster and doesn't require any configuration of mIRC. To enable this way of communication, find and check the "direct send" checkbox in the AMIP options. This will help if DDE doesn't work on your system for some reason.

Please note that if you are using some other client from the supported clients list, such as Klient, Bersirc or PIRCH, you have to use DDE. For Klient and PIRCH there are special checkboxes in AMIP Options. For Bersirc you will need special DDE Wrapper which can be obtained from the AMIP's site. Be sure to read readme.txt from the wrapper archive.

Another problem is the preset. If you see the usual AMIP message in the status when you start Winamp but cannot see the song info, please check the preset.

9. Conditional statements

In the presets you can use so called conditional statements which allow you to choose which variable will be printed depending on the value of another variable.

For example:

%?7<%7|->

The above code will print song genre if it is specified, otherwise it will print -.

The format is %?variable_to_check<print_if_not_empty|print_if_empty>

One condition can be used inside another, AMIP supports unlimited nesting.

It is also possible to compare the variable with some value and then print one or another text depending on the comparation result:

%?LEN='^0$'<--:--:--|%LEN>

The string in single quotes is a perl compatible regular expression.

10. Searching for the song really quickly

You have thousands of mp3s in your playlist and want to listen to song which suites your current mood, or which suits the current moment, or you want to show some one in IRC that you have this song. AMIP again can help you.

You probably know that there is Jump to File dialog in Winamp (Called by J if Winamp window is active). But it has a lot of limitations. It is not convenient to activate Winamp every time you want to switch the song, Winamp 3 doesn't support this at all, also this Windows doesn't support searching non-english titles, etc.

AMIP provides the complete replacement for this dialog. Just hit Ctrl+J from any application and the windows popups. Enter the part of song title or artist name and choose the song you like. You can use up/down arrows and pgup/pgdown to navigate through the results. Focus will always remain in the edit control, so that you can do the search using only keyboard. Hit the Enter key to play selected song, window disappears and focus is automatically returned to the window you were working in.

You can use perl compatible regular expressions when performing search.

Wow! Now you can choose any song from thousands just within 2 seconds!

Ctrl+J shortcut can be changed in the plugin.ini as described in chapter 6, parameter name is RegexHotkey.

11. Displaying song info in the active window title (experimental)

Make sure that your player is not running, open plugin.ini, change CFG_DRAWONCAPTION value from 0 to 1.

Optional: change the format of the displayed text by modifying CFG_CAPTIONFORMAT variable.

12. Conclusion

I hope now you are able to use AMIP and have fun with it, for more advanced options, please read the rest sections of this manual.

13. Uninstalling

Go to Add/Remove programs, find AMIP in the list and remove it.


Functions

Web Integration

Starting from version 2.35 AMIP supports /template and /exec commands, it is possible to put html with song info to your page via FTP or pass song info to php, perl, asp and other scripts running on your web server (for example to make image file with song information to use as a signature in the forums).

This feature still requires some third-party tool like FTP, internal support for this will appear in the future AMIP versions.

I recommend you to use cURL (http://curl.haxx.se/). cURL is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE and LDAP. Curl supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, kerberos, HTTP form based upload, proxies, cookies, user+password authentication, file transfer resume, http proxy tunneling and a busload of other useful tricks.

This manual assumes that you are using cURL, so, go to the page and grab win32 version.

It is recommended to use new AMIP Configurator from http://amip.tools-for.net/config/ since it has special Callbacks/Web presets where you can place commands.

1. Using AMIP to post the playing song information to your page via FTP

First we need to create our HTML page template, I'll take very simple example:

<html>
 <head>
 <title>My cool now-playing page</title>
 </head>
 <body>
 <center><h1>Now playing:</h1></center>
 <blockquote>
 <!-- song name, note that you can use AMIP functions in templates (func_lc - lowercases the string) -->
 <font size=+3>&func_lc(%name)</font><br><br>
 <!-- album and other song information -->
 Album: <b>%4</b><br>
 Year: <b>%5</b><br>
 Genre: <b>%7</b><br>
 Bitrate: <b>%br</b><br>
 File size: <b><font color=red>%fl</font> Mb</b>
</blockquote>
 </body>
</html>

Create a directory, for example, C:\amipweb, create in.html in this directory, copy the above code into in.html. This will be the template. Of course, you can make a damn good page yourself, it's just an example.

Put the downloaded and unpacked curl.exe into the same C:\amipweb directory.

Now let's set up AMIP options: make sure that IRC integration is enabled, actually we are not going to post anything to mIRC, but we need to use a preset. Choose any of the presets, make it active, put the following code in it:

/template:(c:\amipweb\in.html)c:\amipweb\out.html
/exec:(c:\amipweb\curl.exe)-B -T out.html -u <username>:<password> ftp://<your ftp address>/<directory>/

Correct the paths and put in your parameters.

I'll explain the code:

/template command takes the file in the parenthesis (our HTML template file), replaces all the variables, functions, conditional statements, etc and creates the page with song information written in c:\amipweb\out.html file.

/exec command executes the application in the parenthesis and passes all the rest string to this application. So, all the rest lines consists of cURL arguments.

-B tells cURL that we are transferring ascii file;
-T out.htm tells cURL which file to upload to the FTP, you don't need to specify the directory in this case, because AMIP's /exec command automatically uses the working directory of the executed application (c:\amipweb\);
-u <username>:<password> specifies the user name and password to access your FTP server (for example -u mylogin:mypassword);
The last argument is the URL where to put the file. For example ftp://ftp.yourisp.com/web/. Note the trailing slash, it is required and represents the directory. BTW, you can upload the file with a different name, for example ftp://ftp.yourisp.com/web/nowplaying.html will upload our out.html file with nowplaying.html name.

If you've done all the things right, on every song change the file will be updated on your FTP and everyone will be able to see what you listening to on your web page.

If you are behind the proxy, it is not the problem! Read cURL manual and add the appropriate parameters to the /exec command in AMIP options.

2. Passing song information to the script (using cURL and PHP)

I think that you've already got the idea after reading the first section. The difference is that we need to pass the variables to the php script.

cURL supports GET and POST methods for passing variables to the scripts.

Here is what you can put to the AMIP's preset (one line):

/exec:(c:\amipweb\curl.exe) -G -d "title=&func_ue(%name)&album=&func_ue(%4)&bitrate=&func_ue(%br)&action=save" http://URL/np.php

Actually, it is very simple:

-G stands for the HTTP GET, remove it to use HTTP POST method.
-d is followed by the list of arguments in the "key=value" form separated by & character. AMIP's function &func_ue (URL encode) encodes the variables passed to the script. Instead of using & separator, you can define several -d arguments:

-d "title=&func_ue(%name)" -d "album=&func_ue(%4)" -d "bitrate=&func_ue(%br)" -d "action=save"

The last -d parameter will tell our sample script that we need to save this info. If the np.php script is called without any parameters, it will show the last played song info.

Don't forget to specify the URL of the np.php script in the end of /exec command.

Here is the sample np.php script:

<?php
 # If the action is 'save' => Save the variables of the latest song to the npvars.txt
 if(isset($_REQUEST['action']) && $_REQUEST['action'] == 'save'){
 $fp = @fopen("./npvars.txt", "w+");
# File opened
 if($fp){
 foreach($_REQUEST as $key=>$value){
 fputs($fp, "$key=$value\n");
 }
 fclose($fp);
# Display error
 } else {
 print("Cannot open file to save variables!");
 }
 # If no action is specified, show the info for the latest track
 } else {
 $SONG = array();
 $vars = file("npvars.txt");
 foreach($vars as $line){
$line = rtrim($line);
 list($key, $val) = split("=", $line);
 $SONG[$key] = $val;
 }
 # Something was already saved?
 if(count($SONG) > 1){
 # Here you can do with the $SONG variables whatever you like, I'll just show some of them in the plain text
 print("Playing song: $SONG[title]<br>");
 print("Album: $SONG[album]<br>");
 print("Bitrate: $SONG[bitrate]<br>");
} else {
 # Show something saying that nothing was played yet
 print("I haven't played any song yet =(");
 }
 }
 ?>

If you need to pass a lot of variables, it is not convenient to write a long line in the preset. Instead of this it is possible to use the template with variables, and then pass it to cURL as a configuration file.

Here is the sample cURL config which equals by functionality to our previous cURL /exec call:

# Configuration file for cURL
# URL of the np script (!!!replace with your own!!!):
url = http://URL/np.php
# use HTTP GET
-G
# list of parameters to pass:
-d "title=&func_ue(%name)"
-d "album=&func_ue(%4)"
-d "bitrate=&func_ue(%br)"
# our np.php script needs action=save to save parameters
-d "action=save"

Save the above code into c:\amipweb\amipweb.conf.

New AMIP preset looks like this:

/template:(c:\amipweb\amipweb.conf) c:\amipweb\amipweb.out
/exec:(c:\amipweb\curl.exe) -K amipweb.out

The /template command parses amipweb.conf, replaces song variables and saves the result in amipweb.out. cURL is executed with -K parameter which tells it to use amipweb.out configuration file.

Using cURL and AMIP you can pass song information anywhere, read cURL manual for additional information.

3. Creating dynamic image signature

You can create dynamic image signatures using AMIPDS (AMIP Dynamic Signature) which can be dowloaded from http://amip.tools-for.net.

Some other links which may help:

http://whatsplaying.sourceforge.net/downloads.shtml (on this page you can find sample perl, php and ASP scripts for whatsplaying plug-in, you can then use them with AMIP).

http://www.thefinn.net/pages.html?page_id=2 (generates dynamic image signature from text, PHP+Font+background)

http://www.phpbb.com/phpBB/viewtopic.php?t=44858
http://www.phpbb.com/phpBB/viewtopic.php?t=74615

Two above links are the discussion of different plug-ins and tools which can be used to create dynamic signatures.

http://www.maniacalrage.net/thru.php?ID=18 (sample scripts from the CurrentlyHearing plug-ins).

http://www.dougk-ff7.net/sig.phps (PHP script to create dynamic image signature from the text file).


Generic

Generic Variables

Generic Variables & Flags:

Variables are substituted with the corresponding values.

Generic Variables

If-then-else (conditional) constructions are allowed. e.g. %?1<%1 - %2|%no> (if Artist is present then print Artist - Title, else print file name only). Another example: %?VBR='yes'<%ABR|%br>. The word in quotes is matched against the variable as a regular expression. Conditional statements can be also written using Functions.

Variable | Value
%name | This variable represents song title and artist in ARTIST - TITLE format. ARTIST and TITLE are taken from any of the available tag types. If the file contains no supported tags, file name is used for %name. (File name doesn't contain extension). If playing unsupported file type, title from player is used.
%s | This variable stands for the song header as it was tuned in Player settings, generally it's again ARTIST - TITLE, but you can change it in the Player Preferences.
%fl | A float digit for size of playing file (e.g. 3.56)
%fn | Full file name with extension and path. e.g. c:\song.mp3
%nm | Name with extension (without path) e.g. song.mp3
%no | File name only e.g. song
%ext | File extension (mp3/wma/wav/vqf/...)
%fdir | directory name (e.g. for C:\Music\Metallica\Best Of\Nothing-Else Matters.mp3) it will be set to "Best of"
%fupdir | up-directory name (e.g. for C:\Music\Metallica\Best Of\Nothing-Else Matters.mp3) it will be set to "Metallica"
%sr | Sampling frequency(Khz) e.g. 44
%br | Bit-rate (Kbps) e.g. 128
%typ | Song mode e.g. Stereo or Mono
%min | Minutes component of song length (mm)
%sec | Seconds component of song length (ss)
 | Should be used together like (%min:%sec)
%mil | Minutes left (mm)
%sel | Seconds left (ss)
%mode | Operating mode: Joint Stereo/Stereo/Mono/Dual Channel - advanced version of %typ
%page | URL of page where you can get latest Plug-In version
%vol | Winamp volume (0..255) now should work with any player
%ps | current song position (seconds)
%pm | current song position (minutes)
%psec | current song position in seconds
%hstamp | current time hours
%mstamp | current time minutes
%sstamp | current time seconds
%dstamp | current day of month
%ystamp | current year
%monstamp | current month
%prc | the current percentage of song being played. Useful for clipboard integration and mIRC scripting
%repeat | (on/off) repeat state
%shuffle | (on/off) shuffle state

Flags

Flag | Value
%mp3 | variable which can be used to determine that playing file is the mp3 in if-then-else constructions
%id3 | variable which can be used to know that ID3 tag was read correctly in if-then-else constructions
%playing | flag to determine whether winamp is playing
%mac | monkey audio file (.mac or .ape)
%ape | APEv1 or APEv2 tag presence
%flactag | FLAC tag presence
%flac | FLAC file (.fla or .flac)
%mpc | MusePack file format

Examples:

/echo [MP3] %name [%fl~mb] [%min~m%sec~s] [%br~kbps]
('~' is used to separate variable from following text, it is removed from output)


ID3 Tag

ID3 Tag Variables

What's ID3 Tag?

ID3 Tag is a set of fields containing different information about song, it's authors, title, genre, e.t.c. This information is stored inside the music file. Generally there are 2 versions of ID3 Tags: ID3v1 and ID3v2. Since version 0.6 this Plug-In Supports both of them.

How Can I Use ID3 Tag in Program Output?

ID3 Tags are represented by specific variables (as any other information). All you need is to insert this variables to the output string according to the table applied below.

ID3v1 & ID3v2 Common Variables
(also availabe for Ogg, APE, FLAC and other supported tag types)

Variable | Value
%1 | Artist
%2 | Title
%3 | Track Number
%4 | Album
%5 | Year
%6 | Comment
%7 | Genre

Examples:

/me is listening to %1 - %2 (%4|%5|%7)

Complete Variables List

Variable | Value
variables are case sensitive!
%AENC | Audio encryption
%APIC | Attached picture
%COMM | Comments
%COMR | Commercial frame
%ENCR | Encryption method registration
%EQUA | Equalization
%ETCO | Event timing codes
%GEOB | General encapsulated object
%GRID | Group identification registration
%IPLS | Involved people list
%LINK | Linked information
%MCDI | Music CD identifier
%MLLT | MPEG location lookup table
%OWNE | Ownership frame
%PRIV | Private frame
%PCNT | Play counter
%POPM | Popularimeter
%POSS | Position synchronisation frame
%RBUF | Recommended buffer size
%RVAD | Relative volume adjustment
%RVRB | Reverb
%SYLT | Synchronized lyric/text
%SYTC | Synchronized tempo codes
%TALB | Album/Movie/Show title
%TBPM | BPM (beats per minute)
%TCOM | Composer
%TCON | Content type
%TCOP | Copyright message
%TDAT | Date
%TDLY | Playlist delay
%TENC | Encoded by
%TEXT | Lyricist/Text writer
%TFLT | File type
%TIME | Time
%TIT1 | Content group description
%TIT2 | Title/songname/content description
%TIT3 | Subtitle/Description refinement
%TKEY | Initial key
%TLAN | Language(s)
%TLEN | Length
%TMED | Media type
%TOAL | Original album/movie/show title
%TOFN | Original filename
%TOLY | Original lyricist(s)/text writer(s)
%TOPE | Original artist(s)/performer(s)
%TORY | Original release year
%TOWN | File owner/licensee
%TPE1 | Lead performer(s)/Soloist(s)
%TPE2 | Band/orchestra/accompaniment
%TPE3 | Conductor/performer refinement
%TPE4 | Interpreted, remixed, or otherwise modified by
%TPOS | Part of a set
%TPUB | Publisher
%TRCK | Track number/Position in set
%TRDA | Recording dates
%TRSN | Internet radio station name
%TRSO | Internet radio station owner
%TSIZ | Size
%TSRC | ISRC (international standard recording code)
%TSSE | Software/Hardware and settings used for encoding
%TXXX | User defined text information
%TYER | Year
%UFID | Unique file identifier
%USER | Terms of use
%USLT | Unsynchronized lyric/text transcription
%WCOM | Commercial information
%WCOP | Copyright/Legal infromation
%WOAF | Official audio file webpage
%WOAR | Official artist/performer webpage
%WOAS | Official audio source webpage
%WORS | Official internet radio station homepage
%WPAY | Payment
%WPUB | Official publisher webpage
%WXXX | User defined URL link
%XXCR | Encrypted meta frame (id3v2.2.x)
%XXCO | Compressed meta frame (id3v2.2.1)


Control Codes

Control Codes

Control Codes:

Using this special variables you can control the appearance of program output. More information about applying this codes you can get in mIRC Help File.

Control Codes

Variable | Value
&cX,Y | X - foreground color, Y - background color. All text after this variable will be colored according to X and Y values (0 - 15). To discard color settings use another color or &p variable. Press Ctrl+K in mIRC for the color table.
&p | All control settings are discarded after this variable
&u | Underline the text between &u and the next &u (or the end of line if trailing &u is omitted)
&i | Inverse text
&b | Bold attribute

Examples:

/echo &c10[&c0MP3&c10]&c0 &u%name&u &c10(&c15%4&c10|&c15%5&c10|&c15%7&c10)&c0


Advanced

Advanced Variables

Header Variables
Advanced Variables
Examples

Header Variables
(from EncSpot library)

Variable | Value
%ABR | Average bitrate of mp3 file
%VBR | (yes/no) shows if file has VBR
%ENC | encoder used to make mp3 file
%LEN | (e.g. 00:03:19) song length
%FRQ | (e.g. 44100) Samlping frequency (hz)
%MOD | (e.g. joint stereo) Mode
%FRM | number of frames
%FSZ | (e.g. 4,157,036) file size in bytes
%TYP | (e.g. mpeg 1 layer III) - mpeg and layer version
%QUO | (good/ok/bad) a rough determination of the quality of the file. Determined solely by the encoder used, the bitrate, and the stereo mode
%EMP | Emphasis
%COM | (yes/no) if file is complete (not broken)
%ERR | number of sync errors
%CPR | (yes/no) Copyrighted
%ORG | (yes/no) Original
%CRC | (yes/no) CRC
 | Lame header:
%MET | Lame VBR method
%REV | Lame tag revision
%LABR | Lame ABR bitrate
%LQUA | Lame quality (0..100)
%LAM | (yes/no) lame header existance

Note, that if EncSpot is disabled in the Performance options most of these variables will be not set.

Advanced Variables

Variable | Value
%tstat %stat | text and numeric playback status (playing - 1, paused - 3, stopped - 0)
%lver | Layer Version. e.g. Layer 3
%mver | Mpeg Version. e.g. MPEG Version 1
%head | 32bit Mpeg header represented as a bitset. See www.mp3-tech.org for description. Usefull if you want to get and format header information from your mIRC script.
%at | Number of bytes from the file beginning where first mpeg header was found
%ver | Winamp version (e.g. 2.72)
%pv | Plugin version (e.g. 0.71)
%ll | Playlist length
%pos | Current position in the playlist
%sl | Song length in seconds
%sle | Seconds left to play
%lb | OBSOLETE! SINCE AMIP 2.48 use new lines to separate commands
%mcmd | OBSOLETE! SINCE AMIP 2.48 use new lines to separate commands
 | Tag versions:
%id3v1 | (yes/no) ID3v1 tag
%id3v2 | (yes/no) ID3v2 tag
%Lyrics | (yes/no) Lyrics tag
%Lyrics3v2 | (yes/no) Lyrics3v2 tag
%MusicMatch | (yes/no) MusicMatch tag
%apev1 | (yes/no) APE v1.0 tag
%apev2 | (yes/no) APE v2.0 tag
%FLAC | (yes/no) FLAC tag

Examples:

/echo &c10[&c0MP3&c10]&c0 &u%name&u &c10(&c15%4&c10|&c15%5&c10|&c15%7&c10)&c0%lb&c10[&c15%fl~mb&c10] [&c15%min~m%sec~s&c10] [&c15%br~kbps&c10] [&c15Plugin v%pv&c10] [&c15WinAmp v%ver&c10]


Functions

Functions

AMIP Functions:

Functions allow you to modify output text. They should be written in &func_name(param) or in $name(param) format. For example /me is listening to $lc(%name) will print song title in lower case. One function can be inserted in another: /me now playing $u2s($cf(%name))

It is also possible to use if-then-else statements inside functions: $lc(%?4<"%4"|>)

You can use any character inside function instead of round brackets. If you need to use a brackets put '\' character before: $lc(/me is playing %name \(%7\))

Functions

Function | Action
$lc(string) | lower case string
$uc(string) | UPPER CASE STRING
$cf(string) | Capitalize First Letter Of Each Word
$u2s(string) | Converts underscores and %20 to spaces
$ue(string) | URL encodes the argument. Necessary to pass AMIP variables to the scripts. See Web Integration for usage samples.
$next(string) | Provides information about the next song in the playlist (valid only if shuffle is disabled). For instance: $next(next song: %name [%pos])
$if(a,b,c) | If a is not an empty string, b will be used, otherwise c: $if(%1,%1 - %2,%name)
$if2(a,b) | Same as $if(a,b,)
$if3(a,b) | Same as $if(a,a,b)
$mat(subj,patt) | Returns 1 if subject matches regexp patternt, otherwise returns empty string. Main purpose - to be used in conditional functions, for instance: $if($mat(%VBR,yes),VBR,CBR)
$trunc(text,len) | Truncates string by lenght and appends "..."
$trunc2(text,len,str) | Truncates and appends str if text is longer than len
$chr(dec) | Inserts ASCII character with specified decimal code
$enc(text,enc) | Encodes text to specified encoding. (encoding can be WIN, KOI, OEM, FIDO)
$iflen(str,len,shortstr) | If str is longer than len chars, then use shortstr, otherwise use str


Play & Search

Play & Search

Playlist Operations & Song Search from mIRC:

Now you are able to perform search by any part of song's title. Search results are printed in mIRC window as /echo commands and placed in local playlist. After search winamp plays only songs that matching your query. After playing local playlist, winamp plays the original playlist.

It is now possible to print any part of playlist to mIRC window in "index: title" format and play any song by typing its index.

Playlist Commands

Command | Action
/dde mPlug rfind <handler> <pattern> | This command will find all songs from current playlist matching <pattern>. Player starts to play matched songs. To play exact song use /dde mPlug play <index>. To play normal playlist type /dde mPlug clear <pattern> may be a part of file name or a perl 5 regular expression. Search is not case sensitive. use (?-i) pattern option to make it case sensitive. See regexp mini manual for additional information.
/dde mPlug getlistlength "" <handler> | Prints entire playlist length
/dde mPlug getlist <from> <to> | Prints a part of playlist from postion <from> to position <to>
/dde mPlug reindex | Reindexes search database (use it if you changed your playlist)
/dde mPlug clear | Clears local playlist, search results, and indexes
/dde mPlug find <handler> <keyword> | This command will find all songs from current playlist matching <keyword>. Player starts to play matched songs. To play exact song use /dde mPlug play <index>. To play normal playlist type /dde mPlug clear
/dde mPlug autoplay on/off | Toggles autoplay after find and rfind commands

*(<handler> is not mandatory (can be replaced with ""), if omitted output will be printed with "Output by" command specified in configuration dialog, if present, output will be printed with <handler> command)


Winamp Control

Winamp Control

Winamp Control Commands:

Since version 0.53 it's possible to control winamp playback using mIRC scripting. Just type this commands in mIRC or call them from the scripts.

Control Commands

Command | Action
/dde mPlug control > | Plays next entry
/dde mPlug control < | Plays previous
/dde mPlug control play | Starts plaback
/dde mPlug control stop | Stops playback
/dde mPlug control pause | Pauses playback
/dde mPlug control vol x | Sets volume to x (0-255)
/dde mPlug control rew | Rewind 5 sec.
/dde mPlug control ff | Fast forward 5 sec.
/dde mPlug control vup | Volume up
/dde mPlug control vdwn | Volume down
/dde mPlug control repeat | Toggles repeat
/dde mPlug control shuffle | Toggles shuffle
/dde mPlug setrepeat on/off | Sets repeat to on or off
/dde mPlug setshuffle on/off | Sets shuffle to on or off

Note that plug-in is registering it's own DDE server, so you can control playback from any other application that supports dynamic data exchange. DDE server name is "mPlug".


Plug-In Control

Plug-In Control

Plug-In Control Commands:

Since version 0.70 it is possible to control and tune up Plug-In using mIRC scripting. Just type this commans in mIRC or call them from your scripts. New API to work with config is available now, see Scripting.

Control Commands

Command | Action
/dde mPlug show | Manual song info print (works only if winamp is playing) should be used to show song information again, even if it was already shown for the current song.
/dde mPlug search | Shows search dialog
/dde mPlug options | Shows options screen
/dde mPlug control on | Enables AMIP
/dde mPlug control off | Disables AMIP
/dde mPlug getstrip | Displays current output string value without the control codes variables
/dde mPlug cfg_enabled "" <handler> * | Prints 1 if AMIP is enabled, 0 - otherwise
/dde mPlug cfg_convert "" <handler> * | Prints 1 if convert checkbox is enabled, 0 - otherwise
/dde mPlug cfg_strip "" <handler> * | Prints 1 if strip checkbox is enabled, 0 - otherwise
/dde mPlug getplain "" <handler> * | Displays current output string value
/dde mPlug getcodes "" <handler> * | Displays current output string value translating &xx variables to control codes
/dde mPlug preset <n> | Chooses active preset
/dde mPlug set "" str | Sets output string to str value
/dde mPlug help | Displays the help.
/dde mplug manual page.htm | Displays page.htm from the AMIP's chm help
/dde mPlug format <handler> <format_string> | Calls handler with format_string with replaced variables. (/cmsg,%lb,%mcmd are not handled)
/dde mPlug setdde <server_name> | Allows to change DDE server directly from your IRC. Can be used in scripts for publishing information to several IRC client instances.
/dde mPlug setpirch on/off | Allows to switch from mIRC to PIRCH and back. Note: you will need to call /dde mPlug setdde <server_name> with appropriate server name to finish the process of IRC client switching.
/dde mplug setmapping on/off | Allows to change the way how AMIP communicates with mIRC from DDE to FileMapping and back.

*("" <handler> is not mandatory, if omitted output will be printed with "Output by" command specified in configuration dialog, if present, output will be printed with <handler> command, it's a good way to get settings from your mIRC script)

Note that plug-in is registering it's own DDE server, so you can control playback from any other application that supports dynamic data exchange. DDE server name is "mPlug".


Advanced

Advanced Commands

Advanced Commands List:

These commands are used in the configuration string of AMIP and allow advanced actions. You can use several commands in the preset, make sure that each command is on the new line.

Advanced Commands

/cmsg
If format string starts with this command all output will be directed only to the list of channels specified in options.
/cme
Same as /cmsg, but as /me command
/template:(input_file) output_file
Takes the input_file, replaces all the variables and functions and writes the result to output_file. Usefult for Web and E-Mail integrations.
/exec:(application) parameters
Executes the application and passes it the list of parameters. For example you can execute the FTP client to upload file, prepared by /template command. See Web Integration for sample configuration. Note: working directory is set to the directory of the application.
/file:(filename) command
Writes log to file instead of mIRC (command is the usual config string with variables)
/fileonce:(filename) command
Writes current song to file instead of mIRC.
Useful to integrate AMIP with program without DDE, for example e-mail client, e.g in AMIP: '/fileonce:(e:\current.log)%name' and in The Bat!: 'Winamp is playing: %INCLUDE="e:\current.log"' as a part of template
for Russian users:

There is optional parameter - encoding, you can use it to write the file in the specified encoding (KOI, OEM, FIDO, WIN). This parameter must be placed after the file name using | as a separator. It is supported for file, fileonce and template commands.

Examples:

/fileonce:(c:\song_KOI.txt|KOI) np: %name
/fileonce:(c:\song_OEM.txt|OEM) np: %name
/template:(c:\song_win.txt|FIDO) c:\song_fido.txt


mIRC Scripting

mIRC Scripting

mIRC Scripting Tips:

I don't have enough time to write the complete mIRC scripting manual, so just some tips for this moment:

Getting plug-in configuration:
1. Do as described in Plug-In Control section (deprecated API)

2. $dde mPlug cfg_* "", where * can be string, cmdstr, strip, enabled, convert, update. Use /dde mPlug cfgdump to get all variables list.

Setting plug-in configuration: (updated)
1. Do as described in Plug-In Control section (deprecated API)

2. /dde mPlug setvar <variable> <value>, for instance, to disable AMIP type /dde mPlug setvar enabled 0.

Variables list can be retrieved using /dde mplug cfgdump .

You can load/save config using /dde mplug config load and /dde mplug config save.

Getting playing song information:
1. $dde mPlug var_* "", where * can be any %variable (without % symbol) e.g. var_name, var_1, var_fl, e.t.c.

2. /dde mPlug format <handler> <format_string> Calls handler with format_string with replaced variables. (/cmsg,%lb,%mcmd are not handled) e.g. /dde mPlug format /echo "playing &u%name&u (%4|%5|%7)"

3. New to AMIP 2.00: "$dde mPlug format string" variable can be used in mIRC. <string> is like config string. all variables are replaced. But <string> cannot contain spaces!!! Replace all spaces by '_' sign
(underscore). Example:
$dde mPlug format "np:_&b%name&p_%?4<"%4"|>_(%?7<%7|->|%?5<%5|->|%?VBR='yes'<%ABR|%br>~kbps)"

(New)
"$dde mPlug fn <id>" variable can be used in mIRC to get name of file from playlist with the specified <id> number"
"$dde mPlug title <id>" variable can be used in mIRC to get title from playlist with the specified <id> number"

Getting any song information:
There is special variable: $dde mPlug formatsong "song_number:string_with_your_variables".
Example: $dde mPlug formatsong "10:%name_br:%br~kbps". Note that spaces are changed to underscores. It is like $dde mPlug format ... but gets info about song specified by number separated from the rest string by the colon.

Here is a good mIRC script example for AMIP sent by "Shawn Jackson" <rede83(at)home.com> (updated by Thanatos 6000) :

;############################## AMIP #############################

;1. Place in AMIP: /mp3ad
;2. Set channel to advertise in in this script
;3. Turn this script on

;-----Display current song playing on request-----
alias song {
say [Song: %song $+ ] [Album: %songalbum %songyear $+ ] [ $+ %songlength $+ / $+ %songbitrate $+ kbps/ $+ %songtyp $+ ] }

;-----Song Advertisement-----
alias adsong {
/msg %amipchan [Song: %song $+ ] [Album: %songalbum $iif(%songyear,%songyear) $+ ] [ $+ %songlength $+ / $+ %songbitrate $+ kbps/ $+ %songtyp $+ ] }

;-----Set Variables-----
alias songinfo {
  set %songfile $dde(mPlug,var_fn)
  set %song $dde(mPlug,var_name)
  set %songlength $dde(mPlug,var_min) $+ m $+ $dde(mPlug,var_sec) $+ s
  set %songyear $dde(mPlug,var_5)
  set %songalbum $dde(mPlug,var_4)
  set %songtyp $dde(mPlug,var_typ)
  set %songbitrate $dde(mPlug,var_br)
  if (%songalbum == $null) {
    set %songalbum Unavailiable
  }
  if %songyear != $null) {
    set %songyear $chr(40) $+ %songyear $+ $chr(41)
  }
}

;-----Delay to allow AMIP to update completely-----
alias mp3ad {
  .timer 1 1 getsonginfo
}

;-----Set
alias getsonginfo {
  songinfo
  if ((%mp3ad.on == $true) && ($server != $null)) { adsong }
}

;-----Menu System-----
alias amipon {
  set %advert.onoff On
  set %mp3ad.on $true
}

alias amipoff {
  set %advert.onoff Off
  set %mp3ad.on $false
}

alias chamipchan {
  set %amipchan $?="Channel to advertise in: (eg. #chat)"
}

menu menubar {
  MP3Ad
  . $+ %advert.onoff
  ..On:/amipon
  ..Off:/amipoff
  .-
  .Channel
  .. $+ %amipchan
  ...Change:/chamipchan
}

;-----Script Loading-----
on *:load: {
  /amipload
}

alias amipload {
  set %mp3ad.on $false
  set %advert.onoff Off
  set %amipchan #albums
  echo 1. Place in AMIP: /mp3ad
  echo 2. Set channel to advertise in in this script
  echo 3. Turn this script on

}

;-----Control Winamp With mIRC-----
alias mp3 {
  if ($1 = next) {
    dde mPlug control >
  }
  elseif ($1 = prev) {
    dde mPlug control <
  }
  elseif ($1 = play) {
    dde mPlug control play
  }
  elseif ($1 = stop) {
    dde mPlug control stop
  }
  elseif ($1 = pause) {
    dde mPlug control pause
  }
  elseif ($1 = vol) {
    if ($2 == up) {
      dde mPlug control vup
    }
    if ($2 == down) {
      dde mPlug control vdwn
    }
    elseif ($2 == mute) {
      dde mPlug control vol 0
    }
    elseif (($2 >= 0) && ($2 <= 100))  {
      %chvol = $2 / 100
      %chvol = 255 * %chvol
      dde mPlug control vol %chvol
      unset %chvol
    }
    else {
      echo Volume Usage
      echo /mp3 vol       echo Variables:
      echo up - increases volume
      echo down - decreases volume
      echo mute - decreases volume completely
      echo number - sets volume percentage (number between 1 and 100)
    }
  }
  else {
    echo Usage
    echo /mp3  *
    echo -
    echo Variables:\
    echo next - skips to next track on playlist
    echo prev - skips to previous track
    echo play - turns mp3 playback on/restarts track
    echo stop - turns mp3 playback off
    echo pause - pauses mp3 playback
    echo vol * - changes volume, command alone displays * options
  }
}


Regexp hints

Regexp hints

Search with regexps is perfomed by "/dde mPlug rfind "" <pattern>"
Subjects are Winamp playlist entries.

[Q] Search for "Dido" returns "Dido" and "Dj Dido", how can I search only for "Dido"?
[A] Pattern for started with "Dido" should be like "^Dido", "^" stands for begin of the string.

[Q] I don't remeber the exact song title, are there any wildcards?
[A] Yes, "." stands for one symbol ".*" for any number of any symbols. (e.g. search for "D.do" may return Dido and Dodo).

[Q] How can i search for some keywords at a time, I want to listen to Scooter and Dj Quicksilver.
[A] Keywords may be separated by "|" sign. "Scooter|DJ Quicksilver"

[Q] How can i use case sensitive search?
[A] Specify "(?-i)" in the beginning of pattern

The syntax and semantics of the regular expressions supported by PCRE are described in this document. Regular expressions are also described in the Perl documentation and in a number of other books, some of which have copious examples. Jeffrey Friedl's "Mastering Regular Expressions", published by O'Reilly (ISBN 1-56592-257), covers them in great detail.