This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

possible to make eggdrop auto-rehash every x minutes?

Old posts that have not been replied to for several years.
K
Korigon
Voice
Posts: 8
Joined: Tue Aug 02, 2005 4:08 pm

Post by Korigon »

Code: Select all

Currently: syntaxerror {syntax error: PUBLIC identifier not followed by system literal around line 1}
Currently:     while executing
Currently: "rss::parse [http::data $token]"
Currently:     (procedure "retrieve" line 3)
Currently:     invoked from within
Currently: "retrieve $feed"
Currently:     ("foreach" body line 6)
Currently:     invoked from within
Currently: "foreach {chan feed} [array get feeds] {
Currently:          set chan [string tolower $chan]
Currently:          if {[lsearch -exact [string tolower [channels]] $chan] == -1..."
Currently:     invoked from within
Currently: "if [info exists feeds] {
Currently:       foreach {chan feed} [array get feeds] {
Currently:          set chan [string tolower $chan]
Currently:          if {[lsearch -exact [string t..."
Currently:     (procedure "::news::timer" line 4)
Currently:     invoked from within
Currently: "::news::timer $_time1 $_time2 $_time3 $_time4 $_time5"
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

this is an error reported by TclXML, something's wrong with document's XML schema; try with another RSS source, for example http://rss.news.yahoo.com/rss/topstories

BTW which RSS package did you install, BDK's or the japanese?
K
Korigon
Voice
Posts: 8
Joined: Tue Aug 02, 2005 4:08 pm

Post by Korigon »

I use BDK's package, in fact only rss.tcl + pkg_mkIndex etc etc as you described it on the first page.

Well, I'm trying your link and I get

Code: Select all

[18:08:48] <Bot-de-test>
Currently: invalid command name ""
Currently:     while executing
Currently: "$channel items"
Currently:     (procedure "retrieve" line 5)
Currently:     invoked from within
Currently: "retrieve $feed"
Currently:     ("foreach" body line 6)
Currently:     invoked from within
Currently: "foreach {chan feed} [array get feeds] {
Currently:          set chan [string tolower $chan]
Currently:          if {[lsearch -exact [string tolower [channels]] $chan] == -1..."
Currently:     invoked from within
Currently: "if [info exists feeds] {
Currently:       foreach {chan feed} [array get feeds] {
Currently:          set chan [string tolower $chan]
Currently:          if {[lsearch -exact [string t..."
Currently:     (procedure "::news::timer" line 4)
Currently:     invoked from within
Currently: "::news::timer $_time1 $_time2 $_time3 $_time4 $_time5"
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

all I can recommend to you at this time is to try other RSS feeds

there might be some incompatibility with BDK's rss.tcl introduced in those packages in their latest versions; mine are from like one year ago
K
Korigon
Voice
Posts: 8
Joined: Tue Aug 02, 2005 4:08 pm

Post by Korigon »

Could you link your rss.tcl? :-)
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

Code: Select all

 package require Tcl 8.4
 package require struct
 package require xml
 package require snit

 package provide rss 1.0

 namespace eval ::rss {
    variable parser
    variable parserStack
    variable channelObject
    variable itemObject

    variable currentCmds
    array set currentCmds \
        [list \
             elementStart [list [namespace current]::XML.StartRSS] \
             elementEnd [list [namespace current]::XML.EndRSS] \
             characterData {} \
            ]
 }

 proc ::rss::Parser.NewState {elementStart elementEnd characterData} {
    variable parser
    variable parserStack
    variable currentCmds
    variable channel

    $parserStack push \
        [list \
             $currentCmds(elementStart) \
             $currentCmds(elementEnd) \
             $currentCmds(characterData) \
             ]

    set currentCmds(elementStart) $elementStart
    set currentCmds(elementEnd) $elementEnd
    set currentCmds(characterData) $characterData

    return
 }

proc ::rss::Parser.PreviousState {} {
    variable parser
    variable parserStack
    variable currentCmds

    foreach {currentCmds(elementStart) currentCmds(elementEnd) currentCmds(characterData)} [$parserStack pop] {break}

    return
 }

 proc ::rss::Wrapper.ElementStart {name attlist args} {
    variable currentCmds

    if {$currentCmds(elementStart)!={}} {
        set code [catch {uplevel \#0 $currentCmds(elementStart) [list $name $attlist] $args} result]
        return -code $code -errorinfo $::errorInfo -errorcode $::errorCode $result
    }
 }

 proc ::rss::Wrapper.ElementEnd {name args} {
    variable currentCmds

    if {$currentCmds(elementEnd)!={}} {
        set code [catch {uplevel \#0 $currentCmds(elementEnd) [list $name] $args} result]
        return -code $code -errorinfo $::errorInfo -errorcode $::errorCode $result
    }
 }

 proc ::rss::Wrapper.CharacterData {data} {
    variable currentCmds

    if {$currentCmds(characterData)!={}} {
        set code [catch {uplevel \#0 $currentCmds(characterData) [list $data]} result]
        return -code $code -errorinfo $::errorInfo -errorcode $::errorCode $result
    }
 }

 proc ::rss::parse {data} {
    variable parser
    variable parserStack
    variable channel

    set parser [::xml::parser ]
    set parserStack [::struct::stack]
    set channel [Channel %AUTO%]

    $parser configure \
        -elementstartcommand [namespace current]::Wrapper.ElementStart \
        -elementendcommand [namespace current]::Wrapper.ElementEnd \
        -characterdatacommand [namespace current]::Wrapper.CharacterData

    $parser parse $data

    $parser free
    $parserStack destroy

    return $channel
 }

 proc ::rss::XML.StartRSS {name attlist args} {
    variable channel

    switch -- $name {
        channel {
            Parser.NewState \
                [list [namespace current]::XML.Channel $channel] \
                [list [namespace current]::XML.ElementEnd] \
                {}
        }
        item {
            set obj [Item %AUTO%]
            $channel AddItem $obj

            Parser.NewState \
                [list [namespace current]::XML.Item $obj] \
                [list [namespace current]::XML.ElementEnd] \
                {}
        }
    }

    return
 }

 proc ::rss::XML.EndRSS {name args} {
    return
 }

 proc ::rss::XML.Channel {obj name attlist args} {
    switch -- $name {
        title {
            Parser.NewState \
                [list [namespace current]::XML.ElementStart] \
                [list [namespace current]::XML.ElementEnd] \
                [list [namespace current]::XML.CharacterData [$obj GetVariable title]]
        }
        link {
            Parser.NewState \
                [list [namespace current]::XML.ElementStart] \
                [list [namespace current]::XML.ElementEnd] \
                [list [namespace current]::XML.CharacterData [$obj GetVariable link]]
        }
        description {
            Parser.NewState \
                [list [namespace current]::XML.ElementStart] \
                [list [namespace current]::XML.ElementEnd] \
                [list [namespace current]::XML.CharacterData [$obj GetVariable description]]
        }
        item {
            set item [Item %AUTO%]
            $obj AddItem $item

            Parser.NewState \
                [list [namespace current]::XML.Item $item] \
                [list [namespace current]::XML.ElementEnd] \
                {}
        }
        default {
            Parser.NewState \
                [list [namespace current]::XML.ElementStart] \
                [list [namespace current]::XML.ElementEnd] \
                {}
        }
    }

    return
 }

 proc ::rss::XML.Item {obj name attlist args} {
    switch -- $name {
        title {
            Parser.NewState \
                [list [namespace current]::XML.ElementStart] \
                [list [namespace current]::XML.ElementEnd] \
                [list [namespace current]::XML.CharacterData [$obj GetVariable title]]
        }
        link {
            Parser.NewState \
                [list [namespace current]::XML.ElementStart] \
                [list [namespace current]::XML.ElementEnd] \
                [list [namespace current]::XML.CharacterData [$obj GetVariable link]]
        }
        description {
            Parser.NewState \
                [list [namespace current]::XML.ElementStart] \
                [list [namespace current]::XML.ElementEnd] \
                [list [namespace current]::XML.CharacterData [$obj GetVariable description]]
        }
        default {
            Parser.NewState \
                [list [namespace current]::XML.ElementStart] \
                [list [namespace current]::XML.ElementEnd] \
                {}
        }
    }

    return
 }

 proc ::rss::XML.ElementStart {name attlist args} {
    Parser.NewState \
        [list [namespace current]::XML.ElementStart] \
        [list [namespace current]::XML.ElementEnd] \
        {}

    return
 }

 proc ::rss::XML.ElementEnd {name args} {
    Parser.PreviousState

    return
 }

 proc ::rss::XML.CharacterData {var data} {
    upvar \#0 $var myVar

    append myVar $data

    return
 }

 ::snit::type ::rss::Channel {
    variable title {}
    variable link {}
    variable description {}
    variable items {}

    destructor {
        foreach item $items {
            $item destroy
        }

        return
    }

    method title {} {
        return $title
    }

    method link {} {
        return $link
    }

    method description {} {
        return $description
    }

    method items {} {
        return $items
    }

    method GetVariable {var} {
        return [varname $var]
    }

    method AddItem {item} {
        lappend items $item
    }
 }

 ::snit::type ::rss::Item {
    variable title {}
    variable link {}
    variable pubDate {}
    variable description {}

    method title {} {
        return $title
    }

    method link {} {
        return $link
    }

    method pubDate {} {
        return $pubDate
    }

    method description {} {
        return $description
    }

    method GetVariable {var} {
        return [varname $var]
    }
 }
K
Korigon
Voice
Posts: 8
Joined: Tue Aug 02, 2005 4:08 pm

Post by Korigon »

Ahhhhh yes, works better now, thx m8 :-)
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

it works?? yay!

you are the first person (besides me hehe) to get that to work :) congrats
K
Korigon
Voice
Posts: 8
Joined: Tue Aug 02, 2005 4:08 pm

Post by Korigon »

Yes, I'll modify your script for notices => privmsg $chan and add some colors ala perpleXa's RSSNews.
K
Korigon
Voice
Posts: 8
Joined: Tue Aug 02, 2005 4:08 pm

Post by Korigon »

what is the correct syntax if I want add some chan and/or news ?

set feeds(#chan1) {10 http://www.b.d.e/rss/1.xml}
set feeds(#chan2) {10 http://www.a.b.c/rss/2.xml}

or
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

that is correct
J
JoshuaUK
Voice
Posts: 24
Joined: Sun Aug 07, 2005 11:35 am

Post by JoshuaUK »

Hi, When I install this script you are talking about, I bought a shell now running eggdrop 1.6.17. Now could you please just tell me what if possible I do with the tcllib or xml which one do I get? err also, I moved the rss.tcl to home/user/scripts/ and will it still work it loads but fails because it cannot find the required things:

Code: Select all

 package require Tcl 8.4\par
 package require struct 2.0\par
 package require xml 2.6\par
 package require snit 0.9\par
\par
 package provide rss 1.0\par
\par
 namespace eval ::rss \{\par
    variable parser\par
    variable parserStack\par
    variable channelObject\par
\par
    variable currentCmds\par
    array set currentCmds \\\par
        [list \\\par
             elementStart [list [namespace current]::XML.StartRSS] \\\par
             elementEnd [list [namespace current]::XML.EndRSS] \\\par
             characterData \{\} \\\par
            ]\par
 \}
[01:03] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
[joshuauk@server2 bot]$ TclLib
I know you mentione dreading up on it, but I don't really take things in if someone just says read about them sorry :(
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

that you don't want to give up on my script flatters me, however neither this thread nor this forum are meant to teach you how to install Tcl packages - you either learn that yourself by reading the docs that come with packages sources (if you read but didn't understand those, you need to learn how to use Linux/UNIX (shell) first, also by reading - I'd recommend you buy a book on that subject) and then come here if necessary for help on a particular installation issue that you had, or you hire me to teach you how to do stuff without actually bothering to read too much - but I'll have to charge you my usual consulting fee; what I'm trying to explain to you (again) is that these forums are meant to help people who are willing to help themselves first and only ask for help if that fails

sorry if this isn't what you wanted to hear, but that's the way the things are

and folks, if you need further elaboration on my RSS news script, please make a new thread about it and post there; this thread got overused, not to mention it's not relevant to my script in the first place - at least the title has nothing to do with it

edit: I made a new thread on the subject here
J
JoshuaUK
Voice
Posts: 24
Joined: Sun Aug 07, 2005 11:35 am

Post by JoshuaUK »

Well I tried installing the tcllib thing and it worked when I typed in make, then make install failed because it couldn't gain access to the usr lib directory :| So not sure if it is something I have managed to do or what lol. But I seem to have got a small part of the way... will still keep playing with it, as the reason I bought a shell was to run the RSS news feeds with this script or somehow into a chatroom someday.
Locked