Merge from trunk

This commit is contained in:
Charles Haley 2011-09-27 09:25:55 +02:00
commit 02324108c6
7 changed files with 30 additions and 9 deletions

View File

@ -7,6 +7,7 @@ __license__ = 'GPL v3'
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>' __copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
SPOOL_SIZE = 30*1024*1024
''' '''
Rewrite of the calibre database backend. Rewrite of the calibre database backend.

View File

@ -17,6 +17,7 @@ from calibre import isbytestring, force_unicode, prints
from calibre.constants import (iswindows, filesystem_encoding, from calibre.constants import (iswindows, filesystem_encoding,
preferred_encoding) preferred_encoding)
from calibre.ptempfile import PersistentTemporaryFile, SpooledTemporaryFile from calibre.ptempfile import PersistentTemporaryFile, SpooledTemporaryFile
from calibre.db import SPOOL_SIZE
from calibre.db.schema_upgrades import SchemaUpgrade from calibre.db.schema_upgrades import SchemaUpgrade
from calibre.library.field_metadata import FieldMetadata from calibre.library.field_metadata import FieldMetadata
from calibre.ebooks.metadata import title_sort, author_to_author_sort from calibre.ebooks.metadata import title_sort, author_to_author_sort
@ -38,7 +39,7 @@ Differences in semantics from pysqlite:
''' '''
SPOOL_SIZE = 30*1024*1024
class DynamicFilter(object): # {{{ class DynamicFilter(object): # {{{

View File

@ -126,7 +126,7 @@ void XMLImages::add(GfxState *state, Object *ref, Stream *str,
if (img->type == jpeg) { if (img->type == jpeg) {
int c; int c;
str = ((DCTStream *)str)->getRawStream(); str = str->getNextStream();
str->reset(); str->reset();
// copy the stream // copy the stream

View File

@ -625,7 +625,12 @@ static string get_link_dest(LinkAction *link, PDFDoc *doc) {
return oss.str(); return oss.str();
} }
#if (POPPLER_MAJOR_VERSION == 0) && (POPPLER_MINOR_VERSION < 17)
void XMLOutputDev::process_link(Link* link){ void XMLOutputDev::process_link(Link* link){
#else
void XMLOutputDev::process_link(AnnotLink* link){
#endif
double _x1, _y1, _x2, _y2; double _x1, _y1, _x2, _y2;
int x1, y1, x2, y2; int x1, y1, x2, y2;

View File

@ -244,6 +244,11 @@ class XMLOutputDev : public OutputDev {
XMLImages *images; XMLImages *images;
PDFDoc *doc; PDFDoc *doc;
#if (POPPLER_MAJOR_VERSION == 0) && (POPPLER_MINOR_VERSION < 17)
void process_link(Link* link); void process_link(Link* link);
#else
void process_link(AnnotLink* link);
#endif
}; };
} }

View File

@ -35,7 +35,7 @@ from calibre.gui2.dialogs.tag_editor import TagEditor
from calibre.utils.icu import strcmp from calibre.utils.icu import strcmp
from calibre.ptempfile import PersistentTemporaryFile, SpooledTemporaryFile from calibre.ptempfile import PersistentTemporaryFile, SpooledTemporaryFile
from calibre.gui2.languages import LanguagesEdit as LE from calibre.gui2.languages import LanguagesEdit as LE
from calibre.db.backend import SPOOL_SIZE from calibre.db import SPOOL_SIZE
def save_dialog(parent, title, msg, det_msg=''): def save_dialog(parent, title, msg, det_msg=''):
d = QMessageBox(parent) d = QMessageBox(parent)

View File

@ -13,7 +13,7 @@ from functools import partial
from contextlib import nested, closing from contextlib import nested, closing
from calibre import (browser, __appname__, iswindows, from calibre import (browser, __appname__, iswindows, force_unicode,
strftime, preferred_encoding, as_unicode) strftime, preferred_encoding, as_unicode)
from calibre.ebooks.BeautifulSoup import BeautifulSoup, NavigableString, CData, Tag from calibre.ebooks.BeautifulSoup import BeautifulSoup, NavigableString, CData, Tag
from calibre.ebooks.metadata.opf2 import OPFCreator from calibre.ebooks.metadata.opf2 import OPFCreator
@ -49,7 +49,7 @@ class BasicNewsRecipe(Recipe):
#: A couple of lines that describe the content this recipe downloads. #: A couple of lines that describe the content this recipe downloads.
#: This will be used primarily in a GUI that presents a list of recipes. #: This will be used primarily in a GUI that presents a list of recipes.
description = '' description = u''
#: The author of this recipe #: The author of this recipe
__author__ = __appname__ __author__ = __appname__
@ -112,8 +112,6 @@ class BasicNewsRecipe(Recipe):
#: If set to "optional" the use of a username and password becomes optional #: If set to "optional" the use of a username and password becomes optional
needs_subscription = False needs_subscription = False
#:
#: If True the navigation bar is center aligned, otherwise it is left aligned #: If True the navigation bar is center aligned, otherwise it is left aligned
center_navbar = True center_navbar = True
@ -1205,12 +1203,22 @@ class BasicNewsRecipe(Recipe):
mi.author_sort = __appname__ mi.author_sort = __appname__
mi.publication_type = 'periodical:'+self.publication_type+':'+self.short_title() mi.publication_type = 'periodical:'+self.publication_type+':'+self.short_title()
mi.timestamp = nowf() mi.timestamp = nowf()
article_titles, aseen = [], set()
for f in feeds:
for a in f:
if a.title and a.title not in aseen:
aseen.add(a.title)
article_titles.append(force_unicode(a.title, 'utf-8'))
mi.comments = self.description mi.comments = self.description
if not isinstance(mi.comments, unicode):
mi.comments = mi.comments.decode('utf-8', 'replace')
mi.comments += ('\n\n' + _('Articles in this issue: ') + '\n' +
'\n\n'.join(article_titles))
language = canonicalize_lang(self.language) language = canonicalize_lang(self.language)
if language is not None: if language is not None:
mi.language = language mi.language = language
if not isinstance(mi.comments, unicode):
mi.comments = mi.comments.decode('utf-8', 'replace')
mi.pubdate = nowf() mi.pubdate = nowf()
opf_path = os.path.join(dir, 'index.opf') opf_path = os.path.join(dir, 'index.opf')
ncx_path = os.path.join(dir, 'index.ncx') ncx_path = os.path.join(dir, 'index.ncx')
@ -1256,6 +1264,7 @@ class BasicNewsRecipe(Recipe):
self.play_order_counter = 0 self.play_order_counter = 0
self.play_order_map = {} self.play_order_map = {}
def feed_index(num, parent): def feed_index(num, parent):
f = feeds[num] f = feeds[num]
for j, a in enumerate(f): for j, a in enumerate(f):