1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

fixing video length bug

This commit is contained in:
Patrik J. Braun 2019-02-15 16:19:30 -05:00
parent cf69611831
commit 06dd15a0ab
5 changed files with 20 additions and 2 deletions

View File

@ -53,7 +53,7 @@ export class MetadataLoader {
}
if (Utils.isInt32(parseInt(data.streams[i].bit_rate, 10))) {
metadata.duration = 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);
break;

View File

@ -0,0 +1,10 @@
{
"bitRate": 11464,
"creationDate": 1550265200000,
"duration": 13666,
"fileSize": 251571,
"size": {
"height": 60,
"width": 80
}
}

Binary file not shown.

View File

@ -11,7 +11,7 @@ describe('DiskMangerWorker', () => {
Config.Server.imagesFolder = path.join(__dirname, '/../../assets');
ProjectPath.ImageFolder = path.join(__dirname, '/../../assets');
const dir = await DiskMangerWorker.scanDirectory('/');
expect(dir.media.length).to.be.equals(3);
expect(dir.media.length).to.be.equals(4);
const expected = require(path.join(__dirname, '/../../assets/test image öüóőúéáű-.,.json'));
expect(Utils.clone(dir.media[1].name)).to.be.deep.equal('test image öüóőúéáű-.,.jpg');
expect(Utils.clone(dir.media[1].metadata)).to.be.deep.equal(expected);

View File

@ -31,4 +31,12 @@ describe('MetadataLoader', () => {
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
it('should load mp4', async () => {
const data = await MetadataLoader.loadVideoMetadata(path.join(__dirname, '/../../assets/video.mp4'));
const expected = require(path.join(__dirname, '/../../assets/video.json'));
expect(Utils.clone(data)).to.be.deep.equal(expected);
});
});