mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Sync to trunk
This commit is contained in:
commit
d3d4e2e771
File diff suppressed because one or more lines are too long
@ -177,9 +177,9 @@ class Device(_Device):
|
||||
wmi = __import__('wmi', globals(), locals(), [], -1)
|
||||
c = wmi.WMI()
|
||||
for drive in c.Win32_DiskDrive():
|
||||
if self.windows_match_device(str(drive.PNPDeviceID), WINDOWS_MAIN_MEM):
|
||||
if self.windows_match_device(str(drive.PNPDeviceID), self.WINDOWS_MAIN_MEM):
|
||||
drives['main'] = self.windows_get_drive_prefix(drive)
|
||||
elif self.windows_match_device(str(drive.PNPDeviceID), WINDOWS_CARD_MEM):
|
||||
elif self.windows_match_device(str(drive.PNPDeviceID), self.WINDOWS_CARD_MEM):
|
||||
drives['card'] = self.windows_get_drive_prefix(drive)
|
||||
|
||||
if 'main' and 'card' in drives.keys():
|
||||
|
@ -15,15 +15,17 @@ from lxml import etree
|
||||
|
||||
class DefaultProfile(object):
|
||||
|
||||
flow_size = sys.maxint
|
||||
screen_size = None
|
||||
flow_size = sys.maxint
|
||||
screen_size = None
|
||||
remove_special_chars = False
|
||||
remove_object_tags = False
|
||||
|
||||
class PRS505(DefaultProfile):
|
||||
|
||||
flow_size = 270000
|
||||
screen_size = (590, 765)
|
||||
flow_size = 270000
|
||||
screen_size = (590, 765)
|
||||
remove_special_chars = re.compile(u'[\u200b\u00ad]')
|
||||
remove_object_tags = True
|
||||
|
||||
|
||||
PROFILES = {
|
||||
@ -156,7 +158,7 @@ to auto-generate a Table of Contents.
|
||||
help=_('Set the right margin in pts. Default is %default'))
|
||||
layout('base_font_size2', ['--base-font-size'], default=12.0,
|
||||
help=_('The base font size in pts. Default is %defaultpt. Set to 0 to disable rescaling of fonts.'))
|
||||
layout('remove_paragraph_spacing', ['--remove-paragraph-spacing'], default=True,
|
||||
layout('remove_paragraph_spacing', ['--remove-paragraph-spacing'], default=False,
|
||||
help=_('Remove spacing between paragraphs. Will not work if the source file forces inter-paragraph spacing.'))
|
||||
layout('preserve_tag_structure', ['--preserve-tag-structure'], default=False,
|
||||
help=_('Preserve the HTML tag structure while splitting large HTML files. This is only neccessary if the HTML files contain CSS that uses sibling selectors. Enabling this greatly slows down processing of large HTML files.'))
|
||||
|
@ -52,6 +52,7 @@ def convert(opts, recipe_arg, notification=None):
|
||||
|
||||
print 'Generating epub...'
|
||||
opts.encoding = 'utf-8'
|
||||
opts.remove_paragraph_spacing = True
|
||||
html2epub(opf, opts, notification=notification)
|
||||
|
||||
|
||||
|
@ -158,6 +158,10 @@ class HTMLProcessor(Processor, Rationalizer):
|
||||
for br in self.body.xpath('./br'):
|
||||
br.tag = 'p'
|
||||
br.text = u'\u00a0'
|
||||
|
||||
if self.opts.profile.remove_object_tags:
|
||||
for tag in self.root.xpath('//object|//embed'):
|
||||
tag.getparent().remove(tag)
|
||||
|
||||
def save(self):
|
||||
for meta in list(self.root.xpath('//meta')):
|
||||
|
@ -95,7 +95,7 @@ class EbookIterator(object):
|
||||
for match in re.compile(r'@font-face\s*{([^}]+)}').finditer(css):
|
||||
block = match.group(1)
|
||||
family = re.compile(r'font-family\s*:\s*([^;]+)').search(block)
|
||||
url = re.compile(r'url\s*\((.+?)\)', re.DOTALL).search(block)
|
||||
url = re.compile(r'url\s*\([\'"]*(.+?)[\'"]*\)', re.DOTALL).search(block)
|
||||
if url:
|
||||
path = url.group(1).split('/')
|
||||
path = os.path.join(os.path.dirname(item.path), *path)
|
||||
|
@ -848,7 +848,7 @@ class Processor(Parser):
|
||||
# Workaround for anchor rendering bug in ADE
|
||||
css += '\n\na { color: inherit; text-decoration: inherit; cursor: default; }\na[href] { color: blue; text-decoration: underline; cursor:pointer; }'
|
||||
if self.opts.remove_paragraph_spacing:
|
||||
css += '\n\np {text-indent: 2em; margin-top:0pt; margin-bottom:0pt; padding:0pt; border:0pt;}'
|
||||
css += '\n\np {text-indent: 1.5em; margin-top:0pt; margin-bottom:0pt; padding:0pt; border:0pt;}'
|
||||
if self.opts.override_css:
|
||||
css += '\n\n' + self.opts.override_css
|
||||
self.override_css = self.css_parser.parseString(self.preprocess_css(css))
|
||||
|
@ -12,7 +12,7 @@ import copy
|
||||
import re
|
||||
from lxml import etree
|
||||
from calibre.ebooks.oeb.base import namespace, barename
|
||||
from calibre.ebooks.oeb.base import XHTML, XHTML_NS
|
||||
from calibre.ebooks.oeb.base import XHTML, XHTML_NS, OEB_DOCS
|
||||
from calibre.ebooks.oeb.stylizer import Stylizer
|
||||
from calibre.ebooks.oeb.transforms.flatcss import KeyMapper
|
||||
|
||||
@ -96,8 +96,11 @@ class MobiMLizer(object):
|
||||
href = oeb.guide['cover'].href
|
||||
del oeb.guide['cover']
|
||||
item = oeb.manifest.hrefs[href]
|
||||
oeb.manifest.remove(item)
|
||||
|
||||
if item.spine_position is not None:
|
||||
oeb.spine.remove(item)
|
||||
if item.media_type in OEB_DOCS:
|
||||
self.oeb.manifest.remove(item)
|
||||
|
||||
def mobimlize_spine(self):
|
||||
for item in self.oeb.spine:
|
||||
stylizer = Stylizer(item.data, item.href, self.oeb, self.profile)
|
||||
@ -137,7 +140,7 @@ class MobiMLizer(object):
|
||||
para = bstate.para
|
||||
if tag in SPECIAL_TAGS and not text:
|
||||
para = para if para is not None else bstate.body
|
||||
elif para is None:
|
||||
elif para is None or tag in ('td', 'th'):
|
||||
body = bstate.body
|
||||
if bstate.pbreak:
|
||||
etree.SubElement(body, MBP('pagebreak'))
|
||||
@ -157,7 +160,8 @@ class MobiMLizer(object):
|
||||
elif indent != 0 and abs(indent) < self.profile.fbase:
|
||||
indent = (indent / abs(indent)) * self.profile.fbase
|
||||
if tag in NESTABLE_TAGS:
|
||||
para = wrapper = etree.SubElement(parent, XHTML(tag))
|
||||
para = wrapper = etree.SubElement(
|
||||
parent, XHTML(tag), attrib=istate.attrib)
|
||||
bstate.nested.append(para)
|
||||
if tag == 'li' and len(istates) > 1:
|
||||
istates[-2].list_num += 1
|
||||
@ -337,6 +341,10 @@ class MobiMLizer(object):
|
||||
tag = 'tr'
|
||||
elif display == 'table-cell':
|
||||
tag = 'td'
|
||||
if tag in TABLE_TAGS:
|
||||
for attr in ('rowspan', 'colspan'):
|
||||
if attr in elem.attrib:
|
||||
istate.attrib[attr] = elem.attrib[attr]
|
||||
text = None
|
||||
if elem.text:
|
||||
if istate.preserve:
|
||||
@ -374,6 +382,6 @@ class MobiMLizer(object):
|
||||
bstate.vpadding += bstate.vmargin
|
||||
bstate.vmargin = 0
|
||||
bstate.vpadding += vpadding
|
||||
if tag in NESTABLE_TAGS and bstate.nested:
|
||||
if bstate.nested and bstate.nested[-1].tag == elem.tag:
|
||||
bstate.nested.pop()
|
||||
istates.pop()
|
||||
|
@ -124,6 +124,7 @@ class BookHeader(object):
|
||||
sublangid = (langcode >> 10) & 0xFF
|
||||
self.language = main_language.get(langid, 'ENGLISH')
|
||||
self.sublanguage = sub_language.get(sublangid, 'NEUTRAL')
|
||||
self.first_image_index = struct.unpack('>L', raw[0x6c:0x6c+4])[0]
|
||||
|
||||
self.exth_flag, = struct.unpack('>L', raw[0x80:0x84])
|
||||
self.exth = None
|
||||
@ -441,17 +442,18 @@ class MobiReader(object):
|
||||
os.makedirs(output_dir)
|
||||
image_index = 0
|
||||
self.image_names = []
|
||||
for i in range(self.num_sections):
|
||||
for i in range(self.book_header.first_image_index, self.num_sections):
|
||||
if i in processed_records:
|
||||
continue
|
||||
processed_records.append(i)
|
||||
data = self.sections[i][0]
|
||||
buf = cStringIO.StringIO(data)
|
||||
image_index += 1
|
||||
try:
|
||||
im = PILImage.open(buf)
|
||||
except IOError:
|
||||
except IOError, e:
|
||||
continue
|
||||
image_index += 1
|
||||
|
||||
path = os.path.join(output_dir, '%05d.jpg'%image_index)
|
||||
self.image_names.append(os.path.basename(path))
|
||||
im.convert('RGB').save(open(path, 'wb'), format='JPEG')
|
||||
@ -476,6 +478,7 @@ def get_metadata(stream):
|
||||
else:
|
||||
tdir = tempfile.mkdtemp('_mobi_meta', __appname__+'_')
|
||||
atexit.register(shutil.rmtree, tdir)
|
||||
#print tdir
|
||||
mr.extract_images([], tdir)
|
||||
mi = mr.create_opf('dummy.html')
|
||||
if mi.cover:
|
||||
@ -491,7 +494,6 @@ def get_metadata(stream):
|
||||
if os.access(candidate, os.R_OK):
|
||||
cover = candidate
|
||||
break
|
||||
|
||||
if os.access(cover, os.R_OK):
|
||||
mi.cover_data = ('JPEG', open(os.path.join(tdir, cover), 'rb').read())
|
||||
else:
|
||||
|
@ -95,6 +95,7 @@ class Serializer(object):
|
||||
def __init__(self, oeb, images):
|
||||
self.oeb = oeb
|
||||
self.images = images
|
||||
self.logger = oeb.logger
|
||||
self.id_offsets = {}
|
||||
self.href_offsets = defaultdict(list)
|
||||
self.breaks = []
|
||||
@ -144,8 +145,8 @@ class Serializer(object):
|
||||
item = hrefs[path] if path else None
|
||||
if item and item.spine_position is None:
|
||||
return False
|
||||
id = item.id if item else base.id
|
||||
href = '#'.join((id, frag)) if frag else id
|
||||
path = item.href if item else base.href
|
||||
href = '#'.join((path, frag)) if frag else path
|
||||
buffer.write('filepos=')
|
||||
self.href_offsets[href].append(buffer.tell())
|
||||
buffer.write('0000000000')
|
||||
@ -170,7 +171,7 @@ class Serializer(object):
|
||||
buffer = self.buffer
|
||||
if not item.linear:
|
||||
self.breaks.append(buffer.tell() - 1)
|
||||
self.id_offsets[item.id] = buffer.tell()
|
||||
self.id_offsets[item.href] = buffer.tell()
|
||||
for elem in item.data.find(XHTML('body')):
|
||||
self.serialize_elem(elem, item)
|
||||
buffer.write('<mbp:pagebreak/>')
|
||||
@ -180,12 +181,11 @@ class Serializer(object):
|
||||
if not isinstance(elem.tag, basestring) \
|
||||
or namespace(elem.tag) not in nsrmap:
|
||||
return
|
||||
hrefs = self.oeb.manifest.hrefs
|
||||
tag = prefixname(elem.tag, nsrmap)
|
||||
for attr in ('name', 'id'):
|
||||
if attr in elem.attrib:
|
||||
id = '#'.join((item.id, elem.attrib[attr]))
|
||||
self.id_offsets[id] = buffer.tell()
|
||||
href = '#'.join((item.href, elem.attrib[attr]))
|
||||
self.id_offsets[href] = buffer.tell()
|
||||
del elem.attrib[attr]
|
||||
if tag == 'a' and not elem.attrib \
|
||||
and not len(elem) and not elem.text:
|
||||
@ -203,7 +203,7 @@ class Serializer(object):
|
||||
continue
|
||||
elif attr == 'src':
|
||||
href = item.abshref(val)
|
||||
if href in hrefs:
|
||||
if href in self.images:
|
||||
index = self.images[href]
|
||||
buffer.write('recindex="%05d"' % index)
|
||||
continue
|
||||
@ -233,8 +233,12 @@ class Serializer(object):
|
||||
|
||||
def fixup_links(self):
|
||||
buffer = self.buffer
|
||||
for id, hoffs in self.href_offsets.items():
|
||||
ioff = self.id_offsets[id]
|
||||
id_offsets = self.id_offsets
|
||||
for href, hoffs in self.href_offsets.items():
|
||||
if href not in id_offsets:
|
||||
self.logger.warn('Hyperlink target %r not found' % href)
|
||||
href, _ = urldefrag(href)
|
||||
ioff = self.id_offsets[href]
|
||||
for hoff in hoffs:
|
||||
buffer.seek(hoff)
|
||||
buffer.write('%010d' % ioff)
|
||||
@ -360,7 +364,11 @@ class MobiWriter(object):
|
||||
if image.format not in ('JPEG', 'GIF'):
|
||||
width, height = image.size
|
||||
area = width * height
|
||||
format = 'GIF' if area <= 40000 else 'JPEG'
|
||||
if area <= 40000:
|
||||
format = 'GIF'
|
||||
else:
|
||||
image = image.convert('RGBA')
|
||||
format = 'JPEG'
|
||||
changed = True
|
||||
if dimen is not None:
|
||||
image.thumbnail(dimen, Image.ANTIALIAS)
|
||||
@ -507,6 +515,9 @@ def add_mobi_options(parser):
|
||||
group.add_option(
|
||||
'-r', '--rescale-images', default=False, action='store_true',
|
||||
help=_('Modify images to meet Palm device size limitations.'))
|
||||
group.add_option(
|
||||
'--toc-title', default=None, action='store',
|
||||
help=_('Title for any generated in-line table of contents.'))
|
||||
parser.add_option_group(group)
|
||||
group = OptionGroup(parser, _('Profiles'), _('Device renderer profiles. '
|
||||
'Affects conversion of default font sizes and rasterization '
|
||||
@ -550,7 +561,7 @@ def oeb2mobi(opts, inpath):
|
||||
imagemax = PALM_MAX_IMAGE_SIZE if opts.rescale_images else None
|
||||
context = Context(source, dest)
|
||||
oeb = OEBBook(inpath, logger=logger)
|
||||
tocadder = HTMLTOCAdder()
|
||||
tocadder = HTMLTOCAdder(title=opts.toc_title)
|
||||
tocadder.transform(oeb, context)
|
||||
mangler = CaseMangler()
|
||||
mangler.transform(oeb, context)
|
||||
|
@ -15,11 +15,12 @@ from urlparse import urldefrag, urlparse, urlunparse
|
||||
from urllib import unquote as urlunquote
|
||||
import logging
|
||||
import re
|
||||
import htmlentitydefs
|
||||
import uuid
|
||||
import copy
|
||||
from lxml import etree
|
||||
from lxml import html
|
||||
from calibre import LoggingInterface
|
||||
from calibre.translations.dynamic import translate
|
||||
|
||||
XML_PARSER = etree.XMLParser(recover=True)
|
||||
XML_NS = 'http://www.w3.org/XML/1998/namespace'
|
||||
@ -67,14 +68,6 @@ OEB_IMAGES = set([GIF_MIME, JPEG_MIME, PNG_MIME, SVG_MIME])
|
||||
|
||||
MS_COVER_TYPE = 'other.ms-coverimage-standard'
|
||||
|
||||
recode = lambda s: s.decode('iso-8859-1').encode('ascii', 'xmlcharrefreplace')
|
||||
ENTITYDEFS = dict((k, recode(v)) for k, v in htmlentitydefs.entitydefs.items())
|
||||
del ENTITYDEFS['lt']
|
||||
del ENTITYDEFS['gt']
|
||||
del ENTITYDEFS['quot']
|
||||
del ENTITYDEFS['amp']
|
||||
del recode
|
||||
|
||||
|
||||
def element(parent, *args, **kwargs):
|
||||
if parent is not None:
|
||||
@ -298,7 +291,6 @@ class Metadata(object):
|
||||
|
||||
class Manifest(object):
|
||||
class Item(object):
|
||||
ENTITY_RE = re.compile(r'&([a-zA-Z_:][a-zA-Z0-9.-_:]+);')
|
||||
NUM_RE = re.compile('^(.*)([0-9][0-9.]*)(?=[.]|$)')
|
||||
|
||||
def __init__(self, id, href, media_type,
|
||||
@ -317,9 +309,12 @@ class Manifest(object):
|
||||
% (self.id, self.href, self.media_type)
|
||||
|
||||
def _force_xhtml(self, data):
|
||||
repl = lambda m: ENTITYDEFS.get(m.group(1), m.group(0))
|
||||
data = self.ENTITY_RE.sub(repl, data)
|
||||
data = etree.fromstring(data, parser=XML_PARSER)
|
||||
try:
|
||||
data = etree.fromstring(data, parser=XML_PARSER)
|
||||
except etree.XMLSyntaxError:
|
||||
data = html.fromstring(data, parser=XML_PARSER)
|
||||
data = etree.tostring(data, encoding=unicode)
|
||||
data = etree.fromstring(data, parser=XML_PARSER)
|
||||
if namespace(data.tag) != XHTML_NS:
|
||||
data.attrib['xmlns'] = XHTML_NS
|
||||
data = etree.tostring(data)
|
||||
@ -506,6 +501,7 @@ class Spine(object):
|
||||
self.items.pop(index)
|
||||
for i in xrange(index, len(self.items)):
|
||||
self.items[i].spine_position = i
|
||||
item.spine_position = None
|
||||
|
||||
def __iter__(self):
|
||||
for item in self.items:
|
||||
@ -680,22 +676,22 @@ class TOC(object):
|
||||
node.to_opf1(tour)
|
||||
return tour
|
||||
|
||||
def to_ncx(self, parent, playorder=None, depth=1):
|
||||
if not playorder: playorder = [0]
|
||||
def to_ncx(self, parent, order=None, depth=1):
|
||||
if not order: order = [0]
|
||||
for node in self.nodes:
|
||||
playorder[0] += 1
|
||||
order[0] += 1
|
||||
playOrder = str(order[0])
|
||||
id = self.id or 'np' + playOrder
|
||||
point = etree.SubElement(parent,
|
||||
NCX('navPoint'), attrib={'playOrder': str(playorder[0])})
|
||||
NCX('navPoint'), id=id, playOrder=playOrder)
|
||||
if self.klass:
|
||||
point.attrib['class'] = node.klass
|
||||
if self.id:
|
||||
point.attrib['id'] = node.id
|
||||
label = etree.SubElement(point, NCX('navLabel'))
|
||||
etree.SubElement(label, NCX('text')).text = node.title
|
||||
href = node.href if depth > 1 else urldefrag(node.href)[0]
|
||||
child = etree.SubElement(point,
|
||||
NCX('content'), attrib={'src': href})
|
||||
node.to_ncx(point, playorder, depth+1)
|
||||
node.to_ncx(point, order, depth+1)
|
||||
return parent
|
||||
|
||||
|
||||
@ -802,12 +798,20 @@ class OEBBook(object):
|
||||
def _manifest_from_opf(self, opf):
|
||||
self.manifest = manifest = Manifest(self)
|
||||
for elem in xpath(opf, '/o2:package/o2:manifest/o2:item'):
|
||||
id = elem.get('id')
|
||||
href = elem.get('href')
|
||||
media_type = elem.get('media-type')
|
||||
fallback = elem.get('fallback')
|
||||
if href in manifest.hrefs:
|
||||
self.logger.warn(u'Duplicate manifest entry for %r.' % href)
|
||||
continue
|
||||
if not self.container.exists(href):
|
||||
self.logger.warn(u'Manifest item %r not found.' % href)
|
||||
continue
|
||||
manifest.add(elem.get('id'), href, elem.get('media-type'),
|
||||
elem.get('fallback'))
|
||||
if id in manifest.ids:
|
||||
self.logger.warn(u'Duplicate manifest id %r.' % id)
|
||||
id, href = manifest.generate(id, href)
|
||||
manifest.add(id, href, media_type, fallback)
|
||||
|
||||
def _spine_from_opf(self, opf):
|
||||
self.spine = spine = Spine(self)
|
||||
@ -970,6 +974,11 @@ class OEBBook(object):
|
||||
self._toc_from_opf(opf)
|
||||
self._ensure_cover_image()
|
||||
|
||||
def translate(self, text):
|
||||
lang = str(self.metadata.language[0])
|
||||
lang = lang.split('-', 1)[0].lower()
|
||||
return translate(lang, text)
|
||||
|
||||
def to_opf1(self):
|
||||
package = etree.Element('package',
|
||||
attrib={'unique-identifier': self.uid.id})
|
||||
@ -983,22 +992,11 @@ class OEBBook(object):
|
||||
guide = self.guide.to_opf1(package)
|
||||
return {OPF_MIME: ('content.opf', package)}
|
||||
|
||||
def _generate_ncx_item(self):
|
||||
id = 'ncx'
|
||||
index = 0
|
||||
while id in self.manifest:
|
||||
id = 'ncx' + str(index)
|
||||
index = index + 1
|
||||
href = 'toc'
|
||||
index = 0
|
||||
while (href + '.ncx') in self.manifest.hrefs:
|
||||
href = 'toc' + str(index)
|
||||
href += '.ncx'
|
||||
return (id, href)
|
||||
|
||||
def _to_ncx(self):
|
||||
ncx = etree.Element(NCX('ncx'), attrib={'version': '2005-1'},
|
||||
nsmap={None: NCX_NS})
|
||||
lang = unicode(self.metadata.language[0])
|
||||
ncx = etree.Element(NCX('ncx'),
|
||||
attrib={'version': '2005-1', XML('lang'): lang},
|
||||
nsmap={None: NCX_NS})
|
||||
head = etree.SubElement(ncx, NCX('head'))
|
||||
etree.SubElement(head, NCX('meta'),
|
||||
attrib={'name': 'dtb:uid', 'content': unicode(self.uid)})
|
||||
@ -1021,7 +1019,7 @@ class OEBBook(object):
|
||||
nsmap={None: OPF2_NS})
|
||||
metadata = self.metadata.to_opf2(package)
|
||||
manifest = self.manifest.to_opf2(package)
|
||||
id, href = self._generate_ncx_item()
|
||||
id, href = self.manifest.generate('ncx', 'toc.ncx')
|
||||
etree.SubElement(manifest, OPF('item'),
|
||||
attrib={'id': id, 'href': href, 'media-type': NCX_MIME})
|
||||
spine = self.spine.to_opf2(package)
|
||||
|
@ -44,13 +44,15 @@ body > .calibre_toc_block {
|
||||
}
|
||||
|
||||
class HTMLTOCAdder(object):
|
||||
def __init__(self, style='nested'):
|
||||
def __init__(self, title=None, style='nested'):
|
||||
self.title = title
|
||||
self.style = style
|
||||
|
||||
def transform(self, oeb, context):
|
||||
if 'toc' in oeb.guide:
|
||||
return
|
||||
oeb.logger.info('Generating in-line TOC...')
|
||||
title = self.title or oeb.translate('Table of Contents')
|
||||
style = self.style
|
||||
if style not in STYLE_CSS:
|
||||
oeb.logger.error('Unknown TOC style %r' % style)
|
||||
@ -61,15 +63,15 @@ class HTMLTOCAdder(object):
|
||||
contents = element(None, XHTML('html'), nsmap={None: XHTML_NS},
|
||||
attrib={XML('lang'): language})
|
||||
head = element(contents, XHTML('head'))
|
||||
title = element(head, XHTML('title'))
|
||||
title.text = 'Table of Contents'
|
||||
htitle = element(head, XHTML('title'))
|
||||
htitle.text = title
|
||||
element(head, XHTML('link'), rel='stylesheet', type=CSS_MIME,
|
||||
href=css_href)
|
||||
body = element(contents, XHTML('body'),
|
||||
attrib={'class': 'calibre_toc'})
|
||||
h1 = element(body, XHTML('h1'),
|
||||
attrib={'class': 'calibre_toc_header'})
|
||||
h1.text = 'Table of Contents'
|
||||
h1.text = title
|
||||
self.add_toc_level(body, oeb.toc)
|
||||
id, href = oeb.manifest.generate('contents', 'contents.xhtml')
|
||||
item = oeb.manifest.add(id, href, XHTML_MIME, data=contents)
|
||||
|
@ -41,8 +41,9 @@ class ManifestTrimmer(object):
|
||||
while unchecked:
|
||||
new = set()
|
||||
for item in unchecked:
|
||||
if item.media_type in OEB_DOCS or \
|
||||
item.media_type[-4:] in ('/xml', '+xml'):
|
||||
if (item.media_type in OEB_DOCS or
|
||||
item.media_type[-4:] in ('/xml', '+xml')) and \
|
||||
item.data is not None:
|
||||
hrefs = [sel(item.data) for sel in LINK_SELECTORS]
|
||||
for href in chain(*hrefs):
|
||||
href = item.abshref(href)
|
||||
|
@ -296,6 +296,8 @@ class Main(MainWindow, Ui_MainWindow):
|
||||
self.card_view.connect_dirtied_signal(self.upload_booklists)
|
||||
|
||||
self.show()
|
||||
if self.system_tray_icon.isVisible() and opts.start_in_tray:
|
||||
self.hide()
|
||||
self.stack.setCurrentIndex(0)
|
||||
try:
|
||||
db = LibraryDatabase2(self.library_path)
|
||||
@ -1527,6 +1529,8 @@ path_to_ebook to the database.
|
||||
''')
|
||||
parser.add_option('--with-library', default=None, action='store',
|
||||
help=_('Use the library located at the specified path.'))
|
||||
parser.add_option('--start-in-tray', default=False, action='store_true',
|
||||
help=_('Start minimized to system tray.'))
|
||||
parser.add_option('-v', '--verbose', default=0, action='count',
|
||||
help=_('Log debugging information to console'))
|
||||
return parser
|
||||
|
@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
|
@ -17,7 +17,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
|
@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
|
@ -8,13 +8,13 @@ msgstr ""
|
||||
"Project-Id-Version: de\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2009-01-19 04:38+0000\n"
|
||||
"PO-Revision-Date: 2009-01-10 09:57+0000\n"
|
||||
"PO-Revision-Date: 2009-01-19 21:16+0000\n"
|
||||
"Last-Translator: S. Dorscht <Unknown>\n"
|
||||
"Language-Team: American English <kde-i18n-doc@lists.kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
@ -1836,7 +1836,7 @@ msgstr "Benutzung: rb-meta file.rb"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/from_any.py:52
|
||||
msgid "Creating Mobipocket file from EPUB..."
|
||||
msgstr ""
|
||||
msgstr "Erstelle Mobipocket Datei aus EPUB..."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/reader.py:505
|
||||
msgid "%prog [options] myebook.mobi"
|
||||
@ -1848,47 +1848,51 @@ msgstr "Original MOBI HTML gespeichert in"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:501
|
||||
msgid "Mobipocket"
|
||||
msgstr ""
|
||||
msgstr "Mobipocket"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:502
|
||||
msgid "Mobipocket-specific options."
|
||||
msgstr ""
|
||||
msgstr "Einstellungen speziell für Mobipocket."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:505
|
||||
msgid ""
|
||||
"Compress file text using PalmDOC compression. Results in smaller files, but "
|
||||
"takes a long time to run."
|
||||
msgstr ""
|
||||
"Textdatei mit PalmDOC compression komprimieren. Ergibt kleinere Dateien, "
|
||||
"dauert aber länger beim Start."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:509
|
||||
msgid "Modify images to meet Palm device size limitations."
|
||||
msgstr ""
|
||||
msgstr "Bilder auf die Größenlimitation von Palm Geräten einstellen."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:511
|
||||
msgid ""
|
||||
"Device renderer profiles. Affects conversion of default font sizes and "
|
||||
"rasterization resolution. Valid profiles are: %s."
|
||||
msgstr ""
|
||||
"Profile der Gerätedarstellung. Betrifft das Konvertieren mit "
|
||||
"voreingestellten Schriftgrößen und Rasterauflösung. Vorhandene Profile: %s."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:511
|
||||
msgid "Profiles"
|
||||
msgstr ""
|
||||
msgstr "Profile"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:516
|
||||
msgid "Source renderer profile. Default is 'Browser'."
|
||||
msgstr ""
|
||||
msgstr "Profil der Quellendarstellung. Voreinstellung ist 'Browser'."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:519
|
||||
msgid "Destination renderer profile. Default is 'CybookG3'."
|
||||
msgstr ""
|
||||
msgstr "Profil der Zieldarstellung. Voreinstellung ist 'CybookG3'."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:543
|
||||
msgid "Unknown source profile %r"
|
||||
msgstr ""
|
||||
msgstr "Unbekanntes Profil der Quelle %r"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:547
|
||||
msgid "Unknown destination profile %r"
|
||||
msgstr ""
|
||||
msgstr "Unbekanntes Profil des Ziels %r"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/odt/to_oeb.py:57
|
||||
msgid "The output directory. Defaults to the current directory."
|
||||
@ -3513,7 +3517,7 @@ msgstr "Passwort erforderlich"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/progress.py:42
|
||||
msgid "Aborting..."
|
||||
msgstr ""
|
||||
msgstr "Abbruch läuft ..."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/scheduler.py:39
|
||||
msgid "You"
|
||||
@ -4548,11 +4552,11 @@ msgstr "Speichern auf Festplatte nicht möglich"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/main.py:973
|
||||
msgid "Saving to disk..."
|
||||
msgstr ""
|
||||
msgstr "Speichere auf Festplatte..."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/main.py:978
|
||||
msgid "Saved"
|
||||
msgstr ""
|
||||
msgstr "Gespeichert"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/main.py:984
|
||||
msgid "Choose destination directory"
|
||||
|
27
src/calibre/translations/dynamic.py
Normal file
27
src/calibre/translations/dynamic.py
Normal file
@ -0,0 +1,27 @@
|
||||
'''
|
||||
Dynamic language lookup of translations for user-visible strings.
|
||||
'''
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Marshall T. Vandegrift <llasram@gmail.com>'
|
||||
|
||||
import sys
|
||||
from cStringIO import StringIO
|
||||
from gettext import GNUTranslations, NullTranslations
|
||||
from calibre.translations.compiled import translations
|
||||
|
||||
__all__ = ['translate']
|
||||
|
||||
_CACHE = {}
|
||||
|
||||
def translate(lang, text):
|
||||
trans = None
|
||||
if lang in _CACHE:
|
||||
trans = _CACHE[lang]
|
||||
elif lang in translations:
|
||||
buf = StringIO(translations[lang])
|
||||
trans = GNUTranslations(buf)
|
||||
_CACHE[lang] = trans
|
||||
if trans is None:
|
||||
return _(text)
|
||||
return trans.ugettext(text)
|
@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
|
@ -11,13 +11,13 @@ msgstr ""
|
||||
"Project-Id-Version: es\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2009-01-19 04:38+0000\n"
|
||||
"PO-Revision-Date: 2009-01-19 06:30+0000\n"
|
||||
"Last-Translator: Kovid Goyal <Unknown>\n"
|
||||
"PO-Revision-Date: 2009-01-20 01:11+0000\n"
|
||||
"Last-Translator: DiegoJ <diegojromerolopez@gmail.com>\n"
|
||||
"Language-Team: Spanish\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
@ -382,6 +382,9 @@ msgid ""
|
||||
"preference to the autodetected one. With this option, the autodetected one "
|
||||
"is always used."
|
||||
msgstr ""
|
||||
"Normalmente, si el archivo fuente ya tiene una Tabla de contenidos, se usa "
|
||||
"esa en vez de la autodetectada. Con esta opción la autodetectada es la que "
|
||||
"siempre se usa."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/epub/__init__.py:148
|
||||
msgid "Control page layout"
|
||||
@ -1748,7 +1751,7 @@ msgstr "Uso: rb-meta file.rb"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/from_any.py:52
|
||||
msgid "Creating Mobipocket file from EPUB..."
|
||||
msgstr ""
|
||||
msgstr "Creando archivo Mobipocket de un EPUB..."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/reader.py:505
|
||||
msgid "%prog [options] myebook.mobi"
|
||||
@ -1760,21 +1763,25 @@ msgstr "HTML MOBI en bruto guardado en"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:501
|
||||
msgid "Mobipocket"
|
||||
msgstr ""
|
||||
msgstr "Mobipocket"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:502
|
||||
msgid "Mobipocket-specific options."
|
||||
msgstr ""
|
||||
msgstr "Opciones específicas de Mobipocket"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:505
|
||||
msgid ""
|
||||
"Compress file text using PalmDOC compression. Results in smaller files, but "
|
||||
"takes a long time to run."
|
||||
msgstr ""
|
||||
"Comprimir archivo de texto usando compresión PalmDOC. Genera archivos de "
|
||||
"menor tamaño, pero tarda bastante tiempo en terminar."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:509
|
||||
msgid "Modify images to meet Palm device size limitations."
|
||||
msgstr ""
|
||||
"Modificar imágenes para adecuarse a las limitecaiones de tamaño del "
|
||||
"dispositivo de Palm"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:511
|
||||
msgid ""
|
||||
@ -1784,7 +1791,7 @@ msgstr ""
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:511
|
||||
msgid "Profiles"
|
||||
msgstr ""
|
||||
msgstr "Perfiles"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:516
|
||||
msgid "Source renderer profile. Default is 'Browser'."
|
||||
@ -3396,7 +3403,7 @@ msgstr "Se necesita contraseña."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/progress.py:42
|
||||
msgid "Aborting..."
|
||||
msgstr ""
|
||||
msgstr "Abortando..."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/scheduler.py:39
|
||||
msgid "You"
|
||||
@ -4404,11 +4411,11 @@ msgstr "No se puede guardar en disco"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/main.py:973
|
||||
msgid "Saving to disk..."
|
||||
msgstr ""
|
||||
msgstr "Guardando al disco..."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/main.py:978
|
||||
msgid "Saved"
|
||||
msgstr ""
|
||||
msgstr "Guardado"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/main.py:984
|
||||
msgid "Choose destination directory"
|
||||
@ -5412,6 +5419,15 @@ msgid ""
|
||||
"\n"
|
||||
"For help on an individual command: %%prog command --help\n"
|
||||
msgstr ""
|
||||
"%%prog orden [opciones] [argumentos]\n"
|
||||
"\n"
|
||||
"%%prog es la interfaz de línea de órdenes a la base de datos de libros de "
|
||||
"calibre.\n"
|
||||
"\n"
|
||||
"orden es una de:\n"
|
||||
" %s\n"
|
||||
"\n"
|
||||
"Para ver la ayuda a cada orden ejecuta: %%prog orden --help\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/library/database2.py:1171
|
||||
msgid "<p>Copying books to %s<br><center>"
|
||||
|
@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
|
@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
|
@ -8,13 +8,13 @@ msgstr ""
|
||||
"Project-Id-Version: calibre\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2009-01-19 04:38+0000\n"
|
||||
"PO-Revision-Date: 2009-01-19 06:34+0000\n"
|
||||
"Last-Translator: Kovid Goyal <Unknown>\n"
|
||||
"PO-Revision-Date: 2009-01-20 11:05+0000\n"
|
||||
"Last-Translator: Molnár Gábor <csirkus@gmail.com>\n"
|
||||
"Language-Team: Hungarian <hu@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
@ -330,6 +330,11 @@ msgid ""
|
||||
"if your source file contains a very large number of page breaks, you should "
|
||||
"turn off splitting on page breaks."
|
||||
msgstr ""
|
||||
"Oldaltörésnél ne legyen szétvágás. Normális esetben a bemeneti fájlok minden "
|
||||
"oldaltörésnél két részre lesznek vágva. Ez olyan e-könyv formátumot "
|
||||
"eredmenyez, amelyet gyorsabban, kevesebb erőforrást igényelve lehet "
|
||||
"beolvasni. Ez a művelet azonban lassú, és ha a forrásfájlod sok oldaltörést "
|
||||
"tartalmaz, akkor érdemes alkalmazni ezt az opciót."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/epub/__init__.py:128
|
||||
msgid ""
|
||||
@ -339,6 +344,11 @@ msgid ""
|
||||
"trying\n"
|
||||
"to auto-generate a Table of Contents.\n"
|
||||
msgstr ""
|
||||
"Az automatkius tartalomjegyzék generálásás beállítása. Ha egy OPF fájllal "
|
||||
"dolgozunk\n"
|
||||
"és a fájlban található tartalomjegyzék, akkor azt használja a generált "
|
||||
"tartalomjegyzék\n"
|
||||
"helyett.\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/epub/__init__.py:134
|
||||
msgid ""
|
||||
@ -390,6 +400,10 @@ msgid ""
|
||||
"placed in. See http://www.niso.org/workrooms/daisy/Z39-86-2005.html#NCX for "
|
||||
"an overview of the NCX format."
|
||||
msgstr ""
|
||||
"Egy .ncx fájl helye, amely tartalmazza ennek a könyvnek a tartalomjegyzékét. "
|
||||
"Az NCX fájlnak a saját könyvtárához viszonyított linkeket kell tartalmaznia, "
|
||||
"nem abszolút linkeket. Áttekintés az NCX formátumról: "
|
||||
"http://www.niso.org/workrooms/daisy/Z39-86-2005.html#NCX"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/epub/__init__.py:146
|
||||
msgid ""
|
||||
@ -622,6 +636,7 @@ msgstr ""
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/html.py:897
|
||||
msgid "Output HTML is \"pretty printed\" for easier parsing by humans"
|
||||
msgstr ""
|
||||
"A kimenet HTML kód \"szépen formázott\" lesz a könnyebb olvashatóság kedvéért"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/html.py:903
|
||||
msgid ""
|
||||
@ -737,6 +752,8 @@ msgid ""
|
||||
"Render HTML tables as blocks of text instead of actual tables. This is "
|
||||
"neccessary if the HTML contains very large or complex tables."
|
||||
msgstr ""
|
||||
"A HTML táblázatokat alakítsa át szövegblokkokká. Ez akkor szükséges, ha a "
|
||||
"HTML nagy vagy bonyolult táblázatokat tartalmaz."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:99
|
||||
msgid ""
|
||||
@ -773,12 +790,15 @@ msgstr ""
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:112
|
||||
msgid "Add extra spacing below the header. Default is %default px."
|
||||
msgstr ""
|
||||
"Hagyjon ki ennyi helyet a fejléc alatt. Az alapértelmezés %default pixel."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:114
|
||||
msgid ""
|
||||
"Override the CSS. Can be either a path to a CSS stylesheet or a string. If "
|
||||
"it is a string it is interpreted as CSS."
|
||||
msgstr ""
|
||||
"Használja formázáshoz a következő CSS-t. Lehet egy útvonal egy CSS fájlhoz, "
|
||||
"vagy maga a CSS kód."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:116
|
||||
msgid ""
|
||||
@ -819,31 +839,35 @@ msgstr ""
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:137
|
||||
msgid "Left margin of page. Default is %default px."
|
||||
msgstr ""
|
||||
msgstr "Bal margó mérete. Alapértelmezés: %default pixel."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:139
|
||||
msgid "Right margin of page. Default is %default px."
|
||||
msgstr ""
|
||||
msgstr "Jobb margó mérete. Alapértelmezés: %default pixel."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:141
|
||||
msgid "Top margin of page. Default is %default px."
|
||||
msgstr ""
|
||||
msgstr "Felső margó mérete. Alapértelmezés: %default pixel."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:143
|
||||
msgid "Bottom margin of page. Default is %default px."
|
||||
msgstr ""
|
||||
msgstr "Alsó margó mérete. Alapértelmezés: %default pixel."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:145
|
||||
msgid ""
|
||||
"Render tables in the HTML as images (useful if the document has large or "
|
||||
"complex tables)"
|
||||
msgstr ""
|
||||
"A HTML táblázatokat képként szúrja be a szövegbe. Ez bonyolult vagy nagy "
|
||||
"táblázatoknál hasznos."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:147
|
||||
msgid ""
|
||||
"Multiply the size of text in rendered tables by this factor. Default is "
|
||||
"%default"
|
||||
msgstr ""
|
||||
"A betűméret szorzótényezője. Ennyiszer lesz nagyobb minden betű. "
|
||||
"Alapértelmezés: %default"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:152
|
||||
msgid ""
|
||||
@ -857,6 +881,8 @@ msgid ""
|
||||
"A regular expression. <a> tags whose href matches will be ignored. Defaults "
|
||||
"to %default"
|
||||
msgstr ""
|
||||
"Azok az <a> tag-ek, amelyek illeszkednek erre a reguláris kifejezésre nem "
|
||||
"fognak szerepelni a kimenetben. Alapértelmezés: %default"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:160
|
||||
msgid "Don't add links to the table of contents."
|
||||
@ -871,6 +897,9 @@ msgid ""
|
||||
"The regular expression used to detect chapter titles. It is searched for in "
|
||||
"heading tags (h1-h6). Defaults to %default"
|
||||
msgstr ""
|
||||
"Reguláris kifejezés, amely a fejezetcímek automatikus felismeréséhez "
|
||||
"használatos. A h1-h6 tag-ekben keresünk illeszkedést. Alapértelmezés: "
|
||||
"%default"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:170
|
||||
msgid ""
|
||||
@ -897,6 +926,8 @@ msgstr ""
|
||||
msgid ""
|
||||
"Force a page break before tags whose names match this regular expression."
|
||||
msgstr ""
|
||||
"Sortörés beszúrása azon tag-ek előtt amelyek neve illeszkedik erre a "
|
||||
"reguláris kifejezésre."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:184
|
||||
msgid ""
|
||||
@ -913,16 +944,21 @@ msgstr "Az automatikusan észlelt fejezetek hozzáadása a tartalomjegyzékhez."
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:190
|
||||
msgid "Preprocess Baen HTML files to improve generated LRF."
|
||||
msgstr ""
|
||||
"A Baen HTML fájlok előfeldolgozása a jobb minőségű kimenet érdekében."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:192
|
||||
msgid ""
|
||||
"You must add this option if processing files generated by pdftohtml, "
|
||||
"otherwise conversion will fail."
|
||||
msgstr ""
|
||||
"Ezt a kapcsolót abban az esetben kell használnod, ha a HTML fájlt a "
|
||||
"pdftohtml program generálta, ellenkező esetben nem lesz sikeres a "
|
||||
"konvertálás!"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:194
|
||||
msgid "Use this option on html0 files from Book Designer."
|
||||
msgstr ""
|
||||
"Ezt a kapcsolót a Book Designer program html0 fájljaihoz kell használni."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:197
|
||||
msgid ""
|
||||
@ -957,6 +993,8 @@ msgid ""
|
||||
"Minimize memory usage at the cost of longer processing times. Use this "
|
||||
"option if you are on a memory constrained machine."
|
||||
msgstr ""
|
||||
"Memória használat minimalizálása hosszabb feldolgozási időért cserébe. Kevés "
|
||||
"memóriával rendelkező számítógépeken érdemes használni."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/lrf/__init__.py:221
|
||||
msgid ""
|
||||
|
@ -15,7 +15,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
|
@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
|
@ -8,13 +8,13 @@ msgstr ""
|
||||
"Project-Id-Version: de\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2009-01-19 04:38+0000\n"
|
||||
"PO-Revision-Date: 2009-01-10 09:58+0000\n"
|
||||
"PO-Revision-Date: 2009-01-19 21:19+0000\n"
|
||||
"Last-Translator: S. Dorscht <Unknown>\n"
|
||||
"Language-Team: American English <kde-i18n-doc@lists.kde.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
@ -1836,7 +1836,7 @@ msgstr "Benutzung: rb-meta file.rb"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/from_any.py:52
|
||||
msgid "Creating Mobipocket file from EPUB..."
|
||||
msgstr ""
|
||||
msgstr "Erstelle Mobipocket Datei aus EPUB..."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/reader.py:505
|
||||
msgid "%prog [options] myebook.mobi"
|
||||
@ -1848,47 +1848,51 @@ msgstr "Original MOBI HTML gespeichert in"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:501
|
||||
msgid "Mobipocket"
|
||||
msgstr ""
|
||||
msgstr "Mobipocket"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:502
|
||||
msgid "Mobipocket-specific options."
|
||||
msgstr ""
|
||||
msgstr "Einstellungen speziell für Mobipocket."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:505
|
||||
msgid ""
|
||||
"Compress file text using PalmDOC compression. Results in smaller files, but "
|
||||
"takes a long time to run."
|
||||
msgstr ""
|
||||
"Textdatei mit PalmDOC compression komprimieren. Ergibt kleinere Dateien, "
|
||||
"dauert aber länger beim Start."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:509
|
||||
msgid "Modify images to meet Palm device size limitations."
|
||||
msgstr ""
|
||||
msgstr "Bilder auf die Größenlimitation von Palm Geräten einstellen."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:511
|
||||
msgid ""
|
||||
"Device renderer profiles. Affects conversion of default font sizes and "
|
||||
"rasterization resolution. Valid profiles are: %s."
|
||||
msgstr ""
|
||||
"Profile der Gerätedarstellung. Betrifft das Konvertieren mit "
|
||||
"voreingestellten Schriftgrößen und Rasterauflösung. Vorhandene Profile: %s."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:511
|
||||
msgid "Profiles"
|
||||
msgstr ""
|
||||
msgstr "Profile"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:516
|
||||
msgid "Source renderer profile. Default is 'Browser'."
|
||||
msgstr ""
|
||||
msgstr "Profil der Quellendarstellung. Voreinstellung ist 'Browser'."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:519
|
||||
msgid "Destination renderer profile. Default is 'CybookG3'."
|
||||
msgstr ""
|
||||
msgstr "Profil der Zieldarstellung. Voreinstellung ist 'CybookG3'."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:543
|
||||
msgid "Unknown source profile %r"
|
||||
msgstr ""
|
||||
msgstr "Unbekanntes Profil der Quelle %r"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/mobi/writer.py:547
|
||||
msgid "Unknown destination profile %r"
|
||||
msgstr ""
|
||||
msgstr "Unbekanntes Profil des Ziels %r"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/odt/to_oeb.py:57
|
||||
msgid "The output directory. Defaults to the current directory."
|
||||
@ -3513,7 +3517,7 @@ msgstr "Passwort erforderlich"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/progress.py:42
|
||||
msgid "Aborting..."
|
||||
msgstr ""
|
||||
msgstr "Abbruch läuft ..."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/dialogs/scheduler.py:39
|
||||
msgid "You"
|
||||
@ -4548,11 +4552,11 @@ msgstr "Speichern auf Festplatte nicht möglich"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/main.py:973
|
||||
msgid "Saving to disk..."
|
||||
msgstr ""
|
||||
msgstr "Speichere auf Festplatte..."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/main.py:978
|
||||
msgid "Saved"
|
||||
msgstr ""
|
||||
msgstr "Gespeichert"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/gui2/main.py:984
|
||||
msgid "Choose destination directory"
|
||||
|
@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
|
@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
|
@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
|
@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
|
@ -13,7 +13,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
"X-Poedit-Country: RUSSIAN FEDERATION\n"
|
||||
"X-Poedit-Language: Russian\n"
|
||||
|
@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
|
@ -7,13 +7,13 @@ msgstr ""
|
||||
"Project-Id-Version: calibre 0.4.17\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2009-01-19 04:38+0000\n"
|
||||
"PO-Revision-Date: 2009-01-07 18:38+0000\n"
|
||||
"Last-Translator: Kovid Goyal <Unknown>\n"
|
||||
"PO-Revision-Date: 2009-01-19 08:55+0000\n"
|
||||
"Last-Translator: Janko Slatenšek <Unknown>\n"
|
||||
"Language-Team: sl\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
@ -126,7 +126,7 @@ msgstr "Preberi meta podatke iz %s datotek"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/builtins.py:166
|
||||
msgid "Extract cover from comic files"
|
||||
msgstr ""
|
||||
msgstr "Pridobi naslovno stran iz stripa"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/builtins.py:186
|
||||
msgid "Read metadata from ebooks in ZIP archives"
|
||||
@ -280,13 +280,15 @@ msgstr ""
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/epub/__init__.py:121
|
||||
msgid "Path to the cover to be used for this book"
|
||||
msgstr ""
|
||||
msgstr "Pot do naslovne strani, ki bo uporabljena za to knjigo"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/epub/__init__.py:124
|
||||
msgid ""
|
||||
"Use the cover detected from the source file in preference to the specified "
|
||||
"cover."
|
||||
msgstr ""
|
||||
"Uporabi naslovno stran zaznano v izvorni datoteki namesto v nastavitvah "
|
||||
"specificirane naslovne strani."
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/epub/__init__.py:126
|
||||
msgid ""
|
||||
@ -397,7 +399,7 @@ msgstr ""
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/epub/__init__.py:167
|
||||
msgid "Print generated NCX file to stdout"
|
||||
msgstr ""
|
||||
msgstr "Izpiši ustvarjeno NCX datoteko na standardni izhod"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/ebooks/epub/__init__.py:169
|
||||
msgid "Keep intermediate files during processing by html2epub"
|
||||
|
@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
|
@ -14,7 +14,7 @@ msgstr ""
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-19 06:40+0000\n"
|
||||
"X-Launchpad-Export-Date: 2009-01-20 17:04+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#: /home/kovid/work/calibre/src/calibre/customize/__init__.py:41
|
||||
|
@ -532,7 +532,9 @@ class BasicNewsRecipe(object, LoggingInterface):
|
||||
if body is not None:
|
||||
templ = self.navbar.generate(False, f, a, feed_len,
|
||||
not self.has_single_feed,
|
||||
url, __appname__, center=self.center_navbar)
|
||||
url, __appname__,
|
||||
center=self.center_navbar,
|
||||
extra_css=self.extra_css)
|
||||
elem = BeautifulSoup(templ.render(doctype='xhtml').decode('utf-8')).find('div')
|
||||
body.insert(0, elem)
|
||||
if self.remove_javascript:
|
||||
@ -575,7 +577,8 @@ class BasicNewsRecipe(object, LoggingInterface):
|
||||
|
||||
def feeds2index(self, feeds):
|
||||
templ = templates.IndexTemplate()
|
||||
return templ.generate(self.title, self.timefmt, feeds).render(doctype='xhtml')
|
||||
return templ.generate(self.title, self.timefmt, feeds,
|
||||
extra_css=self.extra_css).render(doctype='xhtml')
|
||||
|
||||
@classmethod
|
||||
def description_limiter(cls, src):
|
||||
@ -626,7 +629,8 @@ class BasicNewsRecipe(object, LoggingInterface):
|
||||
|
||||
|
||||
templ = templates.FeedTemplate()
|
||||
return templ.generate(feed, self.description_limiter).render(doctype='xhtml')
|
||||
return templ.generate(feed, self.description_limiter,
|
||||
extra_css=self.extra_css).render(doctype='xhtml')
|
||||
|
||||
|
||||
def create_logger(self, feed_number, article_number):
|
||||
|
@ -22,7 +22,8 @@ recipe_modules = ['recipe_' + r for r in (
|
||||
'time_magazine', 'endgadget', 'fudzilla', 'nspm_int', 'nspm', 'pescanik',
|
||||
'spiegel_int', 'themarketticker', 'tomshardware', 'xkcd', 'ftd', 'zdnet',
|
||||
'joelonsoftware', 'telepolis', 'common_dreams', 'nin', 'tomshardware_de',
|
||||
'pagina12', 'infobae', 'ambito', 'elargentino', 'sueddeutsche',
|
||||
'pagina12', 'infobae', 'ambito', 'elargentino', 'sueddeutsche', 'the_age',
|
||||
'laprensa',
|
||||
)]
|
||||
|
||||
import re, imp, inspect, time, os
|
||||
|
50
src/calibre/web/feeds/recipes/recipe_laprensa.py
Normal file
50
src/calibre/web/feeds/recipes/recipe_laprensa.py
Normal file
@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
||||
'''
|
||||
laprensa.com.ar
|
||||
'''
|
||||
import urllib
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class LaPrensa(BasicNewsRecipe):
|
||||
title = 'La Prensa'
|
||||
__author__ = 'Darko Miletic'
|
||||
description = 'Informacion Libre las 24 horas'
|
||||
oldest_article = 7
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
use_embedded_content = False
|
||||
encoding = 'cp1252'
|
||||
cover_url = 'http://www.laprensa.com.ar/imgs/logo.gif'
|
||||
|
||||
html2lrf_options = [
|
||||
'--comment' , description
|
||||
, '--category' , 'news, Argentina'
|
||||
, '--publisher' , title
|
||||
]
|
||||
|
||||
feeds = [
|
||||
(u'Politica' , u'http://www.laprensa.com.ar/Rss.aspx?Rss=4' )
|
||||
,(u'Economia' , u'http://www.laprensa.com.ar/Rss.aspx?Rss=5' )
|
||||
,(u'Opinion' , u'http://www.laprensa.com.ar/Rss.aspx?Rss=6' )
|
||||
,(u'El Mundo' , u'http://www.laprensa.com.ar/Rss.aspx?Rss=7' )
|
||||
,(u'Actualidad' , u'http://www.laprensa.com.ar/Rss.aspx?Rss=8' )
|
||||
,(u'Deportes' , u'http://www.laprensa.com.ar/Rss.aspx?Rss=9' )
|
||||
,(u'Espectaculos', u'http://www.laprensa.com.ar/Rss.aspx?Rss=10')
|
||||
]
|
||||
|
||||
def print_version(self, url):
|
||||
return url.replace('.note.aspx','.NotePrint.note.aspx')
|
||||
|
||||
def get_article_url(self, article):
|
||||
raw = article.get('link', None).encode('utf8')
|
||||
final = urllib.quote(raw,':/')
|
||||
return final
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
del soup.body['onload']
|
||||
return soup
|
||||
|
@ -16,6 +16,14 @@ class NewYorker(BasicNewsRecipe):
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = False
|
||||
use_embedded_content = False
|
||||
extra_css = '''
|
||||
.calibre_feed_list {font-size:xx-small}
|
||||
.calibre_article_list {font-size:xx-small}
|
||||
.calibre_feed_title {font-size:normal}
|
||||
.calibre_recipe_title {font-size:normal}
|
||||
.calibre_feed_description {font-size:xx-small}
|
||||
'''
|
||||
|
||||
|
||||
keep_only_tags = [
|
||||
dict(name='div' , attrs={'id':'printbody' })
|
||||
|
55
src/calibre/web/feeds/recipes/recipe_the_age.py
Normal file
55
src/calibre/web/feeds/recipes/recipe_the_age.py
Normal file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Matthew Briggs <hal.sulphur@gmail.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
theage.com.au
|
||||
'''
|
||||
from calibre import strftime
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||
|
||||
|
||||
class TheAge(BasicNewsRecipe):
|
||||
|
||||
title = 'The Age'
|
||||
description = 'Business News, World News and Breaking News in Melbourne, Australia'
|
||||
__author__ = 'Matthew Briggs'
|
||||
|
||||
def get_browser(self):
|
||||
br = BasicNewsRecipe.get_browser()
|
||||
br.set_handle_refresh(False)
|
||||
return br
|
||||
|
||||
def parse_index(self):
|
||||
|
||||
soup = BeautifulSoup(self.browser.open('http://www.theage.com.au/text/').read())
|
||||
|
||||
feeds, articles = [], []
|
||||
feed = None
|
||||
|
||||
|
||||
for tag in soup.findAll(['h3', 'a']):
|
||||
if tag.name == 'h3':
|
||||
if articles:
|
||||
feeds.append((feed, articles))
|
||||
articles = []
|
||||
feed = self.tag_to_string(tag)
|
||||
elif feed is not None and tag.has_key('href') and tag['href'].strip():
|
||||
url = tag['href'].strip()
|
||||
if url.startswith('/'):
|
||||
url = 'http://www.theage.com.au' + url
|
||||
title = self.tag_to_string(tag)
|
||||
articles.append({
|
||||
'title': title,
|
||||
'url' : url,
|
||||
'date' : strftime('%a, %d %b'),
|
||||
'description' : '',
|
||||
'content' : '',
|
||||
})
|
||||
|
||||
return feeds
|
||||
|
||||
|
||||
|
@ -32,6 +32,11 @@ class NavBarTemplate(Template):
|
||||
xmlns:py="http://genshi.edgewall.org/"
|
||||
|
||||
>
|
||||
<head>
|
||||
<style py:if="extra_css" type="text/css">
|
||||
${extra_css}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar" style="text-align:${'center' if center else 'left'};">
|
||||
<hr py:if="bottom" />
|
||||
@ -60,14 +65,15 @@ class NavBarTemplate(Template):
|
||||
''')
|
||||
|
||||
def generate(self, bottom, feed, art, number_of_articles_in_feed,
|
||||
two_levels, url, __appname__, prefix='', center=True):
|
||||
two_levels, url, __appname__, prefix='', center=True,
|
||||
extra_css=None):
|
||||
if prefix and not prefix.endswith('/'):
|
||||
prefix += '/'
|
||||
return Template.generate(self, bottom=bottom, art=art, feed=feed,
|
||||
num=number_of_articles_in_feed,
|
||||
two_levels=two_levels, url=url,
|
||||
__appname__=__appname__, prefix=prefix,
|
||||
center=center)
|
||||
center=center, extra_css=extra_css)
|
||||
|
||||
|
||||
class IndexTemplate(Template):
|
||||
@ -88,11 +94,14 @@ class IndexTemplate(Template):
|
||||
<style py:if="style" type="text/css">
|
||||
${style}
|
||||
</style>
|
||||
<style py:if="extra_css" type="text/css">
|
||||
${extra_css}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>${title}</h1>
|
||||
<h1 class="calibre_recipe_title">${title}</h1>
|
||||
<p style="text-align:right">${date}</p>
|
||||
<ul>
|
||||
<ul class="calibre_feed_list">
|
||||
<py:for each="i, feed in enumerate(feeds)">
|
||||
<li py:if="feed" id="feed_${str(i)}">
|
||||
<a class="feed" href="${'feed_%d/index.html'%i}">${feed.title}</a>
|
||||
@ -103,11 +112,12 @@ class IndexTemplate(Template):
|
||||
</html>
|
||||
''')
|
||||
|
||||
def generate(self, title, datefmt, feeds):
|
||||
def generate(self, title, datefmt, feeds, extra_css=None):
|
||||
if isinstance(datefmt, unicode):
|
||||
datefmt = datefmt.encode(preferred_encoding)
|
||||
date = strftime(datefmt)
|
||||
return Template.generate(self, title=title, date=date, feeds=feeds)
|
||||
return Template.generate(self, title=title, date=date, feeds=feeds,
|
||||
extra_css=extra_css)
|
||||
|
||||
|
||||
class FeedTemplate(Template):
|
||||
@ -128,18 +138,21 @@ class FeedTemplate(Template):
|
||||
<style py:if="style" type="text/css">
|
||||
${style}
|
||||
</style>
|
||||
<style py:if="extra_css" type="text/css">
|
||||
${extra_css}
|
||||
</style>
|
||||
</head>
|
||||
<body style="page-break-before:always">
|
||||
<h2 class="feed_title">${feed.title}</h2>
|
||||
<h2 class="calibre_feed_title">${feed.title}</h2>
|
||||
<py:if test="getattr(feed, 'image', None)">
|
||||
<div class="feed_image">
|
||||
<div class="calibre_feed_image">
|
||||
<img alt="${feed.image_alt}" src="${feed.image_url}" />
|
||||
</div>
|
||||
</py:if>
|
||||
<div py:if="getattr(feed, 'description', None)">
|
||||
<div class="calibre_feed_description" py:if="getattr(feed, 'description', None)">
|
||||
${feed.description}<br />
|
||||
</div>
|
||||
<ul>
|
||||
<ul class="calibre_article_list">
|
||||
<py:for each="i, article in enumerate(feed.articles)">
|
||||
<li id="${'article_%d'%i}" py:if="getattr(article, 'downloaded', False)" style="padding-bottom:0.5em">
|
||||
<a class="article" href="${article.url}">${article.title}</a>
|
||||
@ -157,8 +170,9 @@ class FeedTemplate(Template):
|
||||
</html>
|
||||
''')
|
||||
|
||||
def generate(self, feed, cutoff):
|
||||
return Template.generate(self, feed=feed, cutoff=cutoff)
|
||||
def generate(self, feed, cutoff, extra_css=None):
|
||||
return Template.generate(self, feed=feed, cutoff=cutoff,
|
||||
extra_css=extra_css)
|
||||
|
||||
class EmbeddedContent(Template):
|
||||
|
||||
|
@ -11,6 +11,8 @@ import sys, socket, os, urlparse, logging, re, time, copy, urllib2, threading, t
|
||||
from urllib import url2pathname
|
||||
from threading import RLock
|
||||
from httplib import responses
|
||||
from PIL import Image
|
||||
from cStringIO import StringIO
|
||||
|
||||
from calibre import setup_cli_handlers, browser, sanitize_file_name, \
|
||||
relpath, LoggingInterface
|
||||
@ -183,8 +185,9 @@ class RecursiveFetcher(object, LoggingInterface):
|
||||
except urllib2.URLError, err:
|
||||
if hasattr(err, 'code') and responses.has_key(err.code):
|
||||
raise FetchError, responses[err.code]
|
||||
if getattr(err, 'reason', [0])[0] == 104: # Connection reset by peer
|
||||
self.log_debug('Connection reset by peer retrying in 1 second.')
|
||||
if getattr(err, 'reason', [0])[0] == 104 or \
|
||||
getattr(getattr(err, 'args', [None])[0], 'errno', None) == -2: # Connection reset by peer or Name or service not know
|
||||
self.log_debug('Temporary error, retrying in 1 second')
|
||||
time.sleep(1)
|
||||
with closing(self.browser.open(url)) as f:
|
||||
data = response(f.read()+f.read())
|
||||
@ -304,12 +307,17 @@ class RecursiveFetcher(object, LoggingInterface):
|
||||
fname = sanitize_file_name('img'+str(c)+ext)
|
||||
if isinstance(fname, unicode):
|
||||
fname = fname.encode('ascii', 'replace')
|
||||
imgpath = os.path.join(diskpath, fname)
|
||||
with self.imagemap_lock:
|
||||
self.imagemap[iurl] = imgpath
|
||||
with open(imgpath, 'wb') as x:
|
||||
x.write(data)
|
||||
tag['src'] = imgpath
|
||||
imgpath = os.path.join(diskpath, fname+'.jpg')
|
||||
try:
|
||||
im = Image.open(StringIO(data)).convert('RGBA')
|
||||
with self.imagemap_lock:
|
||||
self.imagemap[iurl] = imgpath
|
||||
with open(imgpath, 'wb') as x:
|
||||
im.save(x, 'JPEG')
|
||||
tag['src'] = imgpath
|
||||
except:
|
||||
traceback.print_exc()
|
||||
continue
|
||||
|
||||
def absurl(self, baseurl, tag, key, filter=True):
|
||||
iurl = tag[key]
|
||||
@ -398,7 +406,7 @@ class RecursiveFetcher(object, LoggingInterface):
|
||||
_fname = basename(iurl)
|
||||
if not isinstance(_fname, unicode):
|
||||
_fname.decode('latin1', 'replace')
|
||||
_fname.encode('ascii', 'replace').replace('%', '')
|
||||
_fname = _fname.encode('ascii', 'replace').replace('%', '').replace(os.sep, '')
|
||||
res = os.path.join(linkdiskpath, _fname)
|
||||
self.downloaded_paths.append(res)
|
||||
self.filemap[nurl] = res
|
||||
|
Loading…
x
Reference in New Issue
Block a user