mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
KG updates
This commit is contained in:
commit
f27703974d
@ -37,7 +37,7 @@ class NYTimes(BasicNewsRecipe):
|
|||||||
dict(name=['script', 'noscript', 'style'])]
|
dict(name=['script', 'noscript', 'style'])]
|
||||||
encoding = decode
|
encoding = decode
|
||||||
no_stylesheets = True
|
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):
|
def get_browser(self):
|
||||||
br = BasicNewsRecipe.get_browser()
|
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.nuut2.driver import NUUT2
|
||||||
from calibre.devices.iriver.driver import IRIVER_STORY
|
from calibre.devices.iriver.driver import IRIVER_STORY
|
||||||
from calibre.devices.binatone.driver import README
|
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.ebooks.metadata.fetch import GoogleBooks, ISBNDB, Amazon
|
||||||
from calibre.library.catalog import CSV_XML, EPUB_MOBI
|
from calibre.library.catalog import CSV_XML, EPUB_MOBI
|
||||||
@ -494,6 +494,7 @@ plugins += [
|
|||||||
EB600,
|
EB600,
|
||||||
README,
|
README,
|
||||||
N516,
|
N516,
|
||||||
|
EB511,
|
||||||
]
|
]
|
||||||
plugins += [x for x in list(locals().values()) if isinstance(x, type) and \
|
plugins += [x for x in list(locals().values()) if isinstance(x, type) and \
|
||||||
x.__name__.endswith('MetadataReader')]
|
x.__name__.endswith('MetadataReader')]
|
||||||
|
@ -126,3 +126,15 @@ class BOOX(HANLINV3):
|
|||||||
|
|
||||||
EBOOK_DIR_MAIN = 'MyBooks'
|
EBOOK_DIR_MAIN = 'MyBooks'
|
||||||
EBOOK_DIR_CARD_A = '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
|
Device driver for Hanvon devices
|
||||||
'''
|
'''
|
||||||
|
import re
|
||||||
|
|
||||||
from calibre.devices.usbms.driver import USBMS
|
from calibre.devices.usbms.driver import USBMS
|
||||||
|
|
||||||
@ -32,3 +33,25 @@ class N516(USBMS):
|
|||||||
|
|
||||||
EBOOK_DIR_MAIN = 'e_book'
|
EBOOK_DIR_MAIN = 'e_book'
|
||||||
SUPPORTS_SUB_DIRS = True
|
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)
|
fix_ids(*booklists)
|
||||||
if not os.path.exists(self._main_prefix):
|
if not os.path.exists(self._main_prefix):
|
||||||
os.makedirs(self._main_prefix)
|
os.makedirs(self._main_prefix)
|
||||||
f = open(self._main_prefix + self.__class__.MEDIA_XML, 'wb')
|
with open(self._main_prefix + self.__class__.MEDIA_XML, 'wb') as f:
|
||||||
booklists[0].write(f)
|
booklists[0].write(f)
|
||||||
f.close()
|
|
||||||
|
|
||||||
def write_card_prefix(prefix, listid):
|
def write_card_prefix(prefix, listid):
|
||||||
if prefix is not None and hasattr(booklists[listid], 'write'):
|
if prefix is not None and hasattr(booklists[listid], 'write'):
|
||||||
if not os.path.exists(prefix):
|
if not os.path.exists(prefix):
|
||||||
os.makedirs(prefix)
|
os.makedirs(prefix)
|
||||||
f = open(prefix + self.__class__.CACHE_XML, 'wb')
|
with open(prefix + self.__class__.CACHE_XML, 'wb') as f:
|
||||||
booklists[listid].write(f)
|
booklists[listid].write(f)
|
||||||
f.close()
|
|
||||||
write_card_prefix(self._card_a_prefix, 1)
|
write_card_prefix(self._card_a_prefix, 1)
|
||||||
write_card_prefix(self._card_b_prefix, 2)
|
write_card_prefix(self._card_b_prefix, 2)
|
||||||
|
|
||||||
|
@ -612,7 +612,7 @@
|
|||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QLabel" name="label_22">
|
<widget class="QLabel" name="label_22">
|
||||||
<property name="text">
|
<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>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from calibre.ebooks.metadata import authors_to_string
|
from calibre.ebooks.metadata import authors_to_string
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
import os, textwrap, traceback, re
|
import os, textwrap, traceback, re, shutil
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
|
|
||||||
from math import cos, sin, pi
|
from math import cos, sin, pi
|
||||||
@ -469,8 +469,10 @@ class BooksModel(QAbstractTableModel):
|
|||||||
break
|
break
|
||||||
if format is not None:
|
if format is not None:
|
||||||
pt = PersistentTemporaryFile(suffix='.'+format)
|
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.flush()
|
||||||
|
pt.seek(0)
|
||||||
if set_metadata:
|
if set_metadata:
|
||||||
_set_metadata(pt, self.db.get_metadata(id, get_cover=True, index_is_id=True),
|
_set_metadata(pt, self.db.get_metadata(id, get_cover=True, index_is_id=True),
|
||||||
format)
|
format)
|
||||||
|
@ -1580,6 +1580,8 @@ class LibraryDatabase2(LibraryDatabase):
|
|||||||
ids.append(id)
|
ids.append(id)
|
||||||
self.set_path(id, True)
|
self.set_path(id, True)
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
|
if mi.timestamp is None:
|
||||||
|
mi.timestamp = nowf()
|
||||||
self.set_metadata(id, mi)
|
self.set_metadata(id, mi)
|
||||||
npath = self.run_import_plugins(path, format)
|
npath = self.run_import_plugins(path, format)
|
||||||
format = os.path.splitext(npath)[-1].lower().replace('.', '').upper()
|
format = os.path.splitext(npath)[-1].lower().replace('.', '').upper()
|
||||||
@ -1611,6 +1613,8 @@ class LibraryDatabase2(LibraryDatabase):
|
|||||||
id = obj.lastrowid
|
id = obj.lastrowid
|
||||||
self.data.books_added([id], self)
|
self.data.books_added([id], self)
|
||||||
self.set_path(id, True)
|
self.set_path(id, True)
|
||||||
|
if mi.timestamp is None:
|
||||||
|
mi.timestamp = nowf()
|
||||||
self.set_metadata(id, mi, ignore_errors=True)
|
self.set_metadata(id, mi, ignore_errors=True)
|
||||||
for path in formats:
|
for path in formats:
|
||||||
ext = os.path.splitext(path)[1][1:].lower()
|
ext = os.path.splitext(path)[1][1:].lower()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user