CaiIRC MP3 Player

By LucSatise on Aug 25, 2008

This is just another mp3 player. i got asked to post it so i did. I might upgrade and include playlist option (got it on my old one) but might not.

Run: right click channel and click CaiMP3

To skip during continuous play press F2 or press the skip button.

Update: Will halt timer if you unload script and stops the song.

on *:UNLOAD:{
  timerMp3 Off
  splay stop
}
menu channel {
  -
  CaiMP3: dialog -dm CaiMP3 CaiMP3
  MP3 Info: info
  -
}
dialog CaiMP3 {
  title "CàiI®C Mp3 Player"
  option dbu
  size -1 -1 200 100
  box "Songs", 1, 1 0 198 50
  list 2, 3 8 98 45, vsbar
  Text "Playing:", 3, 105 10 30 20
  Text "N/A", 4, 145 10 50 20
  Text "Time Remaining:", 5, 105 30 30 20
  Text "00:00", 6, 145 35 30 10
  Button "Play Selected", 7, 15 55 40 20
  Button "Play All", 8, 60 55 40 20
  Button "Stop", 9, 105 55 40 20
  Button "Pause/Resume", 10, 150 55 40 20
  Button "Load Songs", 11, 30 75 40 20
  Button "Update Songs", 12, 70 75 40 20
  Button "Skip", 13, 110 75 40 20
}
on *:MP3END:{
  if (%ContPlay == On) { inc %start | contplay }
}
on *:DIALOG:CaiMP3:Sclick:*:{
  if ($did == 7) {
    set %Contplay Off
    set %Playing $Remove($did(CaiMP3,2).seltext,.mp3)
    set %length $gmt($round($calc($mp3(%playing).length / 1000),0),nn:ss)
    splay $read(mp3.txt, w, * $+ $did(CaiMP3,2).seltext $+ *)
    did -ra CaiMP3 4 %playing
    .timermp3 0 0 Remaining
    msg $active $Cai 12,1[-11MP3 Playing:12 %Playing 11|| Length:12 $gmt($round($calc($insong.length / 1000),0),nn:ss) $+ 12-]
  }
  if ($did == 8) {
    set %ContPlay on
    set %Start 1
    contplay
  }
  if ($did == 9) {
    splay stop
    set %ContPlay Off
    msg $active $Cai 12,1[-11MP3 STOPPED12-]
  }
  if ($did == 10) {
    if ($insong) && (!$insong.pause) {
      splay pause
      msg $active $Cai 12,1[-11MP3 PAUSED12-]
    }
    elseif ($insong) && ($Insong.Pause) {
      splay Resume
      msg $active $Cai 12,1[-11MP3 RESUMED12-]
    }
  }
  if ($did == 11) { 
    set %dir $sdir="Mp3 Directory"
    write -c mp3.txt
    noop $findfile(%dir,*.mp3,0,write mp3.txt $1-)
    var %num $findfile(%dir, *.mp3,0,did -a CaiMP3 2 $nopath($1-))
  }
  if ($did == 12) {
    did -r CaiMP3 2
    write -c mp3.txt
    noop $findfile(%dir,*.mp3,0,write mp3.txt $1-)
    var %num $findfile(%dir, *.mp3,0,did -a CaiMP3 2 $nopath($1-))
    Echo $active $Cai 12,1[-11MP312-] [-11List Updates12-]
    dialog -x CaiMP3 CaiMP3
    dialog -dm CaiMP3 CaiMP3
  }
  if ($did == 13) {
    skip
  }
}
alias Skip {
  if (%ContPlay == On) {
    inc %Start
    contplay
  }
}
alias F2 { skip }
alias contplay {
  if ($read(mp3.txt,%start) == $null) { set %start 1 }
  splay $read(mp3.txt,%start)
  set %Playing $remove($nopath($read(mp3.txt,%start))$1-,.mp3)
  msg $active $Cai 12,1[-11Continuous Play:12 $remove($nopath($read(mp3.txt,%start))$1-,.mp3) 11|| Length:12 $asctime($round($calc(($insong.length - $insong.pos) / 1000),0),nn:ss) $+ -]
  .timermp3 0 0 remaining
}
on *:DIALOG:CaiMP3:init:0: {
  inc %MP3LOADS
  msg $Active $Cai 12,1[-11 $+ $me Has loaded CaiMP3 For the %MP3Loads $+ $ending time.12-]
  /did -r CaiMP3 2
  set %count 0
  while (%count <= $lines(mp3.txt)) { 
    inc %count
    /did -a CaiMP3 2 $remove($nopath($read(mp3.txt,%count))$1-,.mp3)
  }
}
alias ending {
  if ($right(%MP3Loads,1) == 1) && ($right(%MP3Loads,1) != 11) { return st }
  if ($right(%MP3Loads,1) == 2) && ($right(%MP3Loads,1) != 12) { return nd }
  if ($right(%MP3Loads,1) == 3) && ($right(%MP3Loads,1) != 13) { return rd }
  else { return th }
}
alias remaining {
  if ($dialog(CaiMP3)) {
    did -ra CaiMP3 4 %playing
    did -ra CaiMP3 6 $asctime($round($calc(($insong.length - $insong.pos) / 1000),0),nn:ss),none)
  }
}
alias Info {
  msg $Active $Cai 12,1[-11CaiMP3 Currently has12 $lines(mp3.txt) 11Songs12-]
  msg $active $Cai 12,1[-11CaiMP3 Created by Rayth12-]
}
alias cai {
  return $left $+ $newcolor(CàiI®C) $+ $right
}

Comments

Sign in to comment.
F*U*R*B*Y*   -  Aug 27, 2008

also, when unloading the script whilst a song is playing, or if dialog is closed, Status window gets full of

-
REMAINING Unknown command

opss forgot about edit button ;)

 Respond  
F*U*R*B*Y*   -  Aug 27, 2008

no pause, rewind, fast forward, Buttons are massive, my first song the title doesn't show up.

 Respond  
Calliope   -  Aug 26, 2008

very nice did what it should not too fussy worked fine for me good job and I don't mind the colours at all well done

 Respond  
EL   -  Aug 25, 2008

`-.-´

 Respond  
EL   -  Aug 25, 2008

ROFL@Eugene,yeah few things the skip function didnt work for me,you should make those button a tad smaller,add a double click event to play from the list and a play list.`-.-´

 Respond  
Eugenio   -  Aug 25, 2008

I spose its a good code, but fugleh ass colours
would rather stare at an eclipse

 Respond  
EL   -  Aug 25, 2008

oh so this is yur mp3 player i keep seein im test heh.`-.-´

 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.