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:
parent
cf69611831
commit
06dd15a0ab
@ -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;
|
||||
|
10
test/backend/unit/assets/video.json
Normal file
10
test/backend/unit/assets/video.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"bitRate": 11464,
|
||||
"creationDate": 1550265200000,
|
||||
"duration": 13666,
|
||||
"fileSize": 251571,
|
||||
"size": {
|
||||
"height": 60,
|
||||
"width": 80
|
||||
}
|
||||
}
|
BIN
test/backend/unit/assets/video.mp4
Normal file
BIN
test/backend/unit/assets/video.mp4
Normal file
Binary file not shown.
@ -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);
|
||||
|
@ -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);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user