All pastes #909023 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-02-18 21:37 UTC
rendered paste body
menu menubar,channel,status {
  Eternal Darkness Mp3: dialog -dm EDMp3 EDMp3 | Var %num $findfile(%dir, *.mp3,0,did -a edmp3 7 $nopath($1-))
}
dialog EDMp3 {
  title "Eternal Darkness Mp3"
  size -1 -1 170 114
  option dbu

  box "Now Playing", 1, 78 1 92 40
  text "Mp3 Playing:", 2, 81 8 90 20
  text "N/A", 3, 81 16 80 8
  text "Mp3 Time Remaining:", 4, 81 24 60 20
  text "00:00", 5, 81 32 18 8

  box "Mp3 List", 6, 0 1 76 113
  list 7, 1 8 74 105, size

  text "---Mp3 Controls---", 8, 100 43 80 8
  button "Play", 9, 83 54 37 10, flat
  button "Stop", 10, 125 54 37 10, flat
  button "Pause", 11, 83 69 37 10, flat
  button "Resume", 12, 125 69 37 10, flat

  text "---Directory Controls---", 13, 97 84 80 8
  button "Set", 14, 83 94 37 10, flat
  button "Update", 15, 125 94 37 10, flat
}


on *:dialog:edmp3:sclick:*:{
  if $did = 9 {
    var %Playing $Remove($did(edmp3,7).seltext,.mp3)
    var %song $findfile(%dir,$did(edmp3,7).seltext,1)
    var %length $gmt($round($calc($mp3(%song).length / 1000),0),nn:ss)
    splay %song
    did -ra edmp3 3 %playing
    msg $active 4{14- Mp3:4 %playing 14-4}{14- 4L14ength:4 %Length 14-4}
    .timermp3 0 0 Remaining
  } 
  if $did = 10 {
    splay Stop
    msg $active 4{14- Mp3 Stopped 14-4}
    .timermp3 off
    did -ra edmp3 3 N/A
  }
  if $did = 11 {
    splay pause
    msg $active 4{14- Mp3 Paused 14-4}
  }
  if $did = 12 {
    splay resume
    msg $active 4{14- Resuming Mp3 14-4}
  }
  if $did = 14 {
    set %dir $sdir="Mp3 Directory"
    did -r edmp3 7
    var %num $findfile(%dir, *.mp3,0,did -a edmp3 7 $nopath($1-))
  }
  if $did = 15 {
    did -r edmp3 7
    var %num $findfile(%dir, *.mp3,0,did -a edmp3 7 $nopath($1-))
    Echo $active 4{14- Mp3 List Updated! 14-4}
  }
}
alias Remaining {
  did -ra edmp3 5 $asctime($round($calc(($insong.length - $insong.pos) / 1000),0),nn:ss),none)
}
on *:dialog:edmp3:close:* {
  .timermp3 off
  splay stop
}