diff options
Diffstat (limited to 'src/data')
-rw-r--r-- | src/data/cacheable-object.js | 2 | ||||
-rw-r--r-- | src/data/things.js | 20 |
2 files changed, 21 insertions, 1 deletions
diff --git a/src/data/cacheable-object.js b/src/data/cacheable-object.js index 99280956..4afb0368 100644 --- a/src/data/cacheable-object.js +++ b/src/data/cacheable-object.js @@ -169,7 +169,7 @@ export default class CacheableObject { const oldValue = this.#propertyUpdateValues[property]; if (newValue === undefined) { - throw new ValueError(`Properties cannot be set to undefined`); + throw new TypeError(`Properties cannot be set to undefined`); } if (newValue === oldValue) { diff --git a/src/data/things.js b/src/data/things.js index c93b8852..16970af5 100644 --- a/src/data/things.js +++ b/src/data/things.js @@ -448,6 +448,9 @@ Album.propertyDescriptors = { } }, + coverArtFileExtension: Thing.common.fileExtension('jpg'), + trackCoverArtFileExtension: Thing.common.fileExtension('jpg'), + wallpaperStyle: Thing.common.simpleString(), wallpaperFileExtension: Thing.common.fileExtension('jpg'), @@ -605,6 +608,20 @@ Track.propertyDescriptors = { } }, + coverArtFileExtension: { + flags: {update: true, expose: true}, + + update: {validate: isFileExtension}, + + expose: { + dependencies: ['albumData'], + transform: (coverArtFileExtension, { albumData, [Track.instance]: track }) => ( + coverArtFileExtension ?? + Track.findAlbum(track, albumData)?.trackCoverArtFileExtension ?? + true) + } + }, + // Previously known as: (track).aka originalReleaseTrackByRef: Thing.common.singleReference(Track), @@ -779,6 +796,9 @@ Artist.propertyDescriptors = { urls: Thing.common.urls(), contextNotes: Thing.common.simpleString(), + hasAvatar: Thing.common.flag(false), + avatarFileExtension: Thing.common.fileExtension('jpg'), + aliasNames: { flags: {update: true, expose: true}, update: { |