mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
comment formating (manual)
ruff 'E114,E115,E116,E261,E262,E265'
This commit is contained in:
parent
19b9d979ab
commit
dba73b96b7
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# vim:fileencoding=utf-8
|
# vim:fileencoding=utf-8
|
||||||
|
|
||||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||||
|
|
||||||
|
@ -56,9 +56,9 @@ def bilderstrecke(soup,tag):
|
|||||||
|
|
||||||
for v in struct:
|
for v in struct:
|
||||||
if isinstance(v, dict) and 'caption' in v and 'defaultUrl' in v:
|
if isinstance(v, dict) and 'caption' in v and 'defaultUrl' in v:
|
||||||
# if type(struct[i-1])== str:
|
# if type(struct[i-1])== str:
|
||||||
# head = soup.new_tag("h4")
|
# head = soup.new_tag("h4")
|
||||||
# head.append(struct[i-1])
|
# head.append(struct[i-1])
|
||||||
cap = soup.new_tag('p')
|
cap = soup.new_tag('p')
|
||||||
cap.append(struct[int(v['caption'])])
|
cap.append(struct[int(v['caption'])])
|
||||||
cap['class'] = 'body-elements__image-figcaption'
|
cap['class'] = 'body-elements__image-figcaption'
|
||||||
@ -172,11 +172,11 @@ class FazNet(BasicNewsRecipe):
|
|||||||
else:
|
else:
|
||||||
def parse_index(self):
|
def parse_index(self):
|
||||||
test_article = 'https://www.faz.net/aktuell/stil/mode-im-em-jahr-wir-zeigen-wie-fussball-und-mode-zusammengehoeren-19766969.html'
|
test_article = 'https://www.faz.net/aktuell/stil/mode-im-em-jahr-wir-zeigen-wie-fussball-und-mode-zusammengehoeren-19766969.html'
|
||||||
# test_article = 'https://www.faz.net/aktuell/feuilleton/buecher/film-eruption-ein-thriller-aus-dem-nachlass-von-michael-crichton-19770491.html'
|
# test_article = 'https://www.faz.net/aktuell/feuilleton/buecher/film-eruption-ein-thriller-aus-dem-nachlass-von-michael-crichton-19770491.html'
|
||||||
# test_article = 'https://www.faz.net/aktuell/stil/mode-design/leonie-benesch-sandra-hueller-ist-eine-meiner-heldinnen-19671638.html'
|
# test_article = 'https://www.faz.net/aktuell/stil/mode-design/leonie-benesch-sandra-hueller-ist-eine-meiner-heldinnen-19671638.html'
|
||||||
# test_article = 'https://www.faz.net/aktuell/feuilleton/medien/sabine-postel-zum-siebzigsten-die-briten-nannten-sie-german-traktor-19708409.html'
|
# test_article = 'https://www.faz.net/aktuell/feuilleton/medien/sabine-postel-zum-siebzigsten-die-briten-nannten-sie-german-traktor-19708409.html'
|
||||||
# test_article = 'https://www.faz.net/aktuell/stil/mode-design/von-richert-beil-bis-william-fan-wer-kauft-denn-das-19666592.html'
|
# test_article = 'https://www.faz.net/aktuell/stil/mode-design/von-richert-beil-bis-william-fan-wer-kauft-denn-das-19666592.html'
|
||||||
# test_article = 'https://www.faz.net/aktuell/feuilleton/buecher/rezensionen/sachbuch/tom-mustills-buch-die-sprache-der-wale-19657782.html'
|
# test_article = 'https://www.faz.net/aktuell/feuilleton/buecher/rezensionen/sachbuch/tom-mustills-buch-die-sprache-der-wale-19657782.html'
|
||||||
if test_article:
|
if test_article:
|
||||||
return [('Articles', [{'title': 'Test article', 'url': test_article}])]
|
return [('Articles', [{'title': 'Test article', 'url': test_article}])]
|
||||||
soup = self.index_to_soup(self.INDEX)
|
soup = self.index_to_soup(self.INDEX)
|
||||||
@ -214,7 +214,7 @@ class FazNet(BasicNewsRecipe):
|
|||||||
if len(par.contents) == 1:
|
if len(par.contents) == 1:
|
||||||
cont = str(par.contents[0])
|
cont = str(par.contents[0])
|
||||||
if re.search(r'^[1-9]\d* Bilder$',cont):
|
if re.search(r'^[1-9]\d* Bilder$',cont):
|
||||||
# print(cont)
|
# print(cont)
|
||||||
for tag in soup.findAll('script',attrs={'id':'__NUXT_DATA__','type':'application/json'}):
|
for tag in soup.findAll('script',attrs={'id':'__NUXT_DATA__','type':'application/json'}):
|
||||||
bilderstrecke(soup,tag)
|
bilderstrecke(soup,tag)
|
||||||
break
|
break
|
||||||
|
@ -178,10 +178,10 @@ class LeMonde(BasicNewsRecipe):
|
|||||||
# soup = self.index_to_soup('https://www.lemonde.fr/')
|
# soup = self.index_to_soup('https://www.lemonde.fr/')
|
||||||
# a = soup.find('a', {'id': 'jelec_link', 'style': True})
|
# a = soup.find('a', {'id': 'jelec_link', 'style': True})
|
||||||
# if a and a['style']:
|
# if a and a['style']:
|
||||||
# url = a['style'].split('/')
|
# url = a['style'].split('/')
|
||||||
# if len(url) > 5 and url[3].isdigit():
|
# if len(url) > 5 and url[3].isdigit():
|
||||||
# overwrite guess if actual cover ID was found
|
# overwrite guess if actual cover ID was found
|
||||||
# cover_id = url[3]
|
# cover_id = url[3]
|
||||||
return 'https://www.lemonde.fr/thumbnail/journal/' + cover_id + '/1000/1490'
|
return 'https://www.lemonde.fr/thumbnail/journal/' + cover_id + '/1000/1490'
|
||||||
|
|
||||||
def get_article_url(self, article):
|
def get_article_url(self, article):
|
||||||
|
@ -69,16 +69,16 @@ class NewYorker(BasicNewsRecipe):
|
|||||||
return soup
|
return soup
|
||||||
|
|
||||||
# def preprocess_image(self, img_data, image_url):
|
# def preprocess_image(self, img_data, image_url):
|
||||||
# from PIL import Image
|
# from PIL import Image
|
||||||
# from calibre import fit_image
|
# from calibre import fit_image
|
||||||
# from io import BytesIO
|
# from io import BytesIO
|
||||||
# img = Image.open(BytesIO(img_data)).convert('RGB')
|
# img = Image.open(BytesIO(img_data)).convert('RGB')
|
||||||
# scaled, nwidth, nheight = fit_image(img.width, img.height, 1024, 1024)
|
# scaled, nwidth, nheight = fit_image(img.width, img.height, 1024, 1024)
|
||||||
# if scaled:
|
# if scaled:
|
||||||
# img = img.resize((nwidth, nheight))
|
# img = img.resize((nwidth, nheight))
|
||||||
# buf = BytesIO()
|
# buf = BytesIO()
|
||||||
# img.save(buf, format='JPEG')
|
# img.save(buf, format='JPEG')
|
||||||
# return buf.getvalue()
|
# return buf.getvalue()
|
||||||
|
|
||||||
recipe_specific_options = {
|
recipe_specific_options = {
|
||||||
'date': {
|
'date': {
|
||||||
|
@ -6,14 +6,14 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
|||||||
|
|
||||||
class UAFootball(BasicNewsRecipe):
|
class UAFootball(BasicNewsRecipe):
|
||||||
|
|
||||||
# Russian version
|
# Russian version
|
||||||
# title = 'UA-\u0424\u0443\u0442\u0431\u043E\u043B'
|
# title = 'UA-\u0424\u0443\u0442\u0431\u043E\u043B'
|
||||||
# language = 'ru_UK'
|
# language = 'ru_UK'
|
||||||
# feeds = [
|
# feeds = [
|
||||||
# ('\u041D\u043E\u0432\u043E\u0441\u0442\u0438 \u0444\u0443\u0442\u0431\u043E\u043B\u0430', 'https://www.ua-football.com/rss/all.xml')
|
# ('\u041D\u043E\u0432\u043E\u0441\u0442\u0438 \u0444\u0443\u0442\u0431\u043E\u043B\u0430', 'https://www.ua-football.com/rss/all.xml')
|
||||||
# ]
|
# ]
|
||||||
|
|
||||||
# Ukrainian version
|
# Ukrainian version
|
||||||
title = 'UA-\u0424\u0443\u0442\u0431\u043E\u043B'
|
title = 'UA-\u0424\u0443\u0442\u0431\u043E\u043B'
|
||||||
description = ('\u0410\u043A\u0442\u0443\u0430\u043B\u044C\u043D\u0456 \u0442\u0435\u043C\u0438'
|
description = ('\u0410\u043A\u0442\u0443\u0430\u043B\u044C\u043D\u0456 \u0442\u0435\u043C\u0438'
|
||||||
' \u0444\u0443\u0442\u0431\u043E\u043B\u044C\u043D\u043E\u0433\u043E'
|
' \u0444\u0443\u0442\u0431\u043E\u043B\u044C\u043D\u043E\u0433\u043E'
|
||||||
@ -22,7 +22,7 @@ class UAFootball(BasicNewsRecipe):
|
|||||||
language = 'uk'
|
language = 'uk'
|
||||||
feeds = [
|
feeds = [
|
||||||
('\u041D\u043E\u0432\u0438\u043D\u0438', 'https://www.ua-football.com/ua/rss/all.xml')
|
('\u041D\u043E\u0432\u0438\u043D\u0438', 'https://www.ua-football.com/ua/rss/all.xml')
|
||||||
]
|
]
|
||||||
|
|
||||||
__author__ = 'bugmen00t'
|
__author__ = 'bugmen00t'
|
||||||
publisher = '1766 TEAM EOOD'
|
publisher = '1766 TEAM EOOD'
|
||||||
|
@ -1487,8 +1487,8 @@ class KOBOTOUCH(KOBO):
|
|||||||
SAGE_PRODUCT_ID = [0x4231]
|
SAGE_PRODUCT_ID = [0x4231]
|
||||||
TOUCH_PRODUCT_ID = [0x4163]
|
TOUCH_PRODUCT_ID = [0x4163]
|
||||||
TOUCH2_PRODUCT_ID = [0x4224]
|
TOUCH2_PRODUCT_ID = [0x4224]
|
||||||
LIBRA_COLOR_PRODUCT_ID = [0x4237] # This is shared by Kobo Libra Color, Clara Color and Clara BW
|
LIBRA_COLOR_PRODUCT_ID = [0x4237] # This is shared by Kobo Libra Color, Clara Color and Clara BW
|
||||||
# as well as tolino shine 5, shine color and vision color. Sigh.
|
# as well as tolino shine 5, shine color and vision color. Sigh.
|
||||||
# Kobo says the following will be used in future firmware (end 2024/2025)
|
# Kobo says the following will be used in future firmware (end 2024/2025)
|
||||||
CLARA_COLOR_PRODUCT_ID = [0x4238]
|
CLARA_COLOR_PRODUCT_ID = [0x4238]
|
||||||
CLARA_BW_PRODUCT_ID = [0x4239]
|
CLARA_BW_PRODUCT_ID = [0x4239]
|
||||||
|
@ -1863,7 +1863,7 @@ program:
|
|||||||
list_join('#@#', $authors, '&', list_re($#genre, ',', '^(.).*$', 'Genre: \\1'), ',')
|
list_join('#@#', $authors, '&', list_re($#genre, ',', '^(.).*$', 'Genre: \\1'), ',')
|
||||||
[/CODE]
|
[/CODE]
|
||||||
''') # not translated as \1 gets mistranslated as a control char in transifex
|
''') # not translated as \1 gets mistranslated as a control char in transifex
|
||||||
# for some reason. And yes, the double backslash is required, for some reason.
|
# for some reason. And yes, the double backslash is required, for some reason.
|
||||||
|
|
||||||
def evaluate(self, formatter, kwargs, mi, locals, with_separator, *args):
|
def evaluate(self, formatter, kwargs, mi, locals, with_separator, *args):
|
||||||
if len(args) % 2 != 0:
|
if len(args) % 2 != 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user