|
cybermix
|
cybermix
|
Hi all! I need your help to make a script (i'm beginer on this). I need a script to read from txt file and send the on channel from this txt file when somebody say: "!onair" on channel. The txt is in other computer (on Network Neighborhood). I need this script because i work in a radio station and we need this for our channel to can know our visitors what songs is onair. I apreaciate if somebody can help me! Thanks! Florin IVAN Radio MIXFM Tg. Mures - ROMANIA iflorin@mixfm.ro
|
|
|
|
GodGell
|
GodGell
|
Hi. This is pretty simple. Copy this into your remote, and do a "/events on":
on *:text:!onair:#channelname:msg $chan $read(COMPUTERNAME\\shareddir\path\file.txt,1)
This reads the first line. Change COMPUTERNAME\\shareddir\path\file.txt to the file path on the other computer. Example: if the other computer's name is "STORE", and the "C:\mIRC\" directory is shared with name "mircdir", and the !onair file is "C:\mIRC\onair.txt", you need to use this: STORE\\mircdir\onair.txt. Bye
|
|
|
|
cybermix
|
cybermix
|
Thanks! I make it! But from XML file i think is more hard! Now this is what i want to do if you can help me. The xml look like this:
<Schedule System="Jazler"> <Event status="happening" startTime="15:19:10" eventType="song"> <Announcement Display="In direct la MIXFM Tg. Mures asculti :"/> <Song title="Cloud Nr 9 ( With Chicane )"> <Artist name="Bryan Adams"> <Media runTime="244.9921"/> <Expire Time="15:23:14"/> </Artist> </Song> </Event> </Schedule>
And i want to send the channel : <Announcement Display=.../>, <Artist name="Bryan Adams">, <Song title="Cloud Nr 9 ( With Chicane )">, startTime="15:19:10 and <Expire Time="15:23:14"/>.
If somebody can help me whith this! Thanks!
|
|
|
|
theRat
|
theRat
|
/help $read /help $mid /help $gettok
|
|
|
|
GodGell
|
GodGell
|
OK, i make it. it will take a few minutes, i will post it when complete.
|
|
|
|
GodGell
|
GodGell
|
on *:text:!onair:#:{
set %fajl <filename>
set %szam 1
if ($hget(onair)) hfree onair
hmake onair 5
while (%szam <= $lines(%fajl)) {
set %sor $read(%fajl,%szam)
if (<Announcement Display="*"/> iswm %sor) hadd onair szoveg $gettok(%sor,2,34)
if (<Artist name="*"> iswm %sor) hadd onair eloado $gettok(%sor,2,34)
if (<Song title="*"> iswm %sor) hadd onair cim $gettok(%sor,2,34)
if (<Event status="*" startTime="*" eventType="*"> iswm %sor) hadd onair ido $gettok(%sor,4,34)
if (<Expire Time="*"/> iswm %sor) hadd onair lejarat $gettok(%sor,2,34)
inc %szam
}
unset %fajl
unset %szam
unset %sor
msg $chan <text>
hfree onair
}
In <text>, use: $hget(onair,szoveg) for <Announcement Display="..."/> $hget(onair,eloado) for <Artist name="..."> $hget(onair,cim) for <Song title="..."> $hget(onair,ido) for <Event status="..." startTime="..." eventType="..."> $hget(onair,lejarat) for <Expire Time="*"/>
|
|
|
|
Joined: Jan 2003
Posts: 2,973
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,973 |
Could use sockets and query the server >:F Ex:
on 1:TEXT:!onair:#: {
; Server of your station (use network name of computer, or ip)
/set -u0 %sc.server www.nappybase.com
; port of server
/set -u0 %sc.port 8000
if (%sc.chan == $null) {
/set %sc.chan $chan
/sockopen shoutcast %sc.server %sc.port
/msg $chan Querying Server... Please Wait.
; stop connectiong from getting "hung up"
.timerscast 1 30 /sc.timeout
}
else { /msg $chan Server Is Being Queried. Please Wait }
}
on 1:SOCKOPEN:shoutcast: {
if ($sockerr) {
; There was an error
/set %sc.status Server is currently Down.
}
else {
; Write To The Socket
/sockwrite -n $sockname GET /7.html HTTP/1.1
/sockwrite -n $sockname Accept: */*
/sockwrite -n $sockname Accept-Language: en-us
/sockwrite -n $sockname Accept-Encoding: gzip, deflate
/sockwrite -n $sockname User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
/sockwrite -n $sockname Host: $sock($sockname).ip $+ :80
/sockwrite -n $sockname Connection: Keep-Alive
/sockwrite -n $sockname $crlf
}
}
on 1:SOCKREAD:shoutcast: {
; Read The Buffer
/sockread -f 5000 &shoutcast
/bwrite shoutcast.txt -1 -1 &shoutcast
}
on 1:SOCKCLOSE:shoutcast: {
if (%sc.chan != $null) {
/set -u0 %sc.read $remove($read(shoutcast.txt, 4), <HTML><meta http-equiv="Pragma" content="no-cache"></head><body>, </body></html>)
; get Information
if (%sc.status == $null) { /set %sc.status $iif($gettok(%sc.read, 2, 44) == 0, Server Is Currently Down, Server Is Currently Up) }
; Message Channel Status
if (down isin %sc.status) { /msg %sc.chan Server Status: %sc.status }
else {
/set %sc.song $gettok(%sc.read, 7, 44)
/msg %sc.chan Server Status: %sc.status - Current Song: %sc.song
}
; Clear Used Variables
/unset %sc.*
}
.remove shoutcast.txt
}
alias sc.timeout {
/msg %sc.chan Server has timed out. Please try again later.
/unset %sc.*
}
|
|
|
|
cybermix
|
cybermix
|
Thanks GodGell for help! I will try your script, but tell me something. I have the xml file on network computer. How i can load information from this file? Thanks again! Florin IVAN Radio MIXFM Targu Mures - ROMANIA url: http://www.mixfm.roLive: http://www.mixfm.ro/live (Romanian and Magyar)  IRC: #mixfm (Undernet server)
|
|
|
|
Joined: Jan 2003
Posts: 2,973
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,973 |
*sigh* all that work for nothing... I should add the words "SHOUTcast" to this thread, as it may help another user who wants a bot.
|
|
|
|
GodGell
|
GodGell
|
you can read info as a simple textfile. mirc does not support xml so you need to read it and getting info from it. hehe i was seen your page. cool. and also cool, Magyar (Hungarian) language, im Hungarian
|
|
|
|
|