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
ca056f014b
7257
imgsrc/plugboard.svg
Normal file
7257
imgsrc/plugboard.svg
Normal file
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 209 KiB |
Binary file not shown.
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 3.6 KiB |
34
resources/recipes/dhnet_be.recipe
Normal file
34
resources/recipes/dhnet_be.recipe
Normal file
@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Lionel Bergeret <lbergeret at gmail.com>'
|
||||
'''
|
||||
dhnet.be
|
||||
'''
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class DHNetBe(BasicNewsRecipe):
|
||||
title = u'La Derniere Heure'
|
||||
__author__ = u'Lionel Bergeret'
|
||||
description = u'News from Belgium in French'
|
||||
publisher = u'dhnet.be'
|
||||
category = 'news, Belgium'
|
||||
oldest_article = 3
|
||||
language = 'fr'
|
||||
|
||||
max_articles_per_feed = 20
|
||||
no_stylesheets = True
|
||||
use_embedded_content = False
|
||||
timefmt = ' [%d %b %Y]'
|
||||
|
||||
keep_only_tags = [
|
||||
dict(name = 'div', attrs = {'id': 'articleText'})
|
||||
,dict(name = 'div', attrs = {'id': 'articlePicureAndLinks'})
|
||||
]
|
||||
|
||||
feeds = [
|
||||
(u'La Une' , u'http://www.dhnet.be/rss' )
|
||||
,(u'La Une Sports' , u'http://www.dhnet.be/rss/dhsports/' )
|
||||
,(u'La Une Info' , u'http://www.dhnet.be/rss/dhinfos/' )
|
||||
]
|
43
resources/recipes/lesoir_be.recipe
Normal file
43
resources/recipes/lesoir_be.recipe
Normal file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Lionel Bergeret <lbergeret at gmail.com>'
|
||||
'''
|
||||
lesoir.be
|
||||
'''
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class LeSoirBe(BasicNewsRecipe):
|
||||
title = u'Le Soir'
|
||||
__author__ = u'Lionel Bergeret'
|
||||
description = u'News from Belgium in French'
|
||||
publisher = u'lesoir.be'
|
||||
category = 'news, Belgium'
|
||||
oldest_article = 3
|
||||
language = 'fr'
|
||||
|
||||
max_articles_per_feed = 20
|
||||
no_stylesheets = True
|
||||
use_embedded_content = False
|
||||
timefmt = ' [%d %b %Y]'
|
||||
|
||||
keep_only_tags = [
|
||||
dict(name = 'div', attrs = {'id': 'story_head'})
|
||||
,dict(name = 'div', attrs = {'id': 'story_body'})
|
||||
]
|
||||
|
||||
remove_tags = [
|
||||
dict(name='form', attrs={'id':'story_actions'})
|
||||
,dict(name='div', attrs={'id':'sb-share'})
|
||||
,dict(name='div', attrs={'id':'sb-subscribe'})
|
||||
]
|
||||
|
||||
feeds = [
|
||||
(u'Belgique' , u'http://www.lesoir.be/actualite/belgique/rss.xml' )
|
||||
,(u'France' , u'http://www.lesoir.be/actualite/france/rss.xml' )
|
||||
,(u'Monde' , u'http://www.lesoir.be/actualite/monde/rss.xml' )
|
||||
,(u'Regions' , u'http://www.lesoir.be/regions/rss.xml' )
|
||||
,(u'Vie du Net' , u'http://www.lesoir.be/actualite/vie_du_net/rss.xml' )
|
||||
,(u'Petite Gazette' , u'http://www.lesoir.be/actualite/sciences/rss.xml' )
|
||||
]
|
@ -31,7 +31,6 @@ class AdvancedUserRecipe1282101454(BasicNewsRecipe):
|
||||
#The following will get read of the Gallery: links when found
|
||||
|
||||
def preprocess_html(self, soup) :
|
||||
print 'SOUP IS: ', soup
|
||||
weblinks = soup.findAll(['head','h2'])
|
||||
if weblinks is not None:
|
||||
for link in weblinks:
|
||||
|
@ -2,7 +2,7 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
__appname__ = 'calibre'
|
||||
__version__ = '0.7.904'
|
||||
__version__ = '0.7.905'
|
||||
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
|
||||
|
||||
import re
|
||||
|
@ -47,10 +47,10 @@ class ISBNDBMetadata(Metadata):
|
||||
def __init__(self, book):
|
||||
Metadata.__init__(self, None, [])
|
||||
|
||||
self.isbn = book.get('isbn13', book.get('isbn'))
|
||||
self.title = book.find('titlelong').string
|
||||
self.isbn = unicode(book.get('isbn13', book.get('isbn')))
|
||||
self.title = unicode(book.find('titlelong').string)
|
||||
if not self.title:
|
||||
self.title = book.find('title').string
|
||||
self.title = unicode(book.find('title').string)
|
||||
self.title = unicode(self.title).strip()
|
||||
au = unicode(book.find('authorstext').string).strip()
|
||||
temp = au.split(',')
|
||||
@ -65,11 +65,11 @@ class ISBNDBMetadata(Metadata):
|
||||
self.author_sort = None
|
||||
except:
|
||||
pass
|
||||
self.publisher = book.find('publishertext').string
|
||||
self.publisher = unicode(book.find('publishertext').string)
|
||||
|
||||
summ = book.find('summary')
|
||||
if summ and hasattr(summ, 'string') and summ.string:
|
||||
self.comments = 'SUMMARY:\n'+summ.string
|
||||
self.comments = 'SUMMARY:\n'+unicode(summ.string)
|
||||
|
||||
|
||||
def build_isbn(base_url, opts):
|
||||
|
@ -84,7 +84,8 @@ class EditMetadataAction(InterfaceAction):
|
||||
|
||||
def do_download_metadata(self, ids, covers=True, set_metadata=True,
|
||||
set_social_metadata=None):
|
||||
db = self.gui.library_view.model().db
|
||||
m = self.gui.library_view.model()
|
||||
db = m.db
|
||||
if set_social_metadata is None:
|
||||
get_social_metadata = config['get_social_metadata']
|
||||
else:
|
||||
@ -93,18 +94,22 @@ class EditMetadataAction(InterfaceAction):
|
||||
self._download_book_metadata = DownloadMetadata(db, ids,
|
||||
get_covers=covers, set_metadata=set_metadata,
|
||||
get_social_metadata=get_social_metadata)
|
||||
self._download_book_metadata.start()
|
||||
if set_social_metadata is not None and set_social_metadata:
|
||||
x = _('social metadata')
|
||||
else:
|
||||
x = _('covers') if covers and not set_metadata else _('metadata')
|
||||
self._book_metadata_download_check = QTimer(self.gui)
|
||||
self._book_metadata_download_check.timeout.connect(self.book_metadata_download_check,
|
||||
type=Qt.QueuedConnection)
|
||||
self._book_metadata_download_check.start(100)
|
||||
self._bb_dialog = BlockingBusy(_('Downloading %s for %d book(s)')%(x,
|
||||
len(ids)), parent=self.gui)
|
||||
self._bb_dialog.exec_()
|
||||
m.stop_metadata_backup()
|
||||
try:
|
||||
self._download_book_metadata.start()
|
||||
if set_social_metadata is not None and set_social_metadata:
|
||||
x = _('social metadata')
|
||||
else:
|
||||
x = _('covers') if covers and not set_metadata else _('metadata')
|
||||
self._book_metadata_download_check = QTimer(self.gui)
|
||||
self._book_metadata_download_check.timeout.connect(self.book_metadata_download_check,
|
||||
type=Qt.QueuedConnection)
|
||||
self._book_metadata_download_check.start(100)
|
||||
self._bb_dialog = BlockingBusy(_('Downloading %s for %d book(s)')%(x,
|
||||
len(ids)), parent=self.gui)
|
||||
self._bb_dialog.exec_()
|
||||
finally:
|
||||
m.start_metadata_backup()
|
||||
|
||||
def book_metadata_download_check(self):
|
||||
if self._download_book_metadata.is_alive():
|
||||
|
@ -630,10 +630,16 @@ Using this button to create author sort will change author sort from red to gree
|
||||
<property name="toolTip">
|
||||
<string>Remove border (if any) from cover</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>T&rim</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/trim.png</normaloff>:/images/trim.png</iconset>
|
||||
</property>
|
||||
<property name="toolButtonStyle">
|
||||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -32,7 +32,7 @@
|
||||
<string>&Explode ePub</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/wizard.png</normaloff>:/images/wizard.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@ -49,7 +49,7 @@
|
||||
<string>&Rebuild ePub</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/exec.png</normaloff>:/images/exec.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@ -63,7 +63,7 @@
|
||||
<string>&Cancel</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<iconset resource="../../../../resources/images.qrc">
|
||||
<normaloff>:/images/window-close.png</normaloff>:/images/window-close.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@ -71,7 +71,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Explode the ePub to display contents in a file browser window. To tweak individual files, right-click, then 'Open with...' your editor of choice. When tweaks are complete, close the file browser window. Rebuild the ePub, updating your calibre library.</string>
|
||||
<string><p>Explode the ePub to display contents in a file browser window. To tweak individual files, right-click, then 'Open with...' your editor of choice. When tweaks are complete, close the file browser window <b>and the editor windows you used to edit files in the epub</b>.</p><p>Rebuild the ePub, updating your calibre library.</p></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
@ -152,7 +152,7 @@ class SearchBar(QWidget): # {{{
|
||||
l.addWidget(x)
|
||||
x.setToolTip(_("Advanced search"))
|
||||
|
||||
self.label = x = QLabel('&Search:')
|
||||
self.label = x = QLabel(_('&Search:'))
|
||||
l.addWidget(self.label)
|
||||
x.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1147,28 +1147,27 @@ class ZipFile:
|
||||
|
||||
self._writecheck(zinfo)
|
||||
self._didModify = True
|
||||
fp = open(filename, "rb")
|
||||
# Must overwrite CRC and sizes with correct data later
|
||||
zinfo.CRC = CRC = 0
|
||||
zinfo.compress_size = compress_size = 0
|
||||
zinfo.file_size = file_size = 0
|
||||
self.fp.write(zinfo.FileHeader())
|
||||
if zinfo.compress_type == ZIP_DEFLATED:
|
||||
cmpr = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION,
|
||||
zlib.DEFLATED, -15)
|
||||
else:
|
||||
cmpr = None
|
||||
while 1:
|
||||
buf = fp.read(1024 * 8)
|
||||
if not buf:
|
||||
break
|
||||
file_size = file_size + len(buf)
|
||||
CRC = crc32(buf, CRC) & 0xffffffff
|
||||
if cmpr:
|
||||
buf = cmpr.compress(buf)
|
||||
compress_size = compress_size + len(buf)
|
||||
self.fp.write(buf)
|
||||
fp.close()
|
||||
with open(filename, "rb") as fp:
|
||||
# Must overwrite CRC and sizes with correct data later
|
||||
zinfo.CRC = CRC = 0
|
||||
zinfo.compress_size = compress_size = 0
|
||||
zinfo.file_size = file_size = 0
|
||||
self.fp.write(zinfo.FileHeader())
|
||||
if zinfo.compress_type == ZIP_DEFLATED:
|
||||
cmpr = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION,
|
||||
zlib.DEFLATED, -15)
|
||||
else:
|
||||
cmpr = None
|
||||
while 1:
|
||||
buf = fp.read(1024 * 8)
|
||||
if not buf:
|
||||
break
|
||||
file_size = file_size + len(buf)
|
||||
CRC = crc32(buf, CRC) & 0xffffffff
|
||||
if cmpr:
|
||||
buf = cmpr.compress(buf)
|
||||
compress_size = compress_size + len(buf)
|
||||
self.fp.write(buf)
|
||||
if cmpr:
|
||||
buf = cmpr.flush()
|
||||
compress_size = compress_size + len(buf)
|
||||
|
Loading…
x
Reference in New Issue
Block a user