1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

adding file creation time as fallback to video creation time

This commit is contained in:
Patrik J. Braun 2019-07-23 09:31:04 +02:00
parent 6d44c22df1
commit 976e50d310

View File

@ -33,6 +33,7 @@ export class MetadataLoader {
try { try {
const stat = fs.statSync(fullPath); const stat = fs.statSync(fullPath);
metadata.fileSize = stat.size; metadata.fileSize = stat.size;
metadata.creationDate = stat.ctime.getTime();
} catch (err) { } catch (err) {
} }
try { try {
@ -55,13 +56,14 @@ export class MetadataLoader {
if (Utils.isInt32(parseInt(data.streams[i].bit_rate, 10))) { if (Utils.isInt32(parseInt(data.streams[i].bit_rate, 10))) {
metadata.bitRate = parseInt(data.streams[i].bit_rate, 10) || null; 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; break;
} }
} }
} catch (err) { } catch (err) {
} }
metadata.creationDate = metadata.creationDate || 0;
return resolve(metadata); return resolve(metadata);
}); });