You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-07-17 01:32:29 +02:00
fixing photo metadata data type error with mysql
This commit is contained in:
@ -45,7 +45,7 @@ export class SQLConnection {
|
|||||||
VersionEntity
|
VersionEntity
|
||||||
];
|
];
|
||||||
options.synchronize = false;
|
options.synchronize = false;
|
||||||
// options.logging = 'all';
|
options.logging = 'all';
|
||||||
|
|
||||||
|
|
||||||
this.connection = await this.createConnection(options);
|
this.connection = await this.createConnection(options);
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
import {Column, Entity, ChildEntity, Unique} from 'typeorm';
|
import {ChildEntity, Column} from 'typeorm';
|
||||||
import {
|
import {CameraMetadata, GPSMetadata, PhotoDTO, PhotoMetadata, PositionMetaData} from '../../../../common/entities/PhotoDTO';
|
||||||
CameraMetadata,
|
|
||||||
FaceRegion,
|
|
||||||
FaceRegionBox,
|
|
||||||
GPSMetadata,
|
|
||||||
PhotoDTO,
|
|
||||||
PhotoMetadata,
|
|
||||||
PositionMetaData
|
|
||||||
} from '../../../../common/entities/PhotoDTO';
|
|
||||||
import {MediaEntity, MediaMetadataEntity} from './MediaEntity';
|
import {MediaEntity, MediaMetadataEntity} from './MediaEntity';
|
||||||
|
|
||||||
export class CameraMetadataEntity implements CameraMetadata {
|
export class CameraMetadataEntity implements CameraMetadata {
|
||||||
@ -21,13 +13,13 @@ export class CameraMetadataEntity implements CameraMetadata {
|
|||||||
@Column('text', {nullable: true})
|
@Column('text', {nullable: true})
|
||||||
make: string;
|
make: string;
|
||||||
|
|
||||||
@Column('int', {nullable: true})
|
@Column('float', {nullable: true})
|
||||||
fStop: number;
|
fStop: number;
|
||||||
|
|
||||||
@Column('int', {nullable: true})
|
@Column('float', {nullable: true})
|
||||||
exposure: number;
|
exposure: number;
|
||||||
|
|
||||||
@Column('int', {nullable: true})
|
@Column('int', {nullable: true, unsigned: true})
|
||||||
focalLength: number;
|
focalLength: number;
|
||||||
|
|
||||||
@Column('text', {nullable: true})
|
@Column('text', {nullable: true})
|
||||||
@ -37,11 +29,11 @@ export class CameraMetadataEntity implements CameraMetadata {
|
|||||||
|
|
||||||
export class GPSMetadataEntity implements GPSMetadata {
|
export class GPSMetadataEntity implements GPSMetadata {
|
||||||
|
|
||||||
@Column('int', {nullable: true})
|
@Column('float', {nullable: true})
|
||||||
latitude: number;
|
latitude: number;
|
||||||
@Column('int', {nullable: true})
|
@Column('float', {nullable: true})
|
||||||
longitude: number;
|
longitude: number;
|
||||||
@Column('int', {nullable: true})
|
@Column('float', {nullable: true})
|
||||||
altitude: number;
|
altitude: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,9 @@ export class MetadataLoader {
|
|||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
const ret = ExifReader.load(data);
|
const ret = ExifReader.load(data);
|
||||||
|
ret.ImageWidth.id
|
||||||
const faces: FaceRegion[] = [];
|
const faces: FaceRegion[] = [];
|
||||||
if (ret.Regions && ret.Regions.value.RegionList && ret.Regions.value.RegionList.value) {
|
if (ret.Regions && ret.Regions.value.RegionList && ret.Regions.value.RegionList.value) {
|
||||||
for (let i = 0; i < ret.Regions.value.RegionList.value.length; i++) {
|
for (let i = 0; i < ret.Regions.value.RegionList.value.length; i++) {
|
||||||
|
@ -1 +1 @@
|
|||||||
export const DataStructureVersion = 9;
|
export const DataStructureVersion = 10;
|
||||||
|
@ -109,6 +109,43 @@ describe('IndexingManager', (sqlHelper: SQLTestHelper) => {
|
|||||||
.to.deep.equal(Utils.clone(Utils.removeNullOrEmptyObj(parent)));
|
.to.deep.equal(Utils.clone(Utils.removeNullOrEmptyObj(parent)));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('should save photos with extreme parameters', async () => {
|
||||||
|
const gm = new GalleryManagerTest();
|
||||||
|
const im = new IndexingManagerTest();
|
||||||
|
|
||||||
|
const parent = TestHelper.getRandomizedDirectoryEntry();
|
||||||
|
const p1 = TestHelper.getRandomizedPhotoEntry(parent, 'Photo1');
|
||||||
|
const p2 = TestHelper.getRandomizedPhotoEntry(parent, 'Photo2');
|
||||||
|
const minFloat = 1.1 * Math.pow(10, -38);
|
||||||
|
const maxFloat = 3.4 * Math.pow(10, +38);
|
||||||
|
p1.metadata.cameraData.fStop = minFloat;
|
||||||
|
p2.metadata.cameraData.fStop = maxFloat;
|
||||||
|
p1.metadata.cameraData.exposure = minFloat;
|
||||||
|
p2.metadata.cameraData.exposure = maxFloat;
|
||||||
|
p1.metadata.cameraData.focalLength = 0;
|
||||||
|
p2.metadata.cameraData.focalLength = 4294967295;
|
||||||
|
p1.metadata.positionData.GPSData.altitude = maxFloat;
|
||||||
|
p2.metadata.positionData.GPSData.altitude = minFloat;
|
||||||
|
p1.metadata.positionData.GPSData.latitude = maxFloat;
|
||||||
|
p2.metadata.positionData.GPSData.latitude = minFloat;
|
||||||
|
p1.metadata.positionData.GPSData.longitude = maxFloat;
|
||||||
|
p2.metadata.positionData.GPSData.longitude = minFloat;
|
||||||
|
|
||||||
|
|
||||||
|
DirectoryDTO.removeReferences(parent);
|
||||||
|
await im.saveToDB(Utils.clone(parent));
|
||||||
|
|
||||||
|
const conn = await SQLConnection.getConnection();
|
||||||
|
const selected = await gm.selectParentDir(conn, parent.name, parent.path);
|
||||||
|
await gm.fillParentDir(conn, selected);
|
||||||
|
|
||||||
|
DirectoryDTO.removeReferences(selected);
|
||||||
|
removeIds(selected);
|
||||||
|
expect(Utils.clone(Utils.removeNullOrEmptyObj(selected)))
|
||||||
|
.to.deep.equal(Utils.clone(Utils.removeNullOrEmptyObj(parent)));
|
||||||
|
});
|
||||||
|
|
||||||
it('should skip meta files', async () => {
|
it('should skip meta files', async () => {
|
||||||
const gm = new GalleryManagerTest();
|
const gm = new GalleryManagerTest();
|
||||||
const im = new IndexingManagerTest();
|
const im = new IndexingManagerTest();
|
||||||
|
Reference in New Issue
Block a user