Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##########################################################
- ##
- ## Radio-script v 1.0.3
- ##
- ## Lasst es wie es ist und gut ist
- ##
- ## mfg 2013 ©ThomasDieKleineLok
- ##
- ###########################################################
- on *:start:{
- if (!$hget(sound)) { hmake sound }
- if ($exists($qt(sound.hsh))) { hload sound $qt(sound.hsh) }
- }
- on *:connect:{ if (($hget(sound,chan)) && ($hget(sound,anaus) == 1)) { radiostart } }
- on *:text:*:#:{
- if ($1 == !radio) && ($2 == help) { msg $chan 9radio-bot befehle: | msg $chan 9!radio on 10startet das posten | msg $chan 9!radio off 10stoppt das posten | msg $chan 09!radio chan #derraum 10radio channel setzen mit | msg $chan 09!radio surl https://www.habedichlieb.de:9999/der/radiostream/zumhören.mp3 10Z.B. 10Radio stream setzen zum Zuhören. | msg $chan 09!radio url https://www.habedichlieb.de:9999/der/radiostream/ 10Z.B. 10Radio URL zum Auslesen setzen. }
- if ($1 == !radio) && ($2 == on) && ($hget(sound,chan)) { radiostart | msg $chan 10radio ist nun an... | hadd -m sound anaus 1 }
- if ($1 == !radio) && ($2 == on) && (!$hget(sound,chan)) { msg $chan 10bitte erst mit 09!radio chan #derraum 10den channel setzen }
- if ($1 == !radio) && ($2 == off) { .timerradio off | msg $chan 10radio ist nun aus... | hadd -m sound anaus 0 }
- if ($1 == !radio) && ($2 == chan) { hadd -m sound chan $3 | msg $chan 10Im Channel $+(,09,$3,10) poste ich nun die Mucke | hsave -o sound "sound.hsh" }
- if ($1 == !radio) && ($2 == surl) { hadd -m sound surl $3 | msg $chan Habe folgende Stream URL gesetz, $hget(sound,surl) | hsave -o sound "sound.hsh" }
- if ($1 == !radio) && ($2 == url) { hadd -m sound url $3 | msg $chan Habe folgende URL zum Auslesen gesetz, $hget(sound,url) | hsave -o sound "sound.hsh" }
- if ($1 == !radio) && ($2 == stats) {
- msg $hget(sound,chan) $+(09[R],$chr(32),,04,song,,15,:,,$chr(32),,04,$replace($hget(sound,song),$chr(245),$chr(32),&,&),$chr(32),,15,*,,,14,$chr(32),$hget(sound,surl),$chr(32),,15,*)
- msg $hget(sound,chan) $+(09[R],$chr(32),,04,Spitzenzuhörer,,15,:,,$chr(32),,14,$hget(sound,peak),$chr(32),,04,Aktuelle Zuhörer,,15,:,,$chr(32),,14,$hget(sound,listeners))
- msg $hget(sound,chan) $+(09[R],$chr(32),,04,Bitrate,,15,:,,$chr(32),,14,$hget(sound,bitrate),$chr(32),kB,$chr(47),s)
- }
- }
- alias -l radiostart { .timerradio 0 10 radio }
- alias -l radio { sockclose radio | sockopen -e radio $gettok($gettok($hget(sound,url),2,47),1,58) $gettok($gettok($hget(sound,url),3,58),1,47) | sockmark radio $remove($hget(sound,url),https://,http://,$gettok($hget(sound,url),2,47)) }
- on *:SOCKOPEN:radio: {
- sockwrite -n $sockname GET $sock($sockname).mark HTTP/1.1
- sockwrite -n $sockname Host: $sock($sockname).addr
- sockwrite -n $sockname Connection: close
- sockwrite -n $sockname
- }
- on *:SOCKREAD:radio: {
- var %sound_tp | sockread %sound_tp
- ;echo -a 1 %sound_tp
- if ($regex(%sound_tp,/<tr><td>Bitrate:</td><td class="streamdata">(.+?)</td></tr><tr><td>Current Listeners:</td><td class="streamdata">(.+?)</td></tr><tr><td>Peak Listeners:</td><td class="streamdata">(.+?)</td></tr>.+?<tr><td>Current Song:</td><td class="streamdata">(.+?)</td></tr>/)) {
- if ($hget(sound,bitrate) != $regml(1)) {
- msg $hget(sound,chan) $+(09[R],$chr(32),,04,Bitrate gewechselt zu,,15,:,,$chr(32),,14,$regml(1),$chr(32),kB,$chr(47),s)
- hadd -m sound bitrate $regml(1)
- }
- if (($hget(sound,listeners) != $regml(2)) || ($hget(sound,peak) != $regml(3))) {
- msg $hget(sound,chan) $+(09[R],$chr(32),$iif($hget(sound,peak) != $regml(3),$+(,04,Spitzenzuhörer,,15,:,,$chr(32),,14,$regml(3),$chr(32))),$iif($hget(sound,listeners) != $regml(2),$+(,04,Aktuelle Zuhörer,,15,:,,$chr(32),,14,$regml(2))))
- hadd -m sound listeners $regml(2) | hadd -m sound peak $regml(3)
- }
- if ($hget(sound,song) != $replace($regml(4),$chr(32),$chr(245))) {
- msg $hget(sound,chan) $+(09[R],$chr(32),,04,song,,15,:,,$chr(32),,04,$replace($regml(4),&,&),$chr(32),,15,*,,,14,$chr(32),$hget(sound,surl),$chr(32),,15,*)
- hadd -m sound song $replace($regml(4),$chr(32),$chr(245))
- }
- hsave -o sound "sound.hsh"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement