| View previous topic :: View next topic |
| Author |
Message |
Kimmi Halfop
Joined: 24 Jul 2003 Posts: 58 Location: Norway
|
Posted: Mon Aug 07, 2006 7:04 am Post subject: irc2html thingy... |
|
|
Hello
I have been looking for a script that does a "screen" on a irc channel and makes a html file, including all users on channel and all chat and actions.
I tryed a script called irc2html.tcl, but its 8 years old and didnt support current eggdrop version.
Anyone that know of a newer version of this script? _________________ Kimmi@EFnet |
|
| Back to top |
|
 |
Kimmi Halfop
Joined: 24 Jul 2003 Posts: 58 Location: Norway
|
Posted: Mon Aug 07, 2006 7:20 am Post subject: |
|
|
| Code: | set buf {}
set maxlines 5 ;# lines
set refresh 30 ;# seconds
bind pubm - "#channel *" foo
proc foo {n u h c t} {
if {[llength $::buf] == $::maxlines} {
set ::buf [lreplace $::buf 0 0]
}
lappend ::buf [list $n $t]
}
proc bar {sec} {
if ![catch {set fd [open /path/to/convo.html w]}] {
puts $fd "<html><head><title>some title</title>"
puts $fd "<meta http-equiv=\"refresh\" content=\"$sec\">"
puts $fd "</head><body>"
foreach e $::buf {
puts $fd "<[lindex $e 0]> [lindex $e 1]<br>"
}
puts $fd "</body></html>"
close $fd
}
utimer $sec [list bar $sec]
}
bar $refresh |
okey I got this code and it looks like this:
http://eggis.multinet.no/~lisemarie/haua.html
Is it hard to add who is saying what... like add the nick
and to make a list of all users in channel ? _________________ Kimmi@EFnet |
|
| Back to top |
|
 |
Alchera Revered One

Joined: 11 Aug 2003 Posts: 3344 Location: Ballarat Victoria, Australia
|
Posted: Mon Aug 07, 2006 7:33 pm Post subject: |
|
|
Rude  _________________ Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Mon Aug 07, 2006 7:37 pm Post subject: |
|
|
Try this:
* code updated with nml375's improvement *
| Code: | set 12h(chan) "#yourchannel"; channel to log
set i2h(maxlines) "5"; # no of lines
set i2h(refresh) "30"; # no of seconds
set i2h(buffer) ""; # the buffer, dont touch
set i2h(file) "/path/to/html/file"; # the html file
if {![file exists $::i2h(file)]} {
set file [open $::i2h(file) w]; puts $file ""; close $file
}
bind pubm - "$::i2h(chan) *" i2h:log
proc i2h:log {nickname hostname handle channel text} {
if {[llength $::i2h(buffer)] >= $::i2h(maxlines)} {
set ::i2h(buffer) ""
}
lappend ::i2h(buffer) "$nickname $text"
}
proc i2h:update {} {
if {[catch { set file [open $::i2h(file) w] } err]} {
putlog "i2h file error: $err"
} else {
puts $file "<html><head><title>some title</title>"
puts $file "<meta http-equiv=\"refresh\" content=\"$sec\">"
puts $file "</head><body>"
foreach i $::i2h(buffer) {
puts $file "<[lindex [split $i] 0]> [lrange $i 1 end]<br>"
}
puts $file "</body></html>"
}
utimer $::i2h(refresh) [list i2h:update]
}
i2h:update
putlog "i2h (irc2html) loaded"
|
Not tested, but hopefully it should work _________________ r0t3n @ #r0t3n @ Quakenet
Last edited by r0t3n on Mon Aug 07, 2006 7:58 pm; edited 2 times in total |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Mon Aug 07, 2006 7:47 pm Post subject: |
|
|
Might be a good idea to escape <> around nicks, to that they're not mistaken for tags.. ie:
| Code: |
...
puts $file "<[lindex $e 0]> [lindex $e 1]<br>"
...
|
rather than
| Code: |
...
puts $file "<[lindex $e 0]> [lindex $e 1]<br>"
...
|
Would make one confused browser otherwize...
edit: Minor typo... _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
Kimmi Halfop
Joined: 24 Jul 2003 Posts: 58 Location: Norway
|
Posted: Tue Aug 08, 2006 8:28 am Post subject: |
|
|
thanx guys!
But I do get an error on line 11
| Code: |
bind pubm - "$::i2h(chan) *" i2h:log
|
| Quote: |
[13:26] can't read "::i2h(chan)": no such element in array
while executing
"bind pubm - "$::i2h(chan) *" i2h:log"
(file "scripts/html2.tcl" line 11)
invoked from within
"source scripts/html2.tcl
" |
#FIXED# IT WAS A TYPO  _________________ Kimmi@EFnet |
|
| Back to top |
|
 |
Kimmi Halfop
Joined: 24 Jul 2003 Posts: 58 Location: Norway
|
Posted: Tue Aug 08, 2006 8:34 am Post subject: |
|
|
okey...
| Quote: |
[13:29] can't read "sec": no such variable
while executing
"puts $file "<meta http-equiv=\"refresh\" content=\"$sec\">""
(procedure "i2h:update" line 6)
invoked from within
"i2h:update"
(file "scripts/html2.tcl" line 35)
invoked from within
"source scripts/html2.tcl
"
|
It kinda looks like I need to set $sec as a time variable, how does one do that ? _________________ Kimmi@EFnet |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Tue Aug 08, 2006 9:34 am Post subject: |
|
|
change
| Code: | | puts $file "<meta http-equiv=\"refresh\" content=\"$sec\">" |
to
| Code: | | puts $file "<meta http-equiv=\"refresh\" content=\"$::i2h(refresh)\">" |
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
Kimmi Halfop
Joined: 24 Jul 2003 Posts: 58 Location: Norway
|
Posted: Tue Aug 08, 2006 2:05 pm Post subject: |
|
|
okey, now the script starts and I get "i2h (irc2html) loaded"
but, now it dont print anything to file....
like haua.html is empty, something must be changes, cuz the initial code on the top, worked. only nick wasnt showing there. _________________ Kimmi@EFnet |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Aug 08, 2006 2:17 pm Post subject: |
|
|
Seems like the updated script does'nt close the file at the end of the update... Would be my first bet..
As for your initial script, it did indeed print out nickname.. you just accidentally turned it into an (invalid) html-tag (check the source of the page you linked earlier) _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Tue Aug 08, 2006 2:29 pm Post subject: |
|
|
*UPDATED* (not tested)
| Code: | set 12h(chan) "#yourchannel"; channel to log
set i2h(maxlines) "5"; # no of lines
set i2h(refresh) "30"; # no of seconds
set i2h(buffer) ""; # the buffer, dont touch
set i2h(file) "/path/to/html/file.html"; # the html file
if {![file exists $::i2h(file)]} {
set file [open $::i2h(file) w]; puts $file ""; close $file
}
bind pubm - "$::i2h(chan) *" i2h:log
proc i2h:log {nickname hostname handle channel text} {
if {[llength $::i2h(buffer)] >= $::i2h(maxlines)} {
set ::i2h(buffer) ""
}
lappend ::i2h(buffer) "$nickname $text"
}
proc i2h:update {} {
if {[catch { set file [open $::i2h(file) w] } err]} {
putlog "i2h file error: $err"
} else {
puts $file "<html><head><title>some title</title>"
puts $file "<meta http-equiv=\"refresh\" content=\"$sec\">"
puts $file "</head><body>"
foreach i $::i2h(buffer) {
puts $file "<[lindex [split $i] 0]> [lrange $i 1 end]<br>"
}
puts $file "</body></html>"
close $file
}
utimer $::i2h(refresh) [list i2h:update]
}
i2h:update
putlog "i2h (irc2html) loaded. Logging $::i2h(chan) to [lindex [split $::i2h(file) /] end]."
|
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
metroid Owner
Joined: 16 Jun 2004 Posts: 771
|
Posted: Tue Aug 08, 2006 5:54 pm Post subject: |
|
|
What's the use of resetting the var (to nothing) after 5 lines when it's only flushed to the file every 30 seconds.
That basically only allows (the last) 5 lines that are said to be in the file, not much of a "irc2html" then. |
|
| Back to top |
|
 |
Kimmi Halfop
Joined: 24 Jul 2003 Posts: 58 Location: Norway
|
Posted: Tue Aug 08, 2006 7:13 pm Post subject: |
|
|
Tosser^^ tywm it worked!! few bugs but sorted that out...
and
I see what you meen metroid, how do I make it only remove the last line and not reset the hole, when it gets to the "max line number I have set"
but, is it easy to implement a list of showing all people on the channel, and topic ? _________________ Kimmi@EFnet |
|
| Back to top |
|
 |
|