Command-based mp3

By RubixCube on Oct 04, 2007

; Command-based mp3 - RubixCube
; Syntax:
; /mp -r/p (mp3name)/s/e
; /mp -se -d/a/b/c
; Ripping is forbidden
; Contact: rub1xcube@yahoo.com

Syntax:

-r : random play
-p (mp3name) : plays a match to the mp3name. It works even for only a few bits of the actual mp3. For example if I typed /mp -p L's and had an mp3 called L's theme B in my directory it would play that mp3.
-s : stops the mp3
-e : pauses/resumes the mp3
-se :
-se -d : sets the directory
-se -a : sets the mp3end option to repeat
-se -b : sets the mp3end option to shuffle
-se -c : sets the mp3end option to halt

  • RubixCube
; Command-based mp3 - RubixCube
; Syntax:
; /mp -r/p (mp3name)/s/e
; /mp -se -d/a/b/c
; Ripping is forbidden
; Contact: rub1xcube@yahoo.com

alias mp { 
  if ($1) { 
    if ($v1 = -r) {
      var %| $findfile(%mp,*,0)
      var %- $r(1,%|)
      var %& $findfile(%mp,*.mp3,%-)
      set %mp_ac $sound(%&).title
      splay -p %&
      if ($active != status window) msg $active cp: $sound(%&).title - $sound(%&).artist - $gmt($round($calc($insong.length / 1000),0),nn:ss)) $+([,$sound(%&).bitrate,kbps,;,$sound(%&).mode,])
    }
    if ($v1 = -se) { 
      if ($2) { 
        if ($v1 = -d) set %mp $sdir(C:\,MP3 DIRECTORY)
        if ($v1 = -a) set %mp_end -re
        if ($v1 = -b) set %mp_end -r
        if ($v1 = -c) set %mp_end -s 
      }
    }
    if ($v1 = -p) { 
      if ($2-) { 
        var %& $findfile(%mp,$+(*,$v1,*),1,splay -p $1-)
        set %mp_ac $sound(%&).title
        var %$ $sound(%&).title - $sound(%&).artist, %^ $gmt($round($calc($insong.length / 1000),0),nn:ss)), %@ $sound(%&).bitrate, %# $sound(%&).mode
        if ($active != status window) msg $active cp: %$ - %^ $+([,%@,kbps,;,%#,])
      }
    }
    if ($v1 = -e) { 
      if ($inmp3) { 
        if (%pause isnum 1) {
          splay -p resume
          unset %pause
          halt
        }
        else {
          splay -p pause
          set %pause 1
          halt
        }
      }
    }
    if ($v1 = -s) { 
      if ($inmp3) { splay -p stop }
    } 
  }
}

on *:MP3END:{ 
  if (%mp_end = -re) mp -p %mp_ac
  if (%mp_end = -r) mp -r
  if (%mp_end = -s) halt
}

Comments

Sign in to comment.
RubixCube   -  Oct 05, 2007

Changed the mp3 player and made it command-based.

 Respond  
RubixCube   -  Oct 05, 2007

Alright, I\'ve localized the aliases and added a pos tracker to the titlebar. I also made use of a variable to check the window status for the commands outside the @mp3 window. Thanks Olliegod.

 Respond  
Olliegod   -  Oct 05, 2007

With aliases that have no use outside of the script (aliases that a user will never manually call) you should always use the -l switch to make it local.

 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.