From 976e50d310478329025858441e1c9c599669068a Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Tue, 23 Jul 2019 09:31:04 +0200 Subject: [PATCH] adding file creation time as fallback to video creation time --- backend/model/threading/MetadataLoader.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/model/threading/MetadataLoader.ts b/backend/model/threading/MetadataLoader.ts index c034138e..59194096 100644 --- a/backend/model/threading/MetadataLoader.ts +++ b/backend/model/threading/MetadataLoader.ts @@ -33,6 +33,7 @@ export class MetadataLoader { try { const stat = fs.statSync(fullPath); metadata.fileSize = stat.size; + metadata.creationDate = stat.ctime.getTime(); } catch (err) { } try { @@ -55,13 +56,14 @@ export class MetadataLoader { if (Utils.isInt32(parseInt(data.streams[i].bit_rate, 10))) { metadata.bitRate = parseInt(data.streams[i].bit_rate, 10) || null; } - metadata.creationDate = Date.parse(data.streams[i].tags.creation_time); + metadata.creationDate = Date.parse(data.streams[i].tags.creation_time) || metadata.creationDate; break; } } } catch (err) { } + metadata.creationDate = metadata.creationDate || 0; return resolve(metadata); });