summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Ritter <xeno@thehappy.de>2009-10-29 10:34:47 +0100
committerStefan Ritter <xeno@thehappy.de>2009-10-29 10:34:47 +0100
commit8a96696731ce4c1c1461240c865eef167ef34445 (patch)
tree417dbc790307f23e11f8672786b348f1da7a1286
parente8ce24d57fa1a93511565ea8ef173cff23353b30 (diff)
Release 1.1:
* Sorting by 'days ago' * Changed output order
-rwxr-xr-xwnpp-query.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/wnpp-query.py b/wnpp-query.py
index 704e282..97abb2d 100755
--- a/wnpp-query.py
+++ b/wnpp-query.py
@@ -47,7 +47,7 @@ for line in url:
line = line.strip()
link = re.sub('<ul>', '', line)
- link = line[14:43]
+ link = line[13:42]
item.append(link)
name = re.sub('<ul>', '', line)
@@ -58,7 +58,7 @@ for line in url:
if options.description:
try:
description = re.sub('</a>,', '', line)
- description = ' (' + description.split(':')[2] + ')'
+ description = ' (' + description.split(':')[2].strip() + ')'
except:
description = ''
item.append(description)
@@ -75,6 +75,7 @@ for line in url:
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)
@@ -83,7 +84,8 @@ for line in url:
reports.append(item)
item = []
+reports.sort(key = lambda x: x[3])
for entry in reports:
if int(entry[3]) <= options.max_days_old \
and int(entry[3]) >= options.min_days_old:
- print entry[1] + entry[2] + ': ' + entry[3] + ' days ago (' + entry[0] + ')'
+ print entry[3], 'days ago:', entry[1], entry[0], entry[2]