mirror of
https://notabug.org/SuperSaltyGamer/ame
synced 2026-01-15 21:52:55 -03:00
[musicbrainz-works] Obtain arrangers from minc
This commit is contained in:
8
dist/musicbrainz-works.user.js
vendored
8
dist/musicbrainz-works.user.js
vendored
File diff suppressed because one or more lines are too long
@@ -17,6 +17,7 @@ interface Work {
|
||||
nextone: string | null
|
||||
lyricists: string[]
|
||||
composers: string[]
|
||||
arrangers: string[]
|
||||
publishers: string[]
|
||||
sources: string[]
|
||||
workCodes: boolean,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// ==UserScript==
|
||||
// @namespace ame-musicbrainz-works
|
||||
// @name Ame (MusicBrainz - Works)
|
||||
// @version 0.2.0
|
||||
// @version 0.3.0
|
||||
// @author SuperSaltyGamer
|
||||
// @run-at document-end
|
||||
// @match https://musicbrainz.org/*
|
||||
|
||||
@@ -54,12 +54,14 @@ export function onMincWorkPage() {
|
||||
const nextone = pathSelector(document, "//a[@href='#nextone']/following-sibling::*/span[2][.!='']")?.innerText?.trim() || null;
|
||||
const lyricists = new Set(pathSelectorAll(document, "//td[contains(., '作詞')]/parent::tr/*[2]").map(el => el.innerText.trim()).filter(Boolean));
|
||||
const composers = new Set(pathSelectorAll(document, "//td[contains(., '作曲')]/parent::tr/*[2]").map(el => el.innerText.trim()).filter(Boolean));
|
||||
const arrangers = new Set(pathSelectorAll(document, "//td[contains(., '編曲')]/parent::tr/*[2]").map(el => el.innerText.trim()).filter(Boolean));
|
||||
const publishers = new Set(pathSelectorAll(document, "//td[contains(., '出版者')]/parent::tr/*[2]").map(el => el.innerText.trim()).filter(Boolean));
|
||||
|
||||
if (iswc) work.iswc = iswc;
|
||||
if (nextone) work.nextone = nextone;
|
||||
work.lyricists = Array.from(lyricists);
|
||||
work.composers = Array.from(composers);
|
||||
work.arrangers = Array.from(arrangers);
|
||||
work.publishers = Array.from(publishers);
|
||||
work.sources.push(location.href);
|
||||
work.sources = Array.from(new Set(work.sources));
|
||||
|
||||
@@ -31,6 +31,7 @@ export async function onMusicBrainzEditWorkPage() {
|
||||
nextone: null,
|
||||
lyricists: [],
|
||||
composers: [],
|
||||
arrangers: [],
|
||||
publishers: [],
|
||||
sources: [],
|
||||
workCodes: false,
|
||||
@@ -56,8 +57,9 @@ export async function onMusicBrainzEditWorkPage() {
|
||||
pasteWorkCodesEl?.click();
|
||||
}
|
||||
|
||||
for (const composer of work.composers) await addRelationship("artist", "composed / composer", composer);
|
||||
for (const lyricist of work.lyricists) await addRelationship("artist", "lyrics / lyricist", lyricist);
|
||||
for (const composer of work.composers) await addRelationship("artist", "composed / composer", composer);
|
||||
for (const arranger of work.arrangers) await addRelationship("artist", "arranged / arranger", arranger);
|
||||
for (const publisher of work.publishers) await addRelationship("label", "published / publisher", publisher);
|
||||
}
|
||||
|
||||
@@ -112,7 +114,7 @@ async function addRelationship(relatedType: string, relationshipType: string, va
|
||||
const relationshipTypeEl = dialogEl.querySelector<HTMLInputElement>("input.relationship-type")!;
|
||||
setReactInputValue(relationshipTypeEl, relationshipType);
|
||||
|
||||
dialogEl.querySelector<HTMLLIElement>("li.option-item")!.click();
|
||||
pathSelector<HTMLLIElement>(dialogEl, `//li[contains(@class, 'option-item') and contains(., '${relationshipType}')]`)!.click();
|
||||
|
||||
const targetEl = dialogEl.querySelector<HTMLInputElement>(".relationship-target input")!;
|
||||
setReactInputValue(targetEl, value);
|
||||
|
||||
Reference in New Issue
Block a user