mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Merge from trunk
This commit is contained in:
commit
e412f0bc81
@ -49,7 +49,7 @@ All the |app| python code is in the ``calibre`` package. This package contains t
|
|||||||
* Metadata reading, writing, and downloading is all in ebooks.metadata
|
* Metadata reading, writing, and downloading is all in ebooks.metadata
|
||||||
* Conversion happens in a pipeline, for the structure of the pipeline,
|
* Conversion happens in a pipeline, for the structure of the pipeline,
|
||||||
see :ref:`conversion-introduction`. The pipeline consists of an input
|
see :ref:`conversion-introduction`. The pipeline consists of an input
|
||||||
plugin, various transforms and an output plugin. The code constructs
|
plugin, various transforms and an output plugin. The that code constructs
|
||||||
and drives the pipeline is in plumber.py. The pipeline works on a
|
and drives the pipeline is in plumber.py. The pipeline works on a
|
||||||
representation of an ebook that is like an unzipped epub, with
|
representation of an ebook that is like an unzipped epub, with
|
||||||
manifest, spine, toc, guide, html content, etc. The
|
manifest, spine, toc, guide, html content, etc. The
|
||||||
@ -74,10 +74,6 @@ After installing Bazaar, you can get the |app| source code with the command::
|
|||||||
|
|
||||||
On Windows you will need the complete path name, that will be something like :file:`C:\\Program Files\\Bazaar\\bzr.exe`.
|
On Windows you will need the complete path name, that will be something like :file:`C:\\Program Files\\Bazaar\\bzr.exe`.
|
||||||
|
|
||||||
To update a branch to the latest code, use the command::
|
|
||||||
|
|
||||||
bzr merge
|
|
||||||
|
|
||||||
|app| is a very large project with a very long source control history, so the
|
|app| is a very large project with a very long source control history, so the
|
||||||
above can take a while (10mins to an hour depending on your internet speed).
|
above can take a while (10mins to an hour depending on your internet speed).
|
||||||
|
|
||||||
@ -88,6 +84,11 @@ using::
|
|||||||
|
|
||||||
bzr branch --stacked lp:calibre
|
bzr branch --stacked lp:calibre
|
||||||
|
|
||||||
|
|
||||||
|
To update a branch to the latest code, use the command::
|
||||||
|
|
||||||
|
bzr merge
|
||||||
|
|
||||||
Submitting your changes to be included
|
Submitting your changes to be included
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
@ -16,10 +16,14 @@ class TheHindu(BasicNewsRecipe):
|
|||||||
|
|
||||||
keep_only_tags = [dict(id='content')]
|
keep_only_tags = [dict(id='content')]
|
||||||
remove_tags = [dict(attrs={'class':['article-links', 'breadcr']}),
|
remove_tags = [dict(attrs={'class':['article-links', 'breadcr']}),
|
||||||
dict(id=['email-section', 'right-column', 'printfooter'])]
|
dict(id=['email-section', 'right-column', 'printfooter', 'topover',
|
||||||
|
'slidebox', 'th_footer'])]
|
||||||
|
|
||||||
extra_css = '.photo-caption { font-size: smaller }'
|
extra_css = '.photo-caption { font-size: smaller }'
|
||||||
|
|
||||||
|
def preprocess_raw_html(self, raw, url):
|
||||||
|
return raw.replace('<body><p>', '<p>').replace('</p></body>', '</p>')
|
||||||
|
|
||||||
def postprocess_html(self, soup, first_fetch):
|
def postprocess_html(self, soup, first_fetch):
|
||||||
for t in soup.findAll(['table', 'tr', 'td','center']):
|
for t in soup.findAll(['table', 'tr', 'td','center']):
|
||||||
t.name = 'div'
|
t.name = 'div'
|
||||||
|
@ -13,8 +13,11 @@ class NikkeiNet_paper_subscription(BasicNewsRecipe):
|
|||||||
max_articles_per_feed = 30
|
max_articles_per_feed = 30
|
||||||
language = 'ja'
|
language = 'ja'
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
cover_url = 'http://parts.nikkei.com/parts/ds/images/common/logo_r1.svg'
|
#cover_url = 'http://parts.nikkei.com/parts/ds/images/common/logo_r1.svg'
|
||||||
masthead_url = 'http://parts.nikkei.com/parts/ds/images/common/logo_r1.svg'
|
cover_url = 'http://cdn.nikkei.co.jp/parts/ds/images/common/st_nikkei_r1_20101003_1.gif'
|
||||||
|
#masthead_url = 'http://parts.nikkei.com/parts/ds/images/common/logo_r1.svg'
|
||||||
|
masthead_url = 'http://cdn.nikkei.co.jp/parts/ds/images/common/st_nikkei_r1_20101003_1.gif'
|
||||||
|
cover_margins = (10, 188, '#ffffff')
|
||||||
|
|
||||||
remove_tags_before = {'class':"cmn-indent"}
|
remove_tags_before = {'class':"cmn-indent"}
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
@ -40,8 +43,11 @@ class NikkeiNet_paper_subscription(BasicNewsRecipe):
|
|||||||
print "-------------------------open top page-------------------------------------"
|
print "-------------------------open top page-------------------------------------"
|
||||||
br.open('http://www.nikkei.com/')
|
br.open('http://www.nikkei.com/')
|
||||||
print "-------------------------open first login form-----------------------------"
|
print "-------------------------open first login form-----------------------------"
|
||||||
link = br.links(url_regex="www.nikkei.com/etc/accounts/login").next()
|
try:
|
||||||
br.follow_link(link)
|
url = br.links(url_regex="www.nikkei.com/etc/accounts/login").next().url
|
||||||
|
except StopIteration:
|
||||||
|
url = 'http://www.nikkei.com/etc/accounts/login?dps=3&pageflag=top&url=http%3A%2F%2Fwww.nikkei.com%2F'
|
||||||
|
br.open(url) #br.follow_link(link)
|
||||||
#response = br.response()
|
#response = br.response()
|
||||||
#print response.get_data()
|
#print response.get_data()
|
||||||
print "-------------------------JS redirect(send autoPostForm)--------------------"
|
print "-------------------------JS redirect(send autoPostForm)--------------------"
|
||||||
|
@ -81,6 +81,7 @@ body {
|
|||||||
background-color: #39a9cf;
|
background-color: #39a9cf;
|
||||||
-moz-border-radius: 5px;
|
-moz-border-radius: 5px;
|
||||||
-webkit-border-radius: 5px;
|
-webkit-border-radius: 5px;
|
||||||
|
border-radius: 5px;
|
||||||
text-shadow: #27211b 1px 1px 1px;
|
text-shadow: #27211b 1px 1px 1px;
|
||||||
-moz-box-shadow: 5px 5px 5px #222;
|
-moz-box-shadow: 5px 5px 5px #222;
|
||||||
-webkit-box-shadow: 5px 5px 5px #222;
|
-webkit-box-shadow: 5px 5px 5px #222;
|
||||||
|
@ -19,7 +19,8 @@ class TECLAST_K3(USBMS):
|
|||||||
PRODUCT_ID = [0x3203]
|
PRODUCT_ID = [0x3203]
|
||||||
BCD = [0x0000, 0x0100]
|
BCD = [0x0000, 0x0100]
|
||||||
|
|
||||||
VENDOR_NAME = ['TECLAST', 'IMAGIN', 'RK28XX', 'PER3274B', 'BEBOOK']
|
VENDOR_NAME = ['TECLAST', 'IMAGIN', 'RK28XX', 'PER3274B', 'BEBOOK',
|
||||||
|
'RK2728']
|
||||||
WINDOWS_MAIN_MEM = WINDOWS_CARD_A_MEM = ['DIGITAL_PLAYER', 'TL-K5',
|
WINDOWS_MAIN_MEM = WINDOWS_CARD_A_MEM = ['DIGITAL_PLAYER', 'TL-K5',
|
||||||
'EREADER', 'USB-MSC', 'PER3274B', 'BEBOOK']
|
'EREADER', 'USB-MSC', 'PER3274B', 'BEBOOK']
|
||||||
|
|
||||||
|
@ -306,8 +306,8 @@ class PdfEngine(QPaintEngine):
|
|||||||
image = pixmap.toImage()
|
image = pixmap.toImage()
|
||||||
ref = self.add_image(image, pixmap.cacheKey())
|
ref = self.add_image(image, pixmap.cacheKey())
|
||||||
if ref is not None:
|
if ref is not None:
|
||||||
self.pdf.draw_image(rect.x(), rect.y(), rect.width(), rect.height(),
|
self.pdf.draw_image(rect.x(), rect.height()+rect.y(), rect.width(),
|
||||||
ref)
|
-rect.height(), ref)
|
||||||
|
|
||||||
@store_error
|
@store_error
|
||||||
def drawImage(self, rect, image, source_rect, flags=Qt.AutoColor):
|
def drawImage(self, rect, image, source_rect, flags=Qt.AutoColor):
|
||||||
@ -316,8 +316,8 @@ class PdfEngine(QPaintEngine):
|
|||||||
image.copy(source_rect))
|
image.copy(source_rect))
|
||||||
ref = self.add_image(image, image.cacheKey())
|
ref = self.add_image(image, image.cacheKey())
|
||||||
if ref is not None:
|
if ref is not None:
|
||||||
self.pdf.draw_image(rect.x(), rect.y(), rect.width(), rect.height(),
|
self.pdf.draw_image(rect.x(), rect.height()+rect.y(), rect.width(),
|
||||||
ref)
|
-rect.height(), ref)
|
||||||
|
|
||||||
def add_image(self, img, cache_key):
|
def add_image(self, img, cache_key):
|
||||||
if img.isNull(): return
|
if img.isNull(): return
|
||||||
|
@ -423,10 +423,9 @@ class PDFStream(object):
|
|||||||
self.objects.commit(r, self.stream)
|
self.objects.commit(r, self.stream)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def draw_image(self, x, y, w, h, imgref):
|
def draw_image(self, x, y, xscale, yscale, imgref):
|
||||||
name = self.current_page.add_image(imgref)
|
name = self.current_page.add_image(imgref)
|
||||||
sx, sy = w, h
|
self.current_page.write('q %g 0 0 %g %g %g cm '%(xscale, yscale, x, y))
|
||||||
self.current_page.write('q %g 0 0 %g %g %g cm '%(sx, -sy, x, y+h))
|
|
||||||
serialize(Name(name), self.current_page)
|
serialize(Name(name), self.current_page)
|
||||||
self.current_page.write_line(' Do Q')
|
self.current_page.write_line(' Do Q')
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ p, li { white-space: pre-wrap; }
|
|||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<number>365</number>
|
<number>36500</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="value">
|
<property name="value">
|
||||||
<number>7</number>
|
<number>7</number>
|
||||||
|
@ -11,11 +11,11 @@ from collections import OrderedDict
|
|||||||
|
|
||||||
import cherrypy
|
import cherrypy
|
||||||
|
|
||||||
from calibre.constants import filesystem_encoding
|
from calibre.constants import filesystem_encoding, config_dir
|
||||||
from calibre import isbytestring, force_unicode, fit_image, \
|
from calibre import (isbytestring, force_unicode, fit_image,
|
||||||
prepare_string_for_xml
|
prepare_string_for_xml, sanitize_file_name2)
|
||||||
from calibre.utils.filenames import ascii_filename
|
from calibre.utils.filenames import ascii_filename
|
||||||
from calibre.utils.config import prefs
|
from calibre.utils.config import prefs, JSONConfig
|
||||||
from calibre.utils.icu import sort_key
|
from calibre.utils.icu import sort_key
|
||||||
from calibre.utils.magick import Image
|
from calibre.utils.magick import Image
|
||||||
from calibre.library.comments import comments_to_html
|
from calibre.library.comments import comments_to_html
|
||||||
@ -242,6 +242,8 @@ class BrowseServer(object):
|
|||||||
connect('browse_category_icon', base_href+'/icon/{name}',
|
connect('browse_category_icon', base_href+'/icon/{name}',
|
||||||
self.browse_icon)
|
self.browse_icon)
|
||||||
|
|
||||||
|
self.icon_map = JSONConfig('gui').get('tags_browser_category_icons', {})
|
||||||
|
|
||||||
# Templates {{{
|
# Templates {{{
|
||||||
def browse_template(self, sort, category=True, initial_search=''):
|
def browse_template(self, sort, category=True, initial_search=''):
|
||||||
|
|
||||||
@ -321,6 +323,14 @@ class BrowseServer(object):
|
|||||||
if not hasattr(self, '__browse_icon_cache__'):
|
if not hasattr(self, '__browse_icon_cache__'):
|
||||||
self.__browse_icon_cache__ = {}
|
self.__browse_icon_cache__ = {}
|
||||||
if name not in self.__browse_icon_cache__:
|
if name not in self.__browse_icon_cache__:
|
||||||
|
if name.startswith('_'):
|
||||||
|
name = sanitize_file_name2(name[1:])
|
||||||
|
try:
|
||||||
|
with open(os.path.join(config_dir, 'tb_icons', name), 'rb') as f:
|
||||||
|
data = f.read()
|
||||||
|
except:
|
||||||
|
raise cherrypy.HTTPError(404, 'no icon named: %r'%name)
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
data = I(name, data=True)
|
data = I(name, data=True)
|
||||||
except:
|
except:
|
||||||
@ -359,7 +369,9 @@ class BrowseServer(object):
|
|||||||
if meta['is_custom'] and category not in displayed_custom_fields:
|
if meta['is_custom'] and category not in displayed_custom_fields:
|
||||||
continue
|
continue
|
||||||
# get the icon files
|
# get the icon files
|
||||||
if category in category_icon_map:
|
if category in self.icon_map:
|
||||||
|
icon = '_'+quote(self.icon_map[category])
|
||||||
|
elif category in category_icon_map:
|
||||||
icon = category_icon_map[category]
|
icon = category_icon_map[category]
|
||||||
elif meta['is_custom']:
|
elif meta['is_custom']:
|
||||||
icon = category_icon_map['custom:']
|
icon = category_icon_map['custom:']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user