This commit is contained in:
Kovid Goyal 2018-07-04 17:59:10 +05:30
parent a516fabae1
commit a6c0be308a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
5 changed files with 11 additions and 15 deletions

View File

@ -199,7 +199,7 @@ class KINDLE(USBMS):
return bookmarked_books return bookmarked_books
def generate_annotation_html(self, bookmark): def generate_annotation_html(self, bookmark):
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag, NavigableString from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag
# Returns <div class="user_annotations"> ... </div> # Returns <div class="user_annotations"> ... </div>
last_read_location = bookmark.last_read_location last_read_location = bookmark.last_read_location
timestamp = datetime.datetime.utcfromtimestamp(bookmark.timestamp) timestamp = datetime.datetime.utcfromtimestamp(bookmark.timestamp)
@ -540,9 +540,9 @@ class KINDLE2(KINDLE):
if temp in self.EXTRA_CUSTOMIZATION_CHOICES[self.OPT_APNX_METHOD]: if temp in self.EXTRA_CUSTOMIZATION_CHOICES[self.OPT_APNX_METHOD]:
method = temp method = temp
else: else:
print ("Invalid method choice for this book (%r), ignoring." % temp) print("Invalid method choice for this book (%r), ignoring." % temp)
except: except:
print 'Could not retrieve override method choice, using default.' print('Could not retrieve override method choice, using default.')
apnx_builder.write_apnx(filepath, apnx_path, method=method, page_count=custom_page_count) apnx_builder.write_apnx(filepath, apnx_path, method=method, page_count=custom_page_count)
except: except:
print 'Failed to generate APNX' print 'Failed to generate APNX'

View File

@ -477,8 +477,8 @@ class KOBO(USBMS):
cursor.close() cursor.close()
if ImageID is None: if ImageID is None:
print "Error condition ImageID was not found" print("Error condition ImageID was not found")
print "You likely tried to delete a book that the kobo has not yet added to the database" print("You likely tried to delete a book that the kobo has not yet added to the database")
# If all this succeeds we need to delete the images files via the ImageID # If all this succeeds we need to delete the images files via the ImageID
return ImageID return ImageID
@ -1170,7 +1170,7 @@ class KOBO(USBMS):
def generate_annotation_html(self, bookmark): def generate_annotation_html(self, bookmark):
import calendar import calendar
from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag, NavigableString from calibre.ebooks.BeautifulSoup import BeautifulSoup, Tag
# Returns <div class="user_annotations"> ... </div> # Returns <div class="user_annotations"> ... </div>
# last_read_location = bookmark.last_read_location # last_read_location = bookmark.last_read_location
# timestamp = bookmark.timestamp # timestamp = bookmark.timestamp

View File

@ -131,8 +131,7 @@ class CHMInput(InputFormatPlugin):
def unquote_path(x): def unquote_path(x):
y = unquote(x) y = unquote(x)
if (not os.path.exists(os.path.join(base, x)) and if (not os.path.exists(os.path.join(base, x)) and os.path.exists(os.path.join(base, y))):
os.path.exists(os.path.join(base, y))):
x = y x = y
return x return x
@ -144,8 +143,7 @@ class CHMInput(InputFormatPlugin):
raw = unquote_path(child.href or '') raw = unquote_path(child.href or '')
rsrcname = os.path.basename(raw) rsrcname = os.path.basename(raw)
rsrcpath = os.path.join(subpath, rsrcname) rsrcpath = os.path.join(subpath, rsrcname)
if (not os.path.exists(os.path.join(base, rsrcpath)) and if (not os.path.exists(os.path.join(base, rsrcpath)) and os.path.exists(os.path.join(base, raw))):
os.path.exists(os.path.join(base, raw))):
rsrcpath = raw rsrcpath = raw
if '%' not in rsrcpath: if '%' not in rsrcpath:

View File

@ -92,8 +92,7 @@ class HTMLInput(InputFormatPlugin):
return self._is_case_sensitive return self._is_case_sensitive
if not path or not os.path.exists(path): if not path or not os.path.exists(path):
return islinux or isbsd return islinux or isbsd
self._is_case_sensitive = not (os.path.exists(path.lower()) and self._is_case_sensitive = not (os.path.exists(path.lower()) and os.path.exists(path.upper()))
os.path.exists(path.upper()))
return self._is_case_sensitive return self._is_case_sensitive
def create_oebbook(self, htmlpath, basedir, opts, log, mi): def create_oebbook(self, htmlpath, basedir, opts, log, mi):

View File

@ -57,9 +57,8 @@ class OEBOutput(OutputFormatPlugin):
for item in oeb_book.manifest: for item in oeb_book.manifest:
if ( if (
not self.opts.expand_css and not self.opts.expand_css and item.media_type in OEB_STYLES and hasattr(
item.media_type in OEB_STYLES and hasattr(item.data, 'cssText') and item.data, 'cssText') and 'nook' not in self.opts.output_profile.short_name):
'nook' not in self.opts.output_profile.short_name):
condense_sheet(item.data) condense_sheet(item.data)
path = os.path.abspath(unquote(item.href)) path = os.path.abspath(unquote(item.href))
dir = os.path.dirname(path) dir = os.path.dirname(path)