Leverlåda 2.6.13
                 (yet another quite bleeding edge version)

                            for X-Chat >= 1.8.8
                                       >= 2.0.3
 
                                20.Mar.2002

                    http://www.geocities.com/iwronsky/

License

Released under GNU General Public License 2. See file COPYING.

WTF


Leverlåda is a perl script to retrieve filelists and files from FSERVEs running on IRC channels. On big channels there might be lots of fserves, queues filled to the brim and not much talking - its boring to idle and hit a zillion triggers of different fserves that could just call the quits next minute or so. In such enviroment its annoying to find anything specific and getting large files is often unsure.

Leverlåda monitors the channels for fserve announcements. It recognizes several of the most common ones, like Polaris, Jpolaris and Excursion. Once it notices something it thinks as a trigger, it will hit it and collect filelist from the fserve unless you already have a filelist and its not too old.

In normal mode, Leverlåda does no more than monitor and collect lists until you give it some command(s) to fetch file(s) from fserve(s). Then it waits for that fserve's next announcement and checks the announcement if there's a free slot in queues. If yes, it attempts to queue the file.

Current implementation also has some additional bells and whistles: a GUI to select files for downloading, an internal search/tag command and a regexp wishlist.

NOTE TO PPL RUNNING/CODING FSERVES: This script does not camp on your fserve - it does its business and goes away. Its intention is not to make trouble or overload your server, but to make the requesting of files less troublesome for the end user on busy fserves and big channels. If you're feeling nasty and want to prevent a healthy script like this, you can just modify your fserve announcement to something bizarre Leverlåda can't recognize. If the complete dirscan loads your machine too much, I suggest that you start providing a compressed, completely unambiguous filelist (in format "/dir1/dir2/file" per line) of your fserve contents with fixed name "000allfiles.zip" or ls-R[.zip|.gz|.bz2] to stay compatible with ftp servers in your fserve's main directory. Once we (the authors) start seeing these lists available, we will add support for them and not do recursive browsing anymore. Until that, be seeing you. :)

This script exists only because file-transferring over IRC with fserves is a fundamentally bad ad-hoc concept (but unfortunately popular!). Probably *ANY* peer-to-peer software, like limewire or whatever, could do much better, in a much more userfriendly fashion.

SPAMMY NOTE 2: In spirit, Leverlåda is associated with the more generic PIMPPA file-hoarding project, see http://pimppa.sf.net/ One day they might be joined. Or maybe not. ;)

3. Installation

Execute "make install". If you have problems, do manually

shell> cp leve.pl ~/.xchat/
shell> mkdir -p ~/.leve/lib
shell> cp *.pm ~/.leve/lib

You must have "auto accept dcc chat/send" and "auto-open the tabs for DCC chats" enabled in xchat for this script to work.

if you are under windows you should set your environment and create a variable called HOME pointing to a directory where you want the leve stuff to be, alternatively the script tries to pick up the directory pointed by APPDATA and if that also fails tries C:

otherwise cope as for unix: copy leve.pl to that dir, and the .pm files to a lib directory underneath that one .

4. Configuration

There's some configuration options on top of "leve.pl", modify them with a text editor to suit your needs. After the script has been started once, you can edit the options by changing "~/.leve/leve.conf".

IMPORTANT: By default this script will only note files of types "avi|mpg|mpeg|rm|asf". Other filetypes are skipped.

Description of the options:

UpdateListsIn           Days to wait before refreshing the fserve list
Running                 Automatically run Leve when loaded into mem?
activationTmout         Timeout in minutes before processing of an
                        fserve is declared failed
DropQueueIn             How many hours before considering a queue
                        dropped by external means
AutoLoad                Load chosen.txt to memory on startup?
ScanDepth               Dirscan how deep in fserves?
failureRestore          Restore failed transfers = 1, do not = 0
removeglobally          On success remove that file from all fservers
listchans               Channels where a !list may be send out
fuzzysearch             Try some fancys to detect similar names
recordFSlog             Enable object history log
maxhits                 Number of maximum hits in a search command, 0=unl
closeDCCwindow          Close DCC window after finishing operations
immediateSave           Determines if on dirscan the info is written
                        out immediately or only after scan completion
handler                 PgHandler or listHandler

You can choose the style of storing fserver data by changing "handler". There are two possible ways: the default way is to keep the lists as separate text files. The second option is to store them in a postgres database, if you have the database manager installed and running on your system. See 6.1 for the description and using of the different listhandlers.

5. Usage

If leve.pl is copied to "~/.xchat/" ("make install" does that) it will be autoloaded to memory on xchat startup. If not, load it manually as perl script/plugin.

leve.pl will monitor fserve announcements in xchat, hit the triggers and collect filelists to "~/.leve/" (or to database). It will also try to fetch files from fserves when commanded to do so. There's lots of additional features, see below. Transfers are logged to the filelist dir as "successes.txt" and "failures.txt".

Commands (this list might be out of date, see the beginning

of leve.pl to be sure):

/lstart

Activate the program. Default: active. /lstop

Disable the program.
/lload <filename>

Loads commands to the local command queue /lsave <filename>

        Save the current commands. As default, load and save
        will use file "~/.leve/chosen.txt".
    /lhelp
        Quick command help
    /lcancel <nick>
        Cancel the command for <nick>
    /llist
        List the current local command queues
    /lclear
        Clear all local command queues.
    /lpush <nick>
        Restore sent command for <nick>
    /lpending
        Show pending actions
    /lrehash <nick>
        Re-request the filelists from <nick>
    /lgui
        Launch the GUI to select files (after selecting/writing,
        you must execute /lload for leverlåda)
    /leve [set] [argument]
        Leverlåda shell commands, [set]s available:
        
        set          Without an argument show the whole list,
                     otherwise set given value
        nickchange   Change manually an fserver to match another nick
        drop
        add
        edit
        search       Search and add matching files into local
                             queue (e.g. "/leve search utena.*01")
        qsearch      Look up queues for a certain pattern
        fsearch      Look up stored database for a certain pattern
        wishlist     List the actual wishes, or with an argument set a wish
        delwish      Delete wish number x
        history      Show the history (debugging) for a certain server
        clrhist      Clear the history
        showmatch    Show matches obtained through fsearch
        selmatch     Select from those matching,
                     without arg select them all
        setser       Set server settings (max number of queues)
        trigger      Let the server be contacted immediately for next task
        version      Print version of this script

/leve help [cmd]

        gives you the list of available commands, or the help for a
        specific command

Command file format for /lload and /lsave is about the same as filelist format (but without the first line containing the date):

<nick> <trigger> <fullpath> <size/channel(optional)>

       ^  ^     ^   ^     ^    ^    ^
       *--|-----|---|-----|----|----|--- Fserve nick
          *-----|---*-----|---------|--- Separator öÄö
                *---------|---------|--- Fserve trigger
                          *---------|--- Full file path on the fserve
                                    *--- Not needed

6.1 Handlers: FileList-Handler

Module: listHandler.pm

This is the traditional handler to store fserver parse listings. ListHandler is the default handler, no changes needed for use.

The filelist format should be similar to the format of "/lload" and "/lsave" above. Lines can be grepped from the filelists and then loaded with /lload etc.

6.2 Handlers: PostgresSQL-Handler

Module: PgHandler.pm

IMPORTANT: prior to use this handler, ensure you have installed the perl DBI package and the DBD::Pg library!

WARNING: this thing causes heavy xchat loads, if you are parsing lists and making transfers at the same time this may break your transfers...

This is the new DB-based handler to store fserver parse listings, at the setting "handler" at the beginning of the leve.pl file you have to set "PgHandler" as the value to activate this handler.

More warnings: even if storing all the data in a DB is a much more satisfactory paradigm, and makes the administration of that data much easier, it has a serious performance drawback with leve, so don't wonder if your xchat client freezes at the end of a server parsing, its the script dumping all the acquired data into the DB.....

Efforts were made to limit at a maximum the connections to the database, and to regroup where possible the different requests into one huge block.

The big step forward with this thing, is the proper recognition of nickchanges and thus alias handling, no more data duplication.

On start of the system, just be sure postgres is running, the script will create itself its database (levei and thus needs the presence of the basic

database: template1) and populate it with the data gathered in the ~/.leve/*.lst files

A convenient way to start the script the first time, is to use the excellent debugging module IRC.pm you can fetch from the xchat site, and then run it alone with 'perl -mIRC leve.pl' thus you won't wonder if starting xchat with the postgres extension the first time it takes ages to give you the hand back (on my athlon system, piping the old data into the DB took approx 15min...) so be warned :D considering: du -s ~/.leve -h
98M /home/bboett/.leve

7. Leve GUI

shell> levesel

(Can be compiled with "make")

NOTE: The GUI works only with default "listHandler.pm".

A gtk GUI. Reads all collected filelists from "~/.leve/", throws a visual list of them, displaying only those matching a given regexp pattern. Selected lines can be written to file "~/.leve/chosen.txt" as commands by pressing the write button. The same file is also loaded upon gui startup. The written command list can be loaded to leverlåda with "/lload".

8. Example

Enter a channel where you see FSERVEs. Leverlåda will start to collect filelists. Examine the filelists from ~/.leve/ in shell using "more", "grep" or "levesel", a leverlåda file selecting GUI. Add the files you want to a command list, as the same lines you found in the filelists, and load the commandlist with /lload. Then let your xchat run. Leverlåda will try to download the files.

Perhaps easier way to select some files is to use, for example, "/leve search <pattern>" where pattern is a filename regexp pattern, like "molested.*fag-kenshin.*01.*". It will search the collected filelists and add all the matching files to the local queue.

9. Notes

Leverlåda hasn't been verified by formal methods. It might (and probably will) perform badly in situations not foreseen.

Leverlåda can handle multiple requests for the same server. Leverlåda must also see the servers announcement again to continue to fill the queues up to maxqueues specifyed for a server.

Multiple triggers are also supported, in similar fashion. First we query the first trigger contents, then as we see the banner again, query the second, and so on.

This script is experimental. It probably won't work on your favourite irc channel, where server announcements can be completely different from what I've seen. There is no standard to them. If something is not working, hack "leve.pl".

We encourage you to tweak. Please send us all the useful results. ;)

10. Troubleshooting

Is your computer connected to the electric socket?

If you still can't start the script, make sure that you have all the necessary perl modules installed on your system. (See lines "use <blah>;" in *.pl and *.pm).

xchat <=1.8.8 binaries are compiled to point to perl 5.6.0 includes. If you have e.g. perl 5.6.1, this will cause trouble. Its best to recompile xchat on your own system to avoid this.

11. Hall 'o Fame

I. Wronsky came up with this infernal concept and kludged the first 1.x versions together.

B. Boettcher saw it as his mission to add more capabilities and change it into an object oriented approach. Glory of 2.x is mostly his achievement.

You want to be here too?! Of course! Everyone wants. Just send us some useful patch and your name will be immortalized here forever.

12. Contact

Ideas and bug reports, etc. are all appreciated. Even better, if you can make the code function better on one topic without making it function worse somewhere else, that'd be superb.

Send mail to: <pimppa-leve(at)lists.sourceforge.net> Its completely ok to post without subscribing.

<EOF>