@@ -248,15 +248,34 @@ def spider(args, paths: Set):
248
248
else :
249
249
new_paths [path ] = None # add key to map; title: None
250
250
251
- media = [{"path" : k , "title" : v } for k , v in new_paths .items ()]
251
+ media = [
252
+ {
253
+ "path" : k ,
254
+ "title" : v ,
255
+ "time_created" : consts .APPLICATION_START ,
256
+ "time_deleted" : 0 ,
257
+ }
258
+ for k , v in new_paths .items ()
259
+ ]
252
260
new_media_count += len (media )
253
261
for i , m in enumerate (media , start = 1 ):
254
262
printing .print_overwrite (
255
263
f"Pages to scan { len (paths )} link scan: { new_media_count } new [{ len (known_paths )} known]; basic metadata { i } of { len (media )} "
256
264
)
257
265
258
- m |= web .stat (m ["path" ])
259
- m ["type" ] = file_utils .mimetype (m ["path" ])
266
+ if DBType .filesystem in args .profiles :
267
+ m |= web .stat (m ["path" ])
268
+ m ["type" ] = file_utils .mimetype (m ["path" ])
269
+ else :
270
+ extension = m ["path" ].rsplit ("." , 1 )[- 1 ].lower ()
271
+ if (
272
+ args .scan_all_files
273
+ or (DBType .video in args .profiles and extension in consts .VIDEO_EXTENSIONS )
274
+ or (DBType .audio in args .profiles and extension in consts .AUDIO_ONLY_EXTENSIONS )
275
+ or (DBType .text in args .profiles and extension in consts .TEXTRACT_EXTENSIONS )
276
+ or (DBType .image in args .profiles and extension in consts .IMAGE_EXTENSIONS )
277
+ ):
278
+ m |= web .stat (m ["path" ])
260
279
261
280
if getattr (args , "hash" , False ):
262
281
# TODO: use head_foot_stream
@@ -268,6 +287,7 @@ def spider(args, paths: Set):
268
287
)
269
288
270
289
extension = m ["path" ].rsplit ("." , 1 )[- 1 ].lower ()
290
+
271
291
remote_path = m ["path" ] # for temp file extraction
272
292
if DBType .video in args .profiles and (extension in consts .VIDEO_EXTENSIONS or args .scan_all_files ):
273
293
m |= av .munge_av_tags (args , m ["path" ])
0 commit comments