summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xwnpp-query.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/wnpp-query.py b/wnpp-query.py
index 13b7a85..bb39b2d 100755
--- a/wnpp-query.py
+++ b/wnpp-query.py
@@ -34,16 +34,13 @@ else: url = urllib2.urlopen('http://www.debian.org/devel/wnpp/requeste
reports = []
item = []
-for line in url:
-
- if re.match('^(.*)bugs\.debian\.org(.*)$', line) \
- or re.match('^requested(.*)$', line) \
- or re.match('^in preparation since(.*)$', line) \
- or re.match('^(.*)days in preparation\.$', line):
-
- if re.match('^\<ul\>(.*),', line) \
- or re.match ('^ \<li\>\<a href(.*)\</a\>,', line):
+line_match = re.compile('(^(.*)bugs\.debian\.org(.*)$|^requested(.*)$|^in preparation since(.*)$|^(.*)days in preparation\.$)')
+line_match_desc = re.compile('(^\<ul\>(.*),|^ \<li\>\<a href(.*)\</a\>,)')
+line_match_age = re.compile('(^requested(.*)$|^(.*)days in preparation(.*)$|^in preparation since(.*)$)')
+for line in url:
+ if re.match(line_match, line):
+ if re.match(line_match_desc, line):
line = line.strip()
link = re.sub('<ul>', '', line)
@@ -65,20 +62,15 @@ for line in url:
else:
item.append('')
- if re.match('^requested(.*)$', line) \
- or re.match('^(.*)days in preparation(.*)$', line) \
- or re.match('^in preparation since(.*)$', line):
-
+ if re.match(line_match_age, line):
if options.itp:
if re.match('^in preparation since yesterday\.$', line): days = '1'
elif re.match('^in preparation since today\.$', line): days = '0'
else: days = line.split(' ')[0]
-
else:
if re.match('^requested yesterday\.$', line): days = '1'
elif re.match('^requested today\.$', line): days = '0'
else: days = line.split(' ')[1]
-
item.append(days)
if len(item) == 4: