Skip to content

Commit

Permalink
feat(server): prefer tagslist (immich-app#12286)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrasm91 authored and pull[bot] committed Sep 24, 2024
1 parent 0007e34 commit 2e5e2d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 15 additions & 0 deletions server/src/services/metadata.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,21 @@ describe(MetadataService.name, () => {
});
});

it('should ignore Keywords when TagsList is present', async () => {
assetMock.getByIds.mockResolvedValue([assetStub.image]);
metadataMock.readTags.mockResolvedValue({ Keywords: 'Child', TagsList: ['Parent/Child'] });
tagMock.upsertValue.mockResolvedValue(tagStub.parent);

await sut.handleMetadataExtraction({ id: assetStub.image.id });

expect(tagMock.upsertValue).toHaveBeenNthCalledWith(1, { userId: 'user-id', value: 'Parent', parent: undefined });
expect(tagMock.upsertValue).toHaveBeenNthCalledWith(2, {
userId: 'user-id',
value: 'Parent/Child',
parent: tagStub.parent,
});
});

it('should not apply motion photos if asset is video', async () => {
assetMock.getByIds.mockResolvedValue([{ ...assetStub.livePhotoMotionAsset, isVisible: true }]);
mediaMock.probe.mockResolvedValue(probeStub.matroskaContainer);
Expand Down
4 changes: 1 addition & 3 deletions server/src/services/metadata.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,7 @@ export class MetadataService {
const tags: unknown[] = [];
if (exifTags.TagsList) {
tags.push(...exifTags.TagsList);
}

if (exifTags.Keywords) {
} else if (exifTags.Keywords) {
let keywords = exifTags.Keywords;
if (!Array.isArray(keywords)) {
keywords = [keywords];
Expand Down

0 comments on commit 2e5e2d7

Please sign in to comment.