autopep8 with 120 chars line length on my modules
This commit is contained in:
parent
6a7bc0924d
commit
5d923bc73b
39 changed files with 434 additions and 426 deletions
|
|
@ -23,11 +23,11 @@ from weboob.capabilities.base import NotAvailable, NotLoaded
|
|||
from weboob.tools.browser import BasePage
|
||||
|
||||
|
||||
__all__ = ['SongResultsPage','SonglyricsPage', 'ArtistResultsPage', 'ArtistSongsPage', 'HomePage']
|
||||
__all__ = ['SongResultsPage', 'SonglyricsPage', 'ArtistResultsPage', 'ArtistSongsPage', 'HomePage']
|
||||
|
||||
|
||||
class HomePage(BasePage):
|
||||
def iter_lyrics(self,criteria,pattern):
|
||||
def iter_lyrics(self, criteria, pattern):
|
||||
self.browser.select_form(name='rechercher')
|
||||
if criteria == 'artist':
|
||||
self.browser['termes_a'] = pattern
|
||||
|
|
@ -41,21 +41,21 @@ class HomePage(BasePage):
|
|||
|
||||
class ArtistResultsPage(BasePage):
|
||||
def iter_lyrics(self):
|
||||
for link in self.parser.select(self.document.getroot(),'div.cont_cat table a.std'):
|
||||
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',''))
|
||||
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','')
|
||||
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-','')
|
||||
id = href.replace('./paroles-', '')
|
||||
songlyrics = SongLyrics(id, title)
|
||||
songlyrics.artist = artist
|
||||
songlyrics.content = NotLoaded
|
||||
|
|
@ -65,14 +65,14 @@ class ArtistSongsPage(BasePage):
|
|||
class SongResultsPage(BasePage):
|
||||
def iter_lyrics(self):
|
||||
first = True
|
||||
for tr in self.parser.select(self.document.getroot(),'div.cont_cat table tr'):
|
||||
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')
|
||||
links = self.parser.select(tr, 'a.std')
|
||||
title = unicode(links[0].text)
|
||||
id = links[0].attrib.get('href','').replace('/paroles-','')
|
||||
id = links[0].attrib.get('href', '').replace('/paroles-', '')
|
||||
artist = unicode(links[1].text)
|
||||
songlyrics = SongLyrics(id, title)
|
||||
songlyrics.artist = artist
|
||||
|
|
@ -84,8 +84,8 @@ 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')
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue