diff --git a/modules/parolesmusique/__init__.py b/modules/parolesmusique/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..f4a6efb2fe58003c613caafa67111e5018df761c
--- /dev/null
+++ b/modules/parolesmusique/__init__.py
@@ -0,0 +1,3 @@
+from .backend import ParolesmusiqueBackend
+
+__all__ = ['ParolesmusiqueBackend']
diff --git a/modules/parolesmusique/backend.py b/modules/parolesmusique/backend.py
new file mode 100644
index 0000000000000000000000000000000000000000..c564989e11530b062f0a60e5f1db40c8a74afd32
--- /dev/null
+++ b/modules/parolesmusique/backend.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+
+# Copyright(C) 2013 Julien Veyssier
+#
+# 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 .
+
+from weboob.capabilities.lyrics import ICapLyrics
+from weboob.tools.backend import BaseBackend
+
+from .browser import ParolesmusiqueBrowser
+
+from urllib import quote_plus
+
+__all__ = ['ParolesmusiqueBackend']
+
+
+class ParolesmusiqueBackend(BaseBackend, ICapLyrics):
+ NAME = 'parolesmusique'
+ MAINTAINER = u'Julien Veyssier'
+ EMAIL = 'julien.veyssier@aiur.fr'
+ VERSION = '0.f'
+ DESCRIPTION = 'paroles-musique lyrics website'
+ LICENSE = 'AGPLv3+'
+ BROWSER = ParolesmusiqueBrowser
+
+ def create_default_browser(self):
+ return self.create_browser()
+
+ def get_lyrics(self, id):
+ return self.browser.get_lyrics(id)
+
+ def iter_lyrics(self, criteria, pattern):
+ return self.browser.iter_lyrics(criteria,pattern.encode('utf-8'))
diff --git a/modules/parolesmusique/browser.py b/modules/parolesmusique/browser.py
new file mode 100644
index 0000000000000000000000000000000000000000..df8ec4ce0820ec635bcb058faa948b87e3f940f2
--- /dev/null
+++ b/modules/parolesmusique/browser.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+
+# Copyright(C) 2013 Julien Veyssier
+#
+# 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 .
+
+
+from weboob.tools.browser import BaseBrowser
+
+from .pages import SongResultsPage, SonglyricsPage, ArtistResultsPage, ArtistSongsPage, HomePage
+
+
+__all__ = ['ParolesmusiqueBrowser']
+
+
+class ParolesmusiqueBrowser(BaseBrowser):
+ DOMAIN = 'www.paroles-musique.com'
+ PROTOCOL = 'http'
+ ENCODING = 'utf-8'
+ USER_AGENT = BaseBrowser.USER_AGENTS['wget']
+ PAGES = {
+ 'http://www.paroles-musique.com': HomePage,
+ 'http://www.paroles-musique.com/lyrics-paroles-0-.*,0.php': SongResultsPage,
+ 'http://www.paroles-musique.com/lyrics-paroles-.*-0,0.php': ArtistResultsPage,
+ 'http://www.paroles-musique.com/paroles-.*p[0-9]*': SonglyricsPage,
+ 'http://www.paroles-musique.com/paroles-.*-lyrics,a[0-9]*': ArtistSongsPage,
+ }
+
+ def iter_lyrics(self, criteria, pattern):
+ self.location('http://www.paroles-musique.com')
+ assert self.is_on_page(HomePage)
+ return self.page.iter_lyrics(criteria,pattern)
+
+ def get_lyrics(self, id):
+ self.location('http://www.paroles-musique.com/paroles-%s' % id)
+ assert self.is_on_page(SonglyricsPage)
+ return self.page.get_lyrics(id)
diff --git a/modules/parolesmusique/pages.py b/modules/parolesmusique/pages.py
new file mode 100644
index 0000000000000000000000000000000000000000..9f3354acea84f97e4410aaeb407ee6999560a4dd
--- /dev/null
+++ b/modules/parolesmusique/pages.py
@@ -0,0 +1,93 @@
+# -*- coding: utf-8 -*-
+
+# Copyright(C) 2013 Julien Veyssier
+#
+# 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 .
+
+
+from weboob.capabilities.lyrics import SongLyrics
+from weboob.capabilities.base import NotAvailable, NotLoaded
+from weboob.tools.browser import BasePage
+
+
+__all__ = ['SongResultsPage','SonglyricsPage', 'ArtistResultsPage', 'ArtistSongsPage', 'HomePage']
+
+
+class HomePage(BasePage):
+ def iter_lyrics(self,criteria,pattern):
+ self.browser.select_form(name='rechercher')
+ if criteria == 'artist':
+ self.browser['termes_a'] = pattern
+ else:
+ self.browser['termes_t'] = pattern
+ self.browser.submit()
+ assert self.browser.is_on_page(SongResultsPage) or self.browser.is_on_page(ArtistResultsPage)
+ for lyr in self.browser.page.iter_lyrics():
+ yield lyr
+
+class ArtistResultsPage(BasePage):
+ def iter_lyrics(self):
+ for link in self.parser.select(self.document.getroot(),'div.cont_cat table a.std'):
+ artist = unicode(link.text_content())
+ self.browser.location('http://www.paroles-musique.com%s'%link.attrib.get('href',''))
+ assert self.browser.is_on_page(ArtistSongsPage)
+ for lyr in self.browser.page.iter_lyrics(artist):
+ yield lyr
+
+
+class ArtistSongsPage(BasePage):
+ def iter_lyrics(self,artist):
+ for link in self.parser.select(self.document.getroot(),'div.cont_catA div.art_scroll a'):
+ href = link.attrib.get('href','')
+ if href.startswith('./paroles'):
+ title = unicode(link.text)
+ id = href.replace('./paroles-','')
+ songlyrics = SongLyrics(id, title)
+ songlyrics.artist = artist
+ songlyrics.content = NotLoaded
+ yield songlyrics
+
+
+class SongResultsPage(BasePage):
+ def iter_lyrics(self):
+ first = True
+ for tr in self.parser.select(self.document.getroot(),'div.cont_cat table tr'):
+ if first:
+ first = False
+ continue
+ artist = NotAvailable
+ links = self.parser.select(tr,'a.std')
+ title = unicode(links[0].text)
+ id = links[0].attrib.get('href','').replace('/paroles-','')
+ artist = unicode(links[1].text)
+ songlyrics = SongLyrics(id, title)
+ songlyrics.artist = artist
+ songlyrics.content = NotLoaded
+ yield songlyrics
+
+
+class SonglyricsPage(BasePage):
+ def get_lyrics(self, id):
+ artist = NotAvailable
+ title = NotAvailable
+ content = unicode(self.parser.select(self.document.getroot(),'div#lyr_scroll',1).text_content().strip())
+ infos = self.parser.select(self.document.getroot(),'h2.lyrics > font')
+ artist = unicode(infos[0].text)
+ title = unicode(infos[1].text)
+ songlyrics = SongLyrics(id, title)
+ songlyrics.artist = artist
+ songlyrics.content = content
+ return songlyrics
diff --git a/modules/parolesmusique/test.py b/modules/parolesmusique/test.py
new file mode 100644
index 0000000000000000000000000000000000000000..88b89bc5adb548cd8e10ba943a11efc344cf25c7
--- /dev/null
+++ b/modules/parolesmusique/test.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+
+# Copyright(C) 2013 Julien Veyssier
+#
+# 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 .
+
+from weboob.tools.test import BackendTest
+from weboob.capabilities.base import NotLoaded
+
+class SeeklyricsTest(BackendTest):
+ BACKEND = 'parolesmusique'
+
+ def test_search_song_n_get(self):
+ l_lyrics = list(self.backend.iter_lyrics('song','chien'))
+ for songlyrics in l_lyrics:
+ assert songlyrics.id
+ assert songlyrics.title
+ assert songlyrics.artist
+ assert songlyrics.content is NotLoaded
+ full_lyr = self.backend.get_lyrics(songlyrics.id)
+ assert full_lyr.id
+ assert full_lyr.title
+ assert full_lyr.artist
+ assert full_lyr.content is not NotLoaded
+
+
+ def test_search_artist(self):
+ l_lyrics = list(self.backend.iter_lyrics('artist','boris'))
+ for songlyrics in l_lyrics:
+ assert songlyrics.id
+ assert songlyrics.title
+ assert songlyrics.artist
+ assert songlyrics.content is NotLoaded
diff --git a/modules/seeklyrics/test.py b/modules/seeklyrics/test.py
index d8d656b6d8dfe501cd28eff13fb7848b787bfb3c..cbbe3a0c5ae65507d4868458118b830b0e93c86b 100644
--- a/modules/seeklyrics/test.py
+++ b/modules/seeklyrics/test.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
-# Copyright(C) 2013
+# Copyright(C) 2013 Julien Veyssier
#
# This file is part of weboob.
#