Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat (web/server) 360 degrees Web panoramas [attempt 2] #3412

Merged
merged 45 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
ee7828c
commit 1 (isPanorama: boolean)
dmitry-brazhenko Jul 23, 2023
4724c0e
working solution for projectiontypeenum
dmitry-brazhenko Jul 24, 2023
26f2c23
fix
dmitry-brazhenko Jul 24, 2023
ccf8eac
format fix
dmitry-brazhenko Jul 24, 2023
a356399
fix
dmitry-brazhenko Jul 24, 2023
2aac848
fix
dmitry-brazhenko Jul 24, 2023
f41cde2
fix
dmitry-brazhenko Jul 24, 2023
6ffb2de
fix
dmitry-brazhenko Jul 24, 2023
fe2ae21
enum projectiontype
dmitry-brazhenko Jul 24, 2023
c0ca82d
working solution with exif
dmitry-brazhenko Jul 24, 2023
c8d9031
fix
dmitry-brazhenko Jul 24, 2023
bd42563
reverted >
dmitry-brazhenko Jul 24, 2023
4c06187
fix format
dmitry-brazhenko Jul 24, 2023
2605e23
reverted auto-magic api.ts prettification
dmitry-brazhenko Jul 24, 2023
59972ca
fix
dmitry-brazhenko Jul 24, 2023
5761bb2
reverted api.ts autogenerated
dmitry-brazhenko Jul 24, 2023
86e879d
api ts regenerated
dmitry-brazhenko Jul 24, 2023
45c393a
Update web/src/lib/components/assets/thumbnail/thumbnail.svelte
dmitry-brazhenko Jul 24, 2023
4bd289c
Update web/src/lib/components/asset-viewer/asset-viewer.svelte
dmitry-brazhenko Jul 24, 2023
5b0b1dd
exifProjectionType
dmitry-brazhenko Jul 24, 2023
757fd5c
Update server/src/microservices/processors/metadata-extraction.proces…
dmitry-brazhenko Jul 24, 2023
efb09b3
projectionType?: string = ProjectionType.NONE;
dmitry-brazhenko Jul 24, 2023
e0646e9
not null
dmitry-brazhenko Jul 24, 2023
a333ebe
projectionType!: ProjectionType;
dmitry-brazhenko Jul 24, 2023
ffc337a
opeapi generator fix
dmitry-brazhenko Jul 24, 2023
bd02d84
fixes
dmitry-brazhenko Jul 24, 2023
7a5202a
fix
dmitry-brazhenko Jul 24, 2023
9e2ba0b
fix
dmitry-brazhenko Jul 24, 2023
a99307a
generate api
alextran1502 Jul 25, 2023
f9e2bac
asset.exifInifo?.projectionType
dmitry-brazhenko Jul 25, 2023
484f9f3
Update server/src/domain/asset/response-dto/exif-response.dto.ts
dmitry-brazhenko Jul 27, 2023
df7ab47
Update server/src/microservices/processors/metadata-extraction.proces…
dmitry-brazhenko Jul 27, 2023
f164f6b
enum -> varchar;projectiontypeenum->projectiontype
dmitry-brazhenko Jul 27, 2023
a8bc93f
asset-viewer fixed prettiffier
dmitry-brazhenko Jul 27, 2023
af4d808
@Column({}) single line
dmitry-brazhenko Jul 27, 2023
a06ee84
enum | string
dmitry-brazhenko Jul 27, 2023
cc1b9e1
make api
dmitry-brazhenko Jul 27, 2023
67c2611
enum | string
dmitry-brazhenko Jul 27, 2023
3fb39fb
enum | str fix
dmitry-brazhenko Jul 27, 2023
9b32ed7
fix
dmitry-brazhenko Jul 27, 2023
0e47f8d
chore: merge main
jrasm91 Jul 27, 2023
644f7f4
Merge branch 'web_panoramas_2' of github.com:dmitry-brazhenko/immich …
jrasm91 Jul 27, 2023
321d07a
chore: use string instead of enum
jrasm91 Jul 27, 2023
815b1a8
chore: open api
jrasm91 Jul 27, 2023
c5222fc
fix: checks
jrasm91 Jul 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 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.

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",
dmitry-brazhenko marked this conversation as resolved.
Show resolved Hide resolved
"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;
jrasm91 marked this conversation as resolved.
Show resolved Hide resolved
}

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,
};
}
20 changes: 20 additions & 0 deletions server/src/infra/entities/exif.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@ import { Column } from 'typeorm/decorator/columns/Column';
import { Entity } from 'typeorm/decorator/entity/Entity';
import { AssetEntity } from './asset.entity';

export enum ProjectionType {
EQUIRECTANGULAR = 'EQUIRECTANGULAR',
CUBEMAP = 'CUBEMAP',
CUBESTRIP = 'CUBESTRIP',
EQUIRECTANGULAR_STEREO = 'EQUIRECTANGULAR_STEREO',
CUBEMAP_STEREO = 'CUBEMAP_STEREO',
CUBESTRIP_STEREO = 'CUBESTRIP_STEREO',
CYLINDER = 'CYLINDER',
NONE = 'NONE',
}

@Entity('exif')
export class ExifEntity {
@OneToOne(() => AssetEntity, { onDelete: 'CASCADE', nullable: true })
Expand Down Expand Up @@ -43,6 +54,15 @@ export class ExifEntity {
@Column({ type: 'float', nullable: true })
longitude!: number | null;

@Column({
type: 'enum',
enum: ProjectionType,
enumName: 'projectionType',
default: ProjectionType.NONE,
nullable: true,
dmitry-brazhenko marked this conversation as resolved.
Show resolved Hide resolved
})
projectionType!: ProjectionType | null;
dmitry-brazhenko marked this conversation as resolved.
Show resolved Hide resolved

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

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

export class Panoramas1690217088596 implements MigrationInterface {
name = 'Panoramas1690217088596'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TYPE "public"."projectionType" AS ENUM('EQUIRECTANGULAR', 'CUBEMAP', 'CUBESTRIP', 'EQUIRECTANGULAR_STEREO', 'CUBEMAP_STEREO', 'CUBESTRIP_STEREO', 'CYLINDER', 'NONE')`);
await queryRunner.query(`ALTER TABLE "exif" ADD "projectionType" "public"."projectionType" DEFAULT 'NONE'`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "exif" DROP COLUMN "projectionType"`);
await queryRunner.query(`DROP TYPE "public"."projectionType"`);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
usePagination,
WithoutProperty,
} from '@app/domain';
import { AssetEntity, AssetType, ExifEntity } from '@app/infra/entities';
import { AssetEntity, AssetType, ExifEntity, ProjectionType } from '@app/infra/entities';
import { Inject, Logger } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { InjectRepository } from '@nestjs/typeorm';
Expand Down Expand Up @@ -336,6 +336,19 @@ export class MetadataExtractionProcessor {
await this.extractEmbeddedVideo(asset, offset, null, fileCreatedAt);
}
}

const exifProperty = getExifProperty('ProjectionType');
dmitry-brazhenko marked this conversation as resolved.
Show resolved Hide resolved
let projectionType: ProjectionType | null = null; // Initialize it as null
dmitry-brazhenko marked this conversation as resolved.
Show resolved Hide resolved

if (exifProperty) {
const exifPropertyUpper = exifProperty.toUpperCase();

if (exifPropertyUpper in ProjectionType) {
projectionType = ProjectionType[exifPropertyUpper as keyof typeof ProjectionType];
dmitry-brazhenko marked this conversation as resolved.
Show resolved Hide resolved
}
}

newExif.projectionType = projectionType;
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 @@ -21,6 +21,7 @@ import {
ExifEntity,
PartnerEntity,
PersonEntity,
ProjectionType,
SharedLinkEntity,
SharedLinkType,
SystemConfigEntity,
Expand Down Expand Up @@ -882,6 +883,7 @@ export const sharedLinkStub = {
livePhotoVideoId: null,
originalFileName: 'asset_1.jpeg',
exifInfo: {
projectionType: ProjectionType.NONE,
livePhotoCID: null,
assetId: 'id_1',
description: 'description',
Expand Down
Loading