Code cleanup

This commit is contained in:
Stefan Ritter 2009-12-09 13:18:48 +01:00
parent bea3e9ee8d
commit f33b70ac0e

View file

@ -44,22 +44,22 @@ in_prep_today = re.compile('^in preparation since today\.$')
in_prep_yesterday = re.compile('^in preparation since yesterday\.$')
for line in url:
if re.match(line_match, line):
if re.match(line_match_desc, line):
if line_match.match(line):
if line_match_desc.match(line):
line = line.strip()
link = re.sub('<ul>', '', line)
link = line.replace('<ul>', '')
link = line[13:42]
item.append(link)
name = re.sub('<ul>', '', line)
name = line.replace('<ul>', '')
name = name[44:]
name = name.split(':', 1)[0]
item.append(name)
if options.description:
try:
description = re.sub('</a>,', '', line)
description = line.replace('</a>,', '')
description = ' (' + description.split(':')[2].strip() + ')'
except:
description = ''
@ -67,14 +67,14 @@ for line in url:
else:
item.append('')
if re.match(line_match_age, line):
if line_match_age.match(line):
if options.itp:
if re.match(in_prep_yesterday, line): days = '1'
elif re.match(in_prep_today, line): days = '0'
if in_prep_yesterday.match(line): days = '1'
elif in_prep_today.match(line): days = '0'
else: days = line.split(' ')[0]
else:
if re.match(req_yesterday, line): days = '1'
elif re.match(req_today, line): days = '0'
if req_yesterday.match(line): days = '1'
elif req_today.match(line): days = '0'
else: days = line.split(' ')[1]
item.append(days)