diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/content/dependencies/generateArtTagGalleryPage.js | 6 | ||||
| -rw-r--r-- | src/content/dependencies/generateArtistInfoPageTracksChunkItem.js | 12 | ||||
| -rw-r--r-- | src/search-select.js | 29 |
3 files changed, 32 insertions, 15 deletions
diff --git a/src/content/dependencies/generateArtTagGalleryPage.js b/src/content/dependencies/generateArtTagGalleryPage.js index f20babba..3e036b08 100644 --- a/src/content/dependencies/generateArtTagGalleryPage.js +++ b/src/content/dependencies/generateArtTagGalleryPage.js @@ -104,6 +104,10 @@ export default { data.onlyFeaturedIndirectly.includes(true) && data.onlyFeaturedIndirectly.includes(false); + data.allWarnings = + query.allArtworks + .flatMap(artwork => artwork?.contentWarnings); + return data; }, @@ -210,6 +214,8 @@ export default { return language.$(workingCapsule, workingOptions); })), + + revealAllWarnings: data.allWarnings, }), ], diff --git a/src/content/dependencies/generateArtistInfoPageTracksChunkItem.js b/src/content/dependencies/generateArtistInfoPageTracksChunkItem.js index b0d9d8e5..f53e0f81 100644 --- a/src/content/dependencies/generateArtistInfoPageTracksChunkItem.js +++ b/src/content/dependencies/generateArtistInfoPageTracksChunkItem.js @@ -10,9 +10,11 @@ export default { query.track = contribs[0].thing; - const creditedAsArtist = + const creditedAsNormalArtist = contribs - .some(contrib => contrib.thingProperty === 'artistContribs'); + .some(contrib => + contrib.thingProperty === 'artistContribs' && + contrib.annotation !== 'featuring'); const creditedAsContributor = contribs @@ -20,7 +22,9 @@ export default { const annotatedContribs = contribs - .filter(contrib => contrib.annotation); + .filter(contrib => + contrib.annotation && + contrib.annotation !== 'featuring'); const annotatedArtistContribs = annotatedContribs @@ -39,7 +43,7 @@ export default { // Return seemingly only for "bass clarinet" when they're also // the one who composed and arranged Renewed Return! if ( - creditedAsArtist && + creditedAsNormalArtist && creditedAsContributor && empty(annotatedArtistContribs) ) { diff --git a/src/search-select.js b/src/search-select.js index fcc1e7d6..4470c463 100644 --- a/src/search-select.js +++ b/src/search-select.js @@ -63,9 +63,11 @@ function determineArtistGroups(artist, opts) { const contributionGroups = contributions.flatMap(contrib => contrib.groups); - const scores = - new Map( - unique(contributionGroups).map(group => [group, 0])); + const groupToZero = + new Map(unique(contributionGroups).map(group => [group, 0])); + + const scores = new Map(groupToZero); + const counts = new Map(groupToZero); const artistNames = [artist, ...artist.artistAliases] @@ -76,6 +78,7 @@ function determineArtistGroups(artist, opts) { for (const artistName of artistNames) { if (compareKebabCase(group.name, artistName)) { scores.delete(group); + counts.delete(group); continue group; } } @@ -83,26 +86,30 @@ function determineArtistGroups(artist, opts) { for (const group of contributionGroups) { scores.set(group, scores.get(group) + 1 / contributions.length); + counts.set(group, counts.get(group) + 1); } const dividingGroups = opts.wikiInfo.divideTrackListsByGroups; - const dividingGroupThreshold = + const dividingGroupScoreThreshold = (contributions.length < 50 ? 0.08 : 0.16); - const generalGroupThreshold = + const generalGroupScoreThreshold = (contributions.length < 50 ? 0.00 : 0.12); + const dividingGroupCountThreshold = 15; + const generalGroupCountThreshold = 20; + for (const group of scores.keys()) { - const threshold = + const [scoreThreshold, countThreshold] = (dividingGroups.includes(group) - ? dividingGroupThreshold - : generalGroupThreshold); + ? [dividingGroupScoreThreshold, dividingGroupCountThreshold] + : [generalGroupScoreThreshold, generalGroupCountThreshold]); - if (scores.get(group) < threshold) { - scores.delete(group); - } + if (scores.get(group) >= scoreThreshold); + else if (counts.get(group) >= countThreshold); + else scores.delete(group); } return Array.from(scores.keys()); |