PDA

View Full Version : [Fixed] daystats to include top downloaders


Frodo
08-02-2005, 01:56 PM
How to enable ioBanana to include stats of downloaders?

ioBanana script do include irc daily stats for the biggest uploaders, is it possilbe to do that with downloaders as well? If so how, and what code do I need to add, if any?

Harm
08-03-2005, 01:25 AM
proc ioB:daystats {} {
global ioBvar dsto
set ee ""; set ioBvar(ftp_error) ""
if {[unixtime] < $dsto} {return}
set day [clock format [expr [clock seconds]+(12*60*60)] -format "%d" -gmt true]
set weekday [clock format [expr [clock seconds]+(12*60*60)] -format "%A" -gmt true]
if {$day==01} {
putlog "\[\002ioB\002\] endOfMonth... displaying monthstats"
set month [clock format [expr [clock seconds]-(12*60*60)] -format "%B" -gmt true]
set year [clock format [expr [clock seconds]-(12*60*60)] -format "%Y" -gmt true]
set output $ioBvar(t_daystats_month_header)
set output [ioB:replacevar $output "%month" "$month"]
set output [ioB:replacevar $output "%year" "$year"]
ioB:tsend chan $ioBvar(announcechannel) $output
set status [catch {set ee [::ftp::Quote $ioBvar(ftp) SITE BSTATS MONTHUP ALL ALL 10 "\"$ioBvar(sections)\""]} result]
if {$status==1 && [string equal $ioBvar(ftp_error) "Not connected!"]} {dccbroadcast "\[\002ioB\002\] Force Login... Status=$status - Result=$result"; ioB:ftp_force_login; return}
set lines [split $ee \n]
set lines [lreplace $lines end end]
foreach line $lines {
set lbit [split [string range $line 4 end] ";"]
set rank [lindex $lbit 0]
set nick [lindex $lbit 1]
set group [lindex $lbit 2]
set transfer [lindex $lbit 3]
if {$rank!=""} {
if {[string length $rank]==1} {set rank "0$rank"}
set output $ioBvar(t_daystats_body)
set output [ioB:replacevar $output "%pos" "$rank"]
set output [ioB:replacevar $output "%name" "$nick"]
set output [ioB:replacevar $output "%group" "$group"]
set output [ioB:replacevar $output "%total" [ioB:fixsm $transfer]]
ioB:tsend chan $ioBvar(announcechannel) $output
}
}
ioB:tsend chan $ioBvar(announcechannel) "And our Top 10 Leechers are:"
set status [catch {set ee [::ftp::Quote $ioBvar(ftp) SITE BSTATS MONTHDN ALL ALL 10 "\"$ioBvar(sections)\""]} result]
if {$status==1 && [string equal $ioBvar(ftp_error) "Not connected!"]} {dccbroadcast "\[\002ioB\002\] Force Login... Status=$status - Result=$result"; ioB:ftp_force_login; return}
set lines [split $ee \n]
set lines [lreplace $lines end end]
foreach line $lines {
set lbit [split [string range $line 4 end] ";"]
set rank [lindex $lbit 0]
set nick [lindex $lbit 1]
set group [lindex $lbit 2]
set transfer [lindex $lbit 3]
if {$rank!=""} {
if {[string length $rank]==1} {set rank "0$rank"}
set output $ioBvar(t_daystats_body)
set output [ioB:replacevar $output "%pos" "$rank"]
set output [ioB:replacevar $output "%name" "$nick"]
set output [ioB:replacevar $output "%group" "$group"]
set output [ioB:replacevar $output "%total" [ioB:fixsm $transfer]]
ioB:tsend chan $ioBvar(announcechannel) $output
}
}
ioB:tsend chan $ioBvar(announcechannel) $ioBvar(t_daystats_month_footer)
if {$ioBvar(checkquota)==1} {
ioB:sitestat "deleteok" "" "" $ioBvar(announcechannel) "quotas123"
ioB:sitestat "deleteok" "" "" $ioBvar(announcechannel) "grpquota123"
}
} elseif {[string equal $weekday "Monday"]} {
putlog "\[\002ioB\002\] endOfWeek... displaying wkstats"
set weeknum [expr [clock format [expr [clock seconds]-(12*60*60)] -format "%W" -gmt true] +1]
set year [clock format [expr [clock seconds]-(12*60*60)] -format "%Y" -gmt true]
set output $ioBvar(t_daystats_week_header)
set output [ioB:replacevar $output "%weeknum" "$weeknum"]
set output [ioB:replacevar $output "%year" "$year"]
ioB:tsend chan $ioBvar(announcechannel) $output
set status [catch {set ee [::ftp::Quote $ioBvar(ftp) SITE BSTATS WKUP ALL ALL 10 "\"$ioBvar(sections)\""]} result]
if {$status==1 && [string equal $ioBvar(ftp_error) "Not connected!"]} {dccbroadcast "\[\002ioB\002\] Force Login... Status=$status - Result=$result"; ioB:ftp_force_login; return}
set lines [split $ee \n]
set lines [lreplace $lines end end]
foreach line $lines {
set lbit [split [string range $line 4 end] ";"]
set rank [lindex $lbit 0]
set nick [lindex $lbit 1]
set group [lindex $lbit 2]
set transfer [lindex $lbit 3]
if {$rank!=""} {
if {[string length $rank]==1} {set rank "0$rank"}
set output $ioBvar(t_daystats_body)
set output [ioB:replacevar $output "%pos" "$rank"]
set output [ioB:replacevar $output "%name" "$nick"]
set output [ioB:replacevar $output "%group" "$group"]
set output [ioB:replacevar $output "%total" [ioB:fixsm $transfer]]
ioB:tsend chan $ioBvar(announcechannel) $output
}
}
ioB:tsend chan $ioBvar(announcechannel) "And our Top 10 Leechers are:"
set status [catch {set ee [::ftp::Quote $ioBvar(ftp) SITE BSTATS WKDN ALL ALL 10 "\"$ioBvar(sections)\""]} result]
if {$status==1 && [string equal $ioBvar(ftp_error) "Not connected!"]} {dccbroadcast "\[\002ioB\002\] Force Login... Status=$status - Result=$result"; ioB:ftp_force_login; return}
set lines [split $ee \n]
set lines [lreplace $lines end end]
foreach line $lines {
set lbit [split [string range $line 4 end] ";"]
set rank [lindex $lbit 0]
set nick [lindex $lbit 1]
set group [lindex $lbit 2]
set transfer [lindex $lbit 3]
if {$rank!=""} {
if {[string length $rank]==1} {set rank "0$rank"}
set output $ioBvar(t_daystats_body)
set output [ioB:replacevar $output "%pos" "$rank"]
set output [ioB:replacevar $output "%name" "$nick"]
set output [ioB:replacevar $output "%group" "$group"]
set output [ioB:replacevar $output "%total" [ioB:fixsm $transfer]]
ioB:tsend chan $ioBvar(announcechannel) $output
}
}
ioB:tsend chan $ioBvar(announcechannel) $ioBvar(t_daystats_week_footer)
} else {
putlog "\[\002ioB\002\] endOfDay... displaying daystats"
ioB:tsend chan $ioBvar(announcechannel) $ioBvar(t_daystats_day_header)
set status [catch {set ee [::ftp::Quote $ioBvar(ftp) SITE BSTATS DAYUP ALL ALL 3 "\"$ioBvar(sections)\""]} result]
if {$status==1 && [string equal $ioBvar(ftp_error) "Not connected!"]} {dccbroadcast "\[\002ioB\002\] Force Login... Status=$status - Result=$result"; ioB:ftp_force_login; return}
set lines [split $ee \n]
set lines [lreplace $lines end end]
foreach line $lines {
set lbit [split [string range $line 4 end] ";"]
set rank [lindex $lbit 0]
set nick [lindex $lbit 1]
set group [lindex $lbit 2]
set transfer [lindex $lbit 3]
if {$rank!=""} {
if {[string length $rank]==1} {set rank "0$rank"}
set output $ioBvar(t_daystats_body)
set output [ioB:replacevar $output "%pos" "$rank"]
set output [ioB:replacevar $output "%name" "$nick"]
set output [ioB:replacevar $output "%group" "$group"]
set output [ioB:replacevar $output "%total" [ioB:fixsm $transfer]]
ioB:tsend chan $ioBvar(announcechannel) $output
}
}
ioB:tsend chan $ioBvar(announcechannel) "And our Top 3 Leechers are:"
set status [catch {set ee [::ftp::Quote $ioBvar(ftp) SITE BSTATS DAYDN ALL ALL 3 "\"$ioBvar(sections)\""]} result]
if {$status==1 && [string equal $ioBvar(ftp_error) "Not connected!"]} {dccbroadcast "\[\002ioB\002\] Force Login... Status=$status - Result=$result"; ioB:ftp_force_login; return}
set lines [split $ee \n]
set lines [lreplace $lines end end]
foreach line $lines {
set lbit [split [string range $line 4 end] ";"]
set rank [lindex $lbit 0]
set nick [lindex $lbit 1]
set group [lindex $lbit 2]
set transfer [lindex $lbit 3]
if {$rank!=""} {
if {[string length $rank]==1} {set rank "0$rank"}
set output $ioBvar(t_daystats_body)
set output [ioB:replacevar $output "%pos" "$rank"]
set output [ioB:replacevar $output "%name" "$nick"]
set output [ioB:replacevar $output "%group" "$group"]
set output [ioB:replacevar $output "%total" [ioB:fixsm $transfer]]
ioB:tsend chan $ioBvar(announcechannel) $output
}
}
ioB:tsend chan $ioBvar(announcechannel) $ioBvar(t_daystats_day_footer)
}
set dsto [expr [unixtime] + 30*60]
return
}
Try to replace proc ioB:daystats (ioBanana.tcl) with this one.

Frodo
08-03-2005, 07:53 AM
Thanks :)