mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Strip trailling periods from filenames calculated by the SQLite backend
This commit is contained in:
parent
6697b9bbb3
commit
e0e6ddb6cf
@ -452,9 +452,12 @@ class OPF(object):
|
||||
def __init__(self, stream, basedir=os.getcwdu(), unquote_urls=True):
|
||||
if not hasattr(stream, 'read'):
|
||||
stream = open(stream, 'rb')
|
||||
raw = stream.read()
|
||||
if not raw:
|
||||
raise ValueError('Empty file: '+getattr(stream, 'name', 'stream'))
|
||||
self.basedir = self.base_dir = basedir
|
||||
self.path_to_html_toc = self.html_toc_fragment = None
|
||||
raw, self.encoding = xml_to_unicode(stream.read(), strip_encoding_pats=True, resolve_entities=True)
|
||||
raw, self.encoding = xml_to_unicode(raw, strip_encoding_pats=True, resolve_entities=True)
|
||||
raw = raw[raw.find('<'):]
|
||||
self.root = etree.fromstring(raw, self.PARSER)
|
||||
self.metadata = self.metadata_path(self.root)
|
||||
|
@ -107,8 +107,6 @@ class Adder(QObject):
|
||||
self.callback(self.paths, self.names, self.infos)
|
||||
self.callback_called = True
|
||||
|
||||
|
||||
|
||||
def update(self):
|
||||
if not self.ids:
|
||||
self.timer.stop()
|
||||
|
@ -631,6 +631,8 @@ class LibraryDatabase2(LibraryDatabase):
|
||||
author = sanitize_file_name(authors.split(',')[0][:self.PATH_LIMIT]).decode(filesystem_encoding, 'replace')
|
||||
title = sanitize_file_name(self.title(id, index_is_id=True)[:self.PATH_LIMIT]).decode(filesystem_encoding, 'replace')
|
||||
name = title + ' - ' + author
|
||||
while name.endswith('.'):
|
||||
name = name[:-1]
|
||||
return name
|
||||
|
||||
def rmtree(self, path):
|
||||
|
Loading…
x
Reference in New Issue
Block a user