Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Add members, tracks and associatedMedia #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ const {
MusicRecording
} = require('./src/music')

// 'member' expects an array of Parties
// 'members' expects an array of Parties
const group = new MusicGroup()
group.setDescription('descriptive')
group.setName('Beatles')
group.addMember(man)
group.addMembers(man)
group.path = '<placeholder group path>'

const composition = new MusicComposition()
Expand All @@ -102,17 +102,17 @@ recording.setRecordingOf(comp)

console.log(recording.data())

// {
// {
// "@context": "http://coalaip.org",
// "@type": "MusicRecording",
// "byArtist": [
// {
// "byArtist": [
// {
// "@context": "http://schema.org",
// "@type": "MusicGroup",
// "name": "Beatles",
// "description": "descriptive",
// "member": [
// {
// "members": [
// {
// "@context": "http://schema.org",
// "@type": "Person",
// "givenName": "John",
Expand All @@ -122,11 +122,11 @@ console.log(recording.data())
// ]
// }
// ],
// "recordingOf": {
// "recordingOf": {
// "@context": "http://coalaip.org",
// "@type": "MusicComposition",
// "composer": [
// {
// "composer": [
// {
// "@context": "http://schema.org",
// "@type": "Person",
// "givenName": "John",
Expand All @@ -141,15 +141,15 @@ console.log(recording.data())

console.log(recording.ipld())

// {
// {
// "@context": "http://coalaip.org",
// "@type": "MusicRecording",
// "byArtist": [
// {
// "byArtist": [
// {
// "/": "<placeholder group path>"
// }
// ],
// "recordingOf": {
// "recordingOf": {
// "/": "<placeholder composition path>"
// }
// }
Expand Down
3 changes: 2 additions & 1 deletion src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ inherit(CreativeWork, Thing)
propArray(CreativeWork, String(), 'genre')
propArray(CreativeWork, new Party(), 'producer')
propArray(CreativeWork, new Party(), 'publisher')
propArray(CreativeWork, new MediaObject(), 'associatedMedia')

// Intangible

Expand Down Expand Up @@ -121,7 +122,7 @@ function Organization (type = 'Organization') {

inherit(Organization, Party)

propArray(Organization, new Party(), 'member')
propArray(Organization, new Party(), 'members')

// Person

Expand Down
2 changes: 1 addition & 1 deletion src/music.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function MusicPlaylist (type = 'MusicPlaylist') {
}

inherit(MusicPlaylist, CreativeWork)
propArray(MusicPlaylist, new MusicRecording(), 'track')
propArray(MusicPlaylist, new MusicRecording(), 'tracks')

// MusicRecording

Expand Down
5 changes: 3 additions & 2 deletions test/fixtures/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ exports.CreativeWork = {
add: {
genre: 'slimecore',
producer: party,
publisher: party
publisher: party,
associatedMedia: [imageObject, imageObject]
},
set: {
name: 'creativeWork'
Expand Down Expand Up @@ -258,7 +259,7 @@ exports.Organization = {
core.Party
],
add: {
member: party
members: [party, party]
},
set: {
email: '[email protected]',
Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/music.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ exports.MusicGroup = {
],
add: {
genre: 'ska',
member: party
members: [party, party]
},
set: {
email: '[email protected]',
Expand Down Expand Up @@ -117,7 +117,7 @@ exports.MusicPlaylist = {
genre: 'slimecore',
producer: party,
publisher: party,
track: musicRecording
tracks: [musicRecording, musicRecording]
},
set: {
name: 'musicPlaylist'
Expand All @@ -139,7 +139,7 @@ exports.MusicAlbum = {
genre: 'slimecore',
producer: party,
publisher: party,
track: musicRecording
tracks: [musicRecording, musicRecording]
},
set: {
albumProductionType: 'DemoAlbum',
Expand All @@ -162,7 +162,7 @@ exports.MusicRelease = {
producer: party,
publisher: party,
recordLabel: party,
track: musicRecording
tracks: [musicRecording, musicRecording]
},
set: {
catalogNumber: '12345',
Expand Down