SHOUTcastBot v1.1 Modification(Serbian Language)

By Archer91SM on Aug 14, 2011

Hello to all hawkee members ....
Now i Modification a ShoutCastBot v1.1

Orginal Snippet is:

This is same bot snippet code but on SERBIAN Language Meybe someone need this....


!kickdj - Kick DJ

!dj - DJ Info

!radio , !link , !url - for makreting your radio

!slusaoci - Listeners Info

NOTICE: All is on serbian language ........ and i think missing one break code "}"

;Ovaj bot snippet slobodno mozete umnozavati,kopirati i davati drugima
;ali ga nikako ne smete menjati zbog samog rada skripte
;mogucnost je da prilikom vasih licnih promena pokvari i ne radi ono
;za sta je predvidjen.

;Autor ovog snippeta nije odgovoran za ne ispravnost addon-a!

;: RadioBot Snippet  ::
;: Coded by Arch3r   ::

;Pocetno loadovanje i startovanje addonsa

;; Unesite oficijalni sajt radija
;; Unesite vasu Stream Adresu radija
set 84.889.224.97 ; adresa je proizvoljna!
;; Naziv Vaseg Radija
set %radio.ime Radio @ Vash Radio
;; Radio Stream port
set %radio.port 278394 ;port je unet proizvoljno radi primera.
;; Admin Korisnicko ime
set %radio.admin admin
;; Admin Sifra
set %radio.admin.pass Vasha sifra admina
;; Sifra Streama
set %radio.pass vasa sifra za strim

;; Informacije i nadimci bota

;; Nadimak vaseg bota (Nick)
set %bot.nadimak NadimakVasheg Bota
;; Alternativni Nadimak(anick)
set %bot.anadimak Alternativni nadimak bota
;; Korisnicko ime Bota
set %bot.kime Korisnicko ime bota(username)
;; Realno ime bota
set %bot.rime Realno ime bota(Real Name)

;Podesavanje IRC Servera

;IRC Server
set %irc.server
;IRC Port
set %irc.port 6667
;IRC Radio Kanal
set %irc.chan #VasRadioKanal
;NickServ sifra za bota
set %irc.pass sifravasegbota 

;Konekcione komande
server %irc.server %irc.port -i %bot.nadimak %bot.anadimak %bot.kime %bot.rime

;: %sc.status (0 za offline, 1 za online) | %sc.bitrate (bitrate)            ::
;: %sc.clisten (Trenutno slusaoca)        | (Trenutna Pesma)        ::
;: (Trenutni DJ,Izvucen iz AIM tag)| (Sajt Radija)           ::
;: %sc.plisten (Trenutni Status Peek)     | %sc.genre (Genre Radija)         ::
;: %sc.mlisten (Maksimalan broj slusaoca) |                                  ::

;Promeni topic kanala (Bot mora da ima status @)
alias sc.title { topic %irc.chan 7,1Radio: %radio.ime 4,1Uvek sveza muzika na nashim talasima! 7,1Trenutni DJ: $iif(%sc.status == 1,, Nema) 4,1Slusajte %radio.ime na: }

; Trenutno na radiju poruka
alias sc.msg { msg %irc.chan 4Trenutno na %radio.ime : ( $+ %sc.bitrate $+ kbps)  }

;Konektuj se na Radio Server
alias sc.con {
if ($sock(sc).to == $null) { sockopen sc %radio.port }
elseif ($sock(sc).to > 8) { sockclose sc | sockopen sc %radio.port }

;Izbacivanje DJ Komanda
alias sc.kick { sockopen sckick %radio.port }

;Slanje Greske korisnicima
alias errmsg {
if ($1 == op) { msg %irc.chan 4 $nick morash biti Operater(@) da bih koristio tu komandu. }
elseif ($1 == offline) { msg %irc.chan 4Radio je iskljucen. }

;Konekcija i Identifikacija

on *:notice:*This nickname is registered and protected.*:*: { .msg NickServ IDENTIFY %irc.pass }

on *:notice:*Password accepted - you are now recognized.*:*: { .join %irc.chan }

on *:disconnect: { timers off }

on *:join:%irc.chan: { $iif($nick == $me, .timercon 0 10 sc.con) }

on *:kick:%irc.chan: { $iif($knick == $me, timers off) }

on *:part:%irc.chan: { $iif($nick == $me, timers off) }

;Funkcije Bota
on *:text:!rejoin*:%irc.chan: {
if ($nick isop %irc.chan) { hop %irc.chan }
else { errmsg op $nick }

on *:text:!info:%irc.chan: {
if ($nick isaop %irc.chan) {
.notice $nick Informacije o %radio.ime
.notice $nick Stream Adresa:  Port: %radio.port Stream Sifra: %radio.pass
.notice $nick Opis %radio.ime $+: Sajt Radija: Trenutni DJ: $iif(%sc.status == 1,, Nema) IRC Kanal: %irc.chan
else { errmsg op $nick }

on *:text:!kickdj:%irc.chan: {
if ($nick isaop %irc.chan) { sc.kick | msg %irc.chan 4Zapocinjem izbacivanje trenutnog DJ-a. }
else { errmsg op $nick }

on *:text:!dj:%irc.chan: {
if (%sc.status == 1) { msg %irc.chan 4Trenutni DJ: }
else { msg %irc.chan Radio je trenutno iskljucen. }

on *:text:!pesma:%irc.chan: {
if (%sc.status == 1) { msg %irc.chan 4Trenutno na %radio.ime ide: }
else { msg %irc.chan 4Radio je trenutno iskljucen! }

on *:text:!status:%irc.chan: {
if (%sc.status == 1) {
.notice $nick 4Status za %radio.ime 
.notice $nick 4Generalno: Trenutni DJ: | Radio Genre: %sc.genre | Bitrate: %sc.bitrate $+ kbp/s 
.notice $nick 4Slusaoci: Trenutno Slusaoca: %sc.clisten | Radio Peek: %sc.plisten | Maksimalno Slusaoca: %sc.mlisten
else { .notice $nick 4Info: Radio je trenutno iskljucen! }

on *:text:!link:%irc.chan: { .msg %irc.chan 4Radio link: }
on *:text:!url:%irc.chan: { .msg %irc.chan 4Radio URL: $+ : %radio.port $+/listen.pls }
on *:text:!radio:%irc.chan: { .msg %irc.chan 4Slusajte %radio.ime na sledecim linkovima: ili putem playera: $+ : %radio.port $+ /listen.pls }

on *:text:!slusaoci:%irc.chan: {
if (%sc.status == 1) { .msg %irc.chan Trenutno Slusaoca: %sc.clisten / Radio Peek: %sc.plisten / Maksimalno Slusaoca: %sc.mlisten / Trenutni DJ: }
else { errmsg offline $nick }
;Socket Funkcije

on *:sockopen:sckick: {
  sockwrite -nt sckick GET /admin.cgi?mode=kicksrc HTTP/1.0
  sockwrite -nt sckick User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.642.2 Safari/534.16
  sockwrite -nt sckick Accept: text/xml,application/xml,application/xhtml+xml,text/html
  sockwrite -nt sckick Authorization: Basic $encode(%cfg.user $+ : $+ %cfg.pass, m)
  sockwrite -nt sckick $crlf

on *:sockread:sckick: {
sockread -fn %tmp
if (HTTP/1.0 302 Found isin %tmp) { .msg %irc.chan DJ je izbacen. Idemooo!!! }

on *:sockopen:sc: {
  sockwrite -nt sc GET /admin.cgi?mode=viewxml HTTP/1.0
  sockwrite -nt sc User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.642.2 Safari/534.16
  sockwrite -nt sc Accept: text/xml,application/xml,application/xhtml+xml,text/html
  sockwrite -nt sc Authorization: Basic $encode(%cfg.user $+ : $+ %cfg.pass, m)
  sockwrite -nt sc $crlf
on *:sockread:sc: {
  sockread -fn %tmp

  ; Strips unnecessary XML
  if (<?xml !isin %tmp) { HALT }

  set %tmp $mid(%tmp, 2033, $calc($len(%tmp) - 2033))
  set %tmp $replace(%tmp, <CONTENT>, $chr(189))
  set %tmp $gettok(%tmp, 1, 189)

  ; Filter unconverted characters
  var %tmp $replace(%tmp, $chr(38) $+ $chr(35) $+ x27 $+ $chr(59), $chr(39), $chr(38) $+ $chr(35) $+ x26 $+ $chr(59), $chr(38), $chr(38) $+ amp $+ $chr(59), $chr(38))

  ; DJ
  var %sc $replace(%tmp, <AIM>, $chr(189), </AIM>, $chr(189))
  var %sc $left($gettok(%sc, 2, 189), $len($gettok(%sc, 2, 189)))
  if ( != %sc) { set %sc | sc.title }

  ; Bitrate
  var %sc $replace(%tmp, <BITRATE>, $chr(189), </BITRATE>, $chr(189))
  set %sc.bitrate $gettok(%sc, 2, 189)

  ; Stream status
  var %sc $replace(%tmp, <STREAMSTATUS>, $chr(189), </STREAMSTATUS>, $chr(189))
  if (%sc.status != $gettok(%sc, 2, 189)) { set %sc.status $gettok(%sc, 2, 189) | sc.title | HALT }

  ; Song title
  var %sc $replace(%tmp, <SONGTITLE>, $chr(189), </SONGTITLE>, $chr(189))
  var %sc $left($gettok(%sc, 2, 189), $len($gettok(%sc, 2, 189)))
  if ( != %sc) { set %sc | sc.msg }

  ; Current listeners
  var %sc $replace(%tmp, <CURRENTLISTENERS>, $chr(189), </CURRENTLISTENERS>, $chr(189))
  set %sc.clisten $gettok(%sc, 1, 189)

  ; Peak listeners
  var %sc $replace(%tmp, <PEAKLISTENERS>, $chr(189), </PEAKLISTENERS>, $chr(189))
  set %sc.plisten $gettok(%sc, 2, 189)

  ; Max listeners
  var %sc $replace(%tmp, <MAXLISTENERS>, $chr(189), </MAXLISTENERS>, $chr(189))
  set %sc.mlisten $gettok(%sc, 2, 189)

  ; Genre
  var %sc $replace(%tmp, <SERVERGENRE>, $chr(189), </SERVERGENRE>, $chr(189))
  set %sc.genre $gettok(%sc, 2, 189)


Sign in to comment.
Veritas   -  Aug 15, 2011

Ah okay, thnx for the help Jethro & Jaytea, I'll use it in my next script o/

Jethro   -  Aug 14, 2011

Ohhh, thanks for the heads up. I never knew that until now. I jotted 512 bytes down according to the help file. Perhaps it's time Khaled updates its info about that as well.

jaytea   -  Aug 14, 2011

The $sock().mark is a temporary storage place, which can store up to 512 bytes

despite what the documentation states, a socket's mark has been able to contain more than 512 bytes for a long time

Jethro   -  Aug 14, 2011

Using an overkill amount of global variables will have to get them unset at the end of socket operation, otherwise you occupy quite a space of variables. In this snippet, for example, it has many global and local variables combined, which make the script appear messy at first glance. The $sock().mark is a temporary storage place, which can store up to 512 bytes, where you have all the values held together for socket to refer to as you go along with its operation. If something useful is there, why not make the most of it? Just food for thought.

Veritas   -  Aug 14, 2011

Jethro I know how it works but can you explain to me why it's better than vars, I really wanna know if it's faster or not :)

Archer91SM   -  Aug 14, 2011

Jethro_ this is not my snippet only my modification for serbian language meybe someone member want a snippet with serbian language commands and infos :))))

Jethro   -  Aug 14, 2011

/sockmark and $sock($sockname).mark are two best friends you can't live without.

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.