mIRC Home    About    Download    Register    News    Help

Print Thread
#19141 14/04/03 07:35 AM
Joined: Apr 2003
Posts: 3
C
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Apr 2003
Posts: 3
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

Joined: Dec 2002
Posts: 44
G
Ameglian cow
Offline
Ameglian cow
G
Joined: Dec 2002
Posts: 44
Hi.
This is pretty simple.

Copy this into your remote, and do a "/events on":
Code:
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 smile


sorry for my bad english
watch out when you're in front of my scalar howitzer smile

Punks not dead!
Joined: Apr 2003
Posts: 3
C
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Apr 2003
Posts: 3
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!

Joined: Dec 2002
Posts: 774
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Dec 2002
Posts: 774
/help $read
/help $mid
/help $gettok


Code:
//if ( khaled isgod ) echo yes | else echo no
Joined: Dec 2002
Posts: 44
G
Ameglian cow
Offline
Ameglian cow
G
Joined: Dec 2002
Posts: 44
OK, i make it. it will take a few minutes, i will post it when complete.


sorry for my bad english
watch out when you're in front of my scalar howitzer smile

Punks not dead!
Joined: Dec 2002
Posts: 44
G
Ameglian cow
Offline
Ameglian cow
G
Joined: Dec 2002
Posts: 44
Code:
on *:text:!onair:#:{
  set %fajl &lt;filename&gt;
  set %szam 1
  if ($hget(onair)) hfree onair
  hmake onair 5
  while (%szam &lt;= $lines(%fajl)) {
    set %sor $read(%fajl,%szam)
    if (&lt;Announcement Display="*"/&gt; iswm %sor) hadd onair szoveg $gettok(%sor,2,34)
    if (&lt;Artist name="*"&gt; iswm %sor) hadd onair eloado $gettok(%sor,2,34)
    if (&lt;Song title="*"&gt; iswm %sor) hadd onair cim $gettok(%sor,2,34)
    if (&lt;Event status="*" startTime="*" eventType="*"&gt; iswm %sor) hadd onair ido $gettok(%sor,4,34)
    if (&lt;Expire Time="*"/&gt; iswm %sor) hadd onair lejarat $gettok(%sor,2,34)
    inc %szam
  }
  unset %fajl
  unset %szam
  unset %sor
  msg $chan &lt;text&gt;
  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="*"/>

smile


sorry for my bad english
watch out when you're in front of my scalar howitzer smile

Punks not dead!
Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
Could use sockets and query the server >:F

Ex:
Code:
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 &amp;shoutcast
  /bwrite shoutcast.txt -1 -1 &amp;shoutcast
}

on 1:SOCKCLOSE:shoutcast: {
  if (%sc.chan != $null) {
    /set -u0 %sc.read $remove($read(shoutcast.txt, 4), &lt;HTML&gt;&lt;meta http-equiv="Pragma" content="no-cache"&gt;&lt;/head&gt;&lt;body&gt;, &lt;/body&gt;&lt;/html&gt;)

    ; 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.*
}


-KingTomato
Joined: Apr 2003
Posts: 3
C
Self-satisified door
OP Offline
Self-satisified door
C
Joined: Apr 2003
Posts: 3
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.ro
Live: http://www.mixfm.ro/live (Romanian and Magyar) wink
IRC: #mixfm (Undernet server)

Joined: Jan 2003
Posts: 3,012
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2003
Posts: 3,012
*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. frown


-KingTomato
Joined: Dec 2002
Posts: 44
G
Ameglian cow
Offline
Ameglian cow
G
Joined: Dec 2002
Posts: 44
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 smile


sorry for my bad english
watch out when you're in front of my scalar howitzer smile

Punks not dead!

Link Copied to Clipboard