## Readme for Tur-DayStats 2.+

--[ Intro ]--

This is a script that will display some stats about today.
You can run it at anytime, but its ment to be executed a 
minute before midnight or so.

Its used with Dark0n3s dZSbot.tcl or pzs-ng (zipscript-c). 
If you use any other sitebot, look at the proc_out() function
for how to write it to glftpd.log so your sitebot announces
it.

--[ Installation ]--

Copy tur-daystats.sh to /glftpd/bin and make it executable
with chmod 755 or something.

Copy tur-daystats.conf to the same dir as tur-daystats.sh
OR copy it somewhere else and set its path in tur-daystats.sh

Configure the following settings in tur-daystats.conf

sitename    = Just the sitename. If you run MSS, you can enter each
              name here. "slave1 & slave2" for example.


gllog       = Full path to glftpd.log


login       = Full path to login.log (LOGIN and LOGOUT is in this
              one since glftpd v1.31+).


tmp         = Some temp dir somewhere.


sections    = Which sections to show number of new releases in.
              Its something in the path. For instance, just DIVX
              if you have /glftpd/site/DIVX

              For MSS users, using mss-daystats.sh, you need to add
              the sections for each slave as well (instructions later).

              Seperate sections with a space.

              When grepping, I look for /$section/. In other words, I 
              add the two / to the search. Therefor, the section you
              specify MUST be the full name of the section, case sensitive.

              So, if your DIVX directory on site is called DIVX_INCOMING, you
              must specify DIVX_INCOMING here.

              That is also what the section will be called in the output text.
              However, would you like another name for it in the output, you can
              add a :alias to it. Like DIVX_INCOMING:DiVX

              It will then look for /DIVX_INCOMING/ and present it as DiVX in 
              the output.


sectionspre = Which sections to show number of pred releases in.
              Same as above.


pregrepline = What to grep for to get ONLY pre lines in glftpd.log
              For instance, if you're pre lines look like:
              Sun Sep 14 16:12:44 2003 PRE: "-->> ^CoolGroup PRE^ <<-- blabla"
              Then set it to either "PRE:" or " PRE: "
              If you have GroupName-PRE:, set it to "PRE:" only.
              It must be something unique thats only in pre lines.

              If you have several triggers using the same announce, for example
              PRE: and PRE-0DAY: - you can specify them both as:
              " PRE: | PRE-0DAY: "


separator   = What to separate the different sections/presections
              with. Just for show.


exclude     = Dont count these as newdirs etc. For instance /CD.
              will make it not count anything including
              /CD* ( . = any single char, meaning 1,2,3,4 etc ).

              This is a standard egrep line. Seperate with | and
              done use spaces ( unless its "\ " ). Excluding a space
              is pretty stupid though as every logline has one.


exclude_from_nukes = Usernames to exclude from the Top-Nuke display.
                     Use ^username$ here so it matches full name only.
                     Example: "^sitebot$|^ostnisse$|^user3$"


exclude_from_logins= Same as above, but for Top-Logins.


statsbin    = Path to stats. Comes with glftpd.
              Make sure it works. Run ./stats -t -u


statsection = When showing top uploaders/downloaders, which section
              to show?
              Usage is "SectionNumber:Sectionname SectionNumber:Sectionname"
              So, for example "0:DEFAULT 1:XXX 2:0DAYS 3:PDA"


users_to_show = How many users to list max in for each section listed above?
                Set to "0" to disable user stats.


groups_to_show= How many groups to list max for each section listed above?
                Set to "0" to disable group stats.


groupnameinpreline = Now, when pres are put in glftpd.log, which part
                     of the line contains the groupname? Consider the
                     following line:
                     Sun Sep 14 16:12:44 2003 PRE: "-->> ^CoolGroup PRE^ <<-- blabla"
                     1   2   3  4        5    6    7      >8<

                     So, we should specify 8 to get the groupname.

                     If you have different prelines per group, you are pretty much
                     screwed on number of pres.

                     As you can see, the example also have a ^ in the groupname. We
                     done want that, so...


removefromgroup    = Any chars to remove from the groupname. Default is "^".
                     Do NOT leave this empty. Set any obscure char or leave ^
                     Note: Bold chars or similar (control chars) are automatically
                     stripped from the groupname. So is the " char.

                     You can add more then one char here. "^~>-" works fine but be aware
                     that if you add, for instance, A here, all A chars will be stripped
                     from the groupname.


MSS_SLAVES         = This is if you use MSS and want the stats from the slaves announced as well.
                     See the extra/mss-daystats.sh file in this package for instructions.
                     Set to "" (default) to disable / not use.

MSS_DAYSTATS_DIR   = See above.



--[ Announce for Dark0n3s Zipscript-c ]--

This needs to be done in dZSbot.tcl, if you havent already added TURGEN for some
other tur-* script.

To 'set msgtypes(DEFAULT)', add TURGEN
( that is, add it to the existing 'set msgtypes(DEFAULT)'. 

Add the following in the appropriate places:

set chanlist(TURGEN)  "#YourChan"
set disable(TURGEN)   0
set variables(TURGEN) "%msg"
set announce(TURGEN)  "%msg"

Dont forget to rehash the bot.

--[ Announce for pzs-ng ]--

This script uses TURGEN for announce. Later versions of pzs-ng already
have this added. To see if you have it added, run this command from shell:
 echo "Fri May 6 22:30:31 2005 TURGEN: \"test\"" >> /glftpd/ftp-data/logs/glftpd.log
(never mind the date).

If it did not announce "test" to your channel, you'll need to either upgrade pzs-ng or:

This goes into dZSconf.tcl:

Note: Depending on version, 'set msgtypes(DEFAULT)' might not
      exist in dZSconf.tcl. If so: 
      * Find it in dZSbconf.defaults.tcl
      * Copy it into dZSconf.tcl
      * Add TURGEN to set msgtypes(DEFAULT) in dZSconf.tcl

To 'set msgtypes(DEFAULT)', add TURGEN (should be a lot of other stuff in there too).

Add the following in the appropriate places:
set chanlist(TURGEN)  "#YourChan"
set disable(TURGEN)   0
set variables(TURGEN) "%msg"

Finally, in your current .theme file, add:
announce.TURGEN = "%msg"

--[ Usage ]--

Right. Run this script with argument 'test' and it will output the 
results on screen instead of to glftpd.log.

Once you are happy with it, add something like this to your
crontab.
58 23 * * *    /glftpd/bin/tur-daystats.sh


Enjoy, and remember: This script might require some changes from you if 
you can not get it to work for your setup. It might not be able to catch
your Pre group-top or something but thats just cause everyone has a 
different preline in glftpd.log. Dont come crying to me. This script
has already caused too much support.

/Turranius - 2003/2004/2005
