alias mircustom dll SohbetSen\dll\mircustom.dll $1-

alias views return SohbetSen\dll\views.mdx

alias bars return SohbetSen\dll\bars.mdx

alias dialogs return SohbetSen\dll\dialog.mdx

alias tab return $chr(9)

alias dlgisnum return $iif($did($dname,$1) isnum && $did($dname,$1) > 0,$v1,$2)

alias dlgnotnull return $iif($did($dname,$1) != $null,$v1,$2)

alias anainp return $$input($1,e,AnacønĞa input,$2)

alias anawarn return $$input($1,wo,AnacønĞa)

alias setmdx {
  mdx SetMircVersion $version
  mdx MarkDialog $dname $dialog($dname).hwnd
}

dialog mp3c {
  title "..: SohbetSen Cafe - MP3 Çalıcı :.."
  size -1 -1 292 283
  option pixels
  text "", 32, 4 2 98 39, center
  text "", 33, 106 2 182 39
  button "9", 35, 5 68 42 20
  button "4", 36, 53 68 42 20
  button ";", 37, 101 68 42 20
  button "<", 38, 149 68 42 20
  button ":", 39, 197 68 42 20
  button "5", 40, 245 68 42 20
  text "", 43, 110 6 174 16, center
  text "", 44, 110 22 58 16, center
  text "", 45, 168 22 58 16, center
  text "", 46, 226 22 58 16, center
  list 34, 105 43 184 23, size
  text "00:00", 47, 10 8 86 27, center
  list 51, 4 91 284 165, size extsel
  text "Çalmıyor", 5, 110 13 174 16, center
  text "", 103, 5 258 282 22, center
  button "", 79, 0 0 0 0, hide ok
  button "", 200, 0 0 0 0, hide
  list 41, 3 43 99 23, size
  menu "Göster", 11
  item "Ses", 13, 11
  item break, 14, 11
  item "Bilgi", 15, 11
  item break, 6, 11
  item "Gizle", 16, 11
  item "Kapat", 66, 11
  menu "Çalma Listesi", 52
  item "Tek Dosya Ekle", 53, 52
  item "Klasör Ekle", 54, 52
  item break, 55, 52
  menu "ÇalmaListesi Yükle", 56, 52
  item "*.m3u", 104, 56
  item "*.pls", 105, 56
  item "*.bpl", 106, 56
  item "*.b4s", 107, 56
  item break, 57, 52
  item "Çalma Listesi Kaydet", 58, 52
  menu "Çalma Listesini Farklı Kaydet", 59, 52
  item "*.m3u", 77, 59
  item "*.pls", 78, 59
  item "*.b4s", 80, 59
  item break, 60, 52
  item "Dosya Sil", 61, 52
  item "Çalma Listesini Sil", 62, 52
  item break, 63, 52
  menu "Taşı", 65, 52
  item "Yukarı", 69, 65
  item "Aşagı", 70, 65
  menu "Listeme Sırası", 67, 52
  item "Başlık", 71, 67
  item "Dosya Adı", 72, 67
  ;item "Parça / Dosya Adı", 73, 67
  ;item "Parça", 74, 67
  item break, 68, 52
  item "Gizle", 64, 52
  menu "Ayarlar", 1
  menu "Renklendirme", 17, 1
  menu "Yazı", 18, 17
  item "Gri", 85, 18
  item "Koyu Gri", 86, 18
  item "Beyaz", 87, 18
  item "Açık Gri", 88, 18
  item "Siyah", 89, 18
  item "Değiştirme", 90, 18
  item break, 91, 18
  item "mIRC Standart'ı", 92, 18
  menu "Arka Alan", 19, 17
  item "Gri", 93, 19
  item "Koyu Gri", 94, 19
  item "Beyaz", 95, 19
  item "Açık Gri", 96, 19
  item "Siyah", 97, 19
  item "Değiştirme", 98, 19
  item break, 101, 19
  item "mIRC Standart'ı", 102, 19
  menu "Çalma Şekli", 7, 1
  item "Sıra ile Çal", 8, 7
  item "Rastgele", 9, 7
  item "Seçtiğim Parçayı", 42, 7
  item break, 26, 7
  item "Tekrar et", 10, 7
  item "1 3 2 5 4", 75, 7
  menu "Zamanlayıcı", 2, 1
  item "Geçen Zaman", 3, 2
  item "Kalan Zaman", 4, 2
  menu "Ne Dinliyorum", 20, 1
  item "Kanallar ve Özellerde Göster", 108, 20
  item break, 109, 20
  item "Kanallarda Göster", 21, 20
  item "Özellerde Göster", 22, 20
  item break, 23, 20
  item "Özelliği Aç", 24, 20
  item "Özelliği Kapat", 25, 20
  item break, 99, 20
  item "Yollanacak Mesaj", 100, 20
}

dialog mp3id3 {
  title "MP3 Çalıcı - Parça Bilgisi"
  size -1 -1 151 123
  option dbu
  edit "", 1, 3 3 146 1
  text " MP3 Bilgisi: Belirtilmemiş", 2, 4 5 145 8, disabled
  edit "", 3, 3 14 146 1
  text "Title: Belirtilmemiş", 4, 4 19 141 8
  text "Şarkıcı: Belirtilmemiş", 5, 4 29 141 8
  text "Tür: Belirtilmemiş", 7, 4 49 141 8
  text "Şarkı No: Belirtilmemiş", 9, 4 59 141 8
  text "Ekstalar:", 10, 4 79 42 8
  edit "Belirtilmemiş", 11, 2 89 147 32, read multi autovs
  text "Albüm: Belirtilmemiş", 12, 4 39 141 8
  text "Yıl: Belirtilmemiş", 6, 5 69 140 8
  button "", 8, 0 0 0 0, hide ok
}

dialog mp3volume {
  title "SES"
  size -1 -1 145 207
  text "Master", 1, 6 3 40 16, disabled
  list 2, 12 18 34 170, size
  text "Wave", 3, 58 3 40 16, disabled
  list 4, 61 18 34 170, size
  text "Midi", 5, 110 3 32 16, disabled
  list 6, 110 18 34 170, size
  check "Sus", 7, 5 185 37 21, push
  check "Sus", 8, 54 185 37 21, push
  check "Sus", 9, 102 185 37 21, push
  button "", 10, 0 0 0 0, hide Ok
}

dialog mp3w {
  title "Mp3 Çalıcı"
  size -1 -1 114 15
  option dbu
  edit "", 1, 2 2 110 1
  text "", 2, 2 4 110 8, center, disabled
  edit "", 3, 2 13 110 1
  button "", 4, 0 0 0 0, hide ok
}

;; Events

on *:dialog:mp3c:*:*:{
  if ($devent == init) {
  { Splay $mircdirSohbetSen\sounds\Menu.wav }
    setmdx
    mdx SetControlMDX $dname $1 contexthelp nocontrol > $dialogs  200
    mdx SetFont $dname 35,36,37,38,39,40 -14 400 Webdings
    mdx SetControlMDX $dname 34,41 trackbar noticks > $bars
    mdx SetBorderStyle $dname 34,41
    mdx SetFont $dname 47 ANSI 25 400 Arial
    mdx SetBorderStyle $dname 32,33,103 clientedge staticedge
    mdx SetBorderStyle $dname 35,36,37,38,39,40 staticedge
    mdx SetFont $dname 5,33,43,44,45,46,51,103 ANSI 12 400 Tahoma
    mdx SetControlMDX $dname 51 listview report rowselect showsel > $views
    did -i $dname 51 1 headerdims 264
    did -i $dname 51 1 headertext Dosya Adı
    did -i $dname 41 1 params $vol(master) 0 65535
    mp3color.aux2
    mp3color.aux3
    if ($mp3ret(main,repeat)) did -c mp3c 10
    if ($mp3ret(main,loop)) did -c mp3c 75
    if (%mp3selected) did -c mp3c 42
    elseif (%mp3shuffle) did -c mp3c 9
    else did -c mp3c 8
    if (%mp3duration) did -c mp3c 3
    else did -c mp3c 4
    var %t = $mp3ret(main,show)
    if (%t == 1) var %t = 21
    elseif (%t == 2) var %t = 22
    elseif (%t == 3) var %t = 24
    elseif (%t == 4) var %t = 108
    elseif (%t == 0) var %t = 25
    did -c mp3c %t
    if (!$mp3ret(main,playlist)) did -b mp3c 58
    if ($mp3ret(main,hide)) {
      dialog -s mp3c -1 -1 358 120
      did -c mp3c 64
    }
    mp3ldisp
    if (!$read($mp3path(mp3f.ml),wn,$inmp3.fname)) {
      did -b mp3c 34,35,37,38,39
    }
    else {
      if (%mp3aux) var %t = $v1
      else {
        var %t = $read($mp3path(mp3f.ml),wn,$inmp3.fname)
        var %t = $readn
      }
      if (%mp3pause) did -b mp3c 37
      did -c mp3c 51 $calc(%t + 1)
      mp3binfo
      mp3pos
      mp3upd $inmp3.fname
    }
  }
  elseif ($devent == dclick) && ($did == 51) mp3play $calc($did(mp3c,51).sel - 1)
  elseif ($devent == sclick) {
    if ($did == 51) {
      if ($did(mp3c,51).sel) {
        if ($gettok($did(mp3c,51,1),1,32) == rclick) mp3pop
        if ($did(mp3c,51).sel) mp3binfo
      }
    }
    elseif ($did == 34) .splay seek $gettok($did(mp3c,34,1).text,1,32)
    elseif ($did == 35) mp3previous
    elseif ($did == 36) mp3play $iif($did(mp3c,51).sel,$calc($v1 - 1))
    elseif ($did == 37) mp3pause
    elseif ($did == 38) mp3stop
    elseif ($did == 39) mp3next
    elseif ($did == 40) mp3addir
    elseif ($did == 41) {
      var %t = $mixeraux(41)
      vol -v $calc(65535 - %t)
      if ($dialog(mp3volume)) did -i mp3volume 2 1 params %t 0 65535
    }
    elseif ($did == 200) adoc mp3
  }
  elseif ($devent == menu) {
    if ($did == 3) mp3duration 1
    elseif ($did == 4) mp3duration 0
    elseif ($did == 8) mp3method 1
    elseif ($did == 9) mp3method 2
    elseif ($did == 42) mp3method 3
    elseif ($did == 10) mp3repeat $iif($did(mp3c,10).state,0,1)
    elseif ($did == 13) mp3volume
    elseif ($did == 15) mp3id3 $read($mp3path(mp3f.ml),n,$calc($did(mp3c,51).sel - 1))
    elseif ($did == 16) dialog -x mp3c
    elseif ($did == 21) mp3setshow 1
    elseif ($did == 22) mp3setshow 2
    elseif ($did == 24) mp3setshow 3
    elseif ($did == 25) mp3setshow 0
    elseif ($did == 108) mp3setshow 4
    elseif ($did == 53) mp3add
    elseif ($did == 54) mp3addir
    elseif ($did == 58) mp3savepl $mp3ret(main,playlist)
    elseif ($did == 61) if ($did(mp3c,51).sel) mp3delf
    elseif ($did == 62) mp3clear
    elseif ($did == 64) {
      if ($did(mp3c,64).state) {
        mp3write main hide 0
        dialog -s mp3c -1 -1 292 302
        did -u mp3c 64
      }
      else {
        mp3write main hide 1
        dialog -s mp3c -1 -1 292 85
        did -c mp3c 64
      }
    }
    elseif ($did == 66) {
      mp3stop
      dialog -x mp3c
    }
    elseif ($did == 69) if ($did(mp3c,51).sel) mp3upf
    elseif ($did == 70) if ($did(mp3c,51).sel) mp3downf
    elseif ($did == 71) mp3sort 1
    elseif ($did == 72) mp3sort 2
    elseif ($did == 73) mp3sort 3
    elseif ($did == 74) mp3sort 4
    elseif ($did == 75) mp3loop $iif($did(mp3c,75).state,0,1)
    elseif ($did == 77) mp3savepl *.m3u
    elseif ($did == 78) mp3savepl *.pls
    elseif ($did == 80) mp3savepl *.b4s
    elseif ($did == 85) mp3color text face
    elseif ($did == 86) mp3color text shadow
    elseif ($did == 87) mp3color text hilight
    elseif ($did == 88) mp3color text 3dlight
    elseif ($did == 89) mp3color text frame
    elseif ($did == 90) mp3color text text
    elseif ($did == 92) mp3color text $color($stdc)
    elseif ($did == 93) mp3color back face
    elseif ($did == 94) mp3color back shadow
    elseif ($did == 95) mp3color back hilight
    elseif ($did == 96) mp3color back 3dlight
    elseif ($did == 97) mp3color back frame
    elseif ($did == 98) mp3color back text
    elseif ($did == 100) mp3setmsg $$input(Tags: <title> $+ $comma <length> $+ $comma <pos> $+ $chr(44) <bitrate> $+ $comma <mode> $+ $comma <sample> $+ $comma <size>,e,MP3 message,%mp3msg)
    elseif ($did == 102) mp3color back $color($stdc)
    elseif ($did == 104) mp3loadpl m3u
    elseif ($did == 105) mp3loadpl pls
    elseif ($did == 106) mp3loadpl bpl
    elseif ($did == 107) mp3loadpl b4s
  }
}



alias comma return $chr(44)

on *:dialog:mp3volume:*:*:{
  if ($devent == init) {
    setmdx
    mdx SetFont $dname 1,3,5 ANSI 13 700 Tahoma
    mdx SetBorderStyle $dname 7,8,9 clientedge
    mdx SetControlMDX $dname 2,4,6 trackbar vertical noticks > $bars
    mdx SetBorderStyle $dname 2,4,6
    did -i $dname 2 1 params $calc(65535 - $vol(master)) 0 65535
    did -i $dname 4 1 params $calc(65535 - $vol(wave)) 0 65535
    did -i $dname 6 1 params $calc(65535 - $vol(midi)) 0 65535
    if ($vol(master).mute) did -c $dname 7
    if ($vol(wave).mute) did -c $dname 8
    if ($vol(midi).mute) did -c $dname 9
  }
  elseif ($devent == sclick) {
    if ($did == 2) {
      var %t = $mixeraux(2)
      vol -v %t
      if ($dialog(mp3c)) did -i mp3c 41 1 params %t 0 65535
    }
    elseif ($did == 4) vol -w $mixeraux(4)
    elseif ($did == 6) vol -m $mixeraux(6)
    elseif ($did == 7) vol -vu $+ $mixeraux2(7)
    elseif ($did == 8) vol -wu $+ $mixeraux2(8)
    elseif ($did == 9) vol -mu $+ $mixeraux2(9)
  }
}

on *:dialog:mp3id3:init:0: { 
  setmdx
  mdx SetFont $dname 2 ANSI 13 700 Tahoma
  mdx SetBorderStyle $dname 1,3,11 staticedge
}

on *:dialog:mp3w:init:0:{
  setmdx
  mdx SetFont $dname 2 ANSI 13 700 Tahoma
  mdx SetDialog $dname style 0 title
  mdx SetBorderStyle $dname 1,3 staticedge
}

on *:START:{
  if (!$isfile($mp3path(mp3f.ml))) write -c $mp3path(mp3f.ml)
  if (!$isfile($mp3path(mp3i.ml))) write -c $mp3path(mp3i.ml)
}

on *:LOAD:{
  set %mp3index 0
  set %mp3shuffle 0
  set %mp3duration 1
  set %mp3msg on <title>   » [<pos>/<length>]
}

on *:UNLOAD:{
  mp3stop
  unset %mp3*
}

on *:MP3END:{
  if ($mp3ret(main,repeat)) .splay -p " $+ $filename $+ "
  elseif (%mp3selected) mp3stop
  else mp3next
}

on *:EXIT:mp3stop

;; Commands

alias mp3volume if (!$dialog(mp3volume)) dialog -hmd mp3volume mp3volume

alias mp3id3 {
  if (!$isfile($1-)) return
  if (!$dialog(mp3id3)) dialog -hmd mp3id3 mp3id3
  mp3id.aux 2 MP3 Bilgisi: $nopath($1-)
  mp3id.aux 4 Başlık: $iif($mp3($1-).title,$v1,Belirtilmemiş)
  mp3id.aux 5 Şarkıcı: $iif($mp3($1-).artist,$v1,Belirtilmemiş)
  mp3id.aux 12 Albüm: $iif($mp3($1-).album,$v1,Belirtilmemiş)
  mp3id.aux 7 Türü: $iif($mp3($1-).genre,$v1,Belirtilmemiş)
  mp3id.aux 9 Şarkı No: $iif($ord($mp3($1-).track) != -1st,$v1,Belirtilmemiş)
  mp3id.aux 6 Yıl: $iif($mp3($1-).year,$v1,Belirtilmemiş)
  mp3id.aux 11 $iif($mp3($1-).comment,$v1,Belirtilmemiş)
}

alias mp3play {
  set %mp3index $lines($mp3path(mp3f.ml))
  if (%mp3pause) {
    .splay resume
    unset %mp3pause
    if ($dialog(mp3c)) did -e mp3c 37
  }
  else {
    if ($1 isnum) mp3start $1
    elseif ($dialog(mp3c)) && ($did(mp3c,51).sel) mp3start $calc($did(mp3c,51).sel - 1)
    else mp3start 1
  }
  if ($dialog(toolbar)) && ($cfgget(showmp3)) && ($inmp3) {
    var %n = $did(toolbar,1).lines
    var %t = $calc(%n - 2)
    did -o toolbar 1 %t +a $calc($gettok($did(toolbar,1,$calc(%t + 1)),2,32) - 1) $tab $+ Pause MP3
    var %t = $calc(%n - 3)
    did -o toolbar 1 %t +a $gettok($did(toolbar,1,%t),2-,32)
    var %t = $calc(%n - 1)
    did -o toolbar 1 %t +a $gettok($did(toolbar,1,%t),2-,32)
    did -o toolbar 1 %n +a $gettok($did(toolbar,1,%n),2-,32)
  }
}

alias mp3pause {
  if (!$inmp3) return
  .splay pause
  set %mp3pause 1
  if ($dialog(mp3c)) did -b mp3c 37
  if ($dialog(toolbar)) && ($cfgget(showmp3)) {
    var %n = $did(toolbar,1).lines
    var %t = $calc(%n - 2)
    did -o toolbar 1 %t +a $calc($gettok($did(toolbar,1,%t),2,32) - 1) $tab $+ Start MP3
  }
}

alias mp3previous {
  var %f = $mp3path(mp3s.ml)
  var %f2 = $mp3path(mp3c.ml)
  if ($isfile(%f2)) {
    if ($mp3previous.aux($1)) mp3previous.aux3
    else {
      dec %mp3aux
      if (%mp3aux < 1) set %mp3aux %mp3index
      var %t = $gettok($read(%f2,wn,*|1,%mp3aux),1,124)
      if (%t) mp3previous.aux2 $readn %f2
      else {
        var %t = $gettok($read(%f2,wn,*|1),1,124)
        if (%t) mp3previous.aux2 $readn %f2
        else mp3stop
      }
    }
  }
  elseif ($isfile(%f)) {
    if ($mp3previous.aux($1)) mp3previous.aux3
    else {
      write -il1 %f $read($mp3path(mp3spre.ml),n,1)
      write -dl1 $mp3path(mp3spre.ml)
      inc %mp3si
      if (%mp3si <= %mp3index) {
        set %mp3line 1
        var %null = $read($mp3path(mp3f.ml),wn,$read(%f,n,1))
        mp3auxp $readn
      }
      else mp3stop
    }
  }
  else mp3stop
}

alias mp3next {
  var %f = $mp3path(mp3s.ml)
  var %f2 = $mp3path(mp3c.ml)
  if ($isfile(%f2)) {
    write -l %mp3aux %f2 $+($read($mp3path(mp3f.ml),n,%mp3aux),|,1)
    inc %mp3aux
    if (%mp3aux > %mp3index) set %mp3aux 1
    var %t = $read(%f2,wn,*.mp3,%mp3aux)
    if (%t) mp3next.aux $readn
    else {
      var %t = $read(%f2,wn,*.mp3)
      if (%t) mp3next.aux $readn
      else {
        if ($mp3ret(main,loop)) mp3play %mp3aux
        else mp3stop
      }
    }
  }
  elseif ($isfile(%f)) {
    write -il1 $mp3path(mp3spre.ml) $read(%f,n,%mp3line)
    write -dl %mp3line %f
    dec %mp3si
    if (%mp3si) {
      set %mp3line $rand(1,%mp3si)
      var %null = $read($mp3path(mp3f.ml),wn,$read(%f,n,%mp3line))
      mp3auxp $readn
    }
    else {
      if ($mp3ret(main,loop)) mp3play
      else mp3stop
    }
  }
  else mp3stop
}

alias mp3stop {
  unset %mp3aux
  unset %mp3si
  unset %mp3line
  unset %mp3pause
  var %f = $mp3path(mp3c.ml)
  if ($isfile(%f)) .remove %f
  var %f = $mp3path(mp3s.ml)
  if ($isfile(%f)) .remove %f
  var %f = $mp3path(mp3spre.ml)
  if ($isfile(%f)) .remove %f
  if ($inmp3) .splay stop
  if ($dialog(mp3c)) {
    did -v mp3c 5
    did -i mp3c 34 1 params 0 0 1
    did -h mp3c 43,44,45,46
    did -ra mp3c 47 00:00
    did -b mp3c 34,35,37,38,39
  }
  if ($dialog(toolbar)) && ($cfgget(showmp3)) {
    var %n = $did(toolbar,1).lines
    var %t = $calc(%n - 2)
    did -o toolbar 1 %t +a $calc($gettok($did(toolbar,1,$calc(%t + 1)),2,32) - 2) $tab $+ Start MP3
    var %t = $calc(%n - 3)
    did -o toolbar 1 %t +ad $gettok($did(toolbar,1,%t),2-,32)
    var %t = $calc(%n - 1)
    did -o toolbar 1 %t +ad $gettok($did(toolbar,1,%t),2-,32)
    did -o toolbar 1 %n +ad $gettok($did(toolbar,1,%n),2-,32)
  }
  .timermp3 off
}

alias mp3add {
  var %n = $$msfile(*.mp3,Choose your MP3's,Ok)
  if (%n == -1) {
    var %n = $anawarn(You've selected to many files at once)
    return
  }
  elseif (!%n) return
  mp3w
  .fopen -no mp3 SohbetSen\Module\Mp3\mp3.t
  var %i = 1
  while (%i <= %n) {
    .fwrite -n mp3 $msfile(%i)
    inc %i
  }
  .fclose mp3
  mp3addf $mp3dsel
  mp3ldisp
  dialog -x mp3w
}

alias mp3addir {
  var %d = $$adir(*,Choose a folder,Ok)
  mp3w
  listfiles setoutput <dir><fname>
  listfiles listfiles f > SohbetSen\Module\Mp3\mp3.t > %d > *.mp3 > > 0
  mp3addf $mp3dsel
  mp3ldisp
  dialog -x mp3w
}

alias mp3del {
  var %f = $mp3path(mp3f.ml)
  if (!$1) || ($1 < 1) || ($1 > $lines(%f)) return
  if ($dialog(mp3c)) && ($did(mp3c,51).sel) var %t = $did(mp3c,51).sel
  dec %mp3index
  if (%mp3aux) {
    if ($1 == %mp3aux) var %l = 1
    elseif ($1 < %mp3aux) dec %mp3aux
    if (%mp3aux > %mp3index) {
      set %mp3aux 1
      if (%t) var %t = -1
    }
    write -dl $1 $mp3path(mp3c.ml)
  }
  elseif (%mp3line) {
    var %f2 = $mp3path(mp3s.ml)
    var %n = $read(%f,n,$1)
    if ($read(%f2,wn,%n)) {
      var %n = $readn
      if (%n == %mp3line) var %l = 1
      if (%n <= %mp3line) dec %mp3line
      write -dl %n %f2 %f
      dec %mp3si
    }
    var %f2 = $mp3path(mp3spre.ml)
    var %n = $read(%f,n,$1)
    if ($read(%f2,wn,%n)) {
      var %n = $readn
      write -dl %n %f2 %f
    }
  }
  write -dl $1 %f
  write -dl $1 $mp3path(mp3i.ml)
  if (%l) mp3auxp $iif(%mp3aux,$v1,$1)
  if (!%mp3nd) mp3ldisp
  if (%t) && ($did(mp3c,51,2)) {
    if (%t == -1) did -c mp3c 51 2
    elseif ($did(mp3c,51).lines >= %t) did -c mp3c 51 %t
    else did -c mp3c 51 $calc(%t - 1)
  }
}

alias mp3clear {
  mp3stop
  set %mp3index 0
  write -c $mp3path(mp3f.ml)
  write -c $mp3path(mp3i.ml)
  if ($dialog(mp3c)) did -r mp3c 51,103  
}

alias mp3loadpl {
  if (!$istok(pls.m3u.bpl.b4s,$1,46)) return
  var %f = $$afile(*. $+ $1,Choose playlist,Ok)
  if (!$isfile(%f)) return
  mp3w
  mp3write main playlist %f
  var %x = $right(%f,4)
  mp3clear
  .fopen mp3 " $+ %f $+ "
  .fopen -no mp3out SohbetSen\Module\Mp3\mp3.t
  while (!$feof) {
    var %mp3t = $fread(mp3)
    if (%x == .m3u) {
      if ($left(%mp3t,4) != #EXT) && ($right(%mp3t,4) == .mp3) {
        if ($mid(%mp3t,2,1) != $chr(58)) && ($left(%mp3t,1) != $chr(92)) var %mp3t = $nofile(%f) $+ %mp3t
        elseif ($left(%mp3t,1) == $chr(92)) var %mp3t = $left(%f,2) $+ %mp3t
      }
    }
    elseif (%x == .pls) {
      if (File* iswm $gettok(%mp3t,1,61)) && ($right(%mp3t,4) == .mp3) {
        var %mp3t = $gettok(%mp3t,2,61)
        if ($mid(%mp3t,2,1) != $chr(58)) && ($left(%mp3t,1) != $chr(92)) var %mp3t = $nofile(%f) $+ %mp3t
        elseif ($left(%mp3t,1) == $chr(92)) var %mp3t = $left(%f,2) $+ %mp3t
      }
    }
    elseif (%x == .bpl) {
      var %winamp.string = <entry Playstring
      if (%winamp.string isin %mp3t) {
        var %mp3t = $gettok($gettok(%mp3t,2-,58),1,34)
        var %mp3t = $plrep(%mp3t)
      }
    }
    elseif (%x == .b4s) {
      var %t = <entry playstring
      if (%t isin %mp3t) && (file: isin %mp3t) var %mp3t = $plrep($gettok($gettok($gettok($remfirst(%mp3t,$calc($pos(%mp3t,playstring=,1) - 1)),2,61),1,34),2-,58))
    }
    if ($mp3(%mp3t).length) .fwrite -n mp3out %mp3t
  }
  .fclose mp3
  .fclose mp3out
  mp3addf
  if ($dialog(mp3c)) did -e mp3c 58
  mp3ldisp
  dialog -x mp3w
}

alias mp3savepl {
  if (!$1) return
  set -u %s $mp3path(mp3f.ml)
  if ($isfile($1-)) {
    set -u %f $+(",$1-,")
    var %x = $right($1-,3)
    $+(save,%x) %f
  }
  else {
    set -u %f $$afile($1,Save playlist,Save)
    var %x = $remfirst($1,1)
    if ($right(%f,4) != %x) set -u %f %f $+ %x
    mp3write main playlist %f
    set -u %f $+(",%f,")
    .fopen mp3in %s
    .fopen -no mp3save %f
    if ($1 == *.m3u) savem3u %f
    elseif ($1 == *.pls) savepls %f
    elseif ($1 == *.b4s) saveb4s %f
    .fclose mp3*
  }
}

alias mp3sort {
  if ($1 !isnum) || ($1 <= 0) || ($1 > 4) return
  var %f = $mp3path(mp3f.ml)
  if (!$isfile(%f)) return
  mp3w
  if ($dialog(mp3c)) && ($did(mp3c,51).sel) var %s = $did(mp3c,51).sel
  var %df = $mp3path(mp3i.ml)
  window -hs @mp3sort
  var %l = $lines(%f)
  var %i = 1
  .fopen sort %f
  while (%i <= %l) {
    var %t = $fread(sort)
    if ($1 == 1) var %x = $mp3info(%t)
    elseif ($1 == 2) var %x = $nopath(%t)
    elseif ($1 == 3) var %x = %t
    elseif ($1 == 4) var %x = $mp3(%t).length
    aline @mp3sort $+(%x,",%t)
    inc %i
  }
  .fclose sort
  var %f2 = $mp3path(mp3c.ml)
  var %f3 = $mp3path(mp3t.ml)
  var %i = 1
  .fopen -no sort %f
  .fopen -no sortd %df
  .fopen -no sort3 %f3
  while ($line(@mp3sort,%i)) {
    var %t = $gettok($v1,-1,34)
    if (%mp3aux) {
      if (%t == $inmp3.fname) set %mp3aux %i
      .fwrite -n sort3 %t $+ $iif($read(%f2,wn,%t $+ |1),|1)
    }
    .fwrite -n sort %t
    .fwrite -n sortd $lv($nopath(%t))
    inc %i
  }
  .fclose sort*
  if (%mp3aux) .copy -o %f3 %f2
  .remove %f3
  window -c @mp3sort
  mp3ldisp
  if ($dialog(mp3c)) {
    if (%s) did -c mp3c 51 %s
    else did -u mp3c 51 %s
  }
  dialog -x mp3w
}

alias mp3up {
  var %f = $mp3path(mp3f.ml)
  if (!$1) || ($1 <= 1) || ($1 > $lines(%f)) return
  var %t = $read(%f,n,$1)
  write -dl $1 %f
  write -il $calc($1 - 1) %f %t
  if (%mp3aux) {
    var %f = $mp3path(mp3c.ml)
    var %t = $read(%f,n,$1)
    write -dl $1 %f
    write -il $calc($1 - 1) %f %t
    if (%mp3aux == $1) set %mp3aux $calc($1 - 1)
    elseif (%mp3aux == $calc($1 - 1)) set %mp3aux $1
  }
  var %f = $mp3path(mp3i.ml)
  var %t1 = $read(%f,n,$1)
  var %t2 = $read(%f,n,$calc($1 - 1))
  write -l $calc($1 - 1) %f %t1
  write -l $1 %f %t2
  if ($dialog(mp3c)) {
    did -co mp3c 51 $1 %t1
    did -o mp3c 51 $calc($1 + 1) %t2
  }
}

alias mp3down {
  var %f = $mp3path(mp3f.ml)
  if (!$1) || ($1 < 1) || ($1 >= $lines(%f)) return
  var %t = $read(%f,n,$1)
  write -dl $1 %f
  write -il $calc($1 + 1) %f %t
  if (%mp3aux) {
    var %f = $mp3path(mp3c.ml)
    var %t = $read(%f,n,$1)
    write -dl $1 %f
    write -il $calc($1 + 1) %f %t
    if (%mp3aux == $1) set %mp3aux $calc($1 + 1)
    elseif (%mp3aux == $calc($1 + 1)) set %mp3aux $1
  }
  var %f = $mp3path(mp3i.ml)
  var %t1 = $read(%f,n,$1)
  var %t2 = $read(%f,n,$calc($1 + 1))
  write -l $calc($1 + 1) %f %t1
  write -l $1 %f %t2
  if ($dialog(mp3c)) {
    did -co mp3c 51 $calc($1 + 2) %t1
    did -o mp3c 51 $calc($1 + 1) %t2
  }
}

alias mp3setmsg set %mp3msg $1-

alias mp3loop mp3lr loop 75 $1

alias mp3repeat mp3lr repeat 10 $1

alias mp3setshow {
  mp3write main show $1
  if ($dialog(mp3c)) {
    if ($1 == 1) var %t = 21
    elseif ($1 == 2) var %t = 22
    elseif ($1 == 3) var %t = 24
    elseif ($1 == 4) var %t = 108
    elseif ($1 == 0) var %t = 25
    did -u mp3c 21,22,24,25,108
    did -c mp3c %t
  }
}

alias mp3color {
  if ($rgb($2) != $null) {
    if ($1 == back) || ($1 == text) mp3write main $1-
    if ($dialog(mp3c)) {
      if ($1 == back) mp3color.aux2
      elseif ($1 == text) mp3color.aux3
    }
  }
}

alias mp3show {
  if (!$inmp3) || (!$server) return
  var %t  = $mp3ret(main,show)
  var %m = $mp3showmsg
  if ($issendmsg($1)) describe $1 %m
  else {
    if ((%t == 1) || (%t == 3)) {
      var %i = 1
      while ($scon(%i)) {
        scid $v1
        if ($chan(1)) ame  %m 
        inc %i
      }
    }
    if ((%t == 2) || (%t == 3)) {
      var %i = 1
      while ($scon(%i)) {
        scid $v1
        if ($query(1)) qme %m
        inc %i
      }
    }
    if (%t == 4) && (($active ischan) || ($query($active)) || ($chat($active))) describe $active %m
  }
}

alias mp3duration {
  set %mp3duration $1
  if ($dialog(mp3c)) {
    if ($1) {
      did -c mp3c 3
      did -u mp3c 4
    }
    else {
      did -u mp3c 3
      did -c mp3c 4
    }
  }
}

alias mp3method {
  var %f = $mp3path(mp3f.ml)
  var %f2 = $mp3path(mp3s.ml)
  var %f3 = $mp3path(mp3c.ml)
  var %f4 = $mp3path(mp3spre.ml)
  if ($1 == 1) || ($1 == 3) {
    set %mp3selected $iif($1 == 3,1,0)
    if (%mp3line) {
      .fopen mp3line %f
      var %i = 1
      while (1) {
        var %t = $fread(mp3line)
        if (!%t) break
        if ($inmp3.fname == %t) set %mp3aux %i
        write %f3 %t $+ $iif(!$read(%f2,wn,%t),|1)
        inc %i
      }
      .fclose mp3line
      unset %mp3si
      unset %mp3line
      if ($isfile(%f2)) .remove %f2
      if ($isfile(%f4)) .remove %f4
    }
    set %mp3shuffle 0
    if ($dialog(mp3c)) {
      did -u mp3c 8,9,42
      did -c mp3c $iif(%mp3selected,42,8)
    }
  }
  elseif ($1 == 2) {
    set %mp3selected 0
    if (%mp3aux) {
      .fopen mp3aux %f3
      while (1) {
        var %t = $fread(mp3aux)
        if (!%t) break
        write $iif(*|1 iswm %t,-il1 %f4,%f2) $gettok(%t,1,124)
        if ($inmp3.fname == $gettok(%t,1,124)) set %mp3line $lines(%f2)
      }
      .fclose mp3aux
      set %mp3si $lines(%f2)
      unset %mp3aux
      if ($isfile(%f3)) .remove %f3
    }
    set %mp3shuffle 1
    if ($dialog(mp3c)) {
      did -u mp3c 8,42
      did -c mp3c 9
    }
  }
}

alias ra echo -a $remove(-A-n-a-c--Ø--n--Ğ--a-,-)

;; Auxiliar commands & identifiers

alias  mp3lr {
  mp3write main $1 $3
  if ($dialog(mp3c)) {
    if ($3) did -c mp3c $2
    else did -u mp3c $2
  }
}

alias  mp3color.aux {
  var %t = $mp3ret(main,$1)
  var %t = $iif(%t isnum,%t,$rgb(%t))
  return %t
}

alias  mp3color.aux2 {
  var %t = $mp3color.aux(back)
  did -i mp3c 51 1 setbkg color %t
  did -i mp3c 51 1 settxt bgcolor %t
  mdx SetColor mp3c 5,32,33,43,44,45,46,47,103 background %t
  mdx SetColor mp3c 5,32,33,43,44,45,46,47,103 textbg %t
}

alias  mp3color.aux3 {
  var %t = $mp3color.aux(text)
  did -i mp3c 51 1 settxt color %t
  mdx SetColor mp3c 5,32,33,43,44,45,46,47,103 text %t
}

alias  mp3ldisp {
  if ($dialog(mp3c)) && ($isfile($mp3path(mp3i.ml))) {
    loadbuf -ro mp3c 51 $mp3path(mp3i.ml)
    if ($dialog(mp3c)) {
      if ($did(mp3c,51,2)) {
        did -c mp3c 51 2
        mp3binfo
      }
      else did -r mp3c 103
    }
  }
}

alias  mp3dsel return $iif($dialog(mp3c) && $did(mp3c,51).sel,$calc($did(mp3c,51).sel - 1))

alias  mp3addf {
  if (!$lines(SohbetSen\Module\Mp3\mp3.t)) return
  var %l = $lines($mp3path(mp3f.ml))
  .fopen mp3 SohbetSen\Module\Mp3\mp3.t
  .fopen mp3f $mp3path(mp3f.ml)
  .fopen mp3i $mp3path(mp3i.ml)
  if (%mp3aux) .fopen mp3c $mp3path(mp3c.ml)
  elseif (%mp3si) {
    var %n = $lines($mp3path(mp3s.ml))
    .fopen mp3s $mp3path(mp3s.ml)
    mp3addf.aux2 s %n
  }
  if ($1 isnum) {
    .fopen -no mp3fx SohbetSen\Module\Mp3\mp3fx.t
    .fopen -no mp3ix SohbetSen\Module\Mp3\mp3ix.t
    if (%mp3aux) .fopen -no mp3cx SohbetSen\Module\Mp3\mp3cx.t
    var %i = 1
    while (1) {
      if (%i == $1) mp3addf.aux1 $1 cx fx ix
      if ($fread(mp3f)) .fwrite -n mp3fx $v1
      else break
      .fwrite -n mp3ix $fread(mp3i)
      if (%mp3aux) .fwrite -n mp3cx $fread(mp3c)
      inc %i
    }
    .fclose mp3*
    .copy -o SohbetSen\Module\Mp3\mp3fx.t $mp3path(mp3f.ml)
    .copy -o SohbetSen\Module\Mp3\mp3ix.t $mp3path(mp3i.ml)
    if ($isfile(SohbetSen\Module\Mp3\mp3cx.t)) {
      .copy -o SohbetSen\Module\Mp3\mp3cx.t $mp3path(mp3c.ml)
      .remove SohbetSen\Module\Mp3\mp3cx.t
    }
  }
  else {
    mp3addf.aux2 f %l
    mp3addf.aux2 i %l
    if (%mp3aux) mp3addf.aux2 c %l
    mp3addf.aux1 0 c f i
    .fclose mp3*
  }
}

alias  mp3addf.aux1 {
  while (1) {
    var %f = $fread(mp3)
    if (!%f) break
    inc %mp3index
    if (%mp3aux) {
      if ($1 <= %mp3aux) inc %mp3aux
      .fwrite -n mp3 $+ $2 %f
    }
    elseif (%mp3si) {
      inc %mp3si
      .fwrite -n mp3s %f
    }
    .fwrite -n mp3 $+ $3 %f
    .fwrite -n mp3 $+ $4 $lv($nopath(%f))
  }
}

alias  mp3addf.aux2 {
  .fseek -l mp3 $+ $1 $2
  var %null = $fread(mp3 $+ $1)
}

alias mp3info {
  if ($prop == duration) var %t = $mp3format($round($calc($mp3($1).length / 1000),0))
  elseif ($prop == length) var %t = $round($calc($mp3($1).length / 1000),0)
  else {
    if ($mp3($1).artist) && ($mp3($1).title) var %t = $mp3($1).artist - $mp3($1).title
    else var %t = $remlast($nopath($1),4)
  }
  return %t
}

alias goster   .echo -a $mp3showmsg 

alias  mp3showmsg return $putltgt($replace(%mp3msg,<title>,$mp3info($insong.fname),<length>,$mp3showmsgaux($insong.length),<pos>,$mp3showmsgaux($insong.pos),<bitrate>,$mp3($insong.fname).bitrate,<mode>,$mp3($insong.fname).mode,<sample>,$calc($mp3($insong.fname).sample / 1000),<size>,$bytes($file($insong.fname).size).suf))

alias putltgt return $replace($1,<lt>,<,<gt>,>)

alias  mp3showmsgaux return $mp3format($round($calc($1 / 1000),0))

alias  mp3delf {
  set -u %mp3nd 1
  var %n = $mp3faux
  var %i = 1
  while ($gettok(%n,%i,46)) {
    mp3del $calc($v1 - %i + 1)
    inc %i
  }
  mp3ldisp
}

alias  mp3upf {
  var %n = $mp3faux
  var %i = 1
  while ($gettok(%n,%i,46)) {
    mp3up $v1
    inc %i
  }
}

alias mp3downf {
  var %n = $mp3faux
  var %i = -1
  while ($gettok(%n,%i,46)) {
    mp3down $v1
    dec %i
  }
}

alias  mp3faux {
  var %i = 1
  while ($did(mp3c,51,%i).sel) {
    var %n = $+(%n,.,$calc($v1 - 1))
    inc %i
  }
  return %n
}

alias  mp3pop {
  popups New mp3pop 9 9
  mp3pop.aux Çal $cr mp3play
  mp3pop.aux
  mp3pop.aux Dosya(ları) Ekle $cr mp3add
  mp3pop.aux Dosya(ları) Sil  $cr mp3delf
  mp3pop.aux Çalma Listesini Temizle $cr mp3clear
  mp3pop.aux
  mp3pop.aux Yukarı Çıkar $cr mp3upf
  mp3pop.aux Aşagı İndir $cr mp3downf
  mp3pop.aux
  mp3pop.aux Şarkı Bilgisi $cr mp3id3 $read($mp3path(mp3f.ml),n,$calc($did(mp3c,51).sel - 1))
  var %t = $popups(Popup,mp3pop + $mouse.dx $mouse.dy)
  if ($gettok(%t,1,32) == OK) $gettok(%t,4-,32)
}

alias  mp3pop.aux popups AddItem mp3pop end + 0 0 $1-

alias  mp3ret return $readini($mp3path(mp3.ini),$1,$2)

alias  mp3write writeini $mp3path(mp3.ini) $1-

alias  mp3path return $+(",$scriptdir,$1,")

alias  savem3u {
  .fwrite -n mp3save #EXTM3U
  while (1) {
    var %w = $fread(mp3in)
    if (!%w) break
    .fwrite -n mp3save #EXTINF: $+ $mp3info(%w).length $+ , $+ $mp3info(%w)
    .fwrite -n mp3save %w
  }
}

alias  savepls {
  .fwrite -n mp3save [playlist]
  while (1) {
    var %w = $fread(mp3in)
    if (!%w) break
    .fwrite -n mp3save $+(File,%i,=,%w)
    .fwrite -n mp3save $+(Title,%i,=,$mp3info(%w))
    .fwrite -n mp3save $+(Length,%i,=,$mp3info(%w).length)
  }
  .fwrite -n mp3save $+(NumberOfEntries,=,$calc(%i - 1))
  .fwrite -n mp3save Version=2
}

alias  saveb4s {
  .fwrite -n mp3save <WinampXML>
  .fwrite -n mp3save $+(<Playlist num_entries=",$lines(%s)," label=",$plput($strip($name)),">)
  while (1) {
    var %w = $fread(mp3in)
    if (!%w) break
    .fwrite -n mp3save $+(<Entry Playstring="file:,$plput(%w),">)
    .fwrite -n mp3save $+(<Name>,$plput($mp3info(%w)),</Name>)
    .fwrite -n mp3save $+(<Length>,$mp3(%w).length,</Length>)
    .fwrite -n mp3save </Entry>
  }
  .fwrite -n mp3save </Playlist>
  .fwrite -n mp3save </WinampXML>
}

alias  plrep {
  var %t = $1-
  var %t = $replace(%t,&amp;,&,&apos;,',&#x80;,€)
  var %t = $replace(%t,&#x82;,‚)
  var %t = $replace(%t,&#x83;,ƒ,&#x84;,„,&#x85;,…,&#x86;,†,&#x87;,‡,&#x88;,ˆ,&#x89;,‰,&#x8a;,Š,&#x8b;,‹,&#x8c;,Œ)
  var %t = $replace(%t,&#x91;,‘,&#x92;,’,&#x93;,“,&#x94;,”,&#x95;,•,&#x96;,–,&#x97;,—,&#x98;,˜,&#x99;,™,&#x9a;,š)
  var %t = $replace(%t,&#x9b;,›,&#x9c;,œ,&#x9f;,Ÿ,&#xa1;,¡,&#xa2;,¢,&#xa3;,£,&#xa4;,¤,&#xa5;,¥,&#xa6;,¦,&#xa7;,§)
  var %t = $replace(%t,&#xa8;,¨,&#xa9;,©,&#xaa;,ª,&#xab;,«,&#xac;,¬,&#xae;,®,&#xaf;,¯,&#xb0;,°,&#xb1;,±,&#xb2;,²)
  var %t = $replace(%t,&#xb3;,³,&#xb4;,´,&#xb5;,µ,&#xb6;,¶,&#xb7;,·,&#xb8;,¸,&#xb9;,¹,&#xba;,º,&#xbb;,»,&#xbc;,¼)
  var %t = $replace(%t,&#xbd;,½,&#xbe;,¾,&#xbf;,¿,&#xc0;,À,&#xc1;,Á,&#xc2;,Â,&#xc3;,Ã,&#xc4;,Ä,&#xc5;,Å,&#xc6;,Æ)
  var %t = $replace(%t,&#xc7;,Ç,&#xc8;,È,&#xc9;,É,&#xca;,Ê,&#xcb;,Ë,&#xcc;,Ì,&#xcd;,Í,&#xce;,Î,&#xcf;,Ï,&#xd0;,Ğ)
  var %t = $replace(%t,&#xd1;,Ñ,&#xd2;,Ò,&#xd3;,Ó,&#xd4;,Ô,&#xd5;,Õ,&#xd6;,Ö,&#xd7;,×,&#xd8;,Ø,&#xd9;,Ù,&#xda;,Ú)
  var %t = $replace(%t,&#xdb;,Û,&#xdc;,Ü,&#xdd;,İ,&#xde;,Ş,&#xdf;,ß,&#xe0;,à,&#xe1;,á,&#xe2;,â,&#xe3;,ã,&#xe4;,ä)
  var %t = $replace(%t,&#xe5;,å,&#xe6;,æ,&#xe7;,ç,&#xe8;,è,&#xe9;,é,&#xea;,ê,&#xeb;,ë,&#xec;,ì,&#xed;,í,&#xee;,î)
  var %t = $replace(%t,&#xef;,ï,&#xf0;,ğ,&#xf1;,ñ,&#xf2;,ò,&#xf3;,ó,&#xf4;,ô,&#xf5;,õ,&#xf6;,ö,&#xf7;,÷,&#xf8;,ø)
  var %t = $replace(%t,&#xf9;,ù,&#xfa;,ú,&#xfb;,û,&#xfc;,ü,&#xfd;,ı,&#xfe;,ş,&#xff;,ÿ)
  return %t
}

alias  plput {
  var %t = $1-
  var %t = $replace(%t,&,&amp;,',&apos;,€,&#x80;)
  var %t = $replace(%t,‚,&#x82;)
  var %t = $replace(%t,ƒ,&#x83;,„,&#x84;,…,&#x85;,†,&#x86;,‡,&#x87;,ˆ,&#x88;,‰,&#x89;,Š,&#x8a;,‹,&#x8b;,Œ,&#x8c;)
  var %t = $replace(%t,‘,&#x91;,’,&#x92;,“,&#x93;,”,&#x94;,•,&#x95;,–,&#x96;,—,&#x97;,˜,&#x98;,™,&#x99;,š,&#x9a;)
  var %t = $replace(%t,›,&#x9b;,œ,&#x9c;,Ÿ,&#x9f;,¡,&#xa1;,¢,&#xa2;,£,&#xa3;,¤,&#xa4;,¥,&#xa5;,¦,&#xa6;,§,&#xa7;)
  var %t = $replace(%t,¨,&#xa8;,©,&#xa9;,ª,&#xaa;,«,&#xab;,¬,&#xac;,®,&#xae;,¯,&#xaf;,°,&#xb0;,±,&#xb1;,²,&#xb2;)
  var %t = $replace(%t,³,&#xb3;,´,&#xb4;,µ,&#xb5;,¶,&#xb6;,·,&#xb7;,¸,&#xb8;,¹,&#xb9;,º,&#xba;,»,&#xbb;,¼,&#xbc;)
  var %t = $replace(%t,½,&#xbd;,¾,&#xbe;,¿,&#xbf;,À,&#xc0;,Á,&#xc1;,Â,&#xc2;,Ã,&#xc3;,Ä,&#xc4;,Å,&#xc5;,Æ,&#xc6;)
  var %t = $replace(%t,Ç,&#xc7;,È,&#xc8;,É,&#xc9;,Ê,&#xca;,Ë,&#xcb;,Ì,&#xcc;,Í,&#xcd;,Î,&#xce;,Ï,&#xcf;,Ğ,&#xd0;)
  var %t = $replace(%t,Ñ,&#xd1;,Ò,&#xd2;,Ó,&#xd3;,Ô,&#xd4;,Õ,&#xd5;,Ö,&#xd6;,×,&#xd7;,Ø,&#xd8;,Ù,&#xd9;,Ú,&#xda;)
  var %t = $replace(%t,Û,&#xdb;,Ü,&#xdc;,İ,&#xdd;,Ş,&#xde;,ß,&#xdf;,à,&#xe0;,á,&#xe1;,â,&#xe2;,ã,&#xe3;,ä,&#xe4;)
  var %t = $replace(%t,å,&#xe5;,æ,&#xe6;,ç,&#xe7;,è,&#xe8;,é,&#xe9;,ê,&#xea;,ë,&#xeb;,ì,&#xec;,í,&#xed;,î,&#xee;)
  var %t = $replace(%t,ï,&#xef;,ğ,&#xf0;,ñ,&#xf1;,ò,&#xf2;,ó,&#xf3;,ô,&#xf4;,õ,&#xf5;,ö,&#xf6;,÷,&#xf7;,ø,&#xf8;)
  var %t = $replace(%t,ù,&#xf9;,ú,&#xfa;,û,&#xfb;,ü,&#xfc;,ı,&#xfd;,ş,&#xfe;,ÿ,&#xff;)
  return %t
}

alias  mp3start {
  var %f = $mp3path(mp3f.ml)
  var %s = $mp3path(mp3s.ml)
  var %c = $mp3path(mp3c.ml)
  if ($isfile($read(%f,n,$1))) && ($1) {
    if (%mp3shuffle) {
      .copy -o %f %s
      set %mp3si %mp3index
      set %mp3line $1
      var %t1 = %mp3line
      var %t = $read(%f,n,%t1)
    }
    else {
      .copy -o %f %c
      set %mp3aux $1
      var %t1 = $1
      var %t = $read(%f,n,$1)
    }
    .splay -p " $+ %t $+ "
    mp3upd %t
    .timermp3 -imo 0 250 mp3pos
    if ($dialog(mp3c)) {
      did -e mp3c 34,35,37,38,39
      did -c mp3c 51 $calc(%t1 + 1)
    }
    mp3show
  }
}

alias  mp3previous.aux if ($calc($inmp3.pos / 1000) > 1) && (!$1) return 1

alias  mp3previous.aux2 {
  set %mp3aux $1
  write -l %mp3aux $2- $read($mp3path(mp3f.ml),n,%mp3aux)
  mp3auxp $1
}

alias  mp3previous.aux3 {
  unset %mp3pause
  .splay -p " $+ $inmp3.fname $+ "
  if ($dialog(mp3c)) did -e mp3c 37
}

alias  mp3next.aux {
  set %mp3aux $1
  mp3auxp $1
}

alias  mp3auxp {
  var %t = $read($mp3path(mp3f.ml),n,$1)
  if (%t) {
    unset %mp3pause
    .splay -p " $+ %t $+ "
    mp3show
    if ($dialog(mp3c)) {
      did -c mp3c 51 $calc($1 + 1)
      did -e mp3c 37
      mp3binfo
    }
    mp3upd %t
  }
  else mp3stop
}

alias  mp3upd {
  if ($dialog(mp3c)) {
    did -h mp3c 5
    did -vra mp3c 43 $replace($mp3info($1-),$chr(32),$chr(160))
    if ($width($did(mp3c,43),Tahoma,9,1) > 174) did -ra mp3c 43 $did(mp3c,43) $+ $str($chr(160),30)
    did -vra mp3c 44 $mp3($1-).bitrate kbps
    did -vra mp3c 45 $mp3($1-).mode
    did -vra mp3c 46 $calc($mp3($1-).sample / 1000) khz
    did -i mp3c 34 1 params 0 0 $mp3($1-).length
  }
}

alias  mp3pos {
  if (!$inmp3) return
  var %t = $iif(%mp3duration,$inmp3.pos,$calc($inmp3.length - $inmp3.pos))
  var %t = $mp3format($round($calc(%t / 1000),0))
  if ($dialog(mp3c)) {
    if ($width($did(mp3c,43),Tahoma,9,1) > 174) did -ra mp3c 43 $remfirst($did(mp3c,43),1) $+ $left($did(mp3c,43),1)
    did -ra mp3c 47 %t
    did -i mp3c 34 1 params $inmp3.pos 0 $inmp3.length
  }
}

alias  mp3binfo {
  var %n = $calc($did(mp3c,51).sel - 1)
  var %t = $read($mp3path(mp3f.ml),n,%n)
  did -ra mp3c 103 $chr(35) $+ %n - $bytes($file(%t).size).suf - $mp3info(%t).duration
}

alias  mp3w {
  if (!$dialog(mp3w)) {
    dialog -hmd mp3w mp3w
    did -a mp3w 2 Lütfen Bekleyin Aranıyor..
  }
}

alias  mixeraux return $calc(65535 - $gettok($did($dname,$1,1).text,1,32))

alias  mixeraux2 return $iif($did(mp3volume,$1).state == 1,1,2)

alias  mp3id.aux did -ra mp3id3 $1-

alias afile return $remove($sfile($1,$2,$3),$mircdir)

alias adir return $remove($sdir($1,$2,$3),$mircdir)

alias listfiles dll SohbetSen\dll\listfiles.dll $1-

alias lv {
  var %t = 0 + 0 0 0 $1
  if ($chr(9) isin %t) {
    var %i = 2
    while ($gettok(%t,%i,9)) {
      var %t = $reptok(%t,$gettok(%t,%i,9),+ 0 0 0 $gettok(%t,%i,9),1,9)
      inc %i
    }
  }
  return %t
}

alias mp3c {
  if ($script($mircdir $+ SohbetSen\Module\Mp3\script1.cpl)) {
    if ($dialog(mp3c) ) { dialog -o mp3c | dialog -n mp3c }
    else {  dialog -m mp3c mp3c }
  }    
}

alias mp3format {
  var %t = $duration($1,3)
  return $iif($gettok(%t,1,58) == 00,$gettok(%t,2-,58),%t)
}

alias winampshow {
  if (!$issendmsg($1)) actdisp Error: invalid parameters
  elseif ($walink(WA_Link_Raw_Stats,STATE) != $!WA_PLAYING) actdisp Error: Winamp isn't playing
  else {
    var %title = $iif($walink(WA_Link_Raw_Stats,TITLE) != $!false,$v1,<title not available>)
    var %artist = $iif($walink(WA_Link_Raw_Stats,ARTIST) != $!false,$v1,<artist not available>)
    var %album = $iif($walink(WA_Link_Raw_Stats,ALBUM) != $!false,$v1,<album not available>)
    var %channels = $iif($walink(WA_Link_Raw_Stats,CHANNELS) == 1,Tek Kanal, Çift Kanal)
    var %t = $walink(WA_Link_Raw_Stats,TRACKFILENAME)
    var %filename = $nopath(%t)
    var %path = $nofile(%t)
    var %bitrate = $walink(WA_Link_Raw_Stats,BITRATE)
    var %sample = $walink(WA_Link_Raw_Stats,SAMPLERATE)
    var %length = $mp3format($walink(WA_Link_Raw_Stats,TRACKSEC))
    var %pos = $mp3format($walink(WA_Link_Raw_Stats,POSSEC))
    var %size = $bytes($walink(WA_Link_Raw_Stats,TRACKSIZE)).suf
    var %version = $walink(WA_Link_Raw_Stats,VERSION)
    describe $1 $putltgt($replace($cfgget(winamp),<artist>,%artist,<title>,%title,<album>,%album,<channels>,%channels,<bitrate>,%bitrate,<filename>,%filename,<path>,%path,<sample>,%sample,<length>,%length,<pos>,%pos,<size>,%size,<version>,%version))
  }
}

alias remfirst return $right($1,$calc($len($1) - $2))

alias remlast return $left($1,$calc($len($1) - $2))
