Fix indents not multiples of four
This commit is contained in:
parent
fbe0fb8d52
commit
f37e3c5742
5 changed files with 44 additions and 44 deletions
|
|
@ -109,7 +109,7 @@ class VideoPage(BasePage):
|
|||
raise BrokenPageError('Unable to extract video url')
|
||||
flashvars = urllib.unquote(mobj.group(1))
|
||||
for key in ['hd1080URL', 'hd720URL', 'hqURL', 'sdURL', 'ldURL', 'video_url']:
|
||||
if key in flashvars:
|
||||
if key in flashvars:
|
||||
max_quality = key
|
||||
break
|
||||
|
||||
|
|
|
|||
|
|
@ -28,17 +28,17 @@ __all__ = ['LoginPage']
|
|||
|
||||
class LoginPage(BasePage):
|
||||
def login(self, login, passwd):
|
||||
msgb = self.document.xpath(".//*[@id='message_client']/text()")
|
||||
msga = ''.join(msgb)
|
||||
msg = msga.strip("\n")
|
||||
msgb = self.document.xpath(".//*[@id='message_client']/text()")
|
||||
msga = ''.join(msgb)
|
||||
msg = msga.strip("\n")
|
||||
|
||||
if "maintenance" in msg:
|
||||
raise BrowserUnavailable(msg)
|
||||
if "maintenance" in msg:
|
||||
raise BrowserUnavailable(msg)
|
||||
|
||||
self.browser.select_form(nr=3)
|
||||
self.browser['login'] = login
|
||||
self.browser['passwd'] = passwd
|
||||
self.browser.submit(nologin=True)
|
||||
self.browser.select_form(nr=3)
|
||||
self.browser['login'] = login
|
||||
self.browser['passwd'] = passwd
|
||||
self.browser.submit(nologin=True)
|
||||
|
||||
|
||||
# vim:ts=4:sw=4
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ __all__ = ['OkCBackend']
|
|||
def parse_dt(s):
|
||||
now = datetime.datetime.now()
|
||||
if s is None:
|
||||
return local2utc(now)
|
||||
return local2utc(now)
|
||||
if 'minutes ago' in s:
|
||||
m = int(s.split()[0])
|
||||
d = now - datetime.timedelta(minutes=m)
|
||||
m = int(s.split()[0])
|
||||
d = now - datetime.timedelta(minutes=m)
|
||||
elif u'–' in s:
|
||||
# Date in form : "Yesterday – 20:45"
|
||||
day, hour = s.split(u'–')
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ __all__ = ['HomePage','SearchPage','SeriePage','SeasonPage']
|
|||
|
||||
class HomePage(BasePage):
|
||||
def iter_subtitles(self,language,pattern):
|
||||
self.browser.select_form(nr=0)
|
||||
self.browser['q'] = pattern.encode('utf-8')
|
||||
self.browser.submit()
|
||||
assert self.browser.is_on_page(SearchPage)
|
||||
for subtitle in self.browser.page.iter_subtitles(language):
|
||||
yield subtitle
|
||||
self.browser.select_form(nr=0)
|
||||
self.browser['q'] = pattern.encode('utf-8')
|
||||
self.browser.submit()
|
||||
assert self.browser.is_on_page(SearchPage)
|
||||
for subtitle in self.browser.page.iter_subtitles(language):
|
||||
yield subtitle
|
||||
|
||||
|
||||
class SearchPage(BasePage):
|
||||
|
|
|
|||
|
|
@ -28,28 +28,28 @@ LAST_THING_IN_PARENTHESIS = re.compile("\([^)]\)$")
|
|||
|
||||
class TranslatePage(BasePage):
|
||||
def get_translation(self):
|
||||
# taking the first signification in the case several were found
|
||||
for tr in self.document.getiterator('tr'):
|
||||
prev_was_nums1 = False
|
||||
for td in tr.getiterator('td'):
|
||||
if prev_was_nums1:
|
||||
result = u''+td.text_content().split(';')[0].strip()
|
||||
result = LAST_THING_IN_PARENTHESIS.sub("",result)
|
||||
return result
|
||||
if td.attrib.get('class','') == 'nums1':
|
||||
prev_was_nums1 = True
|
||||
# if only one signification is found
|
||||
for div in self.document.getiterator('div'):
|
||||
if div.attrib.get('class','') == "trans clickable":
|
||||
names = u''+" ".join(div.text_content().split(']')[1].split()[1:]).split(';')[0]
|
||||
names = LAST_THING_IN_PARENTHESIS.sub("",names)
|
||||
return names.strip()
|
||||
# another numerotation possibility...
|
||||
for table in self.document.getiterator('table'):
|
||||
if table.attrib.get('class','') == "trans clickable":
|
||||
prev_was_roman1 = False
|
||||
for td in table.getiterator('td'):
|
||||
if prev_was_roman1:
|
||||
return u''+td.text_content().split(';')[0].strip()
|
||||
if td.attrib.get('class','') == 'roman1':
|
||||
prev_was_roman1 = True
|
||||
# taking the first signification in the case several were found
|
||||
for tr in self.document.getiterator('tr'):
|
||||
prev_was_nums1 = False
|
||||
for td in tr.getiterator('td'):
|
||||
if prev_was_nums1:
|
||||
result = u''+td.text_content().split(';')[0].strip()
|
||||
result = LAST_THING_IN_PARENTHESIS.sub("",result)
|
||||
return result
|
||||
if td.attrib.get('class','') == 'nums1':
|
||||
prev_was_nums1 = True
|
||||
# if only one signification is found
|
||||
for div in self.document.getiterator('div'):
|
||||
if div.attrib.get('class','') == "trans clickable":
|
||||
names = u''+" ".join(div.text_content().split(']')[1].split()[1:]).split(';')[0]
|
||||
names = LAST_THING_IN_PARENTHESIS.sub("",names)
|
||||
return names.strip()
|
||||
# another numerotation possibility...
|
||||
for table in self.document.getiterator('table'):
|
||||
if table.attrib.get('class','') == "trans clickable":
|
||||
prev_was_roman1 = False
|
||||
for td in table.getiterator('td'):
|
||||
if prev_was_roman1:
|
||||
return u''+td.text_content().split(';')[0].strip()
|
||||
if td.attrib.get('class','') == 'roman1':
|
||||
prev_was_roman1 = True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue