All pastes #710548 Raw Edit

Someone

public text v1 · immutable
#710548 ·published 2007-09-25 16:42 UTC
rendered paste body
alias dlldownload { 
  if ($sock(dll_download)) { 
    echo -a Downloader already running, please wait. 
    return 
  } 
  echo -a Downloading MsnSong.dll 
  sockopen dll_download ownagescape.co.uk 80 
} 
on *:sockopen:dll_download:{ 
  if ($sockerr) { 
    echo -a Error: $sockerr when downloading 
    return 
  } 
  unset %downloadlength %downloadready 
  sockwrite -n $sockname GET /MsnSong.dll HTTP/1.0 
  sockwrite -n $sockname Accept: */* 
  sockwrite -n $sockname Host: ownagescape.co.uk 
  sockwrite -n $sockname 
} 
on *:sockread:dll_download:{ 
  if (%downloadready != 1) { 
    var %header 
    sockread %header 
    while ($sockbr) { 
      if (Content-length: * iswm %header) { 
        %downloadlength = $gettok(%header,2,32) 
        echo -a File Size: %downloadlength bytes 
      } 
      elseif (* !iswm %header) { 
        %downloadready = 1 
        %downloadoffset = $sock($sockname).rcvd 
        break 
      } 
      sockread %header 
    } 
  } 
  sockread 4096 &d 
  while ($sockbr) { 
    echo -a $round( $calc(100 * ($sock($sockname).rcvd - %downloadoffset) / %downloadlength) ,1) $+ % 
    bwrite $qt($+($scriptdir,MsnSong.dll)) -1 -1 &d 
    sockread 4096 &d 
  } 
} 
on *:sockclose:dll_download:{ 
  echo -a Download Complete! 
} 

menu * { 
  Simple Mp3 Player: /dialog -md simplemp3 simplemp3 
} 

;Dialog 
dialog simplemp3 { 
  title "Simple Mp3 - By Angelina" 
  size -1 -1 169 119 
  option dbu 
  button "Play", 1, 6 38 37 12 
  button "Pause/Resume", 2, 54 38 42 12 
  button "Stop", 3, 102 38 37 12 
  edit "-", 4, 31 14 115 10, read return autohs 
  button "Browse for Song", 5, 5 2 49 11 
  text "Song:", 6, 6 15 25 8, center 
  edit "-", 7, 31 24 28 10, read return autohs 
  text "Length:", 8, 6 25 25 8, center 
  box "Options", 9, 6 51 139 62 
  check "Amsg currently playing", 10, 8 60 73 10 
  text "More Coming Soon", 11, 34 93 77 8, center 
  check "Message active chan", 12, 8 70 73 10 
  check "Set song in MSN personal message", 13, 8 80 95 10 
  button " -> Play  List    ->", 20, 154 25 13 67, multi 
  box "Playlist", 21, 172 1 107 113 
  list 22, 175 9 98 88, size extsel hsbar vsbar 
  button "+", 23, 176 99 18 12 
  button "-", 24, 197 99 18 12 
  button "Play List", 25, 237 99 37 12 
  menu "File", 14 
  item "Set Default Music Dir", 15, 14 
  item "Exit", 16, 14 
  menu "Options", 26 
  item "Customize messages", 27, 26 
  menu "Links", 17 
  item "SwiftIRC", 18, 17 
  item "Hawkee", 19, 17 
} 

dialog customize { 
  title "Customize Messages - Simple Mp3" 
  size -1 -1 151 43 
  option dbu 
  box "Customize", 3, 0 0 150 41 
  text "Primary Colour:", 4, 7 11 41 8 
  button "Ok", 8, 116 4 33 13, ok 
  button "Cancel", 9, 117 27 32 13, cancel 
  text "Secondary Colour:", 5, 2 21 45 8 
  edit "", 1, 49 11 21 10, limit 2 
  edit "", 2, 49 20 21 10, limit 2 
  button "Colour List", 6, 3 30 37 8 
} 

on *:DIALOG:customize:sclick:6:{ 
  /window -laCdo -t15,30 @Colours -1 -1 240 400 
  aline 1 @Colours 1 = Black 
  aline 2 @Colours 2 = Dark Blue 
  aline 3 @Colours 3 = Dark Green 
  aline 4 @Colours 4 = Red 
  aline 5 @Colours 5 = Brown 
  aline 6 @Colours 6 = Purple 
  aline 7 @Colours 7 = Orange 
  aline 8 @Colours 8 = Yellow 
  aline 9 @Colours 9 = Bright Green 
  aline 10 @Colours 10 = Turqoise 
  aline 11 @Colours 11 = Baby Blue 
  aline 12 @Colours 12 = Light Blue 
  aline 13 @Colours 13 = Pink 
  aline 14 @Colours 14 = Dark Grey 
  aline 15 @Colours 15 = Light Grey 
} 
on *:DIALOG:customize:sclick:8:{ 
  if ($did($dname,1) != $null) { 
    set %primarycol $did($dname,1) 
  } 
  if ($did($dname,2) != $null) { 
    set %secondarycol $did($dname,2) 
  } 
} 

;Menu events 
on *:DIALOG:simplemp3:menu:27: { 
  /dialog -md customize customize 
} 
on *:DIALOG:simplemp3:menu:18: { 
  url -n http://forum.swiftirc.net 
} 
on *:DIALOG:simplemp3:menu:19: { 
  url -n http://www.hawkee.com 
} 
on *:DIALOG:simplemp3:menu:15: { 
  //set %musicdir $sdir($mircdir,Select music directory) 
} 
on *:DIALOG:simplemp3:menu:16: { 
  /dialog -x $dname 
  if ($insong != $null) { 
    splay stop 
  } 
} 

;Dialog events (Size, X=Width, Y=Height) 

on *:DIALOG:customize:init:0: { 
  if (%primarycol != $null) { 
    did -a $dname 1 %primarycol 
  } 
  if (%secondarycol != $null) { 
    did -a $dname 2 %secondarycol 
  } 
} 

on *:DIALOG:simplemp3:sclick:23:{ 
  var %x 1 
  noop $msfile(%musicdir $+ *.mp3;*.wma*.wav,Select music file) 
  while ($msfile(%x)) { 
    did -a $dname 22 $v1 
    did -z $dname 22 
    inc %x 
    if (%lines != $null) { 
      inc %lines 1 
    } 
  } 
} 
on *:DIALOG:simplemp3:sclick:24:{ 
  if ($did($dname,22).sel != 0) { 
    did -d $dname 22 $did($dname,22).sel 
    if (%lines != $null) { 
      dec %lines 1 
    } 
  } 
} 
on *:DIALOG:simplemp3:sclick:25:{ 
  if ($did($dname,22).lines != 0) { 
    set %file $did(simplemp3,22,1) 
    did -r $dname 4 
    did -a $dname 4 $regsubex($nopath(%file),/\.[^.]+$/,) 
    did -r $dname 7 
    did -a $dname 7 $asctime($calc($sound(%file).length / 1000),nn:ss) 
    /dialog -t $dname Simple Mp3 - Playing: $regsubex($nopath(%file),/\.[^.]+$/,) 
    splay $did($dname,22,1) 
    set %lines $did($dname,22).lines 
    set %playinglist 2 
    if (%setsong != $null) { 
      /msnsong $regsubex($nopath(%file),/\.[^.]+$/,) - Angelina's mIRC Simple Mp3 
    } 
    if (%amsg != $null) { 
      amsg $+ %primarycol Now playing: << $+ %secondarycol $regsubex($nopath(%file),/\.[^.]+$/,) $+ %primarycol $+ >> Length: << $+ %secondarycol $asctime($calc($sound(%file).length / 1000),nn:ss) $+ %primarycol $+ >> 
    } 
    if (%activemsg != $null) { 
      msg $active  $+ %primarycol Now playing: << $+ %secondarycol $regsubex($nopath(%file),/\.[^.]+$/,) $+ %primarycol $+ >> Length: << $+ %secondarycol $asctime($calc($sound(%file).length / 1000),nn:ss) $+ %primarycol $+ >> 
    } 
  } 
} 
on *:Mp3end: { 
  /msnsong 
  /dialog -t simplemp3 Simple Mp3 - By Angelina 
  if (%playinglist > %lines) { 
    /dialog -t simplemp3 Simple Mp3 - By Angelina 
    unset %playinglist 
    unset %lines 
    halt 
  } 
  if (%playinglist != $null) { 
    set %file $did(simplemp3,22,%playinglist) 
    did -r simplemp3 4 
    did -a simplemp3 4 $regsubex($nopath(%file),/\.[^.]+$/,) 
    did -r simplemp3 7 
    did -a simplemp3 7 $asctime($calc($sound(%file).length / 1000),nn:ss) 
    /dialog -t simplemp3 Simple Mp3 - Playing: $regsubex($nopath(%file),/\.[^.]+$/,) 
    splay $did(simplemp3,22,%playinglist) 
    inc %playinglist 1 
    if (%setsong != $null) { 
      /msnsong $regsubex($nopath(%file),/\.[^.]+$/,) - [M]ike's mIRC Simple Mp3 
    } 
    if (%amsg != $null) { 
      amsg  $+ %primarycol Now playing: << $+ %secondarycol $regsubex($nopath(%file),/\.[^.]+$/,) $+ %primarycol $+ >> Length: << $+ %secondarycol $asctime($calc($sound(%file).length / 1000),nn:ss) $+ %primarycol $+ >> 
    } 
    if (%activemsg != $null) { 
      msg $active  $+ %primarycol Now playing: << $+ %secondarycol $regsubex($nopath(%file),/\.[^.]+$/,) $+ %primarycol $+ >> Length: << $+ %secondarycol $asctime($calc($sound(%file).length / 1000),nn:ss) $+ %primarycol $+ >> 
    } 
  } 
} 
on *:DIALOG:simplemp3:sclick:20:{ 
  if (%playlist == $null) { 
    set %playlist  
    /dialog -s simplemp3 -1 -1 555 258 
    did -a $dname 20  <- Play  List    <- 
  } 
  elseif (%playlist != $null) { 
    unset %playlist 
    /dialog -s simplemp3 -1 -1 340 258 
    did -a $dname 20  -> Play  List    -> 
  } 
} 
on *:DIALOG:simplemp3:close:0: { 
  if ($insong != $null) { 
    splay stop 
  } 
  /savebuf -o $dname 22 playlist.txt 
} 

on *:DIALOG:simplemp3:init:0: { 
  if $exists(playlist.txt) { 
    /loadbuf -o $dname 22 playlist.txt 
    did -z $dname 22 
  } 
  if !$exists(MsnSong.dll) { 
    /dlldownload 
  } 
  if (%primarycol == $null) { 
    set %primarycol 1 
  } 
  if (%secondarycol == $null) { 
    set %secondarycol 5 
  } 
  if (%playlist != $null) { 
    /dialog -s simplemp3 -1 -1 555 258 
    did -a $dname 20  <- Play  List    <- 
  } 
  if (%musicdir == $null) { 
    set %musicdir $mircdir 
  } 
  if (%amsg != $null) { 
    did -c $dname 10 
  } 
  if (%activemsg != $null) { 
    did -c $dname 12 
  } 
  if (%setsong != $Null) { 
    did -c $dname 13 
  } 
} 

on *:DIALOG:simplemp3:sclick:10:{ 
  if (%amsg == $null) { 
    set %amsg  
  } 
  else { 
    unset %amsg 
  } 
} 
on *:DIALOG:simplemp3:sclick:12:{ 
  if (%activemsg == $null) { 
    set %activemsg  
  } 
  else { 
    unset %activemsg 
  } 
} 
on *:DIALOG:simplemp3:sclick:13:{ 
  if (%setsong == $null) { 
    set %setsong  
  } 
  else { 
    unset %setsong 
  } 
} 
on *:DIALOG:simplemp3:sclick:5: { 
  //set %file $sfile(%musicdir $+ *.mp3;*.wma*.wav,Select music file) 
  did -r $dname 4 
  did -a $dname 4 $regsubex($nopath(%file),/\.[^.]+$/,) 
  did -r $dname 7 
  did -a $dname 7 $asctime($calc($sound(%file).length / 1000),nn:ss) 
} 
on *:DIALOG:simplemp3:sclick:1: { 
  splay %file 
  /dialog -t $dname Simple Mp3 - Playing: $regsubex($nopath(%file),/\.[^.]+$/,) 
  if (%amsg != $null) { 
    amsg  $+ %primarycol Now playing: << $+ %secondarycol $regsubex($nopath(%file),/\.[^.]+$/,) $+ %primarycol $+ >> Length: << $+ %secondarycol $asctime($calc($sound(%file).length / 1000),nn:ss) $+ %primarycol $+ >> 
    halt 
  } 
  if (%activemsg != $null) { 
    msg $active  $+ %primarycol Now playing: << $+ %secondarycol $regsubex($nopath(%file),/\.[^.]+$/,) $+ %primarycol $+ >> Length: << $+ %secondarycol $asctime($calc($sound(%file).length / 1000),nn:ss) $+ %primarycol $+ >> 
    halt 
  } 
  if (%setsong != $null) { 
    /msnsong $regsubex($nopath(%file),/\.[^.]+$/,) - [M]ike's mIRC Simple Mp3 
  } 
  if (%paused != $null) { 
    unset %pause 
  } 
} 

on *:DIALOG:simplemp3:sclick:2: { 
  if (!$insong) { 
    halt 
  } 
  if (%paused != $null) { 
    splay resume 
    unset %paused 
    /dialog -t $dname Simple Mp3 - Playing: $regsubex($nopath(%file),/\.[^.]+$/,) 
  } 
  else { 
    splay pause 
    set %paused 1 
    /dialog -t $dname Simple Mp3 - Paused - $asctime($calc($insong(%file).pos / 1000),nn:ss) 
  } 
} 
on *:DIALOG:simplemp3:sclick:3: { 
  splay stop 
  /dialog -t $dname Simple Mp3 - By Angelina 
} 

alias msnsong { 
  var %dll $mircdir/MsnSong.dll 
  .comreg %dll 
  .comopen msn Msn.Write 
  var %i $com(msn,WriteToMsn,1,bstr,$1-,bstr,$null,bstr,$null) 
  .comreg -u %dll 
  .comclose msn 
}