This commit is contained in:
Kovid Goyal 2013-08-21 10:30:05 +05:30
parent 8609f177f8
commit d61e0b5be8

View File

@ -138,7 +138,8 @@ class Ozon(Source):
for author in authors:
for miauthor in miauthors:
#log.debug(u'=> %s <> %s'%(author, miauthor))
if author in miauthor: return True
if author in miauthor:
return True
return None
def ensure_metadata_match(mi): # {{{
@ -338,7 +339,7 @@ class Ozon(Source):
metadata.pubdate = toPubdate(log, matcher.group(0))
# overwrite comments from HTML if any
xpt = u'//*[@id="detail_description"]//*[contains(text(), "От производителя")]/../node()[not(self::comment())][not(self::br)][preceding::*[contains(text(), "От производителя")]]'
xpt = u'//*[@id="detail_description"]//*[contains(text(), "От производителя")]/../node()[not(self::comment())][not(self::br)][preceding::*[contains(text(), "От производителя")]]' # noqa
from lxml.etree import ElementBase
comment_elem = doc.xpath(xpt)
if comment_elem:
@ -391,7 +392,7 @@ def _get_affiliateId(): # {{{
def _format_isbn(log, isbn): # {{{
# for now only RUS ISBN are supported
#http://ru.wikipedia.org/wiki/ISBN_российских_издательств
# http://ru.wikipedia.org/wiki/ISBN_российских_издательств
isbn_pat = re.compile(r"""
^
(\d{3})? # match GS1 Prefix for ISBN13
@ -416,7 +417,6 @@ def _format_isbn(log, isbn): # {{{
$
""", re.VERBOSE)
res = check_isbn(isbn)
if res:
m = isbn_pat.match(res)
@ -429,7 +429,7 @@ def _format_isbn(log, isbn): # {{{
def _translageLanguageToCode(displayLang): # {{{
displayLang = unicode(displayLang).strip() if displayLang else None
langTbl = { None: 'ru',
langTbl = {None: 'ru',
u'Немецкий': 'de',
u'Английский': 'en',
u'Французский': 'fr',
@ -480,7 +480,6 @@ if __name__ == '__main__': # tests {{{
from calibre.ebooks.metadata.sources.test import (test_identify_plugin,
title_test, authors_test, isbn_test)
test_identify_plugin(Ozon.name,
[
# (
@ -490,7 +489,7 @@ if __name__ == '__main__': # tests {{{
# authors_test([u'В. П. Колесников', u'Г. В. Шатков'])]
# ),
(
{'identifiers':{'isbn': '9785916572629'} },
{'identifiers':{'isbn': '9785916572629'}},
[title_test(u'На все четыре стороны', exact=True),
authors_test([u'А. А. Гилл'])]
),
@ -501,7 +500,7 @@ if __name__ == '__main__': # tests {{{
authors_test([u'Erich Maria Remarque'])]
),
(
{'identifiers':{ }, 'title':u'Метро 2033',
{'identifiers':{}, 'title':u'Метро 2033',
'authors':[u'Дмитрий Глуховский']},
[title_test(u'Метро 2033', exact=False)]
),