All pastes #776041 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-11-15 20:51 UTC
rendered paste body
menu * {
  mIRC Music Player:Music
}
alias music {
  dialog -meid Music Music
}
alias F6 { 
  /music
}

dialog music {
  title "mIRC Music"
  size -1 -1 114 146
  option dbu
  tab "Play", 1, 1 0 109 141
  button "<", 8, 6 19 9 12, tab 1
  button "Play", 2, 17 19 18 12, tab 1
  button "Pause", 5, 37 19 18 12, tab 1
  button "Stop", 4, 57 19 18 12, tab 1
  button ">", 9, 78 19 9 12, tab 1
  box "Tracks", 3, 6 33 85 62, tab 1
  box "Track Info:", 7, 6 96 99 30, tab 1
  text "", 10, 9 103 92 20, tab 1
  button "^", 11, 95 32 9 9, tab 1
  box "Vol", 13, 92 16 15 38, tab 1
  text "", 14, 96 23 8 7, tab 1
  list 6, 10 41 78 50, tab 1 size hsbar
  button "V", 12, 95 42 9 9, tab 1
  button "Add", 29, 93 56 15 12, tab 1
  button "Del", 30, 93 69 15 12, tab 1
  button "amp3", 35, 93 83 15 13, tab 1
  scroll "", 36, 6 129 100 8, tab 1 range 1 100 horizontal bottom
  tab "Global", 15
  box "Settings", 16, 4 18 102 104, tab 15
  check "Ame", 17, 11 27 29 10, tab 15
  check "Amsg", 18, 40 27 26 10, tab 15
  box "Display", 19, 4 37 102 85, tab 15
  text "Song", 20, 18 48 16 8, tab 15
  check "Artist", 21, 9 57 29 10, tab 15
  text "Note: If available", 25, 7 98 45 9, tab 15
  text "Credits:", 26, 44 52 53 8, tab 15
  check "Album", 22, 9 67 31 10, tab 15
  check "Year", 23, 9 76 27 10, tab 15
  check "Bitrate", 24, 9 85 32 10, tab 15
  text "By [-God-] from irc.swiftirc.net", 27, 44 61 53 19, tab 15
  button "Clear PList", 31, 68 110 34 9, tab 15
  check "Continued", 34, 68 27 36 10, tab 15
  tab "Help", 28
  text "Help", 32, 10 19 32 8, tab 28
  text " < | > - Next/Previous Track                      Play - Plays selected track                        Stop  - Stops playing                                Pause - Pauses Track                                                                                                The settings for global are only shown    if available otherwise they are shown      as -", 33, 10 27 97 97, tab 28
}
on *:DIALOG:music:sclick:17,18:{
  if ($did == 17) {
    did -u $dname 18
    did -c $dname 17
  }
  if ($did == 18) {
    did -u $dname 17
    did -c $dname 18
  }
}
ON *:MP3END:{ 
  var %n = $readini(godplayer.ini,Songs,$calc(%music + 1))
  if (!%n) {
    unset %music 
    splay $readini(godplayer.ini,Songs,1) 
    did -a music 7 Track Info: $iif($sound($insong.fname).title,$sound($insong.fname).title,$remove($replace($$nopath($insong.fname),_,$chr(32)),.mp3,.wav,.wma))
    did -a music 10 $nopath($insong.fname)

    inc %music
  }
  elseif (%n) { 
    splay %n
    inc %music
    did -a music 7 Track Info: $iif($sound($insong.fname).title,$sound($insong.fname).title,$remove($replace($$nopath($insong.fname),_,$chr(32)),.mp3,.wav,.wma))
    did -a music 10 $nopath($insong.fname)
  }
} 
on *:DIALOG:music:sclick:8,9:{
  if ($insong) {
    var %p = $readini(godplayer.ini,Songs,$iif($did == 8,$calc(%music - 1),$calc(%music + 1)))

    if (!%p) {
      unset %music 
      splay $readini(godplayer.ini,Songs,1) 
      did -a $dname 7 Track Info: $iif($sound($insong.fname).title,$sound($insong.fname).title,$remove($replace($$nopath($insong.fname),_,$chr(32)),.mp3,.wav,.wma))
      did -a $dname 10 $nopath($insong.fname)

      inc %music
    }
    if (%p) {
      splay %p
      inc %music
      did -a $dname 7 Track Info: $iif($sound($insong.fname).title,$sound($insong.fname).title,$remove($replace($$nopath($insong.fname),_,$chr(32)),.mp3,.wav,.wma))
      did -a $dname 10 $nopath($insong.fname)
    }
  }
}

on *:DIALOG:mp3:sclick:9:{
  if ($insong) {
    var %m = $readini(godplayer.ini,Songs,$calc(%god + 1))
    if (!%m) {
    unset %god | splay $readini(godplayer.ini,Songs,1) | did -a mp3 7 File path: $insong.fname | inc %god }
    if (%m) {
      splay %m
      inc %god
      did -a mp3 7 File path: $insong.fname 
    }
  }
}
on *:DIALOG:music:close:*:{
  savemusicconfig 
  timermusic off
  splay stop
}
on *:DIALOG:music:sclick:31:{
  remini godplayer.ini songs
  did -r $dname 6
  splay stop
  timermusic off
  did -a $dname 7 Track Info:
  did -r $dname 10
}
on *:DIALOG:music:sclick:29:{ 
  var %file = $msfile(*.mp3,Songs,Load)
  var %load = 0 
  while (%load < %file) {
    inc %load
    writeini godplayer.ini songs $calc($ini(godplayer.ini,Songs,0) + 1) $msfile(%load)
    did -a $dname 6 $remove($nopath($msfile(%load)),.mp3)))
  }
  .loadsongs
} 

on *:DIALOG:music:sclick:30:{ 
  if ($did($dname,6,1).sel == $ini(godplayer.ini,songs,0)) {
    remini godplayer.ini songs $did($dname,6,1).sel
    .loadsongs
  }
  else {
    var %r = $did($dname,6,1).sel, %t = $calc($ini(godplayer.ini,songs,0) - %r - 1)))
    while (%r <= $calc(%t + %r)) {
      if ($readini(godplayer.ini,songs,$calc(%r + 1)) == $null) {
        remini godplayer.ini songs $ini(godplayer.ini,songs,0)
        did -r $dname 6
        .loadsongs
        halt
      }
      else {
        writeini godplayer.ini songs %r $readini(godplayer.ini,songs,$calc(%r + 1))
        inc %r
      }
    }
  }
}
on *:DIALOG:music:scroll:36:{
  if ($insong) {
    splay seek $round($calc($insong.length / 100 * $did($dname,36).sel),0)
  }
}

on *:DIALOG:music:sclick:2:{
  if ($gettok($did($Dname,7).text,6,32) == :paused) {
    splay resume
    timermusic 0 1 did -a $dname 7 Track Info: $!($mid($duration($left($insong.pos,-3),3),4,8)) / $!($mid($duration($remove($insong.length,$right($insong.length,3)),3),4,8))
  }
  else {
    set %music $did(music,6,1).sel
    splay $readini(godplayer.ini,songs,$did(music,6,1).sel)
    timermusic off | timermusic 0 1 did -a $dname 7 Track Info: $!($mid($duration($left($insong.pos,-3),3),4,8)) / $!($mid($duration($remove($insong.length,$right($insong.length,3)),3),4,8))
    did -a $dname 10 $nopath($readini(godplayer.ini,songs,$did(music,6,1).sel))
    did -a $dname 7 Track Info: $iif($sound($insong.fname).title,$sound($insong.fname).title,$remove($replace($$nopath($insong.fname),_,$chr(32)),.mp3,.wav,.wma))
  }
}
on *:DIALOG:music:init:*:{
  loadmusicconfig
  if (!%vol) { 
    set %vol 8
    vol -v $calc(%vol * 5000)
    did -a $dname 14 %vol 
    if ($ini(godplayer.ini,songs,0) > 0) { 
      var %i = 0 
      while (%i < $ini(godplayer.ini,songs,0)) {  
        inc %i 
        did -a $dname 6 %i $remove($nopath($readini(godplayer.ini,Songs,%i)),.mp3) 
      } 
    }
  }
  elseif (%vol) { 
    vol -v $calc(%vol * 5000)
    did -a $dname 14 %vol
    if ($ini(godplayer.ini,songs,0) > 0) { 
      var %i = 0 
      while (%i < $ini(godplayer.ini,songs,0)) {  
        inc %i 
        did -a $dname 6 %i $remove($nopath($readini(godplayer.ini,Songs,%i)),.mp3) 
      } 
    } 
  }
}
on *:DIALOG:music:sclick:5:{
  if ($insong) {
    splay pause
    timermusic off
    did -a $dname 7 Track Info: $($mid($duration($left($insong.pos,-3),3),4,8)) / $($mid($duration($remove($insong.length,$right($insong.length,3)),3),4,8)) :Paused

  }
}
on *:DIALOG:music:sclick:4:{
  splay stop
  timermusic off
  did -a $dname 7 Track Info:
  did -r $dname 10
}
on *:DIALOG:music:dclick:6:{
  set %music $did(music,6,1).sel
  did -a $dname 10 $nopath($readini(godplayer.ini,songs,$did(music,6,1).sel))
  splay $readini(godplayer.ini,songs,%music)
  did -a $dname 7 Track Info: $iif($sound($insong.fname).title,$sound($insong.fname).title,$remove($replace($$nopath($insong.fname),_,$chr(32)),.mp3,.wav,.wma))
  timermusic off | timermusic 0 1 did -a $dname 7 Track Info: $!($mid($duration($left($insong.pos,-3),3),4,8)) / $!($mid($duration($remove($insong.length,$right($insong.length,3)),3),4,8))
}
on *:DIALOG:music:sclick:11:{ 
  if (%vol < 13) { 
    set %vol $calc(%vol + 1) 
    vol -v $calc(%vol * 5000)
    did -a $dname 14 %vol 
  } 
} 
on *:DIALOG:music:sclick:12:{ 
  if (%vol > 1) { 
    set %vol $calc(%vol - 1) 
    vol -v $calc(%vol * 5000)
    did -a $dname 14 %vol 
  } 
}
alias loadsongs {
  /did -r $dname 6
  if ($ini(godplayer.ini,songs,0) > 0) { 
    var %i = 0 
    while (%i < $ini(godplayer.ini,songs,0)) {  
      inc %i 
      did -a $dname 6 %i $remove($nopath($readini(godplayer.ini,Songs,%i)),.mp3) 
    }
  }
}
alias savemusicconfig {
  hadd -m music ame $did(music,17).state
  hadd -m music amsg $did(music,18).state
  hadd -m music artist $did(music,21).state
  hadd -m music album $did(music,22).state
  hadd -m music year $did(music,23).state
  hadd -m music bitrate $did(music,24).state
  hadd -m music continued $did(music,34).state


}
alias loadmusicconfig {
  did $cstate($hget(music,ame)) music 17
  did $cstate($hget(music,amsg)) music 18
  did $cstate($hget(music,artist)) music 21
  did $cstate($hget(music,album)) music 22
  did $cstate($hget(music,year)) music 23
  did $cstate($hget(music,bitrate)) music 24
  did $cstate($hget(music,continued)) music 34

}


alias -l cstate {
  if ($1 == 1) return -c
  if ($1 == 0) return -u
}