diff --git a/resources/recipes/nytimes_sub.recipe b/resources/recipes/nytimes_sub.recipe index e3942469a4..d389ca4eea 100644 --- a/resources/recipes/nytimes_sub.recipe +++ b/resources/recipes/nytimes_sub.recipe @@ -37,7 +37,7 @@ class NYTimes(BasicNewsRecipe): dict(name=['script', 'noscript', 'style'])] encoding = decode no_stylesheets = True - extra_css = 'h1 {font: sans-serif large;}\n.byline {font:monospace;}' + extra_css = 'h1 {font-face:sans-serif; font-size:2em; font-weight:bold;}\n.byline {font:monospace;}\n.bold {font-weight:bold;}' def get_browser(self): br = BasicNewsRecipe.get_browser() diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index 9d4b0694cc..040f28549e 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -420,7 +420,7 @@ from calibre.devices.eslick.driver import ESLICK from calibre.devices.nuut2.driver import NUUT2 from calibre.devices.iriver.driver import IRIVER_STORY from calibre.devices.binatone.driver import README -from calibre.devices.hanvon.driver import N516 +from calibre.devices.hanvon.driver import N516, EB511 from calibre.ebooks.metadata.fetch import GoogleBooks, ISBNDB, Amazon from calibre.library.catalog import CSV_XML, EPUB_MOBI @@ -494,6 +494,7 @@ plugins += [ EB600, README, N516, + EB511, ] plugins += [x for x in list(locals().values()) if isinstance(x, type) and \ x.__name__.endswith('MetadataReader')] diff --git a/src/calibre/devices/hanlin/driver.py b/src/calibre/devices/hanlin/driver.py index aee2a70fd5..e887b331aa 100644 --- a/src/calibre/devices/hanlin/driver.py +++ b/src/calibre/devices/hanlin/driver.py @@ -126,3 +126,15 @@ class BOOX(HANLINV3): EBOOK_DIR_MAIN = 'MyBooks' EBOOK_DIR_CARD_A = 'MyBooks' + + + def windows_sort_drives(self, drives): + main = drives.get('main', None) + card = drives.get('carda', None) + if card and main and card < main: + drives['main'] = card + drives['carda'] = main + + return drives + + diff --git a/src/calibre/devices/hanvon/driver.py b/src/calibre/devices/hanvon/driver.py index ea8d604dd5..d4f6e87d06 100644 --- a/src/calibre/devices/hanvon/driver.py +++ b/src/calibre/devices/hanvon/driver.py @@ -7,6 +7,7 @@ __docformat__ = 'restructuredtext en' ''' Device driver for Hanvon devices ''' +import re from calibre.devices.usbms.driver import USBMS @@ -32,3 +33,25 @@ class N516(USBMS): EBOOK_DIR_MAIN = 'e_book' SUPPORTS_SUB_DIRS = True + +class EB511(USBMS): + name = 'Elonex EB 511 driver' + gui_name = 'EB 511' + description = _('Communicate with the Elonex EB 511 eBook reader.') + author = 'Kovid Goyal' + supported_platforms = ['windows', 'osx', 'linux'] + + FORMATS = ['epub', 'html', 'pdf', 'txt'] + + VENDOR_ID = [0x45e] + PRODUCT_ID = [0xffff] + BCD = [0x0] + + MAIN_MEMORY_VOLUME_LABEL = 'EB 511 Internal Memory' + + EBOOK_DIR_MAIN = 'e_book' + SUPPORTS_SUB_DIRS = True + + OSX_MAIN_MEM_VOL_PAT = re.compile(r'/eReader') + + diff --git a/src/calibre/devices/prs505/driver.py b/src/calibre/devices/prs505/driver.py index a316a8dbc9..5d759be47c 100644 --- a/src/calibre/devices/prs505/driver.py +++ b/src/calibre/devices/prs505/driver.py @@ -192,17 +192,15 @@ class PRS505(CLI, Device): fix_ids(*booklists) if not os.path.exists(self._main_prefix): os.makedirs(self._main_prefix) - f = open(self._main_prefix + self.__class__.MEDIA_XML, 'wb') - booklists[0].write(f) - f.close() + with open(self._main_prefix + self.__class__.MEDIA_XML, 'wb') as f: + booklists[0].write(f) def write_card_prefix(prefix, listid): if prefix is not None and hasattr(booklists[listid], 'write'): if not os.path.exists(prefix): os.makedirs(prefix) - f = open(prefix + self.__class__.CACHE_XML, 'wb') - booklists[listid].write(f) - f.close() + with open(prefix + self.__class__.CACHE_XML, 'wb') as f: + booklists[listid].write(f) write_card_prefix(self._card_a_prefix, 1) write_card_prefix(self._card_b_prefix, 2) diff --git a/src/calibre/gui2/dialogs/config/config.ui b/src/calibre/gui2/dialogs/config/config.ui index c12b864993..aff157bb08 100644 --- a/src/calibre/gui2/dialogs/config/config.ui +++ b/src/calibre/gui2/dialogs/config/config.ui @@ -612,7 +612,7 @@ - calibre can send your books to you (or your reader) by email + calibre can send your books to you (or your reader) by email. Emails will be automatically sent for downloaded news to all email addresses that have Auto-send checked. true diff --git a/src/calibre/gui2/library.py b/src/calibre/gui2/library.py index 6b3e80c955..bf4fd02fa8 100644 --- a/src/calibre/gui2/library.py +++ b/src/calibre/gui2/library.py @@ -1,7 +1,7 @@ from calibre.ebooks.metadata import authors_to_string __license__ = 'GPL v3' __copyright__ = '2008, Kovid Goyal ' -import os, textwrap, traceback, re +import os, textwrap, traceback, re, shutil from operator import attrgetter from math import cos, sin, pi @@ -469,8 +469,10 @@ class BooksModel(QAbstractTableModel): break if format is not None: pt = PersistentTemporaryFile(suffix='.'+format) - pt.write(self.db.format(id, format, index_is_id=True)) + src = self.db.format(id, format, index_is_id=True, as_file=True) + shutil.copyfileobj(src, pt) pt.flush() + pt.seek(0) if set_metadata: _set_metadata(pt, self.db.get_metadata(id, get_cover=True, index_is_id=True), format) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index ed902c8ea4..f1929578f7 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -1580,6 +1580,8 @@ class LibraryDatabase2(LibraryDatabase): ids.append(id) self.set_path(id, True) self.conn.commit() + if mi.timestamp is None: + mi.timestamp = nowf() self.set_metadata(id, mi) npath = self.run_import_plugins(path, format) format = os.path.splitext(npath)[-1].lower().replace('.', '').upper() @@ -1611,6 +1613,8 @@ class LibraryDatabase2(LibraryDatabase): id = obj.lastrowid self.data.books_added([id], self) self.set_path(id, True) + if mi.timestamp is None: + mi.timestamp = nowf() self.set_metadata(id, mi, ignore_errors=True) for path in formats: ext = os.path.splitext(path)[1][1:].lower()