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.

ircstats.tcl

Old posts that have not been replied to for several years.
Locked
User avatar
Thunderdome
Op
Posts: 187
Joined: Tue Mar 15, 2005 4:42 pm

ircstats.tcl

Post by Thunderdome »

Code: Select all

# ircstats.tcl v1.0 (2 April 2001)
# copyright © 2001 by Caramel <mmm_caramel@hotmail.com>
#
#
# This script automatically updates your
# IRCStats (© 1999-2001 Teemu Toivola http://torus.lnet.lut.fi/ircstats/ )
#
# It's still in the fledgling stage but it seems to work
#
# Auto-updates will occur at 11:50 and 23:50 (unixtime)
# or u can manually update from dcc chat (channel doesn't need to be in auto to do it manually)
# .updatestats <chan>
#  
# The only thing u really have to do is modify your stats.cfg file for each 
# channel and name it channel.cfg (eg #lamer.cfg) leave it in the same dir
# as the ircstats prog
#
# And give the FULL path for the .txt files in those cfg's <== MOST IMPORTANT
# ie - /home/myshell/ircstats/nickjoin.txt - not just - nickjoin.txt
# 
# Set the full path to the directory that ircstat lives in
# and the path to your logfiles (note these MUST be mIRC style logs)

set path "/home/myshell/ircstats/"
set logpath "/home/myshell/logs/"

# finally the channels u want it to automatically update (set channels "#lamer #lamest")

set channels "#lamer #lamest"

# Don't edit below unless you know what you're doing.

proc do_stats {min hour day month year} {
  global path logpath channels
  foreach chan [string tolower ${channels}] {
    if {![file exists ${path}${chan}.cfg]} {
      putlog "You must set up a cfg file for $chan first! (or remove the channel from ircstats.tcl)"
      return 0
    }
    if {![file exists ${logpath}${chan}.log]} {
      putlog "I can't find the file $chan.log !"
      return 0
    }
    putlog "Updating Stats for $chan ......"
    exec ${path}ircstats_rh5x ${logpath}${chan}.log ${path}${chan}.cfg
    puthelp "privmsg $chan :Stats page auto-update for $chan .. complete"
  }
}

proc man_stats {handle ipx arg} {
  global path logpath
  set chan [lindex $arg 0]
  if {![file exists ${path}${chan}.cfg]} {
    putlog "You must set up a cfg file for $chan first!"
    return 0
  }
  if {![file exists ${logpath}${chan}.log]} {
    putlog "I can't find the file $chan.log !"
    return 0
  }
  putlog "Updating Stats (forced manual)..."
  exec ${path}ircstats_rh5x ${logpath}${chan}.log ${path}${chan}.cfg
  puthelp "privmsg $chan :The Stats page has just been MANUALLY updated for $chan"
}

bind time - "50 05 * * *" do_stats
bind time - "50 17 * * *" do_stats
bind dcc n updatestats man_stats


putlog "Loaded ircstats.tcl v1.0 by Caramel"

return

# feel free to edit thin if u know what u are doing
# pls give me credit for the original
# if u find a bug or think of an improvment email me :-)
# Caramel <mmm_caramel@hotmail.com>
# or I am usually hanging around on the Planetarion irc servers
# (irc.planetarion.com) in #pub

I would like to have this working... :( does not work since the last versions of Ircstats. But the changes must be little. Is there any chance this could work again?
Or to make a tcl that works like a crontab to make "./ircstats configfile logfile" ?

Thanks! :)
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Are there any tcl errors displayed in partyline ? try .set errorInfo for more info about the errors (if any).
User avatar
Thunderdome
Op
Posts: 187
Joined: Tue Mar 15, 2005 4:42 pm

Post by Thunderdome »

Code: Select all

Tcl error [man_stats]: couldn't execute "/home/thunderdome/IRCStats-1.0/ircstats_rh5x": no such file or directory
and even when I take out the "_rh5x", it does not work:

Code: Select all

Tcl error [man_stats]:
Error:
Unable to open file "colors/uglyDefault.cfg" for reading configs!
Also the "crontab" functions seems not to work properly...

"_rh5x" was for the old version of ircstats I think... the new one is different, but I dunno how to change this...
can you help me out?

Greetz
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

All I can tell you is what it's saying, no such diretcory. Make sure you wrote it correctly.
User avatar
Thunderdome
Op
Posts: 187
Joined: Tue Mar 15, 2005 4:42 pm

Post by Thunderdome »

you see, that directory does not exist in ircstats. maybe it did in old versions...
So it is a matter of making this script for new version...

Or... do you know how can I make a script that makes "./ircstats configfile logfile" in the shell from 25 to 25 minutes?
User avatar
Thunderdome
Op
Posts: 187
Joined: Tue Mar 15, 2005 4:42 pm

Post by Thunderdome »

Code: Select all

Tcl error [man_stats]: 
Error: 
Unable to open file "colors/uglyDefault.cfg" for reading configs!

I now know why this happens! :)
And I have made a script for manual and automatic update of ircstats... my first script! Took me quite some time and trouble to figure out what was wrong... it was not the tcl code, but the program ircstats itself, so I had to had a few extra lines...
done, thanks for the help anyway!
Greetz :wink:

Anyone interessed in this script PM me... :)
Locked