FoRuM KaNaLa #chanel

FoRuM KaNaLa #chanel
 
PrijemPrijem  PortalliPortalli  Često Postavljana PitanjaČesto Postavljana Pitanja  TražiTraži  Registruj seRegistruj se  Lista članovaLista članova  Korisničke grupeKorisničke grupe  Pristupi  

Delite | 
 

 Mp3 Player

Ići dole 
AutorPoruka
^^^^Car^^^^
Member
Member


Broj poruka : 92
Location : Sombor
Datum upisa : 16.08.2007

PočaljiNaslov: Mp3 Player   Ned Avg 19, 2007 7:14 pm

Kod:
;--------------------------
; mp3 Player za mIRC v6.1 samo za Ripere
;--------------------------
; Napisao |S|E|R|B|, a vi sada ako hocete rippajte:D:D
; <reiper@ripercina.com>
;

menu channel {
  mp3Player:{
    if ($dialog(mmp3)) { dialog -ve mmp3 mmp3 }
    else { dialog -md mmp3 mmp3 }
  }
}

; DIALOG

dialog mmp3 {
  title "mp3Play-er"
  option dbu
  size -1 -1 200 210

  box "",240, 1 1 198 33

  text "Nista ne svira", 1, 4 7 154 7
  text "00:00 / 00:00",2,160 7 37 7

  button "<--",100,4 20 37 12
  button "&Sviraj",101,42 15 38 12
  button "Pauzira&j",102,81 20 38 12
  button "&Zaustavi",103,120 15 38 12
  button "-->",104,159 20 38 12

  box "",241, 1 40 198 169

  list 3, 3 36 194 154, hsbar, vsbar, sort
  button "+ Fajl",105, 4 188 28 10
  button "+ Dir",106, 34 198 28 10
  button "- Brisi",107, 138 198 28 10
  button "- Sve",108, 168 188 28 10
  text "Addon napisao        |S|E|R|B|",109, 77 188 38 12

  menu "&Fajl",150
  menu "&Opcije", 170

  item "Dodaj &Fajl",151,150
  item "Dodaj &Dir",152,150
  item break,153,150
  item "Obrisi &Selektovane",154,150
  item "Obrisi &Sve",155,150
  item break,156,150
  item "&Loaduj Listu",157,150,
  item "Sacuvaj &List",158,150
  item break,159,150
  item "I&zadji",160,150

  menu "Sviraj &Selekcija",183,170
  item "&Jednom",184,183
  item "&Stalno",185,183

  menu "Sviraj &Poredu",171,170
  item "&Normalno",172,171
  item "&Neodabrano",173,171

  item break,177,170

  menu "&Pokazi",178,170
  item "O&n",179,178
  item "O&ff",180,178
  item break,181,178
  item "&Doteraj",182,178

  button "", 255,0 0 0 0, ok default
}

; EVENTS

;dialog init
on *:dialog:mmp3:init:0:startup

; +Fajl button
on *:dialog:mmp3:sclick:105:plusfile

; +Dir button
on *:dialog:mmp3:sclick:106:plusdir

; -Izab button
on *:dialog:mmp3:sclick:107:minsel

; -Sve button
on *:dialog:mmp3:sclick:108:minall

; Sviraj button
on *:dialog:mmp3:sclick:101:playmp3

; Pauziraj button
on *:dialog:mmp3:sclick:102:pausemp3

; Zaustavi button
on *:dialog:mmp3:sclick:103:stopmp3

; Sledeci button
on *:dialog:mmp3:sclick:104:playnext

; Prosli button
on *:dialog:mmp3:sclick:100:playprev

; double click mp3
on *:dialog:mmp3:dclick:3:playmp3

; menu add file
on *:dialog:mmp3:menu:151:plusfile

; menu add dir
on *:dialog:mmp3:menu:152:plusdir

; menu del sel
on *:dialog:mmp3:menu:154:minsel

; menu del all
on *:dialog:mmp3:menu:155:minall

; menu load playlist
on *:dialog:mmp3:menu:157:loadplaylist

; menu save playlist
on *:dialog:mmp3:menu:158:saveplaylist

; menu exit
on *:dialog:mmp3:menu:160:dialog -x mmp3

; halt enter
on *:dialog:mmp3:sclick:255:halt

; menu play mode single
on *:dialog:mmp3:menu:184:modesingle

; menu play mode continuous
on *:dialog:mmp3:menu:185:modecontin

; menu play order normal
on *:dialog:mmp3:menu:172:ordernormal

; menu play order shuffle
on *:dialog:mmp3:menu:173:ordershuffle

; menu announce on
on *:dialog:mmp3:menu:179:announceon

; menu announce off
on *:dialog:mmp3:menu:180:announceoff

; configure announce
on *:dialog:mmp3:menu:182:$dialog(mannounce,mannounce)

; on exit : cleanup
on *:exit:cleanup

; on load
on *:load:.unset %mmp3-* | echo -a Dobro dosli, hvala vam na odabiru mojega prvog SAMONAPISANOG addona, moze da ripp ili kako hod hocete ali samo ja znam kako je lepo zavrsiti ovo:)Bilo kakve bugs, nadjite me odmah da mi prijavite, hvala. Naravno posetite nas na www.IRC-Srbadija.cjb.net

; ALIASES

alias -l mp3list return sounds\mp3list.mrc
alias -l mp3src return sounds\mp3src.mrc
alias -l mp3player { if ($dialog(mmp3)) return $true }
alias -l history return sounds\history.tmp

alias -l cleanup {
  unset %mmp3-paused
  .remove $history
}

alias -l announceoff {
  if (%mmp3-announce) { unset %mmp3-announce | did -u mmp3 179 }
  did -c mmp3 180
}

alias -l announceon {
  if (!%mmp3-announce) { set %mmp3-announce true | did -u mmp3 180 }
  did -c mmp3 179
}

alias -l ordernormal {
  if (%mmp3-shuffle) { unset %mmp3-shuffle | did -u mmp3 173 }
  did -c mmp3 172
}

alias -l ordershuffle {
  if (!%mmp3-shuffle) { set %mmp3-shuffle true | did -u mmp3 172 }
  did -c mmp3 173
}

alias -l modesingle {
  if (%mmp3-contin) { unset %mmp3-contin | did -u mmp3 185 }
  did -c mmp3 184
}

alias -l modecontin {
  if (!%mmp3-contin) { set %mmp3-contin true | did -u mmp3 184 }
  did -c mmp3 185
}


alias -l startup {
  if (%mmp3-paused) { unset %mmp3-paused }
  if (%mmp3-shuffle) { did -c mmp3 173 }
  else { did -c mmp3 172 }
  if (%mmp3-announce) { did -c mmp3 179 }
  else { did -c mmp3 180 }
  if (%mmp3-contin) { did -c mmp3 185 }
  else { did -c mmp3 184 }
  .timer -m 1 1 addmp3
}

alias -l saveplaylist {
  :begin
  var %file = $sfile(*.mpl,Sacuvaj Listu ...,Ok)
  if (%file) {
    if ($right(%file,4) !== .mpl) {
      var %tmp = $input(Pogresan fajl .mpl !,260,Greska)
      goto begin
    }
    if ($len($nopath(%file)) == 4) {
      var %tmp = $input(Pogresan fajl odabran! Playliste treba da imaju .mpl i ime fajl!,260,Greska)
      goto begin
    }
    :continue
    .copy -o $mp3list %file
    .copy -o $mp3src $left(%file,$calc($len(%file) - 4)) $+ .src
  }
}

alias -l loadplaylist {
  :begin
  var %file = $sfile(*.mpl,Odaberi listu...,Ok)
  if ($isfile(%file)) {

    minall
    .copy -o %file $mp3list
    .copy -o $left(%file,$calc($len(%file) - 4)) $+ .src $mp3src
    addmp3
  }
}

alias -l minsel {
  var %tmp = $read($mp3list, swt, $did(mmp3,3).sel)
  write -dl $+ $readn $mp3src
  write -dl $+ $readn $mp3list
  did -d mmp3 3 $did(mmp3,3).sel
}

alias -l minall {
  .remove $mp3list
  .remove $mp3src
  did -r mmp3 3
}

alias -l plusfile {
  var %file = $sfile(*.mp3,Izaberi mp3..,Ok)
  if (%file) {
    addlist %file
    addmp3 %file
  }
}
alias -l plusdir {
  unset %mp3dir
  set %mp3dir $sdir(Izaberi directory, Ok)
  echo -a dir: %mp3dir
  if (%mp3dir) { set %i 1 | set %total $findfile(%mp3dir,*.mp3,0) | echo -a Dodavanje %total mp3 pesama, ovo ce malo potrajati, zavisno od file-a ... | .timermp3list 0 0 makelist }
}
alias makelist {
  if (%i <= %total) {
    var %file = $findfile(%mp3dir,*.mp3,%i)
    if (!$read($mp3src,w,%file)) {
      write $mp3src %file
      write $mp3list $getinfo(%file)
    }
    inc %i
  }
  else { .timermp3list off | echo -a Zavrseno dodavanje...dodano je %total mp3 pesama u listu, sada uzivaj uz pesme po tvome izboru:-) mp34Player pr0tect3d | unset %i | unset %total | unset %mp3dir | addmp3 }
}
alias -l addmp3 {
  var %count = $lines($mp3list)
  if ($1) {
    did -a mmp3 3 $read($mp3list,%count)
  }
  else {
    did -r mmp3 3
    var %i = 1
    while (%i <= %count) {
      did -a mmp3 3 $read($mp3list,%i)
      inc %i
    }
  }
  did -z mmp3 3
}
alias -l addlist {
  var %file = $1-
  if (!$read($mp3src,w,%file)) {
    write $mp3src %file
    write $mp3list $getinfo(%file)
  }
}
alias -l getinfo {
  var %x = $1-
  var %artist = $mp3(%x).artist
  var %title = $mp3(%x).title
  if ((%artist == $null) || (%title == $null)) {
    return $left($nopath(%x),$calc($len($nopath(%x)) - 4))
  }
  else { return %artist - %title }
}

alias -l playmp3 {
  if ($did(mmp3,3).sel) {
    did -a mmp3 1 $did(mmp3,3).seltext
    dialog -t mmp3 $did(mmp3,3).seltext
    .timersetinfo 0 1 setinfo
    if (%mmp3-paused) {
      unset %mmp3-paused
      splay resume
    }
    else {
      var %tmp = $read($mp3list,swt,$did(mmp3,3).seltext)
      var %src = $read($mp3src,$readn)
      .splay -p %src
      if (%mmp3-announce) { announce %src }
    }
  }
  else {
    var %tmp = $input(Nista nije izabrano!,260, Greska)
    dialog -ve mmp3
  }
  write $history $did(mmp3,3).seltext
}

alias -l stopmp3 {
  splay stop
  did -a mmp3 2 00:00 / 00:00
  did -a mmp3 1 Nista ne svira
  dialog -t mmp3 ScPlayer
  if (%mmp3-paused) { unset %mmp3-paused }
  .timersetinfo off
}

alias -l pausemp3 {
  if (%mmp3-paused) { unset %mmp3-paused | splay resume | .timersetinfo 0 1 setinfo }
  else { splay pause | set %mmp3-paused true | .timersetinfo off }
}

alias -l setinfo {
  if ($mp3player) {
    if ($inmp3) {
      var %long = $calc($int($calc($inmp3.pos / 1000)) / 60)
      var %mins = $int(%long)
      var %secs = $calc(%long - %mins)
      var %secs = $round($calc(%secs * 60),0)
      if (%mins < 10) { %mins = $+(0,%mins) }
      if (%secs < 10) { %secs = $+(0,%secs) }

      did -a mmp3 2 $+(%mins,:,%secs) / $getlength($inmp3.fname)
    }
    else {
      .timersetinfo off
      if (!%mmp3-contin) { stopmp3 }
      else {
        if (!%mmp3-shuffle) { playnext }
        else { shuffle }
        playmp3
      }
    }
  }
  else { splay stop | .timersetinfo off }
}

alias -l getlength {
  return $right($duration($calc($mp3($inmp3.fname).length / 1000),3),4)
}

alias -l playnext {
  if (%mmp3-shuffle) { shuffle }
  else {
    if ($did(mmp3,3).sel == $did(mmp3,3).lines) { did -c mmp3 3 1 }
    else { did -c mmp3 3 $calc($did(mmp3,3).sel + 1) }
    if ($inmp3) { unset %mmp3-paused | playmp3 }
  }
  if ($inmp3) { unset %mmp3-paused | playmp3 }
}

alias -l shuffle {
  if (%mmp3-paused) { unset %mmp3-paused }
  did -c mmp3 3 $rand(1,$did(mmp3,3).lines)
}

alias -l playprev {
  var %tmp = $read($history,w, $did(mmp3,3).seltext)
  did -c mmp3 3 $didwm(mmp3,3,$read($history,$calc($readn - 1)))
  write -d $history
  if ($inmp3) { unset %mmp3-paused | playmp3 }
}

alias -l announce {
  if ($server) {
    if (!%mmp3-noid3) {
      echo -at Nijedan setings nije nadjen u ScPlayeru. Probaj da to sredis..
      $dialog(mannounce,mannounce)
    }
    var %artist = $mp3($1-).artist
    var %title = $mp3($1-).title
    if ((%artist == $null) || (%title == $null)) {
      var %msg = $replace(%mmp3-noid3,&filename,$left($nopath($inmp3.fname),$calc($len($nopath($inmp3.fname)) - 4)))
    }
    else {
      var %msg = $replace(%mmp3-msg,&artist,%artist,&title,%title)
    }
    if (!%mmp3-sep) { set %mmp3-sep <> }
    if (%mmp3-saylen) { %msg = $+(%msg,$chr(160),%mmp3-sep $getlength($inmp3.fname)) }
    if (%mmp3-saybit) { %msg = $+(%msg,$chr(160),%mmp3-sep $mp3($inmp3.fname).bitrate,Kbs) }
    if (%mmp3-saysize) { %msg = $+(%msg,$chr(160),%mmp3-sep $bytes($file($inmp3.fname).size,m),Mb) }

    if (!%mmp3-ann) { set %mp3-ann all }
    if (%mmp3-ann == all) {
      var %chans = $chan(0)
      var %i = 1
      while (%i <= %chans) {
        var %t = $replace(%msg,&chan,$chan(%i))
        %t
        inc %i
      }
    }
    else {
      if (%mmp3-ann == dont) {
        var %chans = $chan(0)
        var %i = 1
        while (%i <= %chans) {
          if ( $matchtok(%mmp3-chans-dont,$chan(%i),1,$chr(44)) ) { }
          else {
            var %t = $replace(%msg,&chan,$chan(%i))
            %t
          }
          inc %i
        }
      }
      elseif (%mmp3-ann == only) {
        var %chans = $chan(0)
        var %i = 1
        while (%i <= %chans) {
          if ( $matchtok(%mmp3-chans-only,$chan(%i),1,$chr(44)) ) {
            var %t = $replace(%msg,&chan,$chan(%i))
            %t
          }
          inc %i
        }
      }
    }
  }
}

;=========================================================================================================

; MMP3 ANNOUNCE CONFIG DIALOG

; Dialog
dialog mannounce {
  size -1 -1 150 160
  title "mp3Player konfiguracija"
  option dbu

  box "Misc. Opcije",254, 2 2 146 30

  check "Duzina pesme",1,5 11 60 7
  check "Reci kbs-e",2,5 22 60 7
  check "Reci tezinu fajla",3,75 11 60 7
  text "Separator:",250,75 22 30 7
  edit "",70,104 19 25 11,limit 5

  box "Chan Opcije",253,2 35 146 41

  radio "msg na sve kanale",10,5 44 68 7
  radio "Ne salji na ove kanale:",11,5 55 69 7
  edit "#chan1,#chan2,...",20,75 52 70 11,autohs
  radio "msg na samo ove kanale:",12,5 66 69 7
  edit "#chan1,#chan2,...",21,75 63 70 11,autohs

  box "Poruka",252,2 78 146 65
  edit "",50,5 85 140 11,autohs
  text "Ako pesma nema naziv : ",251,10 100 100 7
  edit "",51,10 108 135 11
  text "Vazno: Ne koristiti /ame ili /amsg u vasoj poruci, koristi /describe ili /msg!!!",249,5 123 135 15
  text "Posetite nas na irc.krstarica.com na kanal #Srbadija",209,5 136 135 15

  button "Ok",200,60 146 30 12

  button "",255,0 0 0 0, ok default
}

; Events

on *:dialog:mannounce:init:0:{
  if (%mmp3-saylen) { did -c mannounce 1 }
  if (%mmp3-saybit) { did -c mannounce 2 }
  if (%mmp3-saysize) { did -c mannounce 3 }

  if (!%mmp3-sep) { set %mmp3-sep <> }
  did -a mannounce 70 %mmp3-sep

  if (!%mmp3-ann) { %mmp3-ann = all }
  if (%mmp3-ann == all) { did -c mannounce 10 | did -b mannounce 20,21 }
  if (%mmp3-ann == dont) { did -c mannounce 11 | did -b mannounce 21 }
  if (%mmp3-ann == only) { did -c mannounce 12 | did -b mannounce 20 }
  did -ra mannounce 20 %mmp3-chans-dont
  did -ra mannounce 21 %mmp3-chans-only

  if (!%mmp3-msg) { %mmp3-msg = /describe &chan slusa &artist - &title ~*Srpska Skripta*~ }
  did -a mannounce 50 %mmp3-msg
  if (!%mmp3-noid3) { %mmp3-noid3 = /describe &chan slusa &filename ~*Srpska Skripta*~ }
  did -a mannounce 51 %mmp3-noid3
}

; Ok button
on *:dialog:mannounce:sclick:200:{
  if ($did(mannounce,1).state == 1) { set %mmp3-saylen true }
  else { unset %mmp3-saylen }
  if ($did(mannounce,2).state == 1) { set %mmp3-saybit true }
  else { unset %mmp3-saybit }
  if ($did(mannounce,3).state == 1) { set %mmp3-saysize true }
  else { unset %mmp3-saysize }

  if ($did(mannounce,10).state == 1) { set %mmp3-ann all }
  if ($did(mannounce,11).state == 1) { set %mmp3-ann dont }
  if ($did(mannounce,12).state == 1) { set %mmp3-ann only }
  %mmp3-chans-dont = $did(mannounce,20).text
  %mmp3-chans-only = $did(mannounce,21).text

  set %mmp3-msg $did(mannounce,50).text
  set %mmp3-noid3 $did(mannounce,51).text

  set %mmp3-sep $did(mannounce,70).text

  dialog -x mannounce
  dialog -v mmp3
}

; radio buttons
on *:dialog:mannounce:sclick:11:{ did -e mannounce 20 | did -b mannounce 21 }
on *:dialog:mannounce:sclick:12:{ did -e mannounce 21 | did -b mannounce 20 }
on *:dialog:mannounce:sclick:10:{ did -b mannounce 20,21 }
Nazad na vrh Ići dole
Pogledaj profil korisnika
 
Mp3 Player
Nazad na vrh 
Strana 1 od 1

Dozvole ovog foruma:Ne možete odgovarati na teme u ovom forumu
FoRuM KaNaLa #chanel :: Scripting :: Addons-
Skoči na: