mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
another return in conn.execute loop
This commit is contained in:
parent
e57840f244
commit
13d584cfb8
@ -366,13 +366,16 @@ class Notes:
|
||||
return resource_hash
|
||||
|
||||
def get_resource_data(self, conn, resource_hash) -> Optional[dict]:
|
||||
ans = None
|
||||
for (name,) in conn.execute('SELECT name FROM notes_db.resources WHERE hash=?', (resource_hash,)):
|
||||
path = self.path_for_resource(resource_hash)
|
||||
path = make_long_path_useable(path)
|
||||
os.listdir(os.path.dirname(path))
|
||||
with suppress(FileNotFoundError), open(path, 'rb') as f:
|
||||
mtime = os.stat(f.fileno()).st_mtime
|
||||
return {'name': name, 'data': f.read(), 'hash': resource_hash, 'mtime': mtime}
|
||||
ans = {'name': name, 'data': f.read(), 'hash': resource_hash, 'mtime': mtime}
|
||||
break
|
||||
return ans
|
||||
|
||||
def all_notes(self, conn, restrict_to_fields=(), limit=None, snippet_size=64, return_text=True, process_each_result=None) -> list[dict]:
|
||||
if snippet_size is None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user