SuperAMP
Posted by pumakuma
Friday, March 31, 2006
Description: mIRC mp3 Player (No DLL) -- Give suggestions! pumakuma@gmail.com

;; I am updating every couple weeks... so check back for new versions..
;; Things to come:
;; Song Position Selection, Previous, Next, customizable advertising, help pages,
;; ... And your suggestions! email me :: pumakuma@gmail.com

on *:load:{ echo -a SuperAMP mIRC MP3 Player has been loaded... }
menu channel,nicklist,menubar,query {
  SuperAMP
  .Open Dialog: /superamp
  .Quick Start
  ..Current Song $+ $chr(58) $iif($nopath($insong.fname),$v1,None) $+ : echo -a Current Song: $iif($nopath($insong.fname),$v1,None)
  ..Controls
  ...Play Song: set %samp.file $sfile(C:/,Music File) | splay %samp.file | if ($dialog(superamp)) { did -ra superamp 4 $nopath(%samp.file) | did -ra superamp 25 Playing | did -a superamp 27 %samp.file | did -ra superamp 34 $gettok($calc($insong.length / 60000),1,46) $+ : $+ $iif($len($round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0)) == 2,$round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0),$+(0,$round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0))) } | else { echo -a Now playing song $nopath(%samp.file) without dialog window. }
  ...Resume: $iif($insong.pause,splay resume,echo -a There is no song currently paused..)
  ...Pause: $$iif($insong && !$insong.pause,splay pause,echo -a The song is either already paused or already stopped..)
  ...Stop: splay stop
  ..Advertise: echo -a coming soon..
}
alias superamp {
  /dialog -m superamp superamp
}
dialog superamp {
  title "mIRC SuperAMP MP3 Player"
  size -1 -1 235 153
  option dbu
  text "SuperAMP MP3 Player", 1, 6 140 55 8, center
  box "Current Song:", 3, 4 119 231 21
  text "", 4, 6 128 227 10
  tab "Control", 9, 3 0 231 148
  button "Play/Pause", 2, 96 14 35 14, tab 9
  button "Forward >", 8, 157 27 31 12, tab 9
  button "Next Song >>", 7, 148 40 47 13, tab 9
  button "<< Previous Song", 5, 22 40 47 13, tab 9
  button "< Rewind", 6, 30 27 31 12, tab 9
  button "Stop", 19, 104 56 18 12, tab 9
  box "Status:", 23, 75 29 73 17, tab 9
  text "", 25, 78 36 67 8, tab 9
  text "Length:", 24, 93 69 21 8, tab 9
  text "", 34, 136 69 23 8, tab 9
  text "", 35, 115 69 15 8, tab 9
  text "/", 36, 130 69 5 8, tab 9
  tab "Song List", 11
  button ">>", 15, 101 42 12 12, tab 11
  button "<<", 16, 101 56 12 12, tab 11
  list 31, 9 29 90 89, tab 11 size hsbar extsel
  edit "", 26, 9 17 78 11, tab 11 multi return autohs
  button "...", 20, 87 16 12 12, tab 11
  list 27, 118 29 89 89, tab 11 size hsbar extsel
  text "", 14, 98 72 19 32, tab 11 center
  text "SuperAMP Playlist", 37, 138 17 45 8, tab 11
  tab "MP3 Controls", 12
  check "Mute", 21, 33 35 26 10, tab 12
  edit "", 28, 8 34 18 10, tab 12 right
  button "Apply", 29, 6 106 25 12, tab 12
  text "Mp3 Volume", 30, 10 26 38 8, tab 12
  button "Advertise Setup", 213, 8 45 43 12, tab12
  text "", 17, 6 46 44 8, tab 12
  text "%", 32, 25 35 8 8, tab 12 center
  text "", 33, 87 16 44 8, tab 12
  tab "Credits", 13
  link "http://www.pumakuma.mobstop.com", 10, 143 140 93 8
  button "Advertise", 18, 207 13 26 12
  button "Close", 22, 209 110 24 12, cancel
  button "Reload", 38, 210 97 22 12
}
on &*:dialog:superamp:dclick:*:{
  if ($did == 27) { splay $did($dname,27).seltext | did -ra superamp 4 $nopath($insong.fname) | did -ra superamp 25 Playing | did -ra superamp 34 $gettok($calc($insong.length / 60000),1,46) $+ : $+ $iif($len($round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0)) == 2,$round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0),$+(0,$round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0))) }
  if ($did = 31) {
    if ($did($dname,31).seltext) {
      if ($did($dname,31).seltext !isin $didtok($dname,27)) {
        did -a superamp 27 $did($dname,31).seltext
      }
      else {
        did -ra superamp 14 Song already on playlist | .timerplaylist 1 3 did -r superamp 14
      }
    }
    else {
      did -ra superamp 14 Please select a song | .timerplaylist 1 3 did -r superamp 14
    }
  }
}
on &*:dialog:superamp:sclick:*:{
  if ($did == 213) {
    dialog -m superampadvcontrol superampadvcontrol
  }
  if ($did == 27) {
    if (!$insong) || ($insong.pause) {
      did -ra superamp 4 $nopath($did($dname,27).seltext)
    }
  }
  if ($did == 20) { did -raf superamp 26 $sdir(C:\,Music Directory) }
  if ($did == 15) {
    if ($did($dname,31).seltext) {
      if ($did($dname,31).seltext !isin $didtok($dname,27)) {
        did -a superamp 27 $did($dname,31).seltext
      }
      else {
        did -ra superamp 14 Song already on playlist | .timerplaylist 1 3 did -r superamp 14
      }
    }
    else {
      did -ra superamp 14 Please select a song | .timerplaylist 1 3 did -r superamp 14
    }
  }
  if ($did == 16) {
    if ($did($dname,27).sel) {
      did -d superamp 27 $did($dname,27).sel
    }
    else {
      did -ra superamp 14 No song selected to remove | .timerplaylist 1 3 did -r superamp 14
    }
  }
  if ($did == 29) { $iif($remove($did(28),$chr(37)) isnum,applyvolume,did -ra superamp 17 Enter a number) | $iif($did($dname,21).state,applymute1,applymute2) }
  if ($did == 2) {
    if ($insong) {
      if ($insong.pause) {
        if ($did(4) == $nopath($insong.fname)) {
          did -ra superamp 25 Playing | splay resume
        }
        else {
          var %x 1 | while (%x <= $did($dname,27).lines) {
            if ($+(*,$did($dname,4)) iswm $did($dname,27,%x).text) {
              did -ra superamp 25 Playing | splay $did($dname,27,%x).text | did -ra superamp 34 $gettok($calc($insong.length / 60000),1,46) $+ : $+ $iif($len($round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0)) == 2,$round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0),$+(0,$round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0))) | halt
            }
            elseif (%x == $did($dname,27).lines) {
              did -ra superamp 25 No song selected
            }
            else {
              inc %x
            }
          }
        }
      }
      else {
        did -ra superamp 25 Paused | splay pause
      }
    }
    elseif (!$insong) && ($did(4)) {
      var %x 1 | while (%x <= $did($dname,27).lines) {
        if ($+(*,$did($dname,4)) iswm $did($dname,27,%x).text) {
          splay $did($dname,27,%x).text | did -ra superamp 25 Playing | did -ra superamp 34 $gettok($calc($insong.length / 60000),1,46) $+ : $+ $iif($len($round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0)) == 2,$round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0),$+(0,$round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0))) | halt
        }
        else {
          inc %x
        }
      }
    }
    elseif (!$did(4)) {
      did -ra superamp 25 No song selected | .timerstatus 1 3 did -r superamp 25
    }
  }
  if ($did == 22) {
    ;;Close Button
  }
  if ($did == 19) {
    splay stop | did -ra superamp 25 Stopped
  }
  if ($did == 18) {
    msg $active $songinfo      
  }
  if ($did == 38) {
    dialog -x $dname
    .timerreloadsuperamp 1 1 superamp
  }
}
on *:dialog:superamp:edit:26: {
  did -r superamp 31
  set %samp.dir $did(26)
  var %x 1 | while (%x <= $findfile($did(26),*.mp3,0)) {
    did -a superamp 31 $findfile($did(26),*.mp3,%x) | inc %x
  }
}
on *:dialog:superamp:init:*: {
  did -ra superamp 28 $calc(($vol(mp3) * 100) / 65535)
  if ($vol(mp3).mute) { did -c superamp 21 }
  did -ra superamp 26 %samp.dir
  did -ra superamp 34 0:00
  did -ra superamp 35 0:00
  if ($insong) {
    did -ra superamp 4 $nopath($insong.fname)
    did -ra superamp 25 Playing
    did -ra superamp 34 $gettok($calc($insong.length / 60000),1,46) $+ : $+ $iif($len($round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0)) == 2,$round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0),$+(0,$round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0)))
    did -a superamp 27 %samp.file  
  }
}
on *:mp3end:{
  did -ra superamp 25 Stopped
  var %x 1 | while (%x <= $did($dname,27).lines) {
    if ($+(*,$did(superamp,4)) iswm $did(superamp,27,%x).text) {
      if ($did(superamp,27,$calc(%x + 1)).text) {
        splay $v1
        did -ra superamp 4 $nopath($did($dname,27,$calc(%x + 1)).text)
        did -ra superamp 25 Playing
      }
      else {
        splay stop
        did -ra superamp 25 No more songs on playlist. | .timerundo 1 3 did -r superamp 25
      }
      halt
    }
    else {
      inc %x
    }
  }
}
alias applyvolume {
  /vol -p $calc(($remove($did(28),$chr(37)) * 65535) / 100) | did -ra superamp 33 Settings Applied | .timerapply 1 3 did -r superamp 33
}
alias applymute1 {
  /vol -pu1 | did -ra superamp 33 Settings Applied | .timerapply 1 3 did -r superamp 33
}
alias applymute2 {
  /vol -pu2 | did -ra superamp 33 Settings Applied | .timerapply 1 3 did -r superamp 33
}
;;alias musictimer {
;;.timermusic 0 1 $!iif($insong == $!true,did -ra superamp 35 $!songpos,timermusic off)
;;}
;;alias musictimerinfo {
;; echo -a $insong
;;if ($insong == $true) {
;; echo -a $songpos
;;did -ra superamp 35 $songpos
;;}
;;else {
;; .timermusic off
;;}
;}
;;alias musictimer2 {
;; if ($insong) {
;;  musictimer
;;}
;;}
dialog superampADV {
  title "SuperAMP Advertise"
  size -1 -1 128 104
  option dbu
  box "Advertise Edit Box", 1, 8 8 114 58
  edit "", 2, 12 16 106 46, multi return
  button "OK", 3, 18 72 29 12, ok
  button "Cancel", 4, 51 72 29 12, cancel
  button "Apply", 5, 84 72 29 12
  button "Quick Aliases", 6, 40 96 51 8
  text "", 7, 88 1 39 8
}
on &*:dialog:superampadv:sclick:*:{
  if ($did == 6) {
    dialog -m superampHELP superampHELP
  }
  if ($did == 5) {
    did -ra superampadv 7 Settings Applied | .timersettings 1 3 did -r superampadv 7
  }
}
dialog superampADVCONTROL {
  title "SuperAMP Advertise Control"
  size -1 -1 128 104
  option dbu
  button "Setup", 1, 46 80 37 12
  button "Display to...", 2, 4 80 37 12
  box "Current Setup", 3, 8 4 114 70
  edit "", 4, 16 13 98 53, read multi return vsbar
  button "Cancel", 5, 88 80 37 12, cancel
}
on &*:dialog:superampadvcontrol:sclick:*:{
  if ($did == 1) {
    dialog -m superampadv superampadv
  }
  if ($did == 2) {
    dialog -m superampadvdisplay superampadvdisplay
  }
}
dialog superampadvdisplay {
  title "SuperAMP Advertisement Display"
  size -1 -1 128 168
  option dbu
  list 1, 6 24 45 114, size
  button ">>", 2, 57 56 13 12
  button "<<", 3, 57 80 13 12
  list 4, 77 24 45 114, size
  text "All Options", 5, 8 8 33 8
  text "Display To...", 6, 80 8 33 8
  button "Apply", 7, 88 149 37 12
  button "Cancel", 8, 47 149 37 12, cancel
  button "OK", 9, 6 149 37 12, ok
}
dialog superampHELP {
  title "SuperAMP Quick Aliases"
  size -1 -1 136 104
  option dbu
  edit "", 1, 8 13 122 79, read multi return vsbar
  box "Quick Aliases and Examples", 2, 3 3 132 95
}
;;Advertise ALIASES

;;W/ Dialog
alias playlistlength {
  return $did(superamp,27).lines
}
alias playlistsongnum {
  var %p 1
  while (%p <= $did(superamp,27).lines) {
    if ($+(*,$did(superamp,4)) iswm $did(superamp,27,%p).text) {
      return %p
      halt
    }
    else {
      inc %p
    }
  }
}

;;W/ or W/out Dialog
alias songsize {
  if ($dialog(superamp)) {
    var %x 1 | while (%x <= $did(superamp,27).lines) {
      if ($+(*,$did(superamp,4)) iswm $did(superamp,27,%x).text) {
        return $bytes($file($did(superamp,27,%x).text)).suf
        halt
      }
      else {
        inc %x
      }
    }
  }
  else {
    return $bytes($file(%samp.file)).suf
  }
}
alias songposition {
  return $gettok($calc($insong.pos / 60000),1,46) $+ : $+ $iif($len($round($calc($+($chr(46),$gettok($calc($insong.pos / 60000),2,46)) * 60),0)) == 2,$round($calc($+($chr(46),$gettok($calc($insong.pos / 60000),2,46)) * 60),0),$+($chr(48),$round($calc($+($chr(46),$gettok($calc($insong.pos / 60000),2,46)) * 60),0)))
}
alias songlength {
  return $gettok($calc($insong.length / 60000),1,46) $+ : $+ $iif($len($round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0)) == 2,$round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0),$+(0,$round($calc($+(.,$gettok($calc($insong.length / 60000),2,46)) * 60),0)))
}
alias songstatus {
  return $iif($insong.pause,Paused,$iif($insong && !$insong.pause,Playing,Stopped))
}
alias song {
  return $iif($nopath($insong.fname),$v1,$iif($did(superamp,4),$v1,No song selected))
}
alias songinfo {
  return SuperAMP :: $song - $+($songposition,/,$songlength) $iif($dialog(superamp),- Pl: $+($playlistsongnum,/,$playlistlength),) [Size: $songsize $+ ] :: $songstatus
}
Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world