From 35f00646b671b0ca64c892f0a722f89d765644e2 Mon Sep 17 00:00:00 2001 From: Thomas Lecavelier Date: Tue, 13 Aug 2013 13:39:15 +0200 Subject: [PATCH] Fix cases where current title has String(' - ') in it. --- modules/nihonnooto/pages.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/nihonnooto/pages.py b/modules/nihonnooto/pages.py index 869dcb9b..03f62ee8 100644 --- a/modules/nihonnooto/pages.py +++ b/modules/nihonnooto/pages.py @@ -48,5 +48,11 @@ class ProgramPage(BasePage): def get_current_emission(self): self.document.xpath('//p')[0].text current = Emission(0) - current.artist, current.title = self.document.xpath('//p')[0].text.split('/////')[0].split(' - ') + two_or_more = self.document.xpath('//p')[0].text.split('/////')[0].split(' - ') + # Consider that if String(' - ') appears it'll be in title rather in the artist name + if len(two_or_more) > 2: + current.artist = two_or_more.pop(0) + current.title = ' - '.join(two_or_more) + else: + current.artist, current.title = two_or_more return current