Fix error when no artist/title

It's hard to reproduce the bug, I had it for a very short time, and
didn't think of saving the HTTP responses.
This commit is contained in:
Laurent Bachelier 2012-02-12 15:18:20 +01:00
commit 7d1c232b38

View file

@ -66,7 +66,12 @@ class OuiFMBackend(BaseBackend, ICapRadio, ICapCollection):
suffix = '_%s' % radio
last = document['last%s' % suffix][0]
return last['artiste%s' % suffix].strip(), last['titre%s' % suffix].strip()
artist = last['artiste%s' % suffix]
title = last['titre%s' % suffix]
if artist and title:
return last['artiste%s' % suffix].strip(), last['titre%s' % suffix].strip()
else:
return artist, title
def get_radio(self, radio):
if not isinstance(radio, Radio):