1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-27 02:09:16 +02: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 {
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);
});