Skip to content

Commit

Permalink
feat (web/server) 360 degrees Web panoramas [attempt 2] (immich-app#3412
Browse files Browse the repository at this point in the history
)

* commit 1 (isPanorama: boolean)

* working solution for projectiontypeenum

* fix

* format fix

* fix

* fix

* fix

* fix

* enum projectiontype

* working solution with exif

* fix

* reverted >

* fix format

* reverted auto-magic api.ts prettification

* fix

* reverted api.ts autogenerated

* api ts regenerated

* Update web/src/lib/components/assets/thumbnail/thumbnail.svelte

Co-authored-by: Sergey Kondrikov <[email protected]>

* Update web/src/lib/components/asset-viewer/asset-viewer.svelte

Co-authored-by: Sergey Kondrikov <[email protected]>

* exifProjectionType

* Update server/src/microservices/processors/metadata-extraction.processor.ts

Co-authored-by: Sergey Kondrikov <[email protected]>

* projectionType?: string = ProjectionType.NONE;

* not null

* projectionType!: ProjectionType;

* opeapi generator fix

* fixes

* fix

* fix

* generate api

* asset.exifInifo?.projectionType

* Update server/src/domain/asset/response-dto/exif-response.dto.ts

Co-authored-by: Jason Rasmussen <[email protected]>

* Update server/src/microservices/processors/metadata-extraction.processor.ts

Co-authored-by: Jason Rasmussen <[email protected]>

* enum -> varchar;projectiontypeenum->projectiontype

* asset-viewer fixed prettiffier

* @column({}) single line

* enum | string

* make api

* enum | string

* enum | str fix

* fix

* chore: use string instead of enum

* chore: open api

* fix: checks

---------

Co-authored-by: Sergey Kondrikov <[email protected]>
Co-authored-by: Alex Tran <[email protected]>
Co-authored-by: Jason Rasmussen <[email protected]>
  • Loading branch information
4 people authored Jul 28, 2023
1 parent 13b2b2f commit e071b82
Show file tree
Hide file tree
Showing 20 changed files with 282 additions and 50 deletions.
6 changes: 6 additions & 0 deletions cli/src/api/open-api/api.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions mobile/openapi/doc/ExifResponseDto.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions mobile/openapi/lib/model/exif_response_dto.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions mobile/openapi/test/exif_response_dto_test.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions server/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -5553,6 +5553,11 @@
"type": "string",
"nullable": true,
"default": null
},
"projectionType": {
"type": "string",
"nullable": true,
"default": null
}
}
},
Expand Down
75 changes: 29 additions & 46 deletions server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"cookie-parser": "^1.4.6",
"exiftool-vendored": "^19.0.0",
"exiftool-vendored": "^22.0.0",
"exiftool-vendored.pl": "^12.54.0",
"fluent-ffmpeg": "^2.1.2",
"handlebars": "^4.7.7",
Expand Down
2 changes: 2 additions & 0 deletions server/src/domain/asset/response-dto/exif-response.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class ExifResponseDto {
state?: string | null = null;
country?: string | null = null;
description?: string | null = null;
projectionType?: string | null = null;
}

export function mapExif(entity: ExifEntity): ExifResponseDto {
Expand All @@ -48,5 +49,6 @@ export function mapExif(entity: ExifEntity): ExifResponseDto {
state: entity.state,
country: entity.country,
description: entity.description,
projectionType: entity.projectionType,
};
}
3 changes: 3 additions & 0 deletions server/src/infra/entities/exif.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export class ExifEntity {
@Column({ type: 'float', nullable: true })
longitude!: number | null;

@Column({ type: 'varchar', nullable: true })
projectionType!: string | null;

@Column({ type: 'varchar', nullable: true })
city!: string | null;

Expand Down
13 changes: 13 additions & 0 deletions server/src/infra/migrations/1690469489288-Panoramas.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class Panoramas1690217088596 implements MigrationInterface {
name = 'Panoramas1690217088596';

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "exif" ADD "projectionType" character varying`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "exif" DROP COLUMN "projectionType"`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,12 @@ export class MetadataExtractionProcessor {
await this.extractEmbeddedVideo(asset, offset, null, fileCreatedAt);
}
}

const projectionType = getExifProperty('ProjectionType');
if (projectionType) {
newExif.projectionType = String(projectionType).toUpperCase();
}

newExif.livePhotoCID = getExifProperty('MediaGroupUUID');
if (newExif.livePhotoCID && !asset.livePhotoVideoId) {
const motionAsset = await this.assetRepository.findLivePhotoMatch({
Expand Down
2 changes: 2 additions & 0 deletions server/test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@ const assetInfo: ExifResponseDto = {
state: 'state',
country: 'country',
description: 'description',
projectionType: null,
};

const assetResponse: AssetResponseDto = {
Expand Down Expand Up @@ -882,6 +883,7 @@ export const sharedLinkStub = {
livePhotoVideoId: null,
originalFileName: 'asset_1.jpeg',
exifInfo: {
projectionType: null,
livePhotoCID: null,
assetId: 'id_1',
description: 'description',
Expand Down
Loading

0 comments on commit e071b82

Please sign in to comment.