Server Manager

Quellcode

servman.mrc
menu query,channel,status {
  AddOns
  ;.Winamp Announcer
  ;..Announce using echo:echo -a 4Winamp Echo ON | .timerae 0 1 annc.echo
  ;..Announce using msg:echo -a 4Winamp Message ON | .timeram 0 1 annc.msg
  ;..chan announcer:set %annc.opt $$?="Channel/Nick to announce" | echo -a 4Winamp Message ON | .timerca 0 1 annc.chan
  ;..-
  ;..Announce off:annc.off
  .Server Manager
  ..Connect to Server:servman
  ..Edit Server list:servedit
}
on *:start: { servman }
 
on *:CTCPREPLY:finger*:/set %test1 $1-
 
on *:dialog:serv_man:init:0: {
  var %serv.init = $lines($scriptdirserver.lst)
  var %serv.count = 1
  while (%serv.count <= %serv.init) {
    did -a serv_man 1 $read($scriptdirserver.lst,%serv.count)
    inc %serv.count
  }
  did -c serv_man 3
}
on *:dialog:serv_man:sclick:2: {
  if ($did(serv_man,1).seltext == $null) { echo -a 4ERROR: no server selected | halt }
  if ($did(serv_man,3).state != 1) {
    server $did(serv_man,1).seltext
    ;dialog -x serv_man
  }
  elseif ($did(serv_man,3).state == 1) {
    server -m $did(serv_man,1).seltext
    ;dialog -x serv_man
  }
}
dialog serv_man {
  title "Server Manager"
  size -1 -1 157 64
  option dbu
  list 1, 4 3 104 55, size vsbar
  button "connect", 2, 113 8 37 12
  check "new window", 3, 113 40 41 17, flat
  button "exit", 4, 113 24 37 12, cancel
}
dialog serv_edit {
  title "Server Edit"
  size -1 -1 150 134
  option dbu
  list 1, 4 18 97 110, size vsbar
  button "add server", 2, 107 7 37 12
  button "del server", 3, 107 22 37 12
  button "done", 4, 108 115 37 12, ok
  edit "", 5, 4 7 97 10
}
 
on *:dialog:serv_edit:init:0: {
  var %serv.init = $lines($scriptdirserver.lst)
  var %serv.count = 1
  while (%serv.count <= %serv.init) {
    did -a serv_edit 1 $read($scriptdirserver.lst,%serv.count)
    inc %serv.count
  }
}
 
on *:dialog:serv_edit:sclick:2: {
  if ($did(serv_edit,5).text == $null) { echo -a 4ERROR: no server to add | halt }
  write -a $scriptdirserver.lst $did(5).text
  did -a serv_edit 1 $read($scriptdirserver.lst,$lines($scriptdirserver.lst))
  did -r serv_edit 5
}
on *:dialog:serv_edit:sclick:3: {
  if ($did(serv_edit,1).seltext == $null) { echo -a 4ERROR: no server selected | halt }
  write -dl $+ $did(1).sel $scriptdirserver.lst
  did -d serv_edit 1 $did(1).sel
}
 
Alias servman { dialog -m serv_man serv_man }
Alias servedit { dialog -m serv_edit serv_edit }
 
alias annc.echo {
  if ($dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, TITLE) != %title) {
    set %title $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, TITLE)
    set %artist $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, ARTIST)
    set %album $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, ALBUM)
    set %bitr $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, BITRATE)
    set %genre $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, GENRE)
    if (%title == $false) { var %title = n/a }
    if (%artist == $false) { var %artist = n/a }
    if (%album == $false) { var %album = n/a }
    if (%bitr == $false) { var %bitr = n/a }
    if (%genre == $false) { var %genre = n/a }
    .timer1 1 0 echo -a 12Now Playing 0~ 12Song:14 %title 0~ 12Artist:14 %artist 0~ 12Album:14 %album 0~ 12Genre:14 %genre 0~ 12Bitrate:4 @14 $+ %bitr 4kbs/s 0~
  }
  Else { halt }
}
alias annc.msg {
  if ($dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, TITLE) != %title) {
    set %title $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, TITLE)
    set %artist $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, ARTIST)
    set %album $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, ALBUM)
    set %bitr $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, BITRATE)
    set %genre $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, GENRE)
    if (%title == $false) { var %title = n/a }
    if (%artist == $false) { var %artist = n/a }
    if (%album == $false) { var %album = n/a }
    if (%bitr == $false) { var %bitr = n/a }
    if (%genre == $false) { var %genre = n/a }
    .timer1 1 0 say 12Now Playing 0~ 12Song:14 %title 0~ 12Artist:14 %artist 0~ 12Album:14 %album 0~ 12Genre:14 %genre 0~ 12Bitrate:4 @14 $+ %bitr 4kbs/s 0~
  }
  Else { halt }
}
alias annc.chan {
  if ($dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, TITLE) != %title) {
    set %title $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, TITLE)
    set %artist $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, ARTIST)
    set %album $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, ALBUM)
    set %bitr $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, BITRATE)
    set %genre $dll($scriptdir $+ wa.dll, WA_Link_Raw_Stats, GENRE)
    if (%title == $false) { var %title = n/a }
    if (%artist == $false) { var %artist = n/a }
    if (%album == $false) { var %album = n/a }
    if (%bitr == $false) { var %bitr = n/a }
    if (%genre == $false) { var %genre = n/a }
    .timer1 1 0 msg %annc.opt 12Now Playing 0~ 12Song:14 %title 0~ 12Artist:14 %artist 0~ 12Album:14 %album 0~ 12Genre:14 %genre 0~ 12Bitrate:4 @14 $+ %bitr 4kbs/s 0~
  }
  Else { halt }
}
Alias annc.off {
  .timerae off
  .timeram off
  .timerca off
  unset %title
  unset %album
  unset %artist
  unset %bitr
  unset %genre
  unset %annc.opt
  echo -a 4Winamp Announcer OFF
}