All pastes #449461 Raw Edit

Something

public text v1 · immutable
·published 2007-04-20 06:44 UTC
rendered paste body
alias mpn { if ($dialog(mpnew)) dialog -v mpnew | else dialog -md mpnew mpnew }
alias mp3data { return $+(",$shortfn($scriptdirmp3data.ini),") }

dialog mpnew {
  title "F0x's Mp3 Player"
  size -1 -1 230 173
  option dbu
  box "Playlist", 1, 6 1 194 83
  list 2, 11 8 185 80, sort extsel
  button "Close", 3, 205 38 22 11, ok cancel
  box "Controls", 4, 2 95 108 39
  button "Rewind", 5, 3 104 34 11
  button "Play", 6, 38 104 34 11
  button "Stop", 7, 15 118 34 11
  button "Pause", 8, 72 104 34 11
  button "Forward", 9, 57 118 34 11
  box "Browse", 10, 3 146 226 24
  button "Mp3 Dir", 11, 6 154 34 11
  button "Refresh", 12, 193 154 34 11
  edit "", 13, 41 154 151 11, read
  box "Volume", 14, 110 87 60 24
  button "+", 15, 113 96 10 11
  button "-", 16, 125 96 10 11
  button "Mute", 17, 142 96 24 11
  box "Tunes Found", 18, 110 110 46 24
  edit "", 19, 113 119 40 11, read
  box "Message", 20, 156 110 71 26
  check "Message in Channel", 21, 162 117 64 10
  check "Use Ascii Art", 22, 162 125 64 10
  edit "Is now playing: <song>", 23, 49 136 177 11
  text "Message Format:", 24, 3 137 44 8
}

on *:dialog:mpnew:init:0: { if (%mp.pause == 1) { did -r mpnew 8 | did -a mpnew 8 Resume } | if ($vol(master).mute == $true) { did -o mpnew 17 1 Unmute } | set %mp.format $did(23) | if (%mp.msg == On) { did -c mpnew 21 } | if (%mp.ascii == On) { did -c mpnew 22 } | did -o mpnew 13 1 %mp.dir | set %mp.found $findfile(%mp.dir, *.mp3,0,did -a mpnew 2 $nopath($1-)) | did -o mpnew 19 1 %mp.found }
on *:dialog:mpnew:dclick:4: { splay %mp.temp | set %mp.play 1 | set %mp.pause 0 | did -r mp 8 | did -a mp 8 Pause | mpmsg }
on *:dialog:mpnew:sclick:2: { set %mp.file $did(2).seltext | set %mp.temp %mp.dir $+ %mp.file | set %mp.bitrate $mp3(%mp.temp).bitrate | set %mp.length $mplength | set %mp.size $round($calc($lof(%mp.temp) / 1048576),2) }
on *:dialog:mpnew:sclick:5: { if (%mp.play == 0) { halt } | else { splay seek $calc($inmp3.pos -5000) } }
on *:dialog:mpnew:sclick:6: { splay %mp.dir $+ %mp.file | set %mp.play 1 | set %mp.pause 0 | did -r mpnew 8 | did -a mpnew 8 Pause | set %mp.format $did(23) | mpmsg }
on *:dialog:mpnew:sclick:7: { splay stop | set %mp.play 0 | set %mp.pause 0 | did -r mpnew 8 | did -a mpnew 8 Pause  }
on *:dialog:mpnew:sclick:8: { if (%mp.play == 0) { halt } | elseif (%mp.pause == 1) { splay resume | set %mp.pause 0 | did -r mpnew 8 | did -a mpnew 8 Pause } | elseif ((%mp.play == 1) && (%mp.pause == 0)) { splay pause | set %mp.pause 1 | did -r mpnew 8 | did -a mpnew 8 Resume  } }
on *:dialog:mpnew:sclick:9: { if (%mp.play == 0) { halt } | else { splay seek $calc($inmp3.pos +5000) } | halt }
on *:dialog:mpnew:sclick:11: { did -r mpnew 2 | set %mp.dir $sdir="Mp3 directory" c: | did -o mpnew 13 1 %mp.dir | set %mp.found $findfile(%mp.dir, *.mp3,0,did -a mpnew 2 $nopath($1-)) | did -o mpnew 19 1 %mp.found }
on *:dialog:mpnew:sclick:12: { did -r mpnew 2 | set %mp.found $findfile(%mp.dir, *.mp3,0,did -a mpnew 2 $nopath($1-)) | did -o mpnew 19 1 %mp.found }
on *:dialog:mpnew:sclick:15: { if (%mp.play == 0) { halt } | if ($vol(master).mute == $true) { halt } | else { set %mp.vol $calc($vol(master)+7000) | vol -v %mp.vol | set %mp.vol 0 } }
on *:dialog:mpnew:sclick:16: { if (%mp.play == 0) { halt } | if ($vol(master).mute == $true) { halt } | else { if ($vol(master) < 7000) { vol -v 0 } | elseif ($vol(master) == 0) { halt } | else { set %mp.vol $calc($vol(master)-7000) | vol -v %mp.vol | set %mp.vol 0  } } }
on *:dialog:mpnew:sclick:17: { if (%mp.play == 0) { halt } | if ($vol(master).mute == $false) { vol -vu1 | did -o mpnew 17 1 Unmute } | elseif ($vol(master).mute == $true) { vol -vu2 | did -o mpnew 17 1 Mute } }
on *:dialog:mpnew:sclick:21: { if (%mp.msg == On) { set %mp.msg Off } | else { set %mp.msg On } }
on *:dialog:mpnew:sclick:22: { if (%mp.ascii == On) { set %mp.ascii Off } | else { set %mp.ascii On } }

alias -l mplength {
  var %mp.len $int($calc($mp3(%mp.temp).length / 1000))
  var %mp.min $int($calc(%mp.len / 60))
  var %mp.sec $calc(%mp.len - (%mp.min * 60))
  if (%mp.min < 10) { set %mp.min 0 $+ %mp.min }
  if (%mp.sec < 10) { set %mp.sec 0 $+ %mp.sec }
  set %mp.len %mp.min $+ : $+ %mp.sec
  return %mp.len
}

alias -l mpmsg {
  if (!%mp.format) {
    splay stop
    echo -a 04Error: Please write a format of how you want it to show in the channel
    echo -a 07Example: is now play: <song>
  }
  elseif (%mp.msg == On) && (%mp.ascii == Off) && (%mp.format != $null) {
    set %mp.song1 $remove(%mp.file,.mp3)
    set %mp.song $replace(%mp.format,<song>,%mp.song1)
    ame %mp.song
  }
  elseif (%mp.msg == On) && (%mp.ascii == On) && (%mp.format != $null) {
    set %mp.song1 $remove(%mp.file,.mp3)
    set %mp.song2 $replace(%mp.format,<song>,%mp.song1)
    set %mp.name $replacecs(%mp.song2,a,à,A,Å,b,ß,B,ß,c,ç,C,©,d,Ð,D,Ð,e,é,E,€,f,ƒ,F,ƒ,i,ì,I,Î,l,£,L,£,n,ñ,N,Ñ,o,ô,O,Ô,p,þ,P,þ,q,¶,Q,¶,r,®,R,®,s,§,S,§,u,µ,U,Ü,x,¤,X,×,y,ý,Y,¥,!,¡,?,¿,>,»,<,«,2,²,3,³,half,½,fourth,¼,/,¬,.,·,ae,æ,tm,™,TM,™)
    ame %mp.name
  }
}

menu channel,menubar {
  -
  MP3 Player (NEW):/mpn
  -
}