Skip to content

Commit

Permalink
[replace artist] Add option to skip concertmaster link
Browse files Browse the repository at this point in the history
  • Loading branch information
loujine committed Mar 30, 2022
1 parent 03aff09 commit 480951d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
9 changes: 7 additions & 2 deletions mb-edit-replace_rec_artist_from_release_page.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @name MusicBrainz edit: Replace recording artists from a Release page
// @namespace mbz-loujine
// @author loujine
// @version 2021.9.19
// @version 2022.3.22
// @downloadURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-edit-replace_rec_artist_from_release_page.user.js
// @updateURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-edit-replace_rec_artist_from_release_page.user.js
// @supportURL https://github.com/loujine/musicbrainz-scripts
Expand Down Expand Up @@ -112,8 +112,9 @@ function parseEditData(editData) {
const filterPending = document.getElementById('pending').checked
? !rel.editsPending
: true;
const skipMinorRels = document.getElementById('skip-minor-rels').checked;
if (
server.performingLinkTypes().includes(linkType) &&
server.performingLinkTypes(skipMinorRels).includes(linkType) &&
!uniqueIds.includes(rel.target.id) &&
filterPending &&
rel.target.name !== '[unknown]'
Expand Down Expand Up @@ -216,6 +217,10 @@ function replaceArtist() {
<td><label for="set-unknown">Set [unknown] artist if no rel</label></td>
<td><input type="checkbox" id="set-unknown"></td>
</tr>
<tr>
<td><label for="skip-minor-rels">Skip minor rels (e.g. concertmaster)</label></td>
<td><input type="checkbox" id="skip-minor-rels"></td>
</tr>
</table>
<br />Edit note:
<textarea id="batch_replace_edit_note">
Expand Down
13 changes: 9 additions & 4 deletions mbz-loujine-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @name mbz-loujine-common
// @namespace mbz-loujine
// @author loujine
// @version 2022.1.28
// @version 2022.3.22
// @description musicbrainz.org: common functions
// @compatible firefox+greasemonkey
// @license MIT
Expand Down Expand Up @@ -107,9 +107,11 @@ class Server {
'vocals',
'orchestra',
'conductor',
'performer',
];
this._minorPerformingRoles = [
'concertmaster',
'chorusmaster',
'performer',
];
this.aliasArtistType = {
'Artist name': 1,
Expand Down Expand Up @@ -351,8 +353,11 @@ class Server {
return this.recordingLinkType[this.releaseLinkTypeID[linkTypeID]];
}

performingLinkTypes() {
return this._performingRoles.map(role => this.recordingLinkType[role]);
performingLinkTypes(skipMinorRoles = false) {
const roles = skipMinorRoles ? this._performingRoles : [
...this._performingRoles, ...this._minorPerformingRoles
];
return roles.map(role => this.recordingLinkType[role]);
}

getRelationshipTypeInfo() {
Expand Down

0 comments on commit 480951d

Please sign in to comment.