This repository was archived by the owner on May 10, 2024. It is now read-only.
File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -261,8 +261,12 @@ def dump(self, file: BytesOrString) -> None:
261
261
zf .writestr (f"{ self .ID } /{ page .order } -metadata.json" ,
262
262
json .dumps (page .metadata ))
263
263
page .page .seek (0 )
264
- zf .writestr (f"{ self .ID } .thumbnails/{ page .order } .jpg" ,
265
- page .thumbnail .read ())
264
+ try :
265
+ zf .writestr (f"{ self .ID } .thumbnails/{ page .order } .jpg" ,
266
+ page .thumbnail .read ())
267
+ except AttributeError :
268
+ log .debug (f"missing thumbnail during dump: { self .ID } : { page .order } " )
269
+ pass
266
270
if isinstance (file , BytesIO ):
267
271
file .seek (0 )
268
272
@@ -321,9 +325,14 @@ def load(self, file: BytesOrString) -> None:
321
325
with zf .open (p , 'r' ) as rm :
322
326
page = BytesIO (rm .read ())
323
327
page .seek (0 )
324
- with zf .open (p .replace (".rm" , "-metadata.json" ), 'r' ) as md :
325
- metadata = json .load (md )
326
328
329
+ p_meta = p .replace (".rm" , "-metadata.json" )
330
+ try :
331
+ with zf .open (p_meta , 'r' ) as md :
332
+ metadata = json .load (md )
333
+ except KeyError :
334
+ log .debug (f"missing metadata: { p_meta } " )
335
+ metadata = None
327
336
thumbnail_name = p .replace (".rm" , ".jpg" )
328
337
thumbnail_name = thumbnail_name .replace ("/" , ".thumbnails/" )
329
338
try :
You can’t perform that action at this time.
0 commit comments