Python

Sinopsys

Oblivio is a tool for index generating of a directory tree, for html-like pages it also built the TOC.
By default if none root directory is specified it assume root is the python os.curdir (if you start it from file manager it's the dir where you click it, else it's the shell current dir.)
It's only output for the moment is XML; that needs to be cleaned by Tidy only if your file or directory names involve the use of xml entities, Oblivio actually doesn't check it, the script calls tidy automatically, but it must be configured properly.
The XML looks like the dirs tree; specifying file and dirs name, if you don't want you can give more file pattern, actually the script is able to parse (X)HTML-like, mp3, and .py files, using other pattern Oblivio will return only basics infos like size, last modified date, and so on.
See the Example: Site Map
Obviously you need of other transformation to make your map useful, I use a very simple XSL stylesheet that transform the XML to XHTML. You can exclude directories, directory trees and files using also regex (or simple you can use an * as in the command line; it stands for an unknown number of characters), the program ,also, check empty directories (it checks if specified files are in the dir), to exclude them.
At the end of the map there's a statistics area for more infos about elaboration process. Be aware, time section is strictly the time needed for pages elaboration not for the entire works such as importing modules, writing output and so on, but it isn't difficult to write a script counting all the needed time.

Configuration parameters:

Newer releases support command line parameter, call the program with --help for an overview.
{
'skipDirs':(r'/image',r'/cvs',r'/*_files', r'/Orig_templates')
'excludeFiles':(r'/report.html',r'/LinkVer_report.html')
'filExt':('pdf','htm','html')
'excludeEmpty':1
'timeFormat':"%d %b %y, %H:%M:%S"
'stat':1
'openMap':0
'readTidyOutput':1
'starTidy':1
'tidy':(r'tidy',os.curdir + r'/Orig_templates/xml.tidy')
'output1line':'<?xml version="1.0"?>
<?xml-stylesheet type="text/xml" href="../mappe/xx.xml"?>
<root>'
'plugIns_dir':r'\Obl_plug-ins'
'root': os.pardir
'dest':'mappe/map.xml'
'FullCnt':1
}

Times and statistics

Calling the script via an other module: 1.39 s for 2615.3 KB (version 0.17)

Source

Oblivio0.17
XX.xsl
xml.tidy

Archives

Oblivio0.1.py
Oblivio0.11.py
Oblivio0.12a.py
Oblivio014.py (not stable yet, don't download it!!!!)
Oblivio017.py - not dowloadable as a single file. Download the full package

Ideas for next releases

Change log

Not up to date.

##VERSION 0.17

##8 Mar 2005
Improved pythonic code.
File and directory exclusion works with regex

##VERSION 0.16

##28 Nov 2004
Finally a new decent release!

##VERSION 0.12b

##4 Oct 2004
Version 0.12 will be released only with a working and stable configuration.

##VERSION 0.11

##29 Sept 2004

##VERSION 0.1

##26 Sept 2004

Home
LinkVerify