mirror of
https://github.com/bpatrik/pigallery2.git
synced 2024-12-10 11:10:35 +02:00
parent
c9521bc883
commit
928f282311
@ -74,6 +74,7 @@ export class GalleryMWs {
|
||||
delete (<VideoDTO>m).metadata.bitRate;
|
||||
delete (<VideoDTO>m).metadata.duration;
|
||||
} else if (MediaDTO.isVideo(m)) {
|
||||
delete (<PhotoDTO>m).metadata.rating;
|
||||
delete (<PhotoDTO>m).metadata.caption;
|
||||
delete (<PhotoDTO>m).metadata.cameraData;
|
||||
delete (<PhotoDTO>m).metadata.orientation;
|
||||
|
@ -43,6 +43,9 @@ export class MediaMetadataEntity implements MediaMetadata {
|
||||
@Column(type => PositionMetaDataEntity)
|
||||
positionData: PositionMetaDataEntity;
|
||||
|
||||
@Column('tinyint', {unsigned: true})
|
||||
rating: 0 | 1 | 2 | 3 | 4 | 5;
|
||||
|
||||
@Column('tinyint', {unsigned: true, default: OrientationTypes.TOP_LEFT})
|
||||
orientation: OrientationTypes;
|
||||
|
||||
|
@ -203,16 +203,20 @@ export class MetadataLoader {
|
||||
|
||||
metadata.creationDate = metadata.creationDate || 0;
|
||||
|
||||
if (Config.Client.Faces.enabled) {
|
||||
try {
|
||||
|
||||
const ret = ExifReader.load(data);
|
||||
try {
|
||||
// TODO: clean up the three different exif readers,
|
||||
// and keep the minimum amount only
|
||||
const exif = ExifReader.load(data);
|
||||
if (exif.Rating) {
|
||||
metadata.rating = <any>parseInt(exif.Rating.value, 10);
|
||||
}
|
||||
if (Config.Client.Faces.enabled) {
|
||||
const faces: FaceRegion[] = [];
|
||||
if (ret.Regions && ret.Regions.value.RegionList && ret.Regions.value.RegionList.value) {
|
||||
for (let i = 0; i < ret.Regions.value.RegionList.value.length; i++) {
|
||||
if (exif.Regions && exif.Regions.value.RegionList && exif.Regions.value.RegionList.value) {
|
||||
for (let i = 0; i < exif.Regions.value.RegionList.value.length; i++) {
|
||||
|
||||
let type, name, box;
|
||||
const regionRoot = ret.Regions.value.RegionList.value[i] as any;
|
||||
const regionRoot = exif.Regions.value.RegionList.value[i] as any;
|
||||
const createFaceBox = (w: string, h: string, x: string, y: string) => {
|
||||
return {
|
||||
width: Math.round(parseFloat(w) * metadata.size.width),
|
||||
@ -268,8 +272,8 @@ export class MetadataLoader {
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
}
|
||||
} catch (err) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@ export interface FaceRegion {
|
||||
}
|
||||
|
||||
export interface PhotoMetadata extends MediaMetadata {
|
||||
rating?: 0 | 1 | 2 | 3 | 4 | 5;
|
||||
caption?: string;
|
||||
keywords?: string[];
|
||||
cameraData?: CameraMetadata;
|
||||
|
@ -5,6 +5,9 @@ import {FileDTO} from '../../../common/entities/FileDTO';
|
||||
@Pipe({name: 'gpxFiles'})
|
||||
export class GPXFilesFilterPipe implements PipeTransform {
|
||||
transform(metaFiles: FileDTO[]) {
|
||||
if (!metaFiles) {
|
||||
return null;
|
||||
}
|
||||
return metaFiles.filter((f: FileDTO) => f.name.toLocaleLowerCase().endsWith('.gpx'));
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ export class GalleryGridComponent implements OnChanges, OnInit, AfterViewInit, O
|
||||
@ViewChildren(GalleryPhotoComponent) gridPhotoQL: QueryList<GalleryPhotoComponent>;
|
||||
@Input() media: MediaDTO[];
|
||||
@Input() lightbox: GalleryLightboxComponent;
|
||||
photosToRender: Array<GridMedia> = [];
|
||||
photosToRender: GridMedia[] = [];
|
||||
containerWidth = 0;
|
||||
screenHeight = 0;
|
||||
public IMAGE_MARGIN = 2;
|
||||
|
@ -47,6 +47,7 @@
|
||||
"country": "test country őúéáűóöí-.,)(=/%!+\"'",
|
||||
"state": "test state őúéáűóöí-.,)("
|
||||
},
|
||||
"rating": 3,
|
||||
"size": {
|
||||
"height": 10,
|
||||
"width": 14
|
||||
|
@ -10,7 +10,14 @@ import {OrientationTypes} from 'ts-exif-parser';
|
||||
import {DirectoryEntity} from '../../../../../src/backend/model/database/sql/enitites/DirectoryEntity';
|
||||
import {VideoEntity, VideoMetadataEntity} from '../../../../../src/backend/model/database/sql/enitites/VideoEntity';
|
||||
import {MediaDimension} from '../../../../../src/common/entities/MediaDTO';
|
||||
import {CameraMetadata, FaceRegion, GPSMetadata, PhotoDTO, PhotoMetadata, PositionMetaData} from '../../../../../src/common/entities/PhotoDTO';
|
||||
import {
|
||||
CameraMetadata,
|
||||
FaceRegion,
|
||||
GPSMetadata,
|
||||
PhotoDTO,
|
||||
PhotoMetadata,
|
||||
PositionMetaData
|
||||
} from '../../../../../src/common/entities/PhotoDTO';
|
||||
import {DirectoryDTO} from '../../../../../src/common/entities/DirectoryDTO';
|
||||
import {FileDTO} from '../../../../../src/common/entities/FileDTO';
|
||||
import {DiskMangerWorker} from '../../../../../src/backend/model/threading/DiskMangerWorker';
|
||||
@ -59,6 +66,7 @@ export class TestHelper {
|
||||
m.creationDate = Date.now();
|
||||
m.fileSize = 123456789;
|
||||
m.orientation = OrientationTypes.TOP_LEFT;
|
||||
m.rating = 2;
|
||||
|
||||
// TODO: remove when typeorm is fixed
|
||||
m.duration = null;
|
||||
@ -81,6 +89,7 @@ export class TestHelper {
|
||||
const m = new VideoMetadataEntity();
|
||||
m.caption = null;
|
||||
m.keywords = null;
|
||||
m.rating = null;
|
||||
m.size = sd;
|
||||
m.creationDate = Date.now();
|
||||
m.fileSize = 123456789;
|
||||
@ -252,7 +261,8 @@ export class TestHelper {
|
||||
creationDate: Date.now(),
|
||||
fileSize: rndInt(10000),
|
||||
orientation: OrientationTypes.TOP_LEFT,
|
||||
caption: rndStr()
|
||||
caption: rndStr(),
|
||||
rating: <any>rndInt(5),
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user