All pastes #158698 Raw Edit

Unnamed

public text v1 · immutable
·published 2006-09-02 06:34 UTC
rendered paste body
;;;;;;;;;;;;;;;checksix mp3 player;;;;;;;;;;;;;;;;;;
alias mp3 { dialog -m x6mp3 x6mp3 }
dialog x6mp3 {
  title "CheckSix mp3 Player"
  size -1 -1 308 216
  option pixels
  list 1, 0 70 306 146, size
  button ";", 2, 2 2 30 24
  button "g", 3, 32 2 30 24
  button "4", 4, 62 2 30 24
  button "7", 5, 92 2 30 24
  button "8", 6, 122 2 30 24
  edit "", 7, 0 50 214 20, read autohs
  button "Add", 8, 152 2 30 24
  button "Del", 9, 182 2 30 24, ok
  list 10, 74 25 94 20, size
  text "00:00/00:00", 11, 2 30 66 16
  check "mute", 12, 172 30 44 12
  box "", 13, 218 -1 88 69
  check "Random", 33, 223 8 65 20
  check "Echo to chan", 34, 223 25 81 20
  check "Repeat Trk", 35, 223 44 81 20
  text "Artist:", 21, 4 218 32 16
  text "Title:", 22, 4 240 28 16
  text "Album:", 23, 4 262 34 16
  text "Year:", 24, 238 284 28 16
  text "Genre:", 25, 4 284 36 16
  text "Length:", 26, 114 284 38 16
  edit "", 27, 40 218 268 20, read
  edit "", 28, 40 238 268 20, read
  edit "", 29, 40 260 266 20, read
  edit "", 30, 40 282 64 20, read
  edit "", 31, 152 282 76 20, read
  edit "", 32, 264 282 42 20, read
  menu "File", 17
  item "View Info", 18, 17
  item break, 19, 17
  item "Close", 20, 17, ok
  menu "Help", 36
  item "About", 37, 36
}
on *:dialog:x6mp3:*:*:{
  if ($devent == init) {
    dll $mdx SetMircVersion $version
    dll $mdx MarkDialog $dname
    dll $mdx SetFont  1,8,9 11 0 Tahoma
    dll $mdx SetFont  2,3,4,5,6 15 0 Webdings     
    dll $mdx SetFont  3 10 0 Webdings 
    dll $mdx SetControlMDX 10 trackbar horizontal both tooltips > $scriptdirbars.mdx  
    dll $mdx SetBorderStyle 7 clientedge
    dll $mdx SetBorderStyle 10 none
    dll $mdx SetBorderStyle $dname 1 staticedge
    dll $mdx SetBorderStyle $dname 1 windowedge clientedge
    did -i x6mp3 10 1 params $vol(song) 65535 0 6553.5 655.35 * * 10
    var %k = 1
    while (%k <= $lines(scripts/mp3.txt)) {
      did -a x6mp3 1 %k $+ ) $nopath($read(scripts/mp3.txt,%k))
      inc %k
    }
    did -a x6mp3 7 Welcome to CheckSixAMP mp3 Player
    set %mp3.num 0
  }
  if ($devent == menu) {
    if ($did == 18) {
      if (!%mp3.info) {
        dialog -s x6mp3 -1 -1 308 325
        set %mp3.info 1
      } 
      else { dialog -s x6mp3 -1 -1 308 235 | unset %mp3.info }
      mp3.info
    }
  }
  if ($devent == sclick) {
    if ($did == 8) {
      popdll New mp3.add 16 16 
      popdll SetStyle mp3.add emboss
      AddItem_ mp3.add end + 2 2 Add File $cr add.file
      AddItem_ mp3.add end + 2 2 Add Directory $cr add.dir 
      pop1 mp3.add $mouse.dx $mouse.dy
    }
    if ($did == 1) {
      set %temp $did(x6mp3,1).seltext
    }
    if ($did == 2) { mp3.pause }
    if ($did == 3) { mp3.stop }
    if ($did == 4) { mp3.play }
    if ($did == 9) { 
      popdll New mp3.del 16 16 
      popdll SetStyle mp3.del emboss
      AddItem_ mp3.del end + 2 2 Del File $cr mp3.del.file
      AddItem_ mp3.del end + 2 2 Del Directory $cr mp3.del.dir 
      pop1 mp3.del $mouse.dx $mouse.dy
    }
    if ($did == 10) { vol -p $gettok($did(10,1),1,32)) | if ($gettok($did(10,1),9,32) == tiptext) { did -i x6mp3 10 1 tiptext $int($calc($vol(song) /655.35)) $+ % } }
    if ($did == 6) { mp3.next }
    if ($did == 5) { mp3.previous }
    if ($did == 12) { 
      if (!%oldv) { 
        set %oldv 1 
        vol -pu1 
      }  
      else { 
        vol -pu2
        unset %oldv 
      } 
    }
    if ($did == 14) { .run http://www.check6gaming.com }
  }
  if ($devent == DCLICK) {
    if ($did == 1) { mp3.play } 
  }
}

on *:dialog:x6mp3:close:*:{ unset %pause | unset %mp3.info }

alias mp3.role {
  if ($dialog(x6mp3)) {
    if ($insong) {
      var %b = $insong.fname,%c = $sound(%b).artist,%d = $sound(%b).title
      if (%c) && (%d) { var %a = %c - %d }
      else { var %a = $nopath(%b) }
      if (!%mp3.x) { %mp3.x = $calc($len(%a) +60) }
      did -ra x6mp3 7 $chr(160) $replace($wrap($right($str($chr(160),60) $+ %a,%mp3.x),tahoma,9,150,0,1),$chr(32),$chr(160))
      dec %mp3.x
    }
    else { did -r x6mp3 7 }
  }
}
alias mp3.time {
  if ($dialog(x6mp3)) {
    ;Time nn:ss/nn:ss
    did -ra x6mp3 11 $+($_s2hns($insong.pos,n:s),/,$_s2hns($insong.length,n:s))
  }
}

alias mp3.del.file {
  set %a $did(x6mp3,1).seltext
  if (%a != $null) {
    .write -ds $+ %a scripts/mp3.txt
    did -d x6mp3 1 $did(x6mp3,1).sel
  }
}
alias mp3.del.dir {
  did -r x6mp3 1
  .write -c scripts/mp3.txt
}
alias mp3.play { 
  if ($insong) {
    .splay stop
    if ($did(x6mp3,33).state == 1) { mp3.random }
    else {
      set %c.song $read(scripts/mp3.txt,$did(x6mp3,1).sel)
      set %mp3.num $did(x6mp3,1).sel
      .splay %c.song 
    }
  }
  else {
    set %mp3.num $did(x6mp3,1).sel
    if (%mp3.num == 0) { inc %mp3.num }
    set %c.song $read(scripts/mp3.txt,%mp3.num)
    .splay %c.song 
  }
  var %b = $insong.fname,%c = $sound(%b).artist,%d = $sound(%b).title
  if (%c) && (%d) { var %a = %c - %d }
  else { var %a = $nopath(%b) }
  tb_song %a
  mp3.info
  if ($did(x6mp3,34).state == 1) { song }
}
alias mp3.pause {
  if ($insong.pause == $false) { 
    .splay pause 
    set %pause 1 
    if ($dialog(x6mp3)) {
      dialog -t x6mp3 CheckSix mp3 Player - Paused
    }
  }
  else {
    .splay resume
    unset %pause
    if ($dialog(x6mp3)) {
      dialog -t x6mp3 CheckSix mp3 Player 
    }
  }
}
alias mp3.stop {
  if ($insong) { 
    .splay stop  
    tb_song
    unset %isplay 
    unset %c.song 
    unset %pause
    if ($dialog(x6mp3)) {
      dialog -t x6mp3 CheckSix mp3 Player 
    }
  }
}
alias mp3.random {
  .splay stop
  set %c.song $read(scripts/mp3.txt)
  .splay %c.song
}
alias mp3.next {
  if ($did(x6mp3,35).state == 1) { splay $+(",%c.song,") | return }
  inc %mp3.num
  .splay stop
  if ($did(x6mp3,33).state == 1) { mp3.random }
  else {
    .splay stop
    set %c.song $read(scripts/mp3.txt,%mp3.num)
    .splay %c.song
  }
  var %b = $insong.fname,%c = $sound(%b).artist,%d = $sound(%b).title
  if (%c) && (%d) { var %a = %c - %d }
  else { var %a = $nopath(%b) }
  tb_song %a
  mp3.info
  if ($did(x6mp3,34).state == 1) { song }
}
alias mp3.previous {
  if ($did(x6mp3,33).state == 1) { echo -a not coded :D:D }
  else {
    dec %mp3.num
    if (%mp3.num == 0) { set %mp3.num $lines(scripts/mp3.txt) }
    .splay stop
    set %c.song $read(scripts/mp3.txt,%mp3.num)
    .splay %c.song
    var %b = $insong.fname,%c = $sound(%b).artist,%d = $sound(%b).title
    if (%c) && (%d) { var %a = %c - %d }
    else { var %a = $nopath(%b) }
    tb_song %a
    mp3.info
    if ($did(x6mp3,34).state == 1) { song }
  }
}
alias add.dir {
  var %j = 1, %i = $sdir="Select Directory", %c = $findfile(%i,*.mp3,0)
  while (%j <= %c) { write $+(",scripts/mp3.txt,") $findfile(%i,*.mp3,%j) | inc %j }
  var %k = 1
  while (%k <= $lines(scripts/mp3.txt)) {
    did -a x6mp3 1 $read(scripts/mp3.txt,%k)
    inc %k
  }
}
alias add.file {
  var %k = $sfile($gettok(C:/,1,92) $+ *.mp3,Locate mp3 file,Ok)
  if ($read(scripts/mp3.txt,r, %k) == %k) { var %m = $input(File already exists!,o,Error) } 
  else {
    write scripts/mp3.txt %k
    did -a x6mp3 1 %k
  }
}
alias song {
  if (%c.song) {
    if (($sound(%c.song).title) || ($sound(%c.song).artist)) {
      msg $active 0,1Check4Six0,1AMP: $sound(%c.song).artist - $sound(%c.song).title $+ .mp3
    }
    else { 
      var %b = $insong.fname,%c = $sound(%b).artist,%d = $sound(%b).title
      if (%c) && (%d) { var %a = %c - %d }
      else { var %a = $nopath(%b) }
      msg $active 0,1Check4Six0,1AMP: %a 
    }
  }
  else { echo -a No Song Playing }
}
on *:mp3end:{
  mp3.next
}
alias _s2hns { tokenize 32 $int($calc($int($1) /1000)) $2- | var %h $int($calc($1 / 3600)) | var %n $int($calc(($1 - (%h * 3600)) / 60)) | var %s $calc($1 - (%h * 3600) - (%n * 60)) | if ($len(%h) = 1) { var %h 0 $+ %h } | if ($len(%n) = 1) { var %n 0 $+ %n } | if ($len(%s) = 1) { var %s 0 $+ %s } | return $replace($2,h,%h,n,%n,s,%s) }
alias mp3.info {
  if ($dialog(x6mp3)) {
    if ($insong) {
      did -r x6mp3 27,28,29,30,31,32
      did -a x6mp3 27 $sound(%c.song).artist
      did -a x6mp3 28 $sound(%c.song).title
      did -a x6mp3 29 $sound(%c.song).album
      did -a x6mp3 30 $sound(%c.song).genre
      did -a x6mp3 31 $duration($calc($insong.length / 1000))
      did -a x6mp3 32 $sound(%c.song).year
    }
  }
}