diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2025-04-10 15:25:14 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2025-04-10 16:02:44 -0300 |
commit | e05cdb8ffc1677ebc6eca3c14b144ea530015a4c (patch) | |
tree | 333414f23164eeba047ae7f4ebb7eb4240af25f7 /src/data | |
parent | b9d1e8d935f7e3e833ccac1fa07bcdf196d7bdc8 (diff) |
data, thumbs: Flash.coverArtwork
Diffstat (limited to 'src/data')
-rw-r--r-- | src/data/composite/things/artwork/withDate.js | 6 | ||||
-rw-r--r-- | src/data/composite/wiki-data/withConstitutedArtwork.js | 8 | ||||
-rw-r--r-- | src/data/composite/wiki-properties/constitutibleArtwork.js | 8 | ||||
-rw-r--r-- | src/data/composite/wiki-properties/constitutibleArtworkList.js | 8 | ||||
-rw-r--r-- | src/data/things/artwork.js | 21 | ||||
-rw-r--r-- | src/data/things/flash.js | 37 |
6 files changed, 63 insertions, 25 deletions
diff --git a/src/data/composite/things/artwork/withDate.js b/src/data/composite/things/artwork/withDate.js index 08f1427c..5e05b814 100644 --- a/src/data/composite/things/artwork/withDate.js +++ b/src/data/composite/things/artwork/withDate.js @@ -1,5 +1,6 @@ import {input, templateCompositeFrom} from '#composite'; +import {raiseOutputWithoutDependency} from '#composite/control-flow'; import {withPropertyFromObject} from '#composite/data'; export default templateCompositeFrom({ @@ -25,6 +26,11 @@ export default templateCompositeFrom({ : continuation()), }, + raiseOutputWithoutDependency({ + dependency: 'dateFromThingProperty', + output: input.value({'#date': null}), + }), + withPropertyFromObject({ object: 'thing', property: 'dateFromThingProperty', diff --git a/src/data/composite/wiki-data/withConstitutedArtwork.js b/src/data/composite/wiki-data/withConstitutedArtwork.js index ab3c45e0..44623450 100644 --- a/src/data/composite/wiki-data/withConstitutedArtwork.js +++ b/src/data/composite/wiki-data/withConstitutedArtwork.js @@ -7,10 +7,10 @@ export default templateCompositeFrom({ inputs: { dimensionsFromThingProperty: input({type: 'string', acceptsNull: true}), - fileExtensionFromThingProperty: input({type: 'string'}), - artistContribsFromThingProperty: input({type: 'string'}), - artistContribsArtistProperty: input({type: 'string'}), - dateFromThingProperty: input({type: 'string'}), + fileExtensionFromThingProperty: input({type: 'string', acceptsNull: true}), + artistContribsFromThingProperty: input({type: 'string', acceptsNull: true}), + artistContribsArtistProperty: input({type: 'string', acceptsNull: true}), + dateFromThingProperty: input({type: 'string', acceptsNull: true}), }, outputs: ['#constitutedArtwork'], diff --git a/src/data/composite/wiki-properties/constitutibleArtwork.js b/src/data/composite/wiki-properties/constitutibleArtwork.js index 870e44c7..9f7ba13e 100644 --- a/src/data/composite/wiki-properties/constitutibleArtwork.js +++ b/src/data/composite/wiki-properties/constitutibleArtwork.js @@ -18,10 +18,10 @@ const template = templateCompositeFrom({ inputs: { dimensionsFromThingProperty: input({type: 'string', acceptsNull: true}), - fileExtensionFromThingProperty: input({type: 'string'}), - artistContribsFromThingProperty: input({type: 'string'}), - artistContribsArtistProperty: input({type: 'string'}), - dateFromThingProperty: input({type: 'string'}), + fileExtensionFromThingProperty: input({type: 'string', acceptsNull: true}), + artistContribsFromThingProperty: input({type: 'string', acceptsNull: true}), + artistContribsArtistProperty: input({type: 'string', acceptsNull: true}), + dateFromThingProperty: input({type: 'string', acceptsNull: true}), }, steps: () => [ diff --git a/src/data/composite/wiki-properties/constitutibleArtworkList.js b/src/data/composite/wiki-properties/constitutibleArtworkList.js index 6a48cba8..29e6c774 100644 --- a/src/data/composite/wiki-properties/constitutibleArtworkList.js +++ b/src/data/composite/wiki-properties/constitutibleArtworkList.js @@ -17,10 +17,10 @@ const template = templateCompositeFrom({ inputs: { dimensionsFromThingProperty: input({type: 'string', acceptsNull: true}), - fileExtensionFromThingProperty: input({type: 'string'}), - artistContribsFromThingProperty: input({type: 'string'}), - artistContribsArtistProperty: input({type: 'string'}), - dateFromThingProperty: input({type: 'string'}), + fileExtensionFromThingProperty: input({type: 'string', acceptsNull: true}), + artistContribsFromThingProperty: input({type: 'string', acceptsNull: true}), + artistContribsArtistProperty: input({type: 'string', acceptsNull: true}), + dateFromThingProperty: input({type: 'string', acceptsNull: true}), }, steps: () => [ diff --git a/src/data/things/artwork.js b/src/data/things/artwork.js index ae0e1ecf..4c5c55e7 100644 --- a/src/data/things/artwork.js +++ b/src/data/things/artwork.js @@ -153,16 +153,17 @@ export class Artwork extends Thing { mode: input.value('empty'), }), - { - dependencies: ['thing', 'artistContribsFromThingProperty'], - compute: (continuation, {thing, artistContribsFromThingProperty}) => - (artistContribsFromThingProperty - ? continuation({ - '#artistContribs': - thing[artistContribsFromThingProperty], - }) - : continuation.exit(null)), - }, + exitWithoutDependency({ + dependency: 'artistContribsFromThingProperty', + value: input.value([]), + }), + + withPropertyFromObject({ + object: 'thing', + property: 'artistContribsFromThingProperty', + }).outputs({ + ['#value']: '#artistContribs', + }), withRecontextualizedContributionList({ list: '#artistContribs', diff --git a/src/data/things/flash.js b/src/data/things/flash.js index fe1d17ff..ace18af9 100644 --- a/src/data/things/flash.js +++ b/src/data/things/flash.js @@ -6,8 +6,14 @@ import {sortFlashesChronologically} from '#sort'; import Thing from '#thing'; import {anyOf, isColor, isContentString, isDirectory, isNumber, isString} from '#validators'; -import {parseAdditionalNames, parseContributors, parseDate, parseDimensions} - from '#yaml'; + +import { + parseArtwork, + parseAdditionalNames, + parseContributors, + parseDate, + parseDimensions, +} from '#yaml'; import {withPropertyFromObject} from '#composite/data'; @@ -23,6 +29,7 @@ import { color, commentary, commentatorArtists, + constitutibleArtwork, contentString, contributionList, dimensions, @@ -100,6 +107,10 @@ export class Flash extends Thing { coverArtDimensions: dimensions(), + coverArtwork: + constitutibleArtwork.fromYAMLFieldSpec + .call(this, 'Cover Artwork'), + contributorContribs: contributionList({ date: 'date', artistProperty: input.value('flashContributorContributions'), @@ -205,6 +216,16 @@ export class Flash extends Thing { transform: parseAdditionalNames, }, + 'Cover Artwork': { + property: 'coverArtwork', + transform: + parseArtwork({ + single: true, + fileExtensionFromThingProperty: 'coverArtFileExtension', + dimensionsFromThingProperty: 'coverArtDimensions', + }), + }, + 'Cover Art File Extension': {property: 'coverArtFileExtension'}, 'Cover Art Dimensions': { @@ -225,6 +246,14 @@ export class Flash extends Thing { 'Review Points': {ignore: true}, }, }; + + getOwnArtworkPath(artwork) { + return [ + 'media.flashArt', + this.directory, + artwork.fileExtension, + ]; + } } export class FlashAct extends Thing { @@ -411,7 +440,9 @@ export class FlashSide extends Thing { const flashActData = results.filter(x => x instanceof FlashAct); const flashSideData = results.filter(x => x instanceof FlashSide); - return {flashData, flashActData, flashSideData}; + const artworkData = flashData.map(flash => flash.coverArtwork); + + return {flashData, flashActData, flashSideData, artworkData}; }, sort({flashData}) { |