[weboob] [PATCH] Nihon no Oto module for radioob : just works.

Thomas Lecavelier thomas at lecavelier.name
Mon Aug 12 15:10:05 CEST 2013


From: Thomas Lecavelier <tl at pierlis.com>

---
 modules/nihonnooto/__init__.py |    3 +++
 modules/nihonnooto/backend.py  |   50 ++++++++++++++++++++++++++++++++++++++
 modules/nihonnooto/browser.py  |   49 +++++++++++++++++++++++++++++++++++++
 modules/nihonnooto/favicon.png |  Bin 0 -> 7611 bytes
 modules/nihonnooto/pages.py    |   52 ++++++++++++++++++++++++++++++++++++++++
 modules/nihonnooto/test.py     |   30 +++++++++++++++++++++++
 6 files changed, 184 insertions(+)
 create mode 100644 modules/nihonnooto/__init__.py
 create mode 100644 modules/nihonnooto/backend.py
 create mode 100644 modules/nihonnooto/browser.py
 create mode 100644 modules/nihonnooto/favicon.png
 create mode 100644 modules/nihonnooto/pages.py
 create mode 100644 modules/nihonnooto/test.py

diff --git a/modules/nihonnooto/__init__.py b/modules/nihonnooto/__init__.py
new file mode 100644
index 0000000..216f36b
--- /dev/null
+++ b/modules/nihonnooto/__init__.py
@@ -0,0 +1,3 @@
+from .backend import NihonNoOtoBackend
+
+__all__ = ['NihonNoOtoBackend']
diff --git a/modules/nihonnooto/backend.py b/modules/nihonnooto/backend.py
new file mode 100644
index 0000000..b384ec5
--- /dev/null
+++ b/modules/nihonnooto/backend.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+# Copyright(C) 2013 Thomas Lecavelier
+#
+# This file is part of weboob.
+#
+# weboob is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# weboob is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with weboob. If not, see <http://www.gnu.org/licenses/>.
+
+from weboob.capabilities.radio import ICapRadio, Radio, Stream
+from weboob.tools.backend import BaseBackend
+from .browser import NihonNoOtoBrowser
+
+__all__ = ['NihonNoOtoBackend']
+
+class NihonNoOtoBackend(BaseBackend, ICapRadio):
+    NAME = 'nihonnooto'
+    MAINTAINER = u'Thomas Lecavelier'
+    EMAIL = 'thomas-weboob at lecavelier.name'
+    VERSION = '0.h'
+    DESCRIPTION = u'« Le son du Japon » french operated web radio, diffusing japanese music'
+    # License of your module
+    LICENSE = 'AGPLv3+'
+
+    BROWSER = NihonNoOtoBrowser
+    _RADIOS = {'nihonnooto': (u'Nihon no OTO', True) }
+
+    def iter_radios_search(self, pattern):
+        for radio in self.browser.iter_radios_list():
+            if pattern.lower() in radio.title.lower() or pattern.lower() in radio.description.lower():
+                self.browser.get_current_emission()
+                radio.current = self.browser.get_current_emission()
+ 
+                yield radio
+
+    def get_radio(self, radio):
+        if not isinstance(radio, Radio):
+           for rad in self.browser.iter_radios_list():
+               if rad.id == radio:
+                  return rad
+        return None
diff --git a/modules/nihonnooto/browser.py b/modules/nihonnooto/browser.py
new file mode 100644
index 0000000..abe5df4
--- /dev/null
+++ b/modules/nihonnooto/browser.py
@@ -0,0 +1,49 @@
+# * -*- coding: utf-8 -*-
+
+# Copyright(C) 2013  Thomas Lecavelier
+#
+# This file is part of weboob.
+#
+# weboob is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# weboob is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with weboob. If not, see <http://www.gnu.org/licenses/>.
+
+from weboob.tools.browser import BaseBrowser
+from .pages import LivePage, ProgramPage
+
+__all__ = ['NihonNoOtoBrowser']
+
+class NihonNoOtoBrowser(BaseBrowser):
+    DOMAIN = 'www.nihon-no-oto.com'
+    PROTOCOL = 'http'
+    ENCODING = 'utf-8'
+    USER_AGENT = BaseBrowser.USER_AGENTS['desktop_firefox']
+    PAGES = {
+        'http://www\.nihon-no-oto\.com/': LivePage,
+        'http://www\.nihon-no-oto\.com/app/playlist.php': ProgramPage,
+    }
+
+    def home(self):
+        self.location('/')
+
+        assert self.is_on_page(LivePage)
+
+    def iter_radios_list(self):
+        self.location('/')
+
+        assert self.is_on_page(LivePage)
+        return self.page.iter_radios_list()
+
+    def get_current_emission(self):
+        self.location('/app/playlist.php')
+        assert self.is_on_page(ProgramPage)
+        return self.page.get_current_emission()
diff --git a/modules/nihonnooto/favicon.png b/modules/nihonnooto/favicon.png
new file mode 100644
index 0000000000000000000000000000000000000000..312fff79f60601900d2f0ba6d34ab06d6c7b26de
GIT binary patch
literal 7611
zcmV;s9Yo at ZP)<h;3K|Lk000e1NJLTq002M$002M;1^@s6s%dfF0000PbVXQnQ*UN;
zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBV4T}ebiRCwCtdkJ)0<(205UcK5^sY;Ty
zSh8%(w!9m>fI|$}gw;4~J>5M_nr56phn`8#nIxn`PcNC%Av4`WPbM2-0w>*lCS-xI
zhCpIgW5C#Wm3PUDBx|cGRjKxR^|tx`S0!URGT0{5ojE+8YgN at ->iyq;?{~j@|5uV}
znx6r1fTrW)w^<San9dhtH1lH!0F>Iy>mOGDWPHrGk39g&)XX69KMT at 1PLd?)|1YNF
zSS|<vn+!Nchd5D^?f23oAXatXIkpJxK3X?z5ACP4!QW|gm<5_?G7W~M+oo}_nq_jI
z0n>hMLAUtYEW^@GB5K;GPGMg%4Z|uYla{ILd~5Bd-A|iyj^qDDOpNVZCjN_v7rb4l
z9OOp;AWYkqJ9f<a<(f6twl99sO7Gv#Lrnq1aoRU%i+<+--~sD-i}SRP4!~u!iDN(c
ziS-CC`vcm~X3w_X`N9{h(Kp|;OidF&4AQ<!yNag#E&$;8i$DFnt+L{5lojs|M!DYs
zIb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pages.py
new file mode 100644
index 0000000..3a319e6
--- /dev/null
+++ b/modules/nihonnooto/pages.py
@@ -0,0 +1,52 @@
+# * -*- coding: utf-8 -*-
+
+# Copyright(C) 2013  Thomas Lecavelier
+#
+# This file is part of weboob.
+#
+# weboob is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# weboob is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with weboob. If not, see <http://www.gnu.org/licenses/>.
+
+from weboob.tools.browser import BasePage
+from weboob.capabilities.radio import Radio, Stream, Emission
+
+__all__ = ['LivePage', 'ProgramPage']
+
+class LivePage(BasePage):
+    def iter_radios_list(self):
+        radio = Radio('nihon')
+        radio.title = 'Nihon no Oto'
+        radio.description = u'Nihon no Oto: le son du Japon'
+        radio.streams = []
+
+        index = -1
+       
+        for el in self.document.xpath('//source'):
+            index += 1
+            mime_type  = el.attrib['type']
+            stream_url = el.attrib['src']
+            stream = Stream(index)
+            stream.title = radio.title + ' ' + mime_type
+            stream.url = stream_url
+            radio.streams.append(stream)
+
+        yield radio
+
+
+
+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(' - ')
+        return current
diff --git a/modules/nihonnooto/test.py b/modules/nihonnooto/test.py
new file mode 100644
index 0000000..6a05201
--- /dev/null
+++ b/modules/nihonnooto/test.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+
+# Copyright(C) 2013 Thomas Lecavelier
+#
+# This file is part of weboob.
+#
+# weboob is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# weboob is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with weboob. If not, see <http://www.gnu.org/licenses/>.
+
+
+from weboob.tools.test import BackendTest
+from weboob.capabilities.radio import Radio
+
+
+class NihonNoOtoTest(BackendTest):
+    BACKEND = 'nihonnooto'
+
+    def test_nihonnooto(self):
+        l = list(self.backend.iter_radios_search('')
+        self.assertTrue(len(l) > 0)
-- 
1.7.10.2 (Apple Git-33)



More information about the weboob mailing list