mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge from trunk
This commit is contained in:
commit
012170f1a4
@ -21,14 +21,19 @@ class Fronda(BasicNewsRecipe):
|
||||
|
||||
feeds = [(u'Infformacje', u'http://fronda.pl/news/feed')]
|
||||
|
||||
keep_only_tags = [dict(name='h1', attrs={'class':'big'}),
|
||||
dict(name='ul', attrs={'class':'about clear'}),
|
||||
dict(name='div', attrs={'class':'content'})]
|
||||
keep_only_tags = [dict(name='h2', attrs={'class':'news_title'}),
|
||||
dict(name='div', attrs={'class':'naglowek_tresc'}),
|
||||
dict(name='div', attrs={'id':'czytaj'}) ]
|
||||
|
||||
remove_tags = [dict(name='a', attrs={'class':'print'})]
|
||||
|
||||
preprocess_regexps = [
|
||||
(re.compile(i[0], re.IGNORECASE | re.DOTALL), i[1]) for i in
|
||||
[ (r'<a href="#" class="print">Drukuj</a>', lambda match: ''),
|
||||
(r'<p><a href="http://fronda.pl/sklepy">.*</a></p>', lambda match: ''),
|
||||
[ (r'<p><a href="http://fronda.pl/sklepy">.*</a></p>', lambda match: ''),
|
||||
(r'<p><a href="http://fronda.pl/pasaz">.*</a></p>', lambda match: ''),
|
||||
(r'<h3><strong>W.* lektury.*</a></p></div>', lambda match: '</div>'),
|
||||
(r'<h3>Zobacz t.*?</div>', lambda match: '</div>') ]
|
||||
(r'<h3>Zobacz t.*?</div>', lambda match: '</div>'),
|
||||
(r'<p[^>]*> </p>', lambda match: ''),
|
||||
(r'<p><span style=".*?"><br /></span></p> ', lambda match: ''),
|
||||
(r'<a style=\'float:right;margin-top:3px;\' href="http://www.facebook.com/share.php?.*?</a>', lambda match: '')]
|
||||
]
|
||||
|
BIN
recipes/icons/rzeczpospolita.png
Normal file
BIN
recipes/icons/rzeczpospolita.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
@ -2,7 +2,7 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class RzeczpospolitaRecipe(BasicNewsRecipe):
|
||||
__license__ = 'GPL v3'
|
||||
__author__ = 'kwetal'
|
||||
__author__ = u'kwetal and Tomasz Dlugosz'
|
||||
language = 'pl'
|
||||
version = 1
|
||||
|
||||
@ -38,6 +38,8 @@ class RzeczpospolitaRecipe(BasicNewsRecipe):
|
||||
remove_tags.append(dict(name = 'div', attrs = {'class' : 'clr'}))
|
||||
remove_tags.append(dict(name = 'div', attrs = {'id' : 'share_bottom'}))
|
||||
remove_tags.append(dict(name = 'div', attrs = {'id' : 'copyright_law'}))
|
||||
remove_tags.append(dict(name = 'div', attrs = {'class' : 'more'}))
|
||||
remove_tags.append(dict(name = 'div', attrs = {'class' : 'editorPicks'}))
|
||||
|
||||
extra_css = '''
|
||||
body {font-family: verdana, arial, helvetica, geneva, sans-serif ;}
|
||||
@ -48,6 +50,13 @@ class RzeczpospolitaRecipe(BasicNewsRecipe):
|
||||
.fot{font-size: x-small; color: #666666;}
|
||||
'''
|
||||
|
||||
def skip_ad_pages(self, soup):
|
||||
if ('advertisement' in soup.find('title').string.lower()):
|
||||
href = soup.find('a').get('href')
|
||||
return self.index_to_soup(href, raw=True)
|
||||
else:
|
||||
return None
|
||||
|
||||
def print_version(self, url):
|
||||
start, sep, rest = url.rpartition('/')
|
||||
forget, sep, index = rest.rpartition(',')
|
||||
|
@ -205,7 +205,7 @@ class ITUNES(DriverBase):
|
||||
# 0x129a iPad
|
||||
# 0x12a2 iPad2
|
||||
VENDOR_ID = [0x05ac]
|
||||
PRODUCT_ID = [0x1292,0x1293,0x1294,0x1297,0x1299,0x129a,0x12a2]
|
||||
PRODUCT_ID = [0x1292,0x1293,0x1294,0x1297,0x1299,0x129a,0x129f,0x12a2]
|
||||
BCD = [0x01]
|
||||
|
||||
# Plugboard ID
|
||||
|
@ -68,7 +68,8 @@ def check_command_line_options(parser, args, log):
|
||||
raise SystemExit(1)
|
||||
|
||||
output = args[2]
|
||||
if output.startswith('.') and output != '.':
|
||||
if output.startswith('.') and (output != '.' and not
|
||||
output.startswith('..')):
|
||||
output = os.path.splitext(os.path.basename(input))[0]+output
|
||||
output = os.path.abspath(output)
|
||||
|
||||
|
@ -338,7 +338,7 @@ class Amazon(Source):
|
||||
q['field-author'] = ' '.join(author_tokens)
|
||||
|
||||
if not ('field-keywords' in q or 'field-isbn' in q or
|
||||
('field-title' in q and 'field-author' in q)):
|
||||
('field-title' in q)):
|
||||
# Insufficient metadata to make an identify query
|
||||
return None
|
||||
|
||||
|
@ -212,6 +212,9 @@ class Source(Plugin):
|
||||
def is_customizable(self):
|
||||
return True
|
||||
|
||||
def customization_help(self):
|
||||
return 'This plugin can only be customized using the GUI'
|
||||
|
||||
def config_widget(self):
|
||||
from calibre.gui2.metadata.config import ConfigWidget
|
||||
return ConfigWidget(self)
|
||||
@ -288,10 +291,10 @@ class Source(Plugin):
|
||||
parts = parts[1:] + parts[:1]
|
||||
for tok in parts:
|
||||
tok = remove_pat.sub('', tok).strip()
|
||||
if len(tok) > 2 and tok.lower() not in ('von', ):
|
||||
if len(tok) > 2 and tok.lower() not in ('von', 'van',
|
||||
_('Unknown').lower()):
|
||||
yield tok
|
||||
|
||||
|
||||
def get_title_tokens(self, title, strip_joiners=True, strip_subtitle=False):
|
||||
'''
|
||||
Take a title and return a list of tokens useful for an AND search query.
|
||||
|
@ -20,6 +20,9 @@ class GenerateCatalogAction(InterfaceAction):
|
||||
action_spec = (_('Create a catalog of the books in your calibre library'), 'catalog.png', 'Catalog builder', None)
|
||||
dont_add_to = frozenset(['menubar-device', 'toolbar-device', 'context-menu-device'])
|
||||
|
||||
def genesis(self):
|
||||
self.qaction.triggered.connect(self.generate_catalog)
|
||||
|
||||
def generate_catalog(self):
|
||||
rows = self.gui.library_view.selectionModel().selectedRows()
|
||||
if not rows or len(rows) < 2:
|
||||
|
@ -68,7 +68,7 @@ def titlecase(text):
|
||||
line.append(icu_lower(word))
|
||||
continue
|
||||
|
||||
if prefs['language'].startswith('en'):
|
||||
if prefs['language'].lower().startswith('en'):
|
||||
match = MAC_MC.match(word)
|
||||
if match and not match.group(2)[:3] in ('hin', 'ht'):
|
||||
line.append("%s%s" % (capitalize(match.group(1)),
|
||||
|
Loading…
x
Reference in New Issue
Block a user