All pastes #152272 Raw Edit

brianMan

public text v1 · immutable
#152272 ·published 2006-08-28 18:00 UTC
rendered paste body
alias amip_announce {
  ;; Check if it's a stream or a file.
  if (($left($dde mPlug var_fn "",7) == http://) || ($left($dde mPlug var_fn "",8) == https://)) {
    var %is_stream = 1
  }
  else {
    var %is_stream = 0
  }

  ;; Fetch the various information from AMIP.
  var %tag.auto = $dde mPlug var_name ""
  var %tag.fullpath = $dde mPlug var_fn ""
  var %tag.extension = $iif(%is_stream == 1,stream,$dde mPlug var_ext "")
  var %tag.artist = $dde mPlug var_1 ""
  var %tag.title = $dde mPlug var_2 ""
  var %tag.album = $dde mPlug var_4 ""
  var %tag.track = $dde mPlug var_3 ""
  var %tag.bitrate = $dde mPlug var_br ""
  ;; These can only be set if it's not a stream.
  if (%is_stream == 0) {
    var %tag.length.sec = $dde mPlug var_sl ""
    var %tag.length.nice = $replace($duration(%tag.length.sec),secs,s,sec,s,mins,m,min,m,hrs,h,hr,h,days,d,day,d,wks,w,wk,w)
    var %tag.size.byte = $file($dde mPlug var_fn "").size
    var %tag.size.nice = $round($csize(%tag.size.byte),2)
    var %tag.size.nice.ext = $csize(%tag.size.byte).ext
  }
  if ($1 == xml) {
    var %output = < $+ %tag.extension
    if ((%tag.artist == $null) || ($len(%tag.artist) == 0) || (%tag.title == $null) || ($len(%tag.title) == 0)) {
      var %output = %output $+ $chr(32) $+ song=" $+ %tag.auto  $+ "
    }
    else {
      var %output = %output $+ $chr(32) $+ artist=" $+ %tag.artist  $+ "
      var %output = %output $+ $chr(32) $+ title=" $+ %tag.title  $+ "
    }
    if ((%tag.album != $null)) {
      var %output = %output $+ $chr(32) $+ album=" $+ %tag.album $+ "
    }
    if ((%tag.track != $null) && ($len(%tag.track) != 0)) {
      var %output = %output $+ $chr(32) $+ track=" $+ %tag.track $+ "
    }
    if (%is_stream == 0) {
      var %output = %output $+ $chr(32) $+ length=" $+ %tag.length.nice $+ "
      var %output = %output $+ $chr(32) $+ size=" $+ %tag.size.nice $+ $chr(32) $+ %tag.size.nice.ext $+ "
    }
    var %output = %output $+ $chr(32) $+ bitrate=" $+ %tag.bitrate $+ "
    if (%is_stream == 1) {
      var %output = %output $+ $chr(32) $+ url=" $+ %tag.fullpath $+ "
    }
    var %output = %output $+ $chr(32) $+ />
  }
  elseif ($1 == action) {
    var %output = is listening to:
    var %output = %output $+ $chr(32) $+ %tag.auto
    if (%is_stream == 0) {
      var %output = %output $+ $chr(32) $+ ( $+ %tag.length.nice $+ )
    }
    else {
      var %output = %output $+ $chr(32) $+ ( $+ %tag.fullpath $+ )
    }
  }
  else {
    var %output = %tag.extension $+ :
    var %output = %output $+ $chr(32) $+ %tag.auto
    if (%is_stream == 0) {
      var %output = %output $+ $chr(32) $+ ( $+ %tag.length.nice $+ )
    }
    else {
      var %output = %output $+ $chr(32) $+ ( $+ %tag.fullpath $+ )
    }
  }
  return %output
}