Cm3

By Scruffy on Dec 27, 2005

Well got some help with dialog studio and my best friend.i was still confused with dialogs so my friend and I did this mp3 player. Just type /Cm3-Player and the rest is pretty simple.

Alias Cm3-player { 
  if ($dialog(Cmplayer)) { dialog -ve cmplayer cmplayer } 
  else { dialog -md cmplayer cmplayer } 
} 
alias mp3 { dialog -md cmplayer cmplayer } 
alias load.settings { 
  vol -v %vol 
  .timer1 1 1 did -a cmplayer 44 %vol.pos 
  .timer3 1 2 plist 
} 
alias exit { splay stop | unset %mp3 %mp3.song %nub %file %mp3.stat.* | .timerprog off | echo -a Session closed.. } 
alias plist { 
  if (%mp3.dir == $null) { set %mp3.dir $sdir "What file are your Mp3's in?" } 
  did -r cmplayer 19 
  var %r 1 
  while ( %r <= $findfile(%mp3.dir,*.mp3,0) ) { 
    did -a cmplayer 19 $nopath($findfile(%mp3.dir,*.mp3,%r)) 
  inc %r } 
  did -a cmplayer 45 %r mp3's 
  set %mp3.total %r 
  unset %r 
  did -ra cmplayer 24 %mp3.dir 
} 
alias mp3.play { 
  if ($did == 9) { 
    if (%mp3.shuf) { did -c cmplayer 19 $rand(1,$did(cmplayer,19).lines) | goto next } 
    else { did -c cmplayer 19 $calc($did(cmplayer,19).sel + 1) | goto next } 
  } 
  if ($did == 5) { 
    if (%mp3.shuf) { did -c cmplayer 19 $rand(-1,$did(cmplayer,19).lines) | goto next } 
    else { did -c cmplayer 19 $calc($did(cmplayer,19).sel - 1) | goto next } 
  } 
  :next 
  set %file %mp3.dir $+ $did(cmplayer,19).seltext 
  set %mp3 $did(19).seltext 
  set %mp3.song $replace($remove(%mp3,.mp3),_,$chr(32)) 
  if ($insong == $true) { splay -c stop } 
  set %mp3.stats.size $round($calc($lof(%file) / 1048576),2) $+ mb 
  set %mp3.stats.len $remove($duration($calc(($mp3(%file).length - $inmp3.pos) / 1000)),rs,ins,ecs) 
  set %mp3.stats.kbps $mp3($iif(%file,%file,$inmp3.fname)).bitrate 
  set %mp3.stats.mode $lower($replace($remove($mp3($iif(%file,%file,$inmp3.fname)).mode,joint,$chr(32),channel),single,mono))),chan 
  did -ra cmplayer 1 %mp3.song 
  did -ra cmplayer 11 %mp3.stats.kbps 
  did -ra cmplayer 16 %mp3.stats.len 
  did -ra cmplayer 14 %mp3.stats.mode 
  did -ra cmplayer 15 %mp3.stats.size 
  splay -pq %mp3.dir $+ \ $+ %mp3 
  did -z cmplayer 3 0 $inmp3.length 
  .timerprog -m 0 1 did -c cmplayer 3 $!inmp3.pos 
} 
alias mp3.pause { 
  if (%mp3-pause) { unset %mp3-pause | splay resume | did -ra cmplayer 1 %mp3.song } 
  else { splay pause | set %mp3-pause true | did -ra cmplayer 1 Paused } 
} 
alias mp3.stats { 
  set %mp3.stats.size $round($calc($lof(%mp3) / 1048576),2) $+ mb 
  set %mp3.stats.len $remove($duration($calc(($mp3(%mp3).length - $inmp3.pos) / 1000)),rs,ins,ecs) 
  set %mp3.stats.kbps $mp3($iif(%mp3,%mp3,$inmp3.fname)).bitrate 
  set %mp3.stats.mode $lower($replace($remove($mp3($iif(%mp3,%mp3,$inmp3.fname)).mode,joint,$chr(32),channel),single,mono))  
} 
dialog cmplayer { 
  title "Cmplayer" 
  size -1 -1 174 180 
  option dbu 
  edit "", 1, 2 11 170 10, read center 
  box "", 2, 1 7 172 24 
  scroll "", 3, 3 21 167 8, horizontal 
  button "<<", 4, 3 45 13 12, flat 
  button "|<", 5, 17 45 13 12, flat 
  button "[>", 6, 31 45 13 12, flat 
  button "[ ]", 7, 45 45 13 12, flat 
  button "| |", 8, 59 45 13 12, flat 
  button ">|", 9, 73 45 13 12, flat 
  button ">>", 10, 87 45 13 12, flat 
  edit "", 11, 3 32 26 10, read center 
  box "", 12, 1 27 172 17 
  edit "", 13, 107 32 64 10, read center 
  edit "", 14, 29 32 26 10, read center 
  edit "", 15, 55 32 26 10, read center 
  edit "", 16, 81 32 26 10, read center 
  box "", 17, 1 40 172 19 
  box "", 18, 1 66 172 68 
  list 19, 3 71 168 50, sort size 
  button "Add Mp3", 20, 4 122 26 10, flat 
  button "Remove Mp3", 21, 32 122 35 10, flat 
  button "Playlist Text File", 22, 102 122 68 10, flat 
  box "", 23, 1 130 172 25 
  combo 24, 3 142 144 37, size drop 
  button "+", 25, 149 142 10 10, flat 
  button "-", 26, 160 142 10 10, flat 
  text "[ Mp3 Directories ]", 27, 4 134 166 8, center 
  button "x", 28, 163 1 9 8, flat 
  button "_", 29, 153 1 9 8, flat 
  text "^|| Cmplayer ||^                                           (v)1.0.0b", 30, 1 2 151 8, center 
  check "Shuffle", 31, 145 45 25 12, flat push 
  check "Repeat", 32, 119 45 25 12, flat push 
  box "", 33, 85 151 88 16 
  box "", 34, 1 151 85 16 
  button "Announce to Channel", 35, 12 156 66 10 
  box "", 37, 1 163 172 16 
  button "<Finished>", 38, 3 168 168 9, flat ok 
  box "", 39, 1 55 172 15 
  text "volume", 40, 3 60 17 8 
  button "+", 41, 21 60 9 8, flat 
  button "-", 42, 31 60 9 8, flat 
  button "X", 43, 41 60 9 8, flat 
  edit "", 44, 51 59 22 10, read center 
  edit "", 45, 73 59 97 10, read center 
} 
on *:dialog:cmplayer:init:0 { load.settings } 
on *:dialog:cmplayer:*:*: { 
  if ($devent == sclick) { 
    if ($did == 4) { .splay seek $calc($inmp3.pos - 5000) } 
    if ($did == 5) { mp3.play } 
    if ($did == 6) { mp3.play } 
    if ($did == 7) { splay stop | did -ra cmplayer 1  No Files Playing } 
    if ($did == 8) { mp3.pause } 
    if ($did == 9) { mp3.play } 
    if ($did == 10) { .splay seek $calc($inmp3.pos + 5000) } 
    if ($did == 25) { set %mp3.dir $$sdir(c:\,"Where is your Mp3 directory?") | plist } 
    if ($did == 41) { 
      if (%vol >= 65535) { halt } 
      else { 
        inc %vol $calc(65535/100*10) 
        vol -v %vol 
        set %vol.pos $calc(%vol / 6553.5) $+ 0 $+ % 
        if (%vol.pos == 100%) { did -ra cmplayer 44 MAX } 
        else { did -ra cmplayer 44 %vol.pos } 
        halt 
      } 
    } 
    if ($did == 42) { 
      if (%vol <= 0) { halt } 
      else { 
        dec %vol $calc(65535/100*10) 
        vol -v %vol 
        set %vol.pos $calc(%vol / 6553.5) $+ 0 $+ % 
        if (%vol.pos == 00%) { did -ra cmplayer 44 MIN } 
        else { did -ra cmplayer 44 %vol.pos } 
        halt 
      } 
    } 
    if ($did == 43) { 
      if (%mp3.mute == 0) { set %mute 1 | set %un.mute %vol | vol -v 0 | did -ra cmplayer
      else { set %mute 0 | vol -v %un.mute | did -ra cmplayer 44 $calc(%vol / 6553.5) $+ 0 $+ % |er 44 Mute | halt }  unset %un.mute | halt } 
    } 
    if ($did == 35) { mp3.say } 
    if ($did == 36) { return $did(36,1,0) } 
    if ($did == 28) { exit } 
    if ($did == 29) { dialog -i cmplayer cmplayer } 
    if ($did == 31) { if ($did(cmplayer,31).state) { set %mp3.shuf 1 } | else { set %mp3.shuf 0 | } } 
    if ($did == 32) { mp3.rep } 
    if ($did == 38) { exit } 
  } 
  if ($devent == dclick) { if ($did == 19) { mp3.play } } 
} 
on *:dialog:cmplayer:scroll:3: { 
  .timerprog off 
  splay seek $did(cmplayer,3).scroll 
  .timerprog -m 0 1 did -c cmplayer 3 $!inmp3.pos 
} 
on *:dialog:cmplayer:close:*: { exit } 
on *:mp3end:{ if ($dialog(cmplayer)) { if (%mp3.shuf) { mp3.play } | else { return } } } 
alias Mp3.say {
  /amsg 12,1(-)11,1Now Playing- %mp3.song $+ . Volume: %vol  $+ . Size: %mp3.stats.size $+ . Length: %mp3.stats.len $+ . Kbps: %mp3.stats.kbps $+ . 12,1(-)
}

Comments

Sign in to comment.
EL   -  Jul 07, 2008
 Respond  
idlewild   -  Jul 07, 2008

when i loaded this by typing \"/Cm3-Player\" my MIRC froze.

 Respond  
idlewild   -  Jul 07, 2008

Im looking for a mp3 player that shows what playing via channel notice. like %name %time, etc,.,.,.

 Respond  
SypheR   -  Dec 24, 2006

Pretty good script. However i found some error\'s. your \"remove mp3\" button does not work, \"add mp3\" button aint either. It doesn\'t show automaticly what it\'s playing either, pressing a button each time is not good for users with status. I might use it when you fix that part :)

 Respond  
HassanAbbas   -  Nov 28, 2006

fixed

 Respond  
HassanAbbas   -  Nov 28, 2006

Cool :P

 Respond  
Scruffy   -  Mar 07, 2006

ok well, I worked on it before and saved it on my hard drive, but then my computer crashed. And it got deleted D: so it will take me a while to fix the changes

 Respond  
sladekraven   -  Mar 07, 2006

There is still no mp3.rep command.
I don\'t like your exit alias as it overwrites mIRC\'s existing /exit command to close mIRC.
When shuffle is selected and my current song finishes i get:
$did (line 35, script17.mrc)
The timer should be halted if the dialog is closed, regardless of the button as (Esc) could accidently be hit.
*As noted some buttons wont work (Only tried Playlist Text File)

On a more positive note, love the progress and volume bar, nice interface. Well done, hope to see the above fixes. :)

 Respond  
Scruffy   -  Mar 07, 2006

kakashi, you have to press the button..

 Respond  
Kakashi_Hatake   -  Jan 03, 2006

I get an error when I close the dialog. It floods my status with \"/did Invailid Command\". Then disconnects me. But other than that it\'s pretty good.

 Respond  
tank59   -  Dec 28, 2005

Not bad, although quite a few of your buttons still don\'t work.

 Respond  
Scruffy   -  Dec 27, 2005

oh oops hold on let me fix that

 Respond  
Zachery   -  Dec 27, 2005

There is no reapeat cmd

MP3.REP Unknown command

 Respond  
Repz   -  Dec 27, 2005

Cool Script ;)

 Respond  
Scruffy   -  Dec 27, 2005

fixed

 Respond  
xDaeMoN   -  Dec 27, 2005

You could check for bracket mismatches by click the \"{}\" button in the remote editor.

 Respond  
Scruffy   -  Dec 27, 2005

can you tell me where?

 Respond  
Scruffy   -  Dec 27, 2005

uhh hold on lemme check that..

 Respond  
Zachery   -  Dec 27, 2005

Theres Some Bracket Errors

 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.