diff options
Diffstat (limited to 'src/data/things/album/Album.js')
| -rw-r--r-- | src/data/things/album/Album.js | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/src/data/things/album/Album.js b/src/data/things/album/Album.js index d5fd1682..e81615d4 100644 --- a/src/data/things/album/Album.js +++ b/src/data/things/album/Album.js @@ -1,10 +1,4 @@ -export const DATA_ALBUM_DIRECTORY = 'album'; - -import * as path from 'node:path'; - import {input, V} from '#composite'; -import {traverse} from '#node-utils'; -import {sortAlbumsTracksChronologically, sortChronologically} from '#sort'; import {empty} from '#sugar'; import Thing from '#thing'; import {is, isContributionList, isDate, isDirectory, isNumber} @@ -794,75 +788,6 @@ export class Album extends Thing { ], }; - static [Thing.getYamlLoadingSpec] = ({ - documentModes: {headerAndEntries}, - thingConstructors: {Album, Track, TrackSection}, - }) => ({ - title: `Process album files`, - - files: dataPath => - traverse(path.join(dataPath, DATA_ALBUM_DIRECTORY), { - filterFile: name => path.extname(name) === '.yaml', - prefixPath: DATA_ALBUM_DIRECTORY, - }), - - documentMode: headerAndEntries, - headerDocumentThing: Album, - entryDocumentThing: document => - ('Section' in document - ? TrackSection - : Track), - - connect({header: album, entries}) { - const trackSections = []; - - let currentTrackSection = new TrackSection(); - let currentTrackSectionTracks = []; - - Object.assign(currentTrackSection, { - name: `Default Track Section`, - isDefaultTrackSection: true, - }); - - const closeCurrentTrackSection = () => { - if ( - currentTrackSection.isDefaultTrackSection && - empty(currentTrackSectionTracks) - ) { - return; - } - - currentTrackSection.tracks = currentTrackSectionTracks; - currentTrackSection.album = album; - - trackSections.push(currentTrackSection); - }; - - for (const entry of entries) { - if (entry instanceof TrackSection) { - closeCurrentTrackSection(); - currentTrackSection = entry; - currentTrackSectionTracks = []; - continue; - } - - entry.album = album; - entry.trackSection = currentTrackSection; - - currentTrackSectionTracks.push(entry); - } - - closeCurrentTrackSection(); - - album.trackSections = trackSections; - }, - - sort({albumData, trackData}) { - sortChronologically(albumData); - sortAlbumsTracksChronologically(trackData); - }, - }); - getOwnAdditionalFilePath(_file, filename) { return [ 'media.albumAdditionalFile', |