mp3 length/position statistics

By Saeed on Sep 26, 2007

A simple code to give you the mp3 length/position information of the currently playing mp3. See the in-code comments for more details about this snippet and how to use.

;;; mp3 length/pos statistics - Saeed * 2007 ;;;

/*

About: Returns the length or the position of a current mp3 in a basic time format. A pretty useful snippet for those who are building mp3 players. 

Usage: $inlength or $inpos or a combination of the two: $inposlen

*/

alias inlength { 
  if ($inmp3) {
    var %variable $calc($insong.length / 1000)
    return $gmt(%variable,nn:ss)
  }
}
alias inpos { 
  is ($inmp3) {
    var %variable $calc($insong.pos / 1000)  
    return $gmt(%variable,nn:ss)
  }
}

alias inposlen { 
  if ($inmp3) {
    var %a = $calc($insong.pos / 1000), %b = $calc($insong.length / 1000)  
    return $+($gmt(%a,nn:ss),$chr(47),$gmt(%b,nn:ss))
  }
}

Comments

Sign in to comment.
Saeed   -  Sep 28, 2007

I wouldn\'t expect too much of a code for this type of snippet. Sometimes being simple is enough, as to the 5 I think that is what this snippet deserves. I\'m glad you found this useful.

 Respond  
token   -  Sep 28, 2007

i found this pretty useful when making my quickmp3 player for myself but it is a really simple code 5/10

 Respond  
guest598594   -  Sep 26, 2007

yw

 Respond  
Saeed   -  Sep 26, 2007

I don\'t think that the = matters when using the /var command. As to the $inmp3 part, you are probably right about that I will edit that right now. Thank you for your positive feedback.

 Respond  
guest598594   -  Sep 26, 2007

ah i see nvm

 Respond  
guest598594   -  Sep 26, 2007
why the hell aint code boxes working?
 Respond  
guest598594   -  Sep 26, 2007
var %variable $calc($insong.length / 1000)[/code[
shouldnt it be

var %variable = $calc($insong.length / 1000)

and is the halt necessary? cant u do

alias inlength {
if ($inmp3) {
var %variable $calc($insong.length / 1000)
return $gmt(%variable,nn:ss)
}
}


i may be wrong, so feel free to correct me

otherwise, i havent tested it, but it looks like it would work great, good job
 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.