First commit
This commit is contained in:
commit
c5f82a156b
1 changed files with 48 additions and 0 deletions
48
rfpquery.py
Executable file
48
rfpquery.py
Executable file
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import urllib2, sys, re
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
print 'Syntax:', sys.argv[0], '[max_days_old]'
|
||||
sys.exit()
|
||||
|
||||
try:
|
||||
max_days_old = int(sys.argv[1])
|
||||
except:
|
||||
print 'Not an integer!'
|
||||
sys.exit()
|
||||
|
||||
|
||||
reports = []
|
||||
item = []
|
||||
|
||||
rfpurl = urllib2.urlopen('http://www.debian.org/devel/wnpp/requested')
|
||||
|
||||
for line in rfpurl:
|
||||
if re.findall('bugs\.debian\.org', line) or re.match('requested(.*)ago', line):
|
||||
# First line
|
||||
if re.match('^.ul.(.*),', line) or re.match ('^(.*)li.(.*),', line):
|
||||
# Link
|
||||
link = re.sub('<ul>', '', line)
|
||||
link = re.sub('<li><a href="', '', link).strip()[:29]
|
||||
item.append(link)
|
||||
|
||||
# Name
|
||||
name = re.sub('<ul>', '', line).strip()
|
||||
name = name[44:]
|
||||
name = name.split(':', 1)[0]
|
||||
item.append(name)
|
||||
|
||||
# Second line
|
||||
if re.match('^requested(.*)', line):
|
||||
days = re.sub('requested ', '', line)
|
||||
days = re.sub(' days ago.', '', days).strip()
|
||||
item.append(days)
|
||||
|
||||
if len(item) == 3:
|
||||
reports.append(item)
|
||||
item = []
|
||||
|
||||
for entry in reports:
|
||||
if int(entry[2]) <= max_days_old:
|
||||
print entry[1] + ': ' + entry[2] + ' days old (' + entry[0] + ')'
|
Loading…
Add table
Reference in a new issue