All pastes #156767 Raw Edit

Stuff

public text v1 · immutable
·published 2006-09-01 00:28 UTC
rendered paste body
alias timedur {
  if ($insong.pos < $insong.length) {
    var %i = $remove($replace($duration($calc($insong.pos / 1000)),mins,:,min,:,secs,$chr(32),sec,$chr(32)),$chr(32))
    tokenize 58 %i
    if ($2 == $null) {
      if ($1 isnum 0-9) { var %pos = 0: $+ 0 $+ $1 | goto skip }
      var %pos = 0: $+ $1
      goto skip
    }
    if ($3 == $null) { 
      if ($2 isnum 0-9) { var %pos = $1 $+ : $+ 0 $+ $2 | goto skip }
      var %pos = $1 $+ : $+ $2
      goto skip
    }
    if ($3 != $null) {
      var %2 = $2
      var %3 = $3
      if ($len($2) == 1) { var %2 = 0 $+ $2 }
      if ($len($3) == 1) { var %3 = 0 $+ $2 }
      var %pos = $1 $+ : $+ %2 $+ : $+ %3
    }
    :skip
    var %1 = %pos
    var %i = $remove($replace($duration($calc($insong.length / 1000)),mins,:,min,:,secs,$chr(32),sec,$chr(32)),$chr(32))
    tokenize 58 %i
    if ($2 == $null) {
      if ($1 isnum 0-9) { var %pos = 0: $+ 0 $+ $1 | goto skip1 }
      var %pos = 0: $+ $1
      goto skip1
    }
    if ($3 == $null) { 
      if ($2 isnum 0-9) { var %pos = $1 $+ : $+ 0 $+ $2 | goto skip1 }
      var %pos = $1 $+ : $+ $2
      goto skip1
    }
    if ($3 != $null) {
      var %2 = $2
      var %3 = $3
      if ($len($2) == 1) { var %2 = 0 $+ $2 }
      if ($len($3) == 1) { var %3 = 0 $+ $2 }
      var %pos = $1 $+ : $+ %2 $+ : $+ %3
    }
    :skip1
    var %2 = %pos
    did -ra mp3player 1 ( $+ %1 $+ / $+ %2 $+ )
  }
  if (insong.pos == $insong.length) {
    timerdur off
  }
}