mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
KG updates
This commit is contained in:
commit
f27703974d
@ -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()
|
||||
|
@ -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')]
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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')
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
||||
|
@ -612,7 +612,7 @@
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_22">
|
||||
<property name="text">
|
||||
<string>calibre can send your books to you (or your reader) by email</string>
|
||||
<string>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.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
@ -1,7 +1,7 @@
|
||||
from calibre.ebooks.metadata import authors_to_string
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
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)
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user