mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Merge from trunk
This commit is contained in:
commit
ab9c74404a
@ -119,6 +119,7 @@ class Restore(Thread):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def process_dir(self, dirpath, filenames, book_id):
|
def process_dir(self, dirpath, filenames, book_id):
|
||||||
|
book_id = int(book_id)
|
||||||
formats = filter(self.is_ebook_file, filenames)
|
formats = filter(self.is_ebook_file, filenames)
|
||||||
fmts = [os.path.splitext(x)[1][1:].upper() for x in formats]
|
fmts = [os.path.splitext(x)[1][1:].upper() for x in formats]
|
||||||
sizes = [os.path.getsize(os.path.join(dirpath, x)) for x in formats]
|
sizes = [os.path.getsize(os.path.join(dirpath, x)) for x in formats]
|
||||||
@ -129,14 +130,17 @@ class Restore(Thread):
|
|||||||
path = os.path.relpath(dirpath, self.src_library_path).replace(os.sep,
|
path = os.path.relpath(dirpath, self.src_library_path).replace(os.sep,
|
||||||
'/')
|
'/')
|
||||||
|
|
||||||
|
if int(mi.application_id) == book_id:
|
||||||
self.books.append({
|
self.books.append({
|
||||||
'mi': mi,
|
'mi': mi,
|
||||||
'timestamp': timestamp,
|
'timestamp': timestamp,
|
||||||
'formats': list(zip(fmts, sizes, names)),
|
'formats': list(zip(fmts, sizes, names)),
|
||||||
'id': int(book_id),
|
'id': book_id,
|
||||||
'dirpath': dirpath,
|
'dirpath': dirpath,
|
||||||
'path': path,
|
'path': path,
|
||||||
})
|
})
|
||||||
|
else:
|
||||||
|
self.ignored_dirs.append(dirpath)
|
||||||
|
|
||||||
def create_cc_metadata(self):
|
def create_cc_metadata(self):
|
||||||
self.books.sort(key=itemgetter('timestamp'))
|
self.books.sort(key=itemgetter('timestamp'))
|
||||||
@ -157,7 +161,7 @@ class Restore(Thread):
|
|||||||
self.conflicting_custom_cols[label].add(args)
|
self.conflicting_custom_cols[label].add(args)
|
||||||
m[b['label']] = args
|
m[b['label']] = args
|
||||||
|
|
||||||
db = LibraryDatabase2(self.library_path)
|
db = RestoreDatabase(self.library_path)
|
||||||
for args in m.values():
|
for args in m.values():
|
||||||
db.create_custom_column(*args)
|
db.create_custom_column(*args)
|
||||||
db.conn.close()
|
db.conn.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user