Top

media player


mIRC Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  5.2 (of 6 scores)
Date Added  Sep 20, 2007
Last Updated  Sep 25, 2007
Tags  mp3 

Introduction

to open: either use the menu in a channel window or /aud.open, this will create a minizable desktop/mirc window with the mp3. to change directories: (for users with directories already) /aud.load destroydir -> /aud.load, (for new users) just open the dialog or type /aud.load. to enter the channels you do not want to display it in, change the %i variable to the desired value (remember to seperate the values by commas) to change the method of display (echo/msg(or descrive)) change the isoff to ison or vice versa. if you need to change the the type of msg, go the second value in the %i variable and change it to msg or describe.

;--------

FOR QUICK PLAY:

/quickmedia .play
/quickmedia .pause (type again to resume)
/quickmedia .stop
to edit if you want to enable the broadcast change the %i variable to off or on depending on your choice.



Grab the Code

alias -l aud.ent { 
  if ($istok($1,mp3,46)) { return -p }
  if ($istok($1,wav,46)) { return -w }
  if ($istok($1,mid,46)) { return -m }
}
alias -l aud.seek { 
  if ($dialog(mplay)) && ($inmp3) { 
    ;nT0xIc8's scroll/seek bar
    did -c mplay 4 $round($calc($calc($insong.pos / $insong.length) * 100),0) 
    did -ra mplay 3 $+($gmt($round($calc($insong.pos / 1000),0),nn:ss),$chr(47),$gmt($round($calc($insong.length / 1000),0),nn:ss))
  } 
  else {
    if (!$dialog(mplay)) { 
      .timerpos off 
    } 
    if (!$inmp3) { halt }
  } 
}
 
alias aud.play { 
  var %int = $did(mplay,11).sel
  var %i = $did(mplay,11).seltext
  set -nu1 %temporary %int
  splay $aud.ent($nopath(%temporary)) $read(playlist.txt,%int)
  did -ra mplay 3 $gmt($round($calc($insong.pos / 1000),0),nn:ss)
  did -a mplay 2 $iif(!$sound($inmp3).artist,$remove(%i,.mp3,.wma,.mid),$sound($insong).title - $sound($insong).artist)
  .timerplay 0 1 aud.seek
}
 
alias aud.stop { 
  .timerplay off 
  splay -p stop
  splay -w stop
  splay -m stop
  did -ra mplay 3 00:00/00:00
  did -ra mplay 2 << no song is currently playing >>
  if (%aud.pause) { unset %aud.pause }
}
 
alias aud.pause {
  if ($inmp3) { 
    if (!%aud.pause) { set %aud.pause 1 }
    if (%aud.pause = 1) {  
      .timerplay -p 
      splay pause
      did -ra mplay 2 << song is currently paused >>
      inc %aud.pause 1
      halt
    }
    if (%aud.pause = 2) { inc %aud.pause 1 }
    if (%aud.pause = 3) { 
      .timerplay -r 
      splay resume
      did -ra mplay 2 $iif(!$sound($inmp3).artist,$remove($did($dname,11).seltext,.mp3,.wma,.mid),$sound($insong).title - $sound($insong).artist)
      unset %aud.pause
      halt
    }
  }
}
 
alias aud.load { 
  var %tmpdir $sdir(C:,Music Files)
  if ($dialog(mplay)) did -r mplay 11
  var %x 1 
  :start
  if (%getnum|mp3 = 1) { inc %getnum|mp3 }
  while ($findfile(%tmpdir,*.mp3,%x)) {
    if ($dialog(mplay)) { did -a mplay 11 $nopath($findfile(%tmpdir,*.mp3,%x)) }
    write playlist.txt $findfile(%tmpdir,*.mp3,%x)
    inc %x
  }
  var %x 1  
  while ($findfile(%tmpdir,*.wav,%x)) {
    if ($dialog(mplay)) { did -a mplay 11 $nopath($findfile(%tmpdir,*.wav,%x)) }
    write playlist.txt $findfile(%tmpdir,*.wav,%x)
    inc %x
  }
  var %x 1 
  while ($findfile(%tmpdir,*.midi,%x)) {
    if ($dialog(mplay)) { did -a mplay 11 $nopath($findfile(%tmpdir,*.midi,%x)) }
    write playlist.txt  $findfile(%tmpdir,*.midi,%x)
    inc %x
  }
  halt
  if ($1 = destroydir) { 
    remove playlist.txt
    unset %getnum|mp3
    goto start
  }
  if ($1 = remfile) { 
    if ($2-) {
      if ($read(playlist.txt,$nopath($1)) { write -dl $v1 }
    }
  }
}
 
 
 
dialog mplay {
  title "media player"
  size -1 -1 159 116
  option dbu
  box "", 1, 4 2 150 33
  text "", 2, 8 11 137 8
  text "", 3, 8 23 38 8
  scroll "", 4, 51 23 95 8, range 0 100 horizontal bottom
  button "<<", 5, 17 97 23 12
  button ">", 6, 40 97 23 12
  button "||", 7, 63 97 23 12
  button "[ ]", 8, 86 97 23 12
  button ">>", 9, 109 97 23 12
  box "Playlist", 10, 6 36 139 58
  list 11, 10 43 130 46, size
}
 
on *:dialog:mplay:init:0:{  
  var %x 1
  inc %getnum|mp3
  if (%getnum|mp3 iswm 1) { aud.load }
  else {
    while ($read(playlist.txt,%x)) { 
      did -a $dname 11 $nopath($v1)
      inc %x
    }
  }
}
on *:dialog:mplay:sclick:6:{ 
  aud.play
}
on *:dialog:mplay:sclick:5:{ 
  did -c $dname 11 $calc($did($dname,11).sel - 1)
  aud.play
}
on *:dialog:mplay:sclick:9:{ 
  did -c $dname 11 $calc($did($dname,11).sel + 1)
  aud.play
}
on *:dialog:mplay:sclick:8:{ 
  aud.stop
}
on *:dialog:mplay:sclick:7:{ 
  aud.pause
}
;nT0xIc8's scroll in dialog format
on *:dialog:mplay:scroll:4:{
  if ($devent == scroll) { 
    if ($did == 4) { 
      if ($insong == $true) { 
        var %t $round($calc($did(mplay,4).sel / 22000 * $insong.length),0) 
        splay seek $calc((%t + $did(mplay,4).sel) * 200) 
      } 
    } 
  } 
} 
 
 
on *:dialog:mplay:close:{ 
  aud.stop 
}
 
alias aud.ad { 
  var %f = @title - @duration
  var %c = channels,not,allowed,to,use
  var %i = ison,msg
  if ($insong) {
    if ($gettok(%i,1,44) = isoff) { 
      echo -a $replace($gettok(%f,1-,44),@duration,$gmt($round($calc($insong.length / 1000)),nn:ss),@title,$iif(!$sound($insong.fname).artist,$remove($replace($nopath($insong.fname),_,$chr(32)),.mp3),$sound($insong.fname).title - $sound($insong.fname).artist))
    }
    elseif ($gettok(%i,1,44) = ison) { 
      var %c = 1
      while ($chan(%c)) { 
        if (!$istok(%i, $chan(%c),44)) { $+(/,$gettok(%i,2,44)) $chan(%c) $replace($gettok(%f,1-,44),@duration,$gmt($round($calc($insong.length / 1000)),nn:ss),@title,$iif(!$sound($insong.fname).artist,$remove($replace($nopath($insong.fname),_,$chr(32)),.mp3),$sound($insong.fname).title - $sound($insong.fname).artist)) }
        inc %c
      }
    }
  }
}
 
;----------------- QUICK ACCESS PLAY -----------------
 
alias quickmedia { 
  if ($1) { 
    if ($v1 = .play) { 
      var %i on
      var %s = $$sfile($mircdir, choose a file to play:) 
      splay $aud.ent(%s) %s
      if (%i = on) aud.ad
    }
    if ($v1 = .pause) { 
      if ($insong) { 
        if (!%tmpo) {
          splay pause
          set %tmpo 1
          halt
        }
        elseif (%tmpo) { splay resume | unset %tmpo }
      }
    }
    if ($v1 = .stop) { 
      if ($insong) { splay stop }
    }
  }
}
 
;---------------- OTHER ------------------
 
menu channel { 
  mp3
  .open:aud.open
  .advertise:aud.ad
}
 
alias aud.open { if (!$dialog(mplay)) { dialog -mdo mplay mplay }

Comments

  (15)  RSS
token
Comments: 24
 
mIRC Snippet:  media player
Posted on Sep 20, 2007 11:57 pm
completely reworked everything. it now includes a bit more compatibility then the last. hope you enjoy the update. =)
SilentExile
Comments: 19
 
mIRC Snippet:  media player
Posted on Sep 21, 2007 11:16 am
The thing I like about this snippet is that it doesn't require a dialog to function. It's simple to control and manipulate. I would add a little more functionality to this snippet. Perhaps an an add
file/remove file option and a previous & next function? Maybe more info on the disp. message? Nice job for your first time with hash tables.
token
Comments: 24
 
mIRC Snippet:  media player
Posted on Sep 21, 2007 1:27 pm
thanks SilentExile, i am currently trying to find a way to manipulate everything through a new window. this window will include all of the features your are asking. =)
Kyousoukyoku
Comments: 45
 
mIRC Snippet:  media player
Posted on Sep 22, 2007 12:27 am
Pretty good, but I think it would be cool if you added a way to use multiple playlists. I would either make it a dialog or use window commands if that is what you are trying to do, it just makes it easier to utilize.
token
Comments: 24
 
mIRC Snippet:  media player
Posted on Sep 22, 2007 12:51 am
performed extreme updates. made in into a neast dialog that may require a bit of setup at first. and at Kyousoukyoku, that would be cool. i'll try and figure out a way to include that.
Kyousoukyoku
Comments: 45
 
mIRC Snippet:  media player
Posted on Sep 22, 2007 12:56 am
Couple things. 1) Where is the aud.open command? I can't even open the dialog. :( 2) Your intro isn't updated. ;) 3) I would add a bit more functions. Perhaps an add file and remove file ability as SilentExile has stated and everything can only be set through one time. What if I wanted to add channels or change the directory? Other then that, I haven't performed extensive testing so I can't say anything else. Nice job on the coding though. =)
token
Comments: 24
 
mIRC Snippet:  media player
Posted on Sep 22, 2007 1:12 am
alright kyou, i have made the updates. thank you so much for the feedback.
Kyousoukyoku
Comments: 45
 
mIRC Snippet:  media player
Posted on Sep 22, 2007 2:45 pm
Nice! Looks a lot better now. :)
stargazer989
Comments: 31
 
mIRC Snippet:  media player
Posted on Sep 22, 2007 9:35 pm
ok i'm getting " * Invalid parameters: $did (line 21, mp3system) " when i type /aud.play
any suggestion this is the only error so far ?
Akishoot
Comments: 139
 
mIRC Snippet:  media player
Posted on Sep 22, 2007 9:41 pm
Nice work on this one, token. The use of the horizontal scrollbar like that is truly unique. :3 I like it :D
token
Comments: 24
 
mIRC Snippet:  media player
Posted on Sep 23, 2007 6:35 pm
stargazer989, was the dialog open when you typed this? i probably am going to add a quick use part so that you don't recieve that error. but the dialog should be open for the commands atm.

Akishoot, thank you. ^^
Zsadist
Comments: 38
 
mIRC Snippet:  media player
Posted on Sep 24, 2007 11:17 pm
Very nice. Though I found I hated hash tables, you seemed to have done well with this one. I work more with ini's but still, nice job :3
token
Comments: 24
 
mIRC Snippet:  media player
Posted on Sep 25, 2007 9:54 pm
Update: added a quick media option and edited a few bugs
RubixCube
Comments: 51
 
mIRC Snippet:  media player
Posted on Sep 30, 2007 8:46 pm
Really nice media player token good work. There is just a minute bug that I found. In your aud.load alias, it doesn't check if the playlist.txt is already made. As a result, it adds on to the playlist.txt when changing your directory. Here is the fixed code:

Code:

alias aud.load {
  if ($isfile(playlist.txt)) write -c playlist.txt
  var %tmpdir $sdir(C:,Music Files)
  if ($dialog(mplay)) did -r mplay 11
  var %x 1
  :start
  if (%getnum|mp3 = 1) { inc %getnum|mp3 }
  while ($findfile(%tmpdir,*.mp3,%x)) {
    if ($dialog(mplay)) { did -a mplay 11 $nopath($findfile(%tmpdir,*.mp3,%x)) }
    write playlist.txt $findfile(%tmpdir,*.mp3,%x)
    inc %x
  }
  var %x 1 
  while ($findfile(%tmpdir,*.wav,%x)) {
    if ($dialog(mplay)) { did -a mplay 11 $nopath($findfile(%tmpdir,*.wav,%x)) }
    write playlist.txt $findfile(%tmpdir,*.wav,%x)
    inc %x
  }
  var %x 1
  while ($findfile(%tmpdir,*.midi,%x)) {
    if ($dialog(mplay)) { did -a mplay 11 $nopath($findfile(%tmpdir,*.midi,%x)) }
    write playlist.txt  $findfile(%tmpdir,*.midi,%x)
    inc %x
  }
  halt
  if ($1 = destroydir) {
    remove playlist.txt
    unset %getnum|mp3
    goto start
  }
  if ($1 = remfile) {
    if ($2-) {
      if ($read(playlist.txt,$nopath($1)) { write -dl $v1 }
    }
  }
}

- Really simple edit.

It would be great if you can add an add file feature as well. I have a large directory of songs. Perhaps a:

Code:

var %s = $sfile(C:\,Choose a song to add)
write playlist.txt %s
Mudkipz
Comments: 25
 
mIRC Snippet:  media player
Posted on Jan 20, 2008 7:13 am
how would i add more than one song at a time?

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom