Skip to content

Commit

Permalink
Merge pull request #326 from Kunkka0822/feat/soundprotocol-music-accu…
Browse files Browse the repository at this point in the history
…mulator

Integrate Sound Protocol to Music Accumulator
  • Loading branch information
TimDaub authored Oct 21, 2022
2 parents 08af9f4 + 7883a27 commit 54631d9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/strategies/music-os-accumulator/extractor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,21 @@ const strategies = [
};
},
},
{
files: ["sound-protocol-get-tokenuri-transformation"],
map: new Map(),
accumulator: (map) => {
return (line) => {
const data = JSON.parse(line);
// In the sound-protocol a song can be represented by multiple NFTs where the differentiating factor is within the NFT's metadata, the `trackNumber` property. We're hence generating a unique identifier from the contract's address and the track's number to then filter out potential token duplicates.
const id = caip19(
data.erc721.address,
data.erc721.metadata.trackNumber
);
!map.has(id) && map.set(id, data);
};
},
},
];

async function lineReader(filePath, accumulator) {
Expand Down Expand Up @@ -179,6 +194,7 @@ export async function init() {
trackList = [...trackList, ...strategies[3].map];
trackList = [...trackList, ...strategies[4].map];
trackList = [...trackList, ...strategies[5].map];
trackList = [...trackList, ...Array.from(strategies[6].map.values())];
// NOTE: See: https://github.com/neume-network/strategies/issues/246#issuecomment-1240365903
trackList = uniqWith(trackList, isUnique);
return {
Expand Down

0 comments on commit 54631d9

Please sign in to comment.