Avoid problems with wrong timestamps (bug 352)
I've search a little and it seems that it comes from podcasts that are on my iPod and that don't have a released date. I've just attached my version of util.py. I've added a try/except, so if the timestamp is not None, but is incorrect, the exception is catched and None is returned. It works for me.
This commit is contained in:
parent
8a4a2a8ce8
commit
2fcbabfadb
|
@ -105,7 +105,7 @@ app_authors = [
|
|||
'Ortwin Forster', 'Paul Elliot', 'Paul Rudkin',
|
||||
'Pavel Mlčoch', 'Peter Hoffmann', 'PhilF', 'Philippe Gouaillier', 'Pieter de Decker',
|
||||
'Preben Randhol', 'Rafael Proença', 'R.Bell', 'red26wings', 'Richard Voigt',
|
||||
'Robert Young', 'Roel Groeneveld',
|
||||
'Robert Young', 'Roel Groeneveld', 'Romain Janvier',
|
||||
'Scott Wegner', 'Sebastian Krause', 'Seth Remington', 'Shane Donohoe', 'Silvio Sisto', 'SPGoetze',
|
||||
'S. Rust',
|
||||
'Stefan Lohmaier', 'Stephan Buys', 'Steve McCarthy', 'Stylianos Papanastasiou', 'Teo Ramirez',
|
||||
|
|
|
@ -301,7 +301,11 @@ def format_date(timestamp):
|
|||
|
||||
today = time.localtime()[:3]
|
||||
yesterday = time.localtime(time.time() - seconds_in_a_day)[:3]
|
||||
timestamp_date = time.localtime(timestamp)[:3]
|
||||
try:
|
||||
timestamp_date = time.localtime(timestamp)[:3]
|
||||
except ValueError, ve:
|
||||
log('Warning: Cannot convert timestamp', sender=self, traceback=True)
|
||||
return None
|
||||
|
||||
if timestamp_date == today:
|
||||
return _('Today')
|
||||
|
|
Loading…
Reference in New Issue