All pastes #961712 Raw Edit

Unnamed

public text v1 · immutable
#961712 ·published 2008-03-29 03:02 UTC
rendered paste body
alias wsound {
  if (!$istok(album albumartist author duration filesize filetype genre iscopyright isvbr publisher title track trackingid userlastplayedtime userplaycount $&
    userplaycountafternoon userplaycountevening userplaycountmorning userplaycountnight userplaycountweekday userplaycountweekend $&
    userrating year,$prop,32)) return E_INVALID_PROPERTY
  if (!$isfile($1)) return E_NO_SUCH_FILE
  .comopen wmp::temp WMPlayer.OCX
  if (!$com(wmp::temp)) return E_UNABLE_TO_OPEN_OBJECT
  !.echo -q $com(wmp::temp,Controls,3,dispatch* wmp::temp::controls)
  if (!$com(wmp::temp::controls)) {
    .comclose wmp::temp
    return E_UNABLE_TO_OPEN_OBJECT
  }
  !.echo -q $com(wmp::temp,Url,4,bstr,$1-)
  !.echo -q $com(wmp::temp::controls,Stop,3)
  !.echo -q $com(wmp::temp,currentMedia,3,dispatch* wmp::temp::currentmedia)
  if (!$com(wmp::temp::currentmedia)) {
    .comclose wmp::temp
    .comclose wmp::temp::controls
    return E_UNABLE_TO_OPEN_OBJECT
  }
  var %result = $(,,$com(wmp::temp::currentmedia,getItemInfo,3,bstr,$replace($prop,album,wm/albumtitle,albumartist,wm/albumartist,isprotected,is_protected, $&
    publisher,wm/publisher,track,wm/tracknumber,year,wm/year))) $com(wmp::temp::currentmedia).result
  .comclose wmp::temp
  .comclose wmp::temp::controls
  .comclose wmp::temp::currentmedia
  if ($prop == duration) && ($2) return $asctime(%result,$2)
  return %result
}
alias -l o return $gettok($1-,2-,32)

alias mp3ad { 
  describe $active $replace(%mp3msg,@title,$o(wsound($insong.fname).title),@artist,$o($wsound($insong.fname).author),@length,$asctime($o($wsound($insong.fname).duration),nn:ss), $&
    @bitrate,$+($sound($insong.fname).bitrate,kbps))
}

alias setmp3ad { 
  var %a $$?="Here is where you set how your mp3 advertisement. Here are tags you can use: @artist,@title,@length and @bitrate. An example: listening to @artist - @title [@length]"
  set %mp3msg %a
}