mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
Merge pull request #462 from bpatrik/feature/improved-dto
10% reduction on server resonse size
This commit is contained in:
commit
b9889bf4ce
@ -150,6 +150,7 @@ See all benchmark results in [HISTORY.md](HISTORY.md)
|
|||||||
| | Autocomplete | 13.0 ms | items: 24, size: 979.00B |
|
| | Autocomplete | 13.0 ms | items: 24, size: 979.00B |
|
||||||
| | Add server timing | 0.1 ms | items: 24, size: 979.00B |
|
| | Add server timing | 0.1 ms | items: 24, size: 979.00B |
|
||||||
| | Render result | 0.0 ms | items: 24, size: 979.00B |
|
| | Render result | 0.0 ms | items: 24, size: 979.00B |
|
||||||
|
|
||||||
*Measurements run 20 times and an average was calculated.
|
*Measurements run 20 times and an average was calculated.
|
||||||
Full runtime: 1522539.0ms
|
Full runtime: 1522539.0ms
|
||||||
|
|
||||||
|
@ -124,6 +124,7 @@ export class GalleryMWs {
|
|||||||
|
|
||||||
const cleanUpMedia = (media: MediaDTO[]): void => {
|
const cleanUpMedia = (media: MediaDTO[]): void => {
|
||||||
media.forEach((m): void => {
|
media.forEach((m): void => {
|
||||||
|
delete m.id;
|
||||||
if (MediaDTOUtils.isPhoto(m)) {
|
if (MediaDTOUtils.isPhoto(m)) {
|
||||||
delete (m as VideoDTO).metadata.bitRate;
|
delete (m as VideoDTO).metadata.bitRate;
|
||||||
delete (m as VideoDTO).metadata.duration;
|
delete (m as VideoDTO).metadata.duration;
|
||||||
@ -131,11 +132,12 @@ export class GalleryMWs {
|
|||||||
delete (m as PhotoDTO).metadata.rating;
|
delete (m as PhotoDTO).metadata.rating;
|
||||||
delete (m as PhotoDTO).metadata.caption;
|
delete (m as PhotoDTO).metadata.caption;
|
||||||
delete (m as PhotoDTO).metadata.cameraData;
|
delete (m as PhotoDTO).metadata.cameraData;
|
||||||
delete (m as PhotoDTO).metadata.orientation;
|
|
||||||
delete (m as PhotoDTO).metadata.orientation;
|
|
||||||
delete (m as PhotoDTO).metadata.keywords;
|
delete (m as PhotoDTO).metadata.keywords;
|
||||||
delete (m as PhotoDTO).metadata.positionData;
|
delete (m as PhotoDTO).metadata.positionData;
|
||||||
}
|
}
|
||||||
|
if (m.directory) {
|
||||||
|
delete (m.directory as any).id;
|
||||||
|
}
|
||||||
Utils.removeNullOrEmptyObj(m);
|
Utils.removeNullOrEmptyObj(m);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import {Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn, TableInheritance, Unique} from 'typeorm';
|
import {Column, Entity, Index, ManyToOne, OneToMany, PrimaryGeneratedColumn, TableInheritance, Unique} from 'typeorm';
|
||||||
import {DirectoryEntity} from './DirectoryEntity';
|
import {DirectoryEntity} from './DirectoryEntity';
|
||||||
import {MediaDimension, MediaDTO, MediaMetadata} from '../../../../../common/entities/MediaDTO';
|
import {MediaDimension, MediaDTO, MediaMetadata} from '../../../../../common/entities/MediaDTO';
|
||||||
import {OrientationTypes} from 'ts-exif-parser';
|
|
||||||
import {FaceRegionEntry} from './FaceRegionEntry';
|
import {FaceRegionEntry} from './FaceRegionEntry';
|
||||||
import {columnCharsetCS} from './EntityUtils';
|
import {columnCharsetCS} from './EntityUtils';
|
||||||
import {CameraMetadata, GPSMetadata, PositionMetaData} from '../../../../../common/entities/PhotoDTO';
|
import {CameraMetadata, GPSMetadata, PositionMetaData} from '../../../../../common/entities/PhotoDTO';
|
||||||
@ -57,8 +56,6 @@ export class GPSMetadataEntity implements GPSMetadata {
|
|||||||
latitude: number;
|
latitude: number;
|
||||||
@Column('float', {nullable: true})
|
@Column('float', {nullable: true})
|
||||||
longitude: number;
|
longitude: number;
|
||||||
@Column('int', {nullable: true})
|
|
||||||
altitude: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,9 +126,6 @@ export class MediaMetadataEntity implements MediaMetadata {
|
|||||||
@Column('tinyint', {unsigned: true})
|
@Column('tinyint', {unsigned: true})
|
||||||
rating: 0 | 1 | 2 | 3 | 4 | 5;
|
rating: 0 | 1 | 2 | 3 | 4 | 5;
|
||||||
|
|
||||||
@Column('tinyint', {unsigned: true, default: OrientationTypes.TOP_LEFT})
|
|
||||||
orientation: OrientationTypes;
|
|
||||||
|
|
||||||
@OneToMany(type => FaceRegionEntry, faceRegion => faceRegion.media)
|
@OneToMany(type => FaceRegionEntry, faceRegion => faceRegion.media)
|
||||||
faces: FaceRegionEntry[];
|
faces: FaceRegionEntry[];
|
||||||
|
|
||||||
|
@ -97,7 +97,6 @@ export class MetadataLoader {
|
|||||||
}
|
}
|
||||||
const metadata: PhotoMetadata = {
|
const metadata: PhotoMetadata = {
|
||||||
size: {width: 1, height: 1},
|
size: {width: 1, height: 1},
|
||||||
orientation: OrientationTypes.TOP_LEFT,
|
|
||||||
creationDate: 0,
|
creationDate: 0,
|
||||||
fileSize: 0
|
fileSize: 0
|
||||||
};
|
};
|
||||||
@ -138,11 +137,11 @@ export class MetadataLoader {
|
|||||||
}
|
}
|
||||||
if (Utils.isFloat32(exif.tags.ExposureTime)) {
|
if (Utils.isFloat32(exif.tags.ExposureTime)) {
|
||||||
metadata.cameraData = metadata.cameraData || {};
|
metadata.cameraData = metadata.cameraData || {};
|
||||||
metadata.cameraData.exposure = parseFloat('' + exif.tags.ExposureTime);
|
metadata.cameraData.exposure = parseFloat(parseFloat('' + exif.tags.ExposureTime).toFixed(4));
|
||||||
}
|
}
|
||||||
if (Utils.isFloat32(exif.tags.FNumber)) {
|
if (Utils.isFloat32(exif.tags.FNumber)) {
|
||||||
metadata.cameraData = metadata.cameraData || {};
|
metadata.cameraData = metadata.cameraData || {};
|
||||||
metadata.cameraData.fStop = parseFloat('' + exif.tags.FNumber);
|
metadata.cameraData.fStop = parseFloat(parseFloat('' + exif.tags.FNumber).toFixed(2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isNaN(exif.tags.GPSLatitude) || exif.tags.GPSLongitude || exif.tags.GPSAltitude) {
|
if (!isNaN(exif.tags.GPSLatitude) || exif.tags.GPSLongitude || exif.tags.GPSAltitude) {
|
||||||
@ -150,13 +149,10 @@ export class MetadataLoader {
|
|||||||
metadata.positionData.GPSData = {};
|
metadata.positionData.GPSData = {};
|
||||||
|
|
||||||
if (Utils.isFloat32(exif.tags.GPSLongitude)) {
|
if (Utils.isFloat32(exif.tags.GPSLongitude)) {
|
||||||
metadata.positionData.GPSData.longitude = exif.tags.GPSLongitude;
|
metadata.positionData.GPSData.longitude = parseFloat(exif.tags.GPSLongitude.toFixed(6));
|
||||||
}
|
}
|
||||||
if (Utils.isFloat32(exif.tags.GPSLatitude)) {
|
if (Utils.isFloat32(exif.tags.GPSLatitude)) {
|
||||||
metadata.positionData.GPSData.latitude = exif.tags.GPSLatitude;
|
metadata.positionData.GPSData.latitude = parseFloat(exif.tags.GPSLatitude.toFixed(6));
|
||||||
}
|
|
||||||
if (Utils.isInt32(exif.tags.GPSAltitude)) {
|
|
||||||
metadata.positionData.GPSData.altitude = exif.tags.GPSAltitude;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exif.tags.CreateDate || exif.tags.DateTimeOriginal || exif.tags.ModifyDate) {
|
if (exif.tags.CreateDate || exif.tags.DateTimeOriginal || exif.tags.ModifyDate) {
|
||||||
@ -221,7 +217,9 @@ export class MetadataLoader {
|
|||||||
const exif = ExifReader.load(data);
|
const exif = ExifReader.load(data);
|
||||||
if (exif.Rating) {
|
if (exif.Rating) {
|
||||||
metadata.rating = (parseInt(exif.Rating.value, 10) as any);
|
metadata.rating = (parseInt(exif.Rating.value, 10) as any);
|
||||||
if(metadata.rating < 0) { metadata.rating = 0; }
|
if (metadata.rating < 0) {
|
||||||
|
metadata.rating = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (exif.subject && exif.subject.value && exif.subject.value.length > 0) {
|
if (exif.subject && exif.subject.value && exif.subject.value.length > 0) {
|
||||||
if (metadata.keywords === undefined) {
|
if (metadata.keywords === undefined) {
|
||||||
@ -234,8 +232,8 @@ export class MetadataLoader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (exif.Orientation) {
|
if (exif.Orientation) {
|
||||||
metadata.orientation = (parseInt(exif.Orientation.value as any, 10) as any);
|
const orientation = (parseInt(exif.Orientation.value as any, 10) as any);
|
||||||
if (OrientationTypes.BOTTOM_LEFT < metadata.orientation) {
|
if (OrientationTypes.BOTTOM_LEFT < orientation) {
|
||||||
// noinspection JSSuspiciousNameCombination
|
// noinspection JSSuspiciousNameCombination
|
||||||
const height = metadata.size.width;
|
const height = metadata.size.width;
|
||||||
// noinspection JSSuspiciousNameCombination
|
// noinspection JSSuspiciousNameCombination
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
* This version indicates that the SQL sql/entities/*Entity.ts files got changed and the db needs to be recreated
|
* This version indicates that the SQL sql/entities/*Entity.ts files got changed and the db needs to be recreated
|
||||||
*/
|
*/
|
||||||
export const DataStructureVersion = 26;
|
export const DataStructureVersion = 27;
|
||||||
|
@ -34,7 +34,6 @@ export const MediaDTOUtils = {
|
|||||||
(media as PhotoDTO).metadata.positionData.state ||
|
(media as PhotoDTO).metadata.positionData.state ||
|
||||||
(media as PhotoDTO).metadata.positionData.country ||
|
(media as PhotoDTO).metadata.positionData.country ||
|
||||||
((media as PhotoDTO).metadata.positionData.GPSData &&
|
((media as PhotoDTO).metadata.positionData.GPSData &&
|
||||||
(media as PhotoDTO).metadata.positionData.GPSData.altitude &&
|
|
||||||
(media as PhotoDTO).metadata.positionData.GPSData.latitude &&
|
(media as PhotoDTO).metadata.positionData.GPSData.latitude &&
|
||||||
(media as PhotoDTO).metadata.positionData.GPSData.longitude));
|
(media as PhotoDTO).metadata.positionData.GPSData.longitude));
|
||||||
},
|
},
|
||||||
|
@ -36,7 +36,6 @@ export interface PhotoMetadata extends MediaMetadata {
|
|||||||
keywords?: string[];
|
keywords?: string[];
|
||||||
cameraData?: CameraMetadata;
|
cameraData?: CameraMetadata;
|
||||||
positionData?: PositionMetaData;
|
positionData?: PositionMetaData;
|
||||||
orientation: OrientationTypes;
|
|
||||||
size: MediaDimension;
|
size: MediaDimension;
|
||||||
creationDate: number;
|
creationDate: number;
|
||||||
fileSize: number;
|
fileSize: number;
|
||||||
@ -52,9 +51,8 @@ export interface PositionMetaData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface GPSMetadata {
|
export interface GPSMetadata {
|
||||||
latitude?: number;
|
latitude?: number; // float with precision: 6
|
||||||
longitude?: number;
|
longitude?: number; // float with precision: 6
|
||||||
altitude?: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -62,8 +60,8 @@ export interface CameraMetadata {
|
|||||||
ISO?: number;
|
ISO?: number;
|
||||||
model?: string;
|
model?: string;
|
||||||
make?: string;
|
make?: string;
|
||||||
fStop?: number;
|
fStop?: number; // float with precision: 2
|
||||||
exposure?: number;
|
exposure?: number; // float with precision: 4
|
||||||
focalLength?: number;
|
focalLength?: number;
|
||||||
lens?: string;
|
lens?: string;
|
||||||
}
|
}
|
||||||
|
@ -128,8 +128,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="details-sub row" *ngIf="hasGPS()">
|
<div class="details-sub row" *ngIf="hasGPS()">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
{{PositionData.GPSData.latitude.toFixed(3)}},
|
{{PositionData.GPSData.latitude.toFixed(6)}},
|
||||||
{{PositionData.GPSData.longitude.toFixed(3)}}
|
{{PositionData.GPSData.longitude.toFixed(6)}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"cameraData": {
|
"cameraData": {
|
||||||
"ISO": 500,
|
"ISO": 500,
|
||||||
"exposure": 0.03333333333333333,
|
"exposure": 0.0333,
|
||||||
"fStop": 2,
|
"fStop": 2,
|
||||||
"focalLength": 2.96,
|
"focalLength": 2.96,
|
||||||
"make": "HUAWEI",
|
"make": "HUAWEI",
|
||||||
@ -9,7 +9,6 @@
|
|||||||
},
|
},
|
||||||
"creationDate": 1460826466000,
|
"creationDate": 1460826466000,
|
||||||
"fileSize": 1980,
|
"fileSize": 1980,
|
||||||
"orientation": 1,
|
|
||||||
"size": {
|
"size": {
|
||||||
"height": 1,
|
"height": 1,
|
||||||
"width": 1
|
"width": 1
|
||||||
|
@ -27,12 +27,10 @@
|
|||||||
"USA Road trip",
|
"USA Road trip",
|
||||||
"Yosemite"
|
"Yosemite"
|
||||||
],
|
],
|
||||||
"orientation": 1,
|
|
||||||
"positionData": {
|
"positionData": {
|
||||||
"GPSData": {
|
"GPSData": {
|
||||||
"altitude": 1960,
|
"latitude": 37.748058,
|
||||||
"latitude": 37.74805833333333,
|
"longitude": -119.514023
|
||||||
"longitude": -119.51402333333333
|
|
||||||
},
|
},
|
||||||
"city": "Yosemite Nemzeti Park",
|
"city": "Yosemite Nemzeti Park",
|
||||||
"country": "United States",
|
"country": "United States",
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
},
|
},
|
||||||
"creationDate": -2211753600000,
|
"creationDate": -2211753600000,
|
||||||
"fileSize": 72850,
|
"fileSize": 72850,
|
||||||
"orientation": 1,
|
|
||||||
"size": {
|
"size": {
|
||||||
"height": 768,
|
"height": 768,
|
||||||
"width": 1024
|
"width": 1024
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"creationDate"
|
"creationDate"
|
||||||
],
|
],
|
||||||
"fileSize": 71311,
|
"fileSize": 71311,
|
||||||
"orientation": 1,
|
|
||||||
"size": {
|
"size": {
|
||||||
"height": 1200,
|
"height": 1200,
|
||||||
"width": 1783
|
"width": 1783
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"creationDate"
|
"creationDate"
|
||||||
],
|
],
|
||||||
"fileSize": 5860,
|
"fileSize": 5860,
|
||||||
"orientation": 1,
|
|
||||||
"size": {
|
"size": {
|
||||||
"height": 7,
|
"height": 7,
|
||||||
"width": 10
|
"width": 10
|
||||||
|
@ -25,12 +25,10 @@
|
|||||||
"USA",
|
"USA",
|
||||||
"Yosemite"
|
"Yosemite"
|
||||||
],
|
],
|
||||||
"orientation": 1,
|
|
||||||
"positionData": {
|
"positionData": {
|
||||||
"GPSData": {
|
"GPSData": {
|
||||||
"altitude": 1960,
|
|
||||||
"latitude": 37.746765,
|
"latitude": 37.746765,
|
||||||
"longitude": -119.52988333333333
|
"longitude": -119.529883
|
||||||
},
|
},
|
||||||
"country": "United States",
|
"country": "United States",
|
||||||
"state": "California"
|
"state": "California"
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
},
|
},
|
||||||
"creationDate": 1126455782000,
|
"creationDate": 1126455782000,
|
||||||
"fileSize": 2582,
|
"fileSize": 2582,
|
||||||
"orientation": 1,
|
|
||||||
"size": {
|
"size": {
|
||||||
"height": 5,
|
"height": 5,
|
||||||
"width": 7
|
"width": 7
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"orientation": 1,
|
|
||||||
"size": {
|
"size": {
|
||||||
"height": 1200,
|
"height": 1200,
|
||||||
"width": 1800
|
"width": 1800
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
"orientation": 1,
|
|
||||||
"size": {
|
"size": {
|
||||||
"height": 1800,
|
"height": 1800,
|
||||||
"width": 1200
|
"width": 1200
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
"width": 3024,
|
"width": 3024,
|
||||||
"height": 4032
|
"height": 4032
|
||||||
},
|
},
|
||||||
"orientation": 6,
|
|
||||||
"creationDate": 1518964712000,
|
"creationDate": 1518964712000,
|
||||||
"fileSize": 256001,
|
"fileSize": 256001,
|
||||||
"cameraData": {
|
"cameraData": {
|
||||||
@ -11,14 +10,13 @@
|
|||||||
"make": "Google",
|
"make": "Google",
|
||||||
"ISO": 116,
|
"ISO": 116,
|
||||||
"focalLength": 4.442,
|
"focalLength": 4.442,
|
||||||
"exposure": 0.008335,
|
"exposure": 0.0083,
|
||||||
"fStop": 1.8
|
"fStop": 1.8
|
||||||
},
|
},
|
||||||
"positionData": {
|
"positionData": {
|
||||||
"GPSData": {
|
"GPSData": {
|
||||||
"longitude": -73.96425083333334,
|
"longitude": -73.964251,
|
||||||
"latitude": 40.77845111111111,
|
"latitude": 40.778451
|
||||||
"altitude": 2.2
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
},
|
},
|
||||||
"creationDate": 1185452882000,
|
"creationDate": 1185452882000,
|
||||||
"fileSize": 124036,
|
"fileSize": 124036,
|
||||||
"orientation": 1,
|
|
||||||
"size": {
|
"size": {
|
||||||
"height": 3072,
|
"height": 3072,
|
||||||
"width": 2304
|
"width": 2304
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"cameraData": {
|
"cameraData": {
|
||||||
"ISO": 3200,
|
"ISO": 3200,
|
||||||
"exposure": 0.00125,
|
"exposure": 0.0013,
|
||||||
"fStop": 5.6,
|
"fStop": 5.6,
|
||||||
"focalLength": 85,
|
"focalLength": 85,
|
||||||
"lens": "EF-S15-85mm f/3.5-5.6 IS USM",
|
"lens": "EF-S15-85mm f/3.5-5.6 IS USM",
|
||||||
@ -36,11 +36,9 @@
|
|||||||
"USA",
|
"USA",
|
||||||
"űáéúőóüö ŰÁÉÚŐÓÜÖ"
|
"űáéúőóüö ŰÁÉÚŐÓÜÖ"
|
||||||
],
|
],
|
||||||
"orientation": 1,
|
|
||||||
"positionData": {
|
"positionData": {
|
||||||
"GPSData": {
|
"GPSData": {
|
||||||
"altitude": 90,
|
"latitude": 37.871093,
|
||||||
"latitude": 37.871093333333334,
|
|
||||||
"longitude": -122.25678
|
"longitude": -122.25678
|
||||||
},
|
},
|
||||||
"city": "test city őúéáűóöí-.,)(=",
|
"city": "test city őúéáűóöí-.,)(=",
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
],
|
],
|
||||||
"fileSize": 4381,
|
"fileSize": 4381,
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"orientation": 1,
|
|
||||||
"size": {
|
"size": {
|
||||||
"height": 26,
|
"height": 26,
|
||||||
"width": 26
|
"width": 26
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
},
|
},
|
||||||
"creationDate": 1619181527000,
|
"creationDate": 1619181527000,
|
||||||
"fileSize": 4877,
|
"fileSize": 4877,
|
||||||
"orientation": 1,
|
|
||||||
"rating":3,
|
"rating":3,
|
||||||
"size": {
|
"size": {
|
||||||
"height": 5,
|
"height": 5,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"cameraData": {
|
"cameraData": {
|
||||||
"ISO": 50,
|
"ISO": 50,
|
||||||
"exposure": 0.007751937984496124,
|
"exposure": 0.0078,
|
||||||
"fStop": 2.4,
|
"fStop": 2.4,
|
||||||
"focalLength": 4.32,
|
"focalLength": 4.32,
|
||||||
"make": "samsung",
|
"make": "samsung",
|
||||||
@ -9,7 +9,6 @@
|
|||||||
},
|
},
|
||||||
"creationDate": 1614703656000,
|
"creationDate": 1614703656000,
|
||||||
"fileSize": 4709,
|
"fileSize": 4709,
|
||||||
"orientation": 1,
|
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"Max",
|
"Max",
|
||||||
"Spaß",
|
"Spaß",
|
||||||
|
@ -419,8 +419,6 @@ describe('IndexingManager', (sqlHelper: DBTestHelper) => {
|
|||||||
p2.metadata.cameraData.exposure = maxFloat;
|
p2.metadata.cameraData.exposure = maxFloat;
|
||||||
p1.metadata.cameraData.focalLength = minFloat;
|
p1.metadata.cameraData.focalLength = minFloat;
|
||||||
p2.metadata.cameraData.focalLength = maxFloat;
|
p2.metadata.cameraData.focalLength = maxFloat;
|
||||||
p1.metadata.positionData.GPSData.altitude = -2147483647;
|
|
||||||
p2.metadata.positionData.GPSData.altitude = 2147483646;
|
|
||||||
p1.metadata.positionData.GPSData.latitude = maxFloat;
|
p1.metadata.positionData.GPSData.latitude = maxFloat;
|
||||||
p2.metadata.positionData.GPSData.latitude = minFloat;
|
p2.metadata.positionData.GPSData.latitude = minFloat;
|
||||||
p1.metadata.positionData.GPSData.longitude = maxFloat;
|
p1.metadata.positionData.GPSData.longitude = maxFloat;
|
||||||
|
@ -1067,8 +1067,7 @@ describe('SearchManager', (sqlHelper: DBTestHelper) => {
|
|||||||
ObjectManagers.getInstance().LocationManager.getGPSData = async (): Promise<GPSMetadata> => {
|
ObjectManagers.getInstance().LocationManager.getGPSData = async (): Promise<GPSMetadata> => {
|
||||||
return {
|
return {
|
||||||
longitude: 10,
|
longitude: 10,
|
||||||
latitude: 10,
|
latitude: 10
|
||||||
altitude: 0
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -74,7 +74,6 @@ export class TestHelper {
|
|||||||
m.size = sd;
|
m.size = sd;
|
||||||
m.creationDate = Date.now();
|
m.creationDate = Date.now();
|
||||||
m.fileSize = 123456789;
|
m.fileSize = 123456789;
|
||||||
m.orientation = OrientationTypes.TOP_LEFT;
|
|
||||||
// m.rating = 0; no rating by default
|
// m.rating = 0; no rating by default
|
||||||
|
|
||||||
// TODO: remove when typeorm is fixed
|
// TODO: remove when typeorm is fixed
|
||||||
@ -323,7 +322,6 @@ export class TestHelper {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const gps: GPSMetadata = {
|
const gps: GPSMetadata = {
|
||||||
altitude: rndInt(1000),
|
|
||||||
latitude: rndInt(1000),
|
latitude: rndInt(1000),
|
||||||
longitude: rndInt(1000)
|
longitude: rndInt(1000)
|
||||||
};
|
};
|
||||||
@ -349,7 +347,6 @@ export class TestHelper {
|
|||||||
size: sd,
|
size: sd,
|
||||||
creationDate: Date.now() + ++TestHelper.creationCounter,
|
creationDate: Date.now() + ++TestHelper.creationCounter,
|
||||||
fileSize: rndInt(10000),
|
fileSize: rndInt(10000),
|
||||||
orientation: OrientationTypes.TOP_LEFT,
|
|
||||||
caption: rndStr(),
|
caption: rndStr(),
|
||||||
rating: rndInt(5) as any,
|
rating: rndInt(5) as any,
|
||||||
};
|
};
|
||||||
|
@ -95,12 +95,12 @@ describe('MetadataLoader', () => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO: deprecated tests. We do not save orientation anymore.
|
||||||
describe('should read orientation', () => {
|
describe('should read orientation', () => {
|
||||||
for (let i = 0; i <= 8; ++i) {
|
for (let i = 0; i <= 8; ++i) {
|
||||||
it('Landscape ' + i, async () => {
|
it('Landscape ' + i, async () => {
|
||||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/orientation/Landscape_' + i + '.jpg'));
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/orientation/Landscape_' + i + '.jpg'));
|
||||||
const expected = require(path.join(__dirname, '/../../../assets/orientation/Landscape.json'));
|
const expected = require(path.join(__dirname, '/../../../assets/orientation/Landscape.json'));
|
||||||
expected.orientation = i;
|
|
||||||
delete data.fileSize;
|
delete data.fileSize;
|
||||||
delete data.creationDate;
|
delete data.creationDate;
|
||||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||||
@ -108,7 +108,6 @@ describe('MetadataLoader', () => {
|
|||||||
it('Portrait ' + i, async () => {
|
it('Portrait ' + i, async () => {
|
||||||
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/orientation/Portrait_' + i + '.jpg'));
|
const data = await MetadataLoader.loadPhotoMetadata(path.join(__dirname, '/../../../assets/orientation/Portrait_' + i + '.jpg'));
|
||||||
const expected = require(path.join(__dirname, '/../../../assets/orientation/Portrait.json'));
|
const expected = require(path.join(__dirname, '/../../../assets/orientation/Portrait.json'));
|
||||||
expected.orientation = i;
|
|
||||||
delete data.fileSize;
|
delete data.fileSize;
|
||||||
delete data.creationDate;
|
delete data.creationDate;
|
||||||
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
expect(Utils.clone(data)).to.be.deep.equal(expected);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user