Fix a memory leak in our UPnP handler code
[amule.git] / src / utils / scripts / logfilter
blobaae59f9fd8d274c3238f346917774d8fa7331df5
1 #!/usr/bin/python
3 # This file is part of the aMule project.
5 # Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either
10 # version 2 of the License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 # Usage:
22 # svn log ... | logfilter <nick> [<nick2> [<nickn> ...]]
24 import sys
26 line = sys.stdin.readline()
27 while line:
28 if not line.strip().startswith("-"):
29 foundNick = False
30 for user in sys.argv[1:]:
31 if user == line.lower().split()[2]:
32 foundNick = True
33 break
35 if foundNick:
36 print ("-" * 72)
37 print line.strip()
39 # Check for -q
40 if line.count("|") > 2:
41 lineCount = int(line.split("|")[-1].split()[0])
42 line = sys.stdin.readline()
44 if foundNick: print line.rstrip()
46 if line.strip() == "Changed paths:":
47 line = sys.stdin.readline()
48 while line.strip():
49 if foundNick: print line.rstrip()
50 line = sys.stdin.readline()
52 if foundNick: print
54 for i in range(lineCount):
55 line = sys.stdin.readline()
56 if foundNick: print line.rstrip()
58 line = sys.stdin.readline()