Author: rgardler
Date: Wed Nov 17 00:04:02 2010
New Revision: 1035866
URL: http://svn.apache.org/viewvc?rev=1035866&view=rev
Log:
Add some logging (turn off with -q command line options) and support an
alternative mbox file format
Modified:
labs/agora/src/python/process.py
Modified: labs/agora/src/python/process.py
URL:
http://svn.apache.org/viewvc/labs/agora/src/python/process.py?rev=1035866&r1=1035865&r2=1035866&view=diff
==============================================================================
--- labs/agora/src/python/process.py (original)
+++ labs/agora/src/python/process.py Wed Nov 17 00:04:02 2010
@@ -168,7 +168,10 @@ def process(read,write):
if (backlink):
output.write(msgID + " " + repr(date) + " " +
address + " " + backlink + "\n")
else:
- output.write(msgID + " " + repr(date) + " " +
address + "\n")
+ output.write(msgID + " " + repr(date) + " " +
address + "\n")
+
+ if loud:
+ print "Processed msg", msgID
except (OverflowError,ValueError,TypeError):
error += 1
else:
@@ -181,12 +184,14 @@ def process(read,write):
#-----------------------------------------------------------------------#
-mbox_pattern = re.compile(r'^.*?(\d{4})(\d{2})(:?.gz)?',re.S)
-
+mbox_pattern = re.compile(r'^.*?(\d{4})-?(\d{2})(:?.gz)?',re.S)
+
def crawl(history,archives,input_path,output_path,file):
input = os.path.join(input_path,file)
if os.path.isdir(input):
+ if loud:
+ print "Process directory", input
output = os.path.join(output_path,file)
if (not os.path.exists(output)):
os.mkdir(output)
@@ -199,6 +204,8 @@ def crawl(history,archives,input_path,ou
if file:
archives.write("-:\n")
else:
+ if loud:
+ print "Process file", input
m = mbox_pattern.match(file)
if m:
name = m.group(1) + "-" + m.group(2)
@@ -214,7 +221,9 @@ def crawl(history,archives,input_path,ou
else:
if loud:
print "skipping", input
-
+ else:
+ if loud:
+ print "Ignoring", input
#-----------------------------------------------------------------------#
def usage(code, msg=''):
@@ -234,7 +243,7 @@ def main():
global loud, force
try:
- opts, args = getopt.getopt(sys.argv[1:], 'hfqd:m:p:')
+ opts, args = getopt.getopt(sys.argv[1:], 'hfqvd:m:p:')
except getopt.error, msg:
usage(2, msg)
@@ -271,6 +280,8 @@ def main():
sys.stderr.write("PID directory '" + piddir + "' could not be
found.\n")
sys.exit(-1)
else:
+ if loud:
+ print "Process files in", maildir
set_running(piddir)
history = load_history()
archives = open(os.path.join(datadir,"archives.dat"),"w")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]