mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Dont list directories in list_extra_files()
This commit is contained in:
parent
27bb04c2bd
commit
0b9064bcc6
@ -12,6 +12,7 @@ import hashlib
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import stat
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
@ -1914,9 +1915,11 @@ class DB:
|
|||||||
relpath = os.path.relpath(path, full_book_path)
|
relpath = os.path.relpath(path, full_book_path)
|
||||||
relpath = relpath.replace(os.sep, '/')
|
relpath = relpath.replace(os.sep, '/')
|
||||||
if relpath not in known_files:
|
if relpath not in known_files:
|
||||||
stat = os.stat(path)
|
stat_result = os.stat(path)
|
||||||
|
if stat.S_ISDIR(stat_result.st_mode):
|
||||||
|
continue
|
||||||
if yield_paths:
|
if yield_paths:
|
||||||
yield relpath, path, stat
|
yield relpath, path, stat_result
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
src = open(path, 'rb')
|
src = open(path, 'rb')
|
||||||
@ -1925,7 +1928,7 @@ class DB:
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
src = open(path, 'rb')
|
src = open(path, 'rb')
|
||||||
with src:
|
with src:
|
||||||
yield relpath, src, stat
|
yield relpath, src, stat_result
|
||||||
|
|
||||||
def add_extra_file(self, relpath, stream, book_path, replace=True, auto_rename=False):
|
def add_extra_file(self, relpath, stream, book_path, replace=True, auto_rename=False):
|
||||||
bookdir = os.path.join(self.library_path, book_path)
|
bookdir = os.path.join(self.library_path, book_path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user