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
3b6259b925
@ -536,3 +536,4 @@ many_libraries = 10
|
|||||||
# yellow when using a Virtual Library. By setting this to False, you can turn
|
# yellow when using a Virtual Library. By setting this to False, you can turn
|
||||||
# that off.
|
# that off.
|
||||||
highlight_virtual_library_book_count = True
|
highlight_virtual_library_book_count = True
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ class KOBO(USBMS):
|
|||||||
gui_name = 'Kobo Reader'
|
gui_name = 'Kobo Reader'
|
||||||
description = _('Communicate with the Kobo Reader')
|
description = _('Communicate with the Kobo Reader')
|
||||||
author = 'Timothy Legge and David Forrester'
|
author = 'Timothy Legge and David Forrester'
|
||||||
version = (2, 0, 9)
|
version = (2, 0, 10)
|
||||||
|
|
||||||
dbversion = 0
|
dbversion = 0
|
||||||
fwversion = 0
|
fwversion = 0
|
||||||
@ -45,6 +45,7 @@ class KOBO(USBMS):
|
|||||||
supported_platforms = ['windows', 'osx', 'linux']
|
supported_platforms = ['windows', 'osx', 'linux']
|
||||||
|
|
||||||
booklist_class = CollectionsBookList
|
booklist_class = CollectionsBookList
|
||||||
|
book_class = Book
|
||||||
|
|
||||||
# Ordered list of supported formats
|
# Ordered list of supported formats
|
||||||
FORMATS = ['epub', 'pdf', 'txt', 'cbz', 'cbr']
|
FORMATS = ['epub', 'pdf', 'txt', 'cbz', 'cbr']
|
||||||
@ -115,7 +116,6 @@ class KOBO(USBMS):
|
|||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
USBMS.initialize(self)
|
USBMS.initialize(self)
|
||||||
self.book_class = Book
|
|
||||||
self.dbversion = 7
|
self.dbversion = 7
|
||||||
|
|
||||||
def books(self, oncard=None, end_session=True):
|
def books(self, oncard=None, end_session=True):
|
||||||
@ -1213,7 +1213,7 @@ class KOBOTOUCH(KOBO):
|
|||||||
min_dbversion_archive = 71
|
min_dbversion_archive = 71
|
||||||
min_dbversion_images_on_sdcard = 77
|
min_dbversion_images_on_sdcard = 77
|
||||||
|
|
||||||
max_supported_fwversion = (2,5,1)
|
max_supported_fwversion = (2,5,3)
|
||||||
min_fwversion_images_on_sdcard = (2,4,1)
|
min_fwversion_images_on_sdcard = (2,4,1)
|
||||||
|
|
||||||
has_kepubs = True
|
has_kepubs = True
|
||||||
@ -1237,11 +1237,9 @@ class KOBOTOUCH(KOBO):
|
|||||||
_('Keep cover aspect ratio') +
|
_('Keep cover aspect ratio') +
|
||||||
':::'+_('When uploading covers, do not change the aspect ratio when resizing for the device.'
|
':::'+_('When uploading covers, do not change the aspect ratio when resizing for the device.'
|
||||||
' This is for firmware versions 2.3.1 and later.'),
|
' This is for firmware versions 2.3.1 and later.'),
|
||||||
_('Show expired books') +
|
_('Show archived books') +
|
||||||
':::'+_('A bug in an earlier version left non kepubs book records'
|
':::'+_('Archived books are listed on the device but need to be downloaded to read.'
|
||||||
' in the database. With this option Calibre will show the '
|
' Use this option to show these books and match them with books in the calibre library.'),
|
||||||
'expired records and allow you to delete them with '
|
|
||||||
'the new delete logic.'),
|
|
||||||
_('Show Previews') +
|
_('Show Previews') +
|
||||||
':::'+_('Kobo previews are included on the Touch and some other versions'
|
':::'+_('Kobo previews are included on the Touch and some other versions'
|
||||||
' by default they are no longer displayed as there is no good reason to '
|
' by default they are no longer displayed as there is no good reason to '
|
||||||
@ -1289,7 +1287,7 @@ class KOBOTOUCH(KOBO):
|
|||||||
OPT_UPLOAD_COVERS = 3
|
OPT_UPLOAD_COVERS = 3
|
||||||
OPT_UPLOAD_GRAYSCALE_COVERS = 4
|
OPT_UPLOAD_GRAYSCALE_COVERS = 4
|
||||||
OPT_KEEP_COVER_ASPECT_RATIO = 5
|
OPT_KEEP_COVER_ASPECT_RATIO = 5
|
||||||
OPT_SHOW_EXPIRED_BOOK_RECORDS = 6
|
OPT_SHOW_ARCHIVED_BOOK_RECORDS = 6
|
||||||
OPT_SHOW_PREVIEWS = 7
|
OPT_SHOW_PREVIEWS = 7
|
||||||
OPT_SHOW_RECOMMENDATIONS = 8
|
OPT_SHOW_RECOMMENDATIONS = 8
|
||||||
OPT_UPDATE_SERIES_DETAILS = 9
|
OPT_UPDATE_SERIES_DETAILS = 9
|
||||||
@ -1347,6 +1345,10 @@ class KOBOTOUCH(KOBO):
|
|||||||
self.set_device_name()
|
self.set_device_name()
|
||||||
return super(KOBOTOUCH, self).get_device_information(end_session)
|
return super(KOBOTOUCH, self).get_device_information(end_session)
|
||||||
|
|
||||||
|
|
||||||
|
def device_database_path(self):
|
||||||
|
return self.normalize_path(self._main_prefix + '.kobo/KoboReader.sqlite')
|
||||||
|
|
||||||
def books(self, oncard=None, end_session=True):
|
def books(self, oncard=None, end_session=True):
|
||||||
debug_print("KoboTouch:books - oncard='%s'"%oncard)
|
debug_print("KoboTouch:books - oncard='%s'"%oncard)
|
||||||
from calibre.ebooks.metadata.meta import path_to_ext
|
from calibre.ebooks.metadata.meta import path_to_ext
|
||||||
@ -1599,9 +1601,7 @@ class KOBOTOUCH(KOBO):
|
|||||||
|
|
||||||
self.debug_index = 0
|
self.debug_index = 0
|
||||||
import sqlite3 as sqlite
|
import sqlite3 as sqlite
|
||||||
with closing(sqlite.connect(
|
with closing(sqlite.connect(self.device_database_path())) as connection:
|
||||||
self.normalize_path(self._main_prefix +
|
|
||||||
'.kobo/KoboReader.sqlite'))) as connection:
|
|
||||||
debug_print("KoboTouch:books - reading device database")
|
debug_print("KoboTouch:books - reading device database")
|
||||||
|
|
||||||
# return bytestrings if the content cannot the decoded as unicode
|
# return bytestrings if the content cannot the decoded as unicode
|
||||||
@ -1618,7 +1618,21 @@ class KOBOTOUCH(KOBO):
|
|||||||
debug_print("KoboTouch:books - shelf list:", self.bookshelvelist)
|
debug_print("KoboTouch:books - shelf list:", self.bookshelvelist)
|
||||||
|
|
||||||
opts = self.settings()
|
opts = self.settings()
|
||||||
if self.supports_series():
|
if self.supports_kobo_archive():
|
||||||
|
query= ("select Title, Attribution, DateCreated, ContentID, MimeType, ContentType, " \
|
||||||
|
"ImageID, ReadStatus, ___ExpirationStatus, FavouritesIndex, Accessibility, " \
|
||||||
|
"IsDownloaded, Series, SeriesNumber, ___UserID " \
|
||||||
|
" from content " \
|
||||||
|
" where BookID is Null " \
|
||||||
|
" and ((Accessibility = -1 and IsDownloaded in ('true', 1 )) or (Accessibility in (1,2) %(expiry)s) " \
|
||||||
|
" %(previews)s %(recomendations)s )" \
|
||||||
|
" and not ((___ExpirationStatus=3 or ___ExpirationStatus is Null) and ContentType = 6)") % \
|
||||||
|
dict(\
|
||||||
|
expiry="" if opts.extra_customization[self.OPT_SHOW_ARCHIVED_BOOK_RECORDS] else "and IsDownloaded in ('true', 1)", \
|
||||||
|
previews=" or (Accessibility in (6) and ___UserID <> '')" if opts.extra_customization[self.OPT_SHOW_PREVIEWS] else "", \
|
||||||
|
recomendations=" or (Accessibility in (-1, 4, 6) and ___UserId = '')" if opts.extra_customization[self.OPT_SHOW_RECOMMENDATIONS] else "" \
|
||||||
|
)
|
||||||
|
elif self.supports_series():
|
||||||
query= ("select Title, Attribution, DateCreated, ContentID, MimeType, ContentType, " \
|
query= ("select Title, Attribution, DateCreated, ContentID, MimeType, ContentType, " \
|
||||||
"ImageID, ReadStatus, ___ExpirationStatus, FavouritesIndex, Accessibility, " \
|
"ImageID, ReadStatus, ___ExpirationStatus, FavouritesIndex, Accessibility, " \
|
||||||
"IsDownloaded, Series, SeriesNumber, ___UserID " \
|
"IsDownloaded, Series, SeriesNumber, ___UserID " \
|
||||||
@ -1627,7 +1641,7 @@ class KOBOTOUCH(KOBO):
|
|||||||
" and ((Accessibility = -1 and IsDownloaded in ('true', 1)) or (Accessibility in (1,2)) %(previews)s %(recomendations)s )" \
|
" and ((Accessibility = -1 and IsDownloaded in ('true', 1)) or (Accessibility in (1,2)) %(previews)s %(recomendations)s )" \
|
||||||
" and not ((___ExpirationStatus=3 or ___ExpirationStatus is Null) %(expiry)s") % \
|
" and not ((___ExpirationStatus=3 or ___ExpirationStatus is Null) %(expiry)s") % \
|
||||||
dict(\
|
dict(\
|
||||||
expiry=" and ContentType = 6)" if opts.extra_customization[self.OPT_SHOW_EXPIRED_BOOK_RECORDS] else ")", \
|
expiry=" and ContentType = 6)" if opts.extra_customization[self.OPT_SHOW_ARCHIVED_BOOK_RECORDS] else ")", \
|
||||||
previews=" or (Accessibility in (6) and ___UserID <> '')" if opts.extra_customization[self.OPT_SHOW_PREVIEWS] else "", \
|
previews=" or (Accessibility in (6) and ___UserID <> '')" if opts.extra_customization[self.OPT_SHOW_PREVIEWS] else "", \
|
||||||
recomendations=" or (Accessibility in (-1, 4, 6) and ___UserId = '')" if opts.extra_customization[self.OPT_SHOW_RECOMMENDATIONS] else "" \
|
recomendations=" or (Accessibility in (-1, 4, 6) and ___UserId = '')" if opts.extra_customization[self.OPT_SHOW_RECOMMENDATIONS] else "" \
|
||||||
)
|
)
|
||||||
@ -1638,7 +1652,7 @@ class KOBOTOUCH(KOBO):
|
|||||||
' from content ' \
|
' from content ' \
|
||||||
' where BookID is Null %(previews)s %(recomendations)s and not ((___ExpirationStatus=3 or ___ExpirationStatus is Null) %(expiry)s') % \
|
' where BookID is Null %(previews)s %(recomendations)s and not ((___ExpirationStatus=3 or ___ExpirationStatus is Null) %(expiry)s') % \
|
||||||
dict(\
|
dict(\
|
||||||
expiry=' and ContentType = 6)' if opts.extra_customization[self.OPT_SHOW_EXPIRED_BOOK_RECORDS] else ')', \
|
expiry=' and ContentType = 6)' if opts.extra_customization[self.OPT_SHOW_ARCHIVED_BOOK_RECORDS] else ')', \
|
||||||
previews=' and Accessibility <> 6' if opts.extra_customization[self.OPT_SHOW_PREVIEWS] == False else '', \
|
previews=' and Accessibility <> 6' if opts.extra_customization[self.OPT_SHOW_PREVIEWS] == False else '', \
|
||||||
recomendations=' and IsDownloaded in (\'true\', 1)' if opts.extra_customization[self.OPT_SHOW_RECOMMENDATIONS] == False else ''\
|
recomendations=' and IsDownloaded in (\'true\', 1)' if opts.extra_customization[self.OPT_SHOW_RECOMMENDATIONS] == False else ''\
|
||||||
)
|
)
|
||||||
@ -1648,7 +1662,7 @@ class KOBOTOUCH(KOBO):
|
|||||||
'"1" as IsDownloaded, null as Series, null as SeriesNumber, ___UserID' \
|
'"1" as IsDownloaded, null as Series, null as SeriesNumber, ___UserID' \
|
||||||
' from content where ' \
|
' from content where ' \
|
||||||
'BookID is Null and not ((___ExpirationStatus=3 or ___ExpirationStatus is Null) %(expiry)s') % dict(expiry=' and ContentType = 6)' \
|
'BookID is Null and not ((___ExpirationStatus=3 or ___ExpirationStatus is Null) %(expiry)s') % dict(expiry=' and ContentType = 6)' \
|
||||||
if opts.extra_customization[self.OPT_SHOW_EXPIRED_BOOK_RECORDS] else ')')
|
if opts.extra_customization[self.OPT_SHOW_ARCHIVED_BOOK_RECORDS] else ')')
|
||||||
else:
|
else:
|
||||||
query= 'select Title, Attribution, DateCreated, ContentID, MimeType, ContentType, ' \
|
query= 'select Title, Attribution, DateCreated, ContentID, MimeType, ContentType, ' \
|
||||||
'ImageID, ReadStatus, "-1" as ___ExpirationStatus, "-1" as FavouritesIndex, "-1" as Accessibility, ' \
|
'ImageID, ReadStatus, "-1" as ___ExpirationStatus, "-1" as FavouritesIndex, "-1" as Accessibility, ' \
|
||||||
@ -2586,7 +2600,7 @@ class KOBOTOUCH(KOBO):
|
|||||||
def modify_database_check(self, function):
|
def modify_database_check(self, function):
|
||||||
# Checks to see whether the database version is supported
|
# Checks to see whether the database version is supported
|
||||||
# and whether the user has chosen to support the firmware version
|
# and whether the user has chosen to support the firmware version
|
||||||
# debug_print("KoboTouch:modify_database_check - self.fwversion <= self.max_supported_fwversion=", self.fwversion > self.max_supported_fwversion)
|
# debug_print("KoboTouch:modify_database_check - self.fwversion > self.max_supported_fwversion=", self.fwversion > self.max_supported_fwversion)
|
||||||
if self.dbversion > self.supported_dbversion or self.fwversion > self.max_supported_fwversion:
|
if self.dbversion > self.supported_dbversion or self.fwversion > self.max_supported_fwversion:
|
||||||
# Unsupported database
|
# Unsupported database
|
||||||
opts = self.settings()
|
opts = self.settings()
|
||||||
|
@ -28,7 +28,10 @@ class ConfigWidget(QWidget, Ui_ConfigWidget):
|
|||||||
|
|
||||||
all_formats = set(all_formats)
|
all_formats = set(all_formats)
|
||||||
self.calibre_known_formats = device.FORMATS
|
self.calibre_known_formats = device.FORMATS
|
||||||
|
try:
|
||||||
self.device_name = device.get_gui_name()
|
self.device_name = device.get_gui_name()
|
||||||
|
except TypeError:
|
||||||
|
self.device_name = getattr(device, 'gui_name', None) or _('Device')
|
||||||
if device.USER_CAN_ADD_NEW_FORMATS:
|
if device.USER_CAN_ADD_NEW_FORMATS:
|
||||||
all_formats = set(all_formats) | set(BOOK_EXTENSIONS)
|
all_formats = set(all_formats) | set(BOOK_EXTENSIONS)
|
||||||
|
|
||||||
|
@ -172,7 +172,10 @@ class Tweaks(QAbstractListModel, SearchQueryParser): # {{{
|
|||||||
doc.append(line[1:].strip())
|
doc.append(line[1:].strip())
|
||||||
doc = '\n'.join(doc)
|
doc = '\n'.join(doc)
|
||||||
while True:
|
while True:
|
||||||
|
try:
|
||||||
line = lines[pos]
|
line = lines[pos]
|
||||||
|
except IndexError:
|
||||||
|
break
|
||||||
if not line.strip():
|
if not line.strip():
|
||||||
break
|
break
|
||||||
spidx1 = line.find(' ')
|
spidx1 = line.find(' ')
|
||||||
|
@ -431,7 +431,8 @@ class KindlePage(QWizardPage, KindleUI):
|
|||||||
default = ac[2]
|
default = ac[2]
|
||||||
if x.strip().endswith('@kindle.com'):
|
if x.strip().endswith('@kindle.com'):
|
||||||
accs.append((x, default))
|
accs.append((x, default))
|
||||||
if default: has_default = True
|
if default:
|
||||||
|
has_default = True
|
||||||
if has_default:
|
if has_default:
|
||||||
accs = [x for x in accs if x[1]]
|
accs = [x for x in accs if x[1]]
|
||||||
if accs:
|
if accs:
|
||||||
@ -450,7 +451,8 @@ class KindlePage(QWizardPage, KindleUI):
|
|||||||
if (len(parts) >= 2 and parts[0] and self.send_email_widget.set_email_settings(True)):
|
if (len(parts) >= 2 and parts[0] and self.send_email_widget.set_email_settings(True)):
|
||||||
conf = smtp_prefs()
|
conf = smtp_prefs()
|
||||||
accounts = conf.parse().accounts
|
accounts = conf.parse().accounts
|
||||||
if not accounts: accounts = {}
|
if not accounts:
|
||||||
|
accounts = {}
|
||||||
for y in accounts.values():
|
for y in accounts.values():
|
||||||
y[2] = False
|
y[2] = False
|
||||||
accounts[x] = ['AZW, MOBI, TPZ, PRC, AZW1', True, True]
|
accounts[x] = ['AZW, MOBI, TPZ, PRC, AZW1', True, True]
|
||||||
@ -484,9 +486,9 @@ class StanzaPage(QWizardPage, StanzaUI):
|
|||||||
c = server_config()
|
c = server_config()
|
||||||
c.set('port', p)
|
c.set('port', p)
|
||||||
|
|
||||||
|
|
||||||
def set_port(self, *args):
|
def set_port(self, *args):
|
||||||
if not self.content_server.isChecked(): return
|
if not self.content_server.isChecked():
|
||||||
|
return
|
||||||
import socket
|
import socket
|
||||||
s = socket.socket()
|
s = socket.socket()
|
||||||
with closing(s):
|
with closing(s):
|
||||||
@ -518,8 +520,7 @@ class DevicePage(QWizardPage, DeviceUI):
|
|||||||
self.manufacturer_view.setModel(self.man_model)
|
self.manufacturer_view.setModel(self.man_model)
|
||||||
previous = dynamic.get('welcome_wizard_device', False)
|
previous = dynamic.get('welcome_wizard_device', False)
|
||||||
if previous:
|
if previous:
|
||||||
previous = [x for x in get_devices() if \
|
previous = [x for x in get_devices() if x.id == previous]
|
||||||
x.id == previous]
|
|
||||||
if not previous:
|
if not previous:
|
||||||
previous = [Device]
|
previous = [Device]
|
||||||
previous = previous[0]
|
previous = previous[0]
|
||||||
@ -841,7 +842,6 @@ class FinishPage(QWizardPage, FinishUI):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Wizard(QWizard):
|
class Wizard(QWizard):
|
||||||
|
|
||||||
BUTTON_TEXTS = {
|
BUTTON_TEXTS = {
|
||||||
@ -859,7 +859,6 @@ class Wizard(QWizard):
|
|||||||
_('&Finish')
|
_('&Finish')
|
||||||
_('Commit')
|
_('Commit')
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
QWizard.__init__(self, parent)
|
QWizard.__init__(self, parent)
|
||||||
self.setWindowTitle(__appname__+' '+_('welcome wizard'))
|
self.setWindowTitle(__appname__+' '+_('welcome wizard'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user