Home > Code, mIRC > simple_amip.mrc – Simple AMIP Announcer

simple_amip.mrc – Simple AMIP Announcer

;;;; Simple AMIP Announcer v1.0.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan.                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load this script in mIRC, if you don't know how to do this, then perhaps   ;;
;; you shouldn't be using this script.                                        ;;
;;                                                                            ;;
;; Simple script to announce in a channel what you're listening to.           ;;
;; The scripts interacts with the AMIP plugin for WinAMP, which can be found  ;;
;; on this address: http://amip.tools-for.net/wiki/                           ;;
;;                                                                            ;;
;; This script has it's 2 default outputs bound to the F3 and Shift+F3 keys.  ;;
;;                                                                            ;;
;; Identifiers available:                                                     ;;
;;   $amip_announce                                                           ;;
;;                                                                            ;;
;; Examples:                                                                  ;;
;;   msg $active $amip_announce                                               ;;
;;   msg $active $amip_announce(xml)                                          ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.0.0                                                                     ;;
;; + Initial release.                                                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias F3 /msg $active $amip_announce
alias SF3 /msg $active $amip_announce(xml)
alias amip_announce {
    ;; Check if it's a stream or a file.
    if (($left($dde mPlug var_fn "",7) == http://) || ($left($dde mPlug var_fn "",8) == https://)) {
        var %is_stream = 1
    }
    else {
        var %is_stream = 0
    }

    ;; Fetch the various information from AMIP.
    var %tag.auto = $dde mPlug var_name ""
    var %tag.fullpath = $dde mPlug var_fn ""
    var %tag.extension = $iif(%is_stream == 1,stream,$dde mPlug var_ext "")
    var %tag.artist = $dde mPlug var_1 ""
    var %tag.title = $dde mPlug var_2 ""
    var %tag.album = $dde mPlug var_4 ""
    var %tag.track = $dde mPlug var_3 ""
    var %tag.bitrate = $dde mPlug var_br ""
    ;; These can only be set if it's not a stream.
    if (%is_stream == 0) {
        var %tag.length.sec = $dde mPlug var_sl ""
        var %tag.length.nice = $replace($duration(%tag.length.sec),secs,s,sec,s,mins,m,min,m,hrs,h,hr,h,days,d,day,d,wks,w,wk,w)
        var %tag.size.byte = $file($dde mPlug var_fn "").size
        var %tag.size.nice = $round($csize(%tag.size.byte),2)
        var %tag.size.nice.ext = $csize(%tag.size.byte).ext
    }
    if ($1 == xml) {
        var %output = < $+ %tag.extension
        if ((%tag.artist == $null) || ($len(%tag.artist) == 0) || (%tag.title == $null) || ($len(%tag.title) == 0)) {
            var %output = %output $+ $chr(32) $+ song=" $+ %tag.auto  $+ "
        }
        else {
            var %output = %output $+ $chr(32) $+ artist=" $+ %tag.artist  $+ "
            var %output = %output $+ $chr(32) $+ title=" $+ %tag.title  $+ "
        }
        if ((%tag.album != $null)) {
            var %output = %output $+ $chr(32) $+ album=" $+ %tag.album $+ "
        }
        if ((%tag.track != $null) && ($len(%tag.track) != 0)) {
            var %output = %output $+ $chr(32) $+ track=" $+ %tag.track $+ "
        }
        if (%is_stream == 0) {
            var %output = %output $+ $chr(32) $+ length=" $+ %tag.length.nice $+ "
            var %output = %output $+ $chr(32) $+ size=" $+ %tag.size.nice $+ $chr(32) $+ %tag.size.nice.ext $+ "
        }
        var %output = %output $+ $chr(32) $+ bitrate=" $+ %tag.bitrate $+ "
        if (%is_stream == 1) {
            var %output = %output $+ $chr(32) $+ url=" $+ %tag.fullpath $+ "
        }
        var %output = %output $+ $chr(32) $+ />
    }
    elseif ($1 == action) {
        var %output = is listening to:
        var %output = %output $+ $chr(32) $+ %tag.auto
        if (%is_stream == 0) {
            var %output = %output $+ $chr(32) $+ ( $+ %tag.length.nice $+ )
        }
        else {
            var %output = %output $+ $chr(32) $+ ( $+ %tag.fullpath $+ )
        }
    }
    else {
        var %output = %tag.extension $+ :
        var %output = %output $+ $chr(32) $+ %tag.auto
        if (%is_stream == 0) {
            var %output = %output $+ $chr(32) $+ ( $+ %tag.length.nice $+ )
        }
        else {
            var %output = %output $+ $chr(32) $+ ( $+ %tag.fullpath $+ )
        }
    }
    return %output
}
Categories: Code, mIRC Tags: , ,