[weboob] [PATCH 1/2] Fix cases where current title has String(' - ') in it.

Thomas Lecavelier thomas at lecavelier.name
Tue Aug 13 13:39:15 CEST 2013


From: Thomas Lecavelier <tl at pierlis.com>

---
 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 869dcb9..03f62ee 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
-- 
1.7.10.2 (Apple Git-33)




More information about the weboob mailing list