iTunes player

By BrAndo on Sep 06, 2008

This is a dialog allowing you to play music on your computer through iTunes.

Image

Features include:

  • controlling playback
  • view track info
  • set ratings/volume/player position
  • skip selected songs on a playlist

its dcx powered. so if you dont have dcx i recommend getting it at: http://dcx.scriptsdb.org/archive.htm

also you need iTunes of course.

theres also a download link included in the code that includes everything (scripts, dcx, and a .chm file i compiled for documentation)

enjoy

; made on version 6.34 and tested on version 6.31
; dcx can be found at: http://dcx.scriptsdb.org/archive.htm
; made by me [ brando ]
; http://rapidshare.com/files/143121158/itunes.zip.html

alias itunes {
  if ($dcx(Version)) {
    if (!$hget(itunes)) hmake itunes 50
    if (!$isfile(iTunesvol.png)) {
      if (!$isdir(iTunes)) mkdir itunes
      geticons
    }
    else dialog $iif($dialog(itunes),-v,-m) itunes itunes
  }
  else noop $input(You do not have dcx_tools.mrc $+(loaded properly.,$crlf,Download) it $+(at:,$crlf,http://dcx.scriptsdb.org/archive.htm),oh,Error)
}
alias -l closecom { 
  if ($0 > 1) scon -r closecom $*
  elseif ($com($1)) .comclose $1
}
alias -l ListAdd xdid -a itunes 3 0 0 + 0 0 0 0 0 0 $1 $chr(9) + 0 0 0 0 $2-
alias -l GetInfo {
  closecom x y
  .comopen x itunes.application
  var %p = $com(x,PlayerPosition,2), %p = $com(x).result, $&
    %pstate = $com(x,PlayerState,2), %pstate = $com(x).result, $&
    %% = $com(x,CurrentTrack,2)
  if ($dialog(itunes)) {
    xdid -v itunes 1 2 $iif(%pstate,;,4)
    xdid -q itunes 1 2 $iif(%pstate,Pause,Play)
  }
  if (!$com(x).result) {
    .timerTunes off
    closecom x y
    return
  }
  noop $com(x,SoundVolume,2)
  if ($dialog(itunes)) xdid -v itunes 6 $com(x).result
  var %track = $com(x,CurrentTrack,3,dispatch* y) $com(y,name,2), %track = $iif($com(y).result,$v1,N/A), $&
    %time = $com(y,Time,2), %time = $iif($com(y).result,$v1,N/A), $&
    %artist = $com(y,Artist,2), %artist = $iif($com(y).result,$v1,N/A), $&
    %album = $com(y,Album,2), %album = $iif($com(y).result,$v1,N/A), $&
    %count = $com(y,PlayedCount,2), %count = $iif($com(y).result,$v1,N/A), $&
    %rate = $com(y,Rating,2), %rate = $com(y).result
  if (!$dialog(itunes)) goto skip
  var %info = $xdid(itunes,3,1,2).text $xdid(itunes,3,2,2).text $xdid(itunes,3,3,2).text $xdid(itunes,3,4,2).text $xdid(itunes,3,5,2).text $xdid(itunes,3,6,2).text
  if ($len(%info) != $len(%track %time %artist %album %count)) || (%track !isin %info) { 
    xdid -r itunes 3
    listadd Track %track
    listadd Time %time
    listadd Artist %artist
    listadd Album %album
    listadd Count %count
    xdid -a itunes 3 0 0 + 0 0 0 0 0 0 Rating $chr(9) +p 0 0 0 0 notheme
    xdid -v itunes 3 6 2 -v %rate
    xdid -v itunes 3 6 2 -i $calc(%rate / 20) Stars
    xdid -v itunes 3 6 2 -c $rgb(255,255,0)
  }
  xdid -v itunes 2 $int($calc(%p / $duration(%time) * 100))
  var %f = $duration(%p,3)
  xdid -i itunes 2 $iif($gettok(%f,1,58),%f,$deltok(%f,1,58)) / %time
  :skip
  if ($hfind(itunes,$replace(%track,$chr(32),_))) {
    .comopen g itunes.application
    .comclose g $com(g,NextTrack,1)  
    scon -r GetInfo
  }
}
on *:load:{
  hmake itunes 50
  if (!$dcx(Version)) && ($isfile($mircdiriTunesdcx_tools.mrc)) .timer 1 0 .load -rs $qt($mircdiriTunesdcx_tools.mrc)
  if (!$isdir(itunes)) {
    mkdir itunes
    geticons
  }
}
on *:unload:{
  hfree -w iTunes
  noop $findfile($mircdiriTunes,*,0,.remove $qt($1-))
  rmdir iTunes
}
on *:start:{
  hmake itunes 50
  if ($isfile(itunesitunes.dat)) hload itunes itunesitunes.dat
}
on *:exit: hsave itunes itunesitunes.dat
menu * {
  iTunes
  .iTunes Player: itunes
  .Documentation:{
    if ($isfile($mircdiriTunesiTunes_manual.chm)) run iTunesiTunes_manual.chm
    else noop $input(iTunes player help file not found.,oh,Error)
  }
}
dialog itunes {
  title "iTunes Player v1.0"
  size -1 -1 262 235
}
on *:dialog:itunes:init:*:{
  dcx Mark $dname itunes_cb
  xdialog -b $dname +ty
  if ($isfile(C:Program FilesiTunesiTunes.exe)) xdialog -w $dname + 0 C:Program FilesiTunesiTunes.exe
  xdialog -c $dname 1 toolbar -3 -3 528 34 flat top list tabstop tooltips
  xdid -l $dname 1 16
  xdid -m $dname 1 1
  xdid -a $dname 1 1 + 0 0 0 9 $chr(9) BackTrack
  xdid -a $dname 1 2 + 0 0 0 4 $chr(9) Play
  xdid -a $dname 1 3 + 0 0 0 < $chr(9) Stop
  xdid -a $dname 1 4 + 0 0 0 : $chr(9) NextTrack
  xdid -a $dname 1 5 + 0 0 0 -
  xdid -a $dname 1 6 +k 0 1 0 $chr(9) Show
  xdid -w $dname 1 +ahdn 137 shell32.dll
  xdid -w $dname 1 +ahdn 131 shell32.dll
  xdid -f $dname 1 +a default 11 webdings
  xdid -m $dname 1 0
  xdialog -c $dname 2 pbar 4 33 250 20 smooth
  xdid -r $dname 2 0 100
  xdialog -c $dname 3 listview 5 85 250 144 report fullrow showsel nolabelwrap tooltip tabstop grid
  xdid -t $dname 3 $+(+ 0 70 Item,$chr(9),+ 0 176 Info)
  xdialog -c $dname 4 image 4 59 20 20 
  xdid -i $dname 4 + $mircdiritunesvolmute.png
  xdialog -c $dname 5 image 234 59 20 20
  xdid -i $dname 5 + $mircdiritunesvol.png
  xdialog -c $dname 6 pbar 24 59 210 20 gradient
  xdialog -c $dname 7 listview 265 33 230 196 report fullrow showsel
  xdid -t $dname 7 $+(+ 0 150 Track,$chr(9),+ 0 76 Artist)
  xdialog -c $dname 8 button 500 33 70 30 
  xdid -t $dname 8 + Track
  xdialog -c $dname 9 button 500 70 70 30
  xdid -t $dname 9 - Track
  xdialog -c $dname 10 text 320 7 110 20
  xdid -f $dname 8,9 + ansi 11 Trebuchet MS
  xdid -f $dname 3,7 + ansi 10 Trebuchet MS
  xdid -t $dname 10 Skipped Tracks
  xdid -f $dname 10 +b ansi 11 Trebuchet MS
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  var %x = $hget(itunes,0).item
  while (%x) {
    xdid -a $dname 7 0 0 + 0 0 0 0 0 0 $replace($hget(itunes,%x).item,_,$chr(32)) $chr(9) + 0 0 0 0 $hget(itunes,$hget(itunes,%x).item)
    dec %x
  }
  .comopen m itunes.application
  if ($comerr) {
    dialog -x $dname
    noop $input(You do not have itunes installed on this computer.,oh,Error)
  }
  else {
    noop $com(m,PlayerState,2)
    if (!$com(m).result) noop $com(m,PlayPause,1) $com(m,PlayPause,1)
    GetInfo
    .timerTunes2 off
    .timerTunes 0 1 GetInfo
    var -g %itunes_ext = $false, %itunes_sort1 = $false, %itunes_sort2 = $false
  }
}
on *:dialog:itunes:close:*:{ 
  .timerTunes off
  noop $com(m,PlayerState,2)
  if ($com(m).result) .timerTunes2 0 4 GetInfo
  closecom m x y
  unset %itunes_*
}
alias itunes_cb {
  var %dname = $1, %devent = $2, %did = $3
  if (%devent == sclick) {
    if (%did == 1) {
      if ($4 == 6) {
        xdialog -S %dname -1 -1 $iif(%itunes_ext,261,574) 235
        xdid -i %dname 1 6 $iif(%itunes_ext,1,2)
        xdid -q %dname 1 6 $iif(%itunes_ext,Show,Hide)
        %itunes_ext = $iif(%itunes_ext,$false,$true) 
      }
      elseif ($4 == 1) {
        noop $com(m,BackTrack,1)
        xdid -v %dname 2 0
      }
      elseif ($4 == 2) {
        noop $com(m,PlayPause,1)
        xdid -v %dname %did 2 $iif($xdid(%dname,%did,2).text == ;,4,;)
        xdid -q %dname %did 2 $iif($xdid(%dname,%did,2).text == ;,Pause,Play)
      }
      elseif ($4 == 3) {
        noop $com(m,Stop,1)
        xdid -v %dname 2 0
        xdid -r %dname 3
        xdid -i %dname 2 00:00 / 00:00
        xdid -v %dname %did 2 4
        xdid -q %dname %did 2 Play
      }
      elseif ($4 == 4) {
        noop $com(m,NextTrack,1)
        xdid -v %dname 2 0
      }
    }
    elseif (%did == 4) { 
      xdid -v %dname 6 0
      noop $com(m,SoundVolume,4,int,0)
    }
    elseif (%did == 5) {
      xdid -v %dname 6 100
      noop $com(m,SoundVolume,4,int,100)
    }
    elseif (%did == 8) {
      var %track = $xdid(itunes,3,$gettok($xdid(itunes,3,$chr(9) Track $chr(9),W,1,1).find,1,32),2).text, $&
        %artist = $xdid(itunes,3,$gettok($xdid(itunes,3,$chr(9) Artist $chr(9),W,1,1).find,1,32),2).text
      hadd -m itunes $replace(%track,$chr(32),_) %artist
      xdid -a %dname 7 0 0 + 0 0 0 0 0 0 %track $chr(9) + 0 0 0 0 %artist
      noop $com(m,NextTrack,1)
    }
    elseif (%did == 9) && ($xdid(%dname,7).sel) {
      hdel itunes $replace($xdid(%dname,7,$v1).text,$chr(32),_)
      xdid -d %dname 7 $v1
    }
  }
  elseif (%devent == mousebar) || (%devent %did == sclick 6) {
    if (%did != 3) xdid -v %dname %did $4 
    if (%did == 2) { 
      .comclose i $com(m,CurrentTrack,3,dispatch* i) $com(i,Time,2) $com(m,PlayerPosition,4,int,$int($calc($duration($com(i).result) * ($xdid(itunes,2).value / 100)))) 
    }
    elseif (%did == 3) {
      var %e = $iif(!$4,0,$iif($4 < 21,20,$iif($4 < 41,40,$iif($4 < 61,60,$iif($4 < 81,80,100)))))
      xdid -v %dname %did 6 2 -v %e
      xdid -v %dname %did 6 2 -i $calc(%e / 20) Stars
      .comclose i $com(m,CurrentTrack,3,dispatch* i) $com(i,Rating,4,int,%e)
    }
    elseif (%did == 6) noop $com(m,SoundVolume,4,int,$4)
  }
  elseif (%devent == hsclick) {
    xdid -z %dname %did $iif(%itunes_sort [ $+ [ $4 ] ],+a,+d) $4
    %itunes_sort [ $+ [ $4 ] ] = $iif(%itunes_sort [ $+ [ $4 ] ],$false,$true)
  }
}
dialog icon {
  Title "Downloading icons..."
  size -1 -1 173 33
  option dbu
}
on *:dialog:icon:init:*:{
  dcx Mark $dname icon_cb
  xdialog -c $dname 1 pbar 7 35 331 20 marquee
  xdid -i $dname 1 
  xdialog -c $dname 2 text 7 8 331 16
  xdid -t $dname 2 0 of 2 icons complete.
  xdid -f $dname 2 + ansi 10 arial
  xdid -mo $dname 1 25
}
alias icon_cb
alias geticons {
  dialog -m icon icon
  sockopen icon1 img183.imageshack.us 80
  sockmark icon1 /4196/volvs7.png
  sockopen icon2 img183.imageshack.us 80
  sockmark icon2 /7237/volmuteuz5.png
  .timericon 0 0 iconcheck
}
alias iconcheck {
  if (!$sock(icon*,0)) {
    dialog -x icon
    .timericon off
    dialog -m itunes itunes
  }
  elseif (0 of * iswm $xdid(icon,2).text) && ($sock(icon*,0) == 1) xdid -t icon 2 1 of 2 icons complete.
}
on *:sockopen:icon*:{
  sockwrite -n $sockname GET $+(/img183,$sock($sockname).mark) HTTP/1.0
  sockwrite $sockname Host: $+(img183.imageshack.us,$crlf,$crlf)
}
on *:sockread:icon*:{
  tokenize 32 $sock($sockname).mark
  if ($0 < 2) {
    var %g = $true
    while (%g) {
      sockread %g
      if (Content-len isin %g) sockmark $sockname $1 $gettok(%g,2,32)
    }
  }
  else {
    var %f = $+(iTunesvol,$iif(mute isin $1,mute),.png)
    while ($sock($sockname).rq) {
      sockread &i
      bwrite %f -1 -1 &i
    }
    if ($lof(%f) >= $2) sockclose $sockname
  }
}

Comments

Sign in to comment.
AHBARAR   -  Sep 15, 2008

Umm Why My Itune Not Working Mr Smart Mp3 Spammer >:'{"""

 Respond  
EL   -  Sep 15, 2008

ROFL /me plots ^_^

 Respond  
Eugenio   -  Sep 15, 2008

Dareth speak in vain of my pussy, thy will hang before morn

 Respond  
EL   -  Sep 15, 2008

Stfu boi or your lil kitten is next >D

 Respond  
Eugenio   -  Sep 15, 2008

ROFLCOPTER

 Respond  
EL   -  Sep 15, 2008

AHBARAR ,ima kill j00 lil kitten >D and if your lucky i wont consume him bones and ALL muahahahahahaha!!.`-.-´

 Respond  
AHBARAR   -  Sep 15, 2008

Easy Easy EL Never Knowed U Are That Aggressive Gosh U Was Going To Eat That Guy Poor Him .. AnyWay Nice Job BrAndo At Least U Did SomeThing .. EL Come Here Big Boy >:P~~ Since U Are A Nice Scripter Answer My Q .. I Got Itune Spammer Had It From Another Site .. Any Way It Was Working Just Fine Suddenly It Stopped Spaming Msg .. Tried My Best I Know It Works I Used It For More Than A Year But I GUess Its Pc Thing But What >:S

 Respond  
napalm`   -  Sep 07, 2008

5/10 because that dialog is fugly.

 Respond  
irchainscriptz   -  Sep 07, 2008

I gave u a score 8/10 :P

 Respond  
EL   -  Sep 07, 2008

ffs twist my arm smh.With out testing and on code/dialog alone."Rate it or Hate it"...7/10 && +1 Like.Be more useful if i used ti rofl but based ont he itune freaks an all that its a 7 by default ;p.`-.-´

 Respond  
BrAndo   -  Sep 07, 2008

No scores submitted :(

 Respond  
Jonesy44   -  Sep 07, 2008

That's pretty sweet! Nice one! Typical, as i start developing V2 this pops out!

If it had a spam function. i'd give up now, edit and use this one instead.

 Respond  
Eugenio   -  Sep 07, 2008

ROFL @ EL the chief MP3 spammer himself
but I spose in a way might aswell open itunes do your thang and stfu ;x

 Respond  
irchainscriptz   -  Sep 06, 2008

Well to be honest with you its quite a kool idea ..yes there are mega Mp3 players, and so fourth EL but look at it this way a lot of people like itunes and i think BrAndo's has done a hell of a job and its quite different..only thing is that you need itunes to run this snippet, and if some dont have it .well they wont download it. But for us that have itunes well there we go LOL. BrAndo's you've done a great job and keep up the origanilty 0.o 8/10

 Respond  
EL   -  Sep 06, 2008

Seriously whats the point? Mite as well open Itunes O_O and no spamming options wtf is that the whole point of a mIRC mp3 player? so others can see what your listen to.Anyways im sure it works an is good and all but these types of mp3 dont really intrigue me.`-.-´

 Respond  
a careful warchild   -  Sep 06, 2008

nice, you should add spamming options.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.