fix broken ouifm backend (to get current songs)

This commit is contained in:
Romain Bignon 2011-02-03 18:10:07 +01:00 committed by Romain Bignon
commit 47243c1ade
2 changed files with 10 additions and 10 deletions

View file

@ -26,11 +26,15 @@ __all__ = ['OuiFMBrowser']
class OuiFMBrowser(BaseBrowser):
DOMAIN = u'www.ouifm.fr'
PAGES = {r'.*ouifm.fr/scripts_player/decode_json.php': PlayerPage,
PAGES = {r'.*ouifm.fr/player/decode_json.*.php': PlayerPage,
}
def get_current(self, radio):
self.location('/scripts_player/decode_json.php')
if radio == 'general':
_radio = ''
else:
_radio = '_%s' % radio
self.location('/player/decode_json%s.php' % _radio)
assert self.is_on_page(PlayerPage)
return self.page.get_current(radio)
return self.page.get_current()

View file

@ -24,11 +24,7 @@ __all__ = ['PlayerPage']
class PlayerPage(BasePage):
def get_current(self, radio):
if radio == 'general':
_radio = ''
else:
_radio = '_%s' % radio
title = select(self.document.getroot(), 'div#titre%s' % _radio, 1).text.strip()
artist = select(self.document.getroot(), 'div#artiste%s' % _radio, 1).text.strip()
def get_current(self):
title = select(self.document.getroot(), 'div#liste_titres span.titre', 1).text.strip()
artist = select(self.document.getroot(), 'div#liste_titres span.artiste', 1).text.strip()
return unicode(artist), unicode(title)