Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
jesus2099 authored Nov 25, 2024
2 parents c298541 + a625704 commit 2f9b89e
Show file tree
Hide file tree
Showing 13 changed files with 203 additions and 132 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
name: 'Linter'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1

Expand All @@ -20,13 +20,13 @@ jobs:
name: 'Selenium tests'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
architecture: x64

- name: 'Install dependencies'
Expand Down
16 changes: 14 additions & 2 deletions mb-display_count_alias.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,31 @@
// @name MusicBrainz: Display alias count
// @namespace mbz-loujine
// @author loujine
// @version 2020.11.16
// @version 2024.11.25
// @downloadURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-display_count_alias.user.js
// @updateURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-display_count_alias.user.js
// @supportURL https://github.com/loujine/musicbrainz-scripts
// @icon https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/icon.png
// @description musicbrainz.org: Display alias count on work/artist pages
// @description musicbrainz.org: Display alias count on entities pages
// @compatible firefox+tampermonkey
// @license MIT
// @require https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mbz-loujine-common.js
// @include http*://*musicbrainz.org/work/*
// @exclude http*://*musicbrainz.org/work/add*
// @exclude http*://*musicbrainz.org/work/create*
// @exclude http*://*musicbrainz.org/work/*/edits
// @include http*://*musicbrainz.org/release/*
// @exclude http*://*musicbrainz.org/release/add*
// @exclude http*://*musicbrainz.org/release/create*
// @exclude http*://*musicbrainz.org/release/*/edits
// @include http*://*musicbrainz.org/release-group/*
// @exclude http*://*musicbrainz.org/release-group/add*
// @exclude http*://*musicbrainz.org/release-group/create*
// @exclude http*://*musicbrainz.org/release-group/*/edits
// @include http*://*musicbrainz.org/event/*
// @exclude http*://*musicbrainz.org/event/add*
// @exclude http*://*musicbrainz.org/event/create*
// @exclude http*://*musicbrainz.org/event/*/edits
// @include http*://*musicbrainz.org/artist/*
// @exclude http*://*musicbrainz.org/artist/add*
// @exclude http*://*musicbrainz.org/artist/create*
Expand Down
14 changes: 13 additions & 1 deletion mb-edit-create_from_wikidata.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @name MusicBrainz edit: Create entity or fill data from wikipedia / wikidata / VIAF / ISNI
// @namespace mbz-loujine
// @author loujine
// @version 2024.11.8
// @version 2024.11.25
// @downloadURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-edit-create_from_wikidata.user.js
// @updateURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-edit-create_from_wikidata.user.js
// @supportURL https://github.com/loujine/musicbrainz-scripts
Expand Down Expand Up @@ -97,17 +97,23 @@ class WikiDataHelpers {
idMyspace: 'P3265',
idWeibo: 'P3579',
idPinterest: 'P3836',
idThreads: 'P11892',
// other
idSpotify: 'P1902',
idYoutube: 'P2397',
idDeezer: 'P2722',
idiTunes: 'P2850',
idNapster: 'P6972',
idTidal: 'P4576',
idAmazonMusic: 'P6276',
idBoomplay: 'P11090',
idDailymotion: 'P2942',
idSoundCloud: 'P3040',
idLastFM: 'P3192',
idSongkick: 'P3478',
idVimeo: 'P4015',
idPatreon: 'P4175',
idAnghami: 'P10885',
// missing: Tumblr (P3943), Bandcamp (P3283)
};
this.urls = {
Expand Down Expand Up @@ -141,17 +147,23 @@ class WikiDataHelpers {
idMyspace: 'https://myspace.com/',
idWeibo: 'https://weibo.com/',
idPinterest: 'https://www.pinterest.com/',
idThreads: 'https://www.threads.net/@',
// other
idSpotify: 'https://open.spotify.com/artist/',
idYoutube: 'https://www.youtube.com/channel/',
idDeezer: 'https://www.deezer.com/artist/',
idiTunes: 'https://itunes.apple.com/artist/',
idNapster: 'https://web.napster.com/artist/',
idTidal: 'https://tidal.com/browse/artist/',
idAmazonMusic: 'https://music.amazon.com/artists/',
idBoomplay: 'https://www.boomplay.com/artists/',
idDailymotion: 'https://www.dailymotion.com/',
idSoundCloud: 'https://soundcloud.com/',
idLastFM: 'https://www.last.fm/music/',
idSongkick: 'https://www.songkick.com/artists/',
idVimeo: 'https://vimeo.com/',
idPatreon: 'https://www.patreon.com/',
idAnghami: 'https://play.anghami.com/artist/',
};
}

Expand Down
6 changes: 3 additions & 3 deletions mb-edit-edit_subworks.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @name MusicBrainz edit: Replace subwork titles, disambiguations and attributes in Work edit page
// @namespace mbz-loujine
// @author loujine
// @version 2023.3.11
// @version 2024.11.25
// @downloadURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-edit-edit_subworks.user.js
// @updateURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-edit-edit_subworks.user.js
// @supportURL https://github.com/loujine/musicbrainz-scripts
Expand Down Expand Up @@ -127,10 +127,10 @@ function setSubworksAttributes(attrName) {
button.click();
await helper.waitFor(() => !!MB.relationshipEditor.relationshipDialogDispatch, 1);

document.querySelector(`.dialog-content input#${attrName}-checkbox`).click();
document.querySelector(`.relationship-dialog input#${attrName}-checkbox`).click();
await helper.delay(1);

document.querySelector('.dialog-content button.positive').click();
document.querySelector('.relationship-dialog button.positive').click();
});
}

Expand Down
4 changes: 2 additions & 2 deletions mb-reledit-copy_dates.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @name MusicBrainz relation editor: Copy dates on recording relations
// @namespace mbz-loujine
// @author loujine
// @version 2023.3.6
// @version 2024.11.25
// @downloadURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-reledit-copy_dates.user.js
// @updateURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-reledit-copy_dates.user.js
// @supportURL https://github.com/loujine/musicbrainz-scripts
Expand Down Expand Up @@ -79,7 +79,7 @@ async function applyNewDate(rel, dateProps) {
});
await helper.delay(1);

document.querySelector('.dialog-content button.positive').click();
document.querySelector('.relationship-dialog button.positive').click();
}

const propagateDates = (replace) => {
Expand Down
14 changes: 7 additions & 7 deletions mb-reledit-guess_works.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @name MusicBrainz relation editor: Guess related works in batch
// @namespace mbz-loujine
// @author loujine
// @version 2023.3.12
// @version 2024.11.25
// @downloadURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-reledit-guess_works.user.js
// @updateURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-reledit-guess_works.user.js
// @supportURL https://github.com/loujine/musicbrainz-scripts
Expand Down Expand Up @@ -78,11 +78,11 @@ const setWork = async (recording, work, partial) => {
}
await helper.delay(1);

if (document.querySelector('.dialog-content p.error')) {
if (document.querySelector('.relationship-dialog p.error')) {
console.error('Dialog error, probably an identical relation already exists');
document.querySelector('.dialog-content button.negative').click();
document.querySelector('.relationship-dialog button.negative').click();
} else {
document.querySelector('.dialog-content button.positive').click();
document.querySelector('.relationship-dialog button.positive').click();
}
};

Expand Down Expand Up @@ -113,11 +113,11 @@ const replaceWork = async (recording, work) => {
});
await helper.delay(1);

if (document.querySelector('.dialog-content p.error')) {
if (document.querySelector('.relationship-dialog p.error')) {
console.error('Dialog error, probably an identical relation already exists');
document.querySelector('.dialog-content button.negative').click();
document.querySelector('.relationship-dialog button.negative').click();
} else {
document.querySelector('.dialog-content button.positive').click();
document.querySelector('.relationship-dialog button.positive').click();
}
};

Expand Down
3 changes: 2 additions & 1 deletion mb-reledit-release_rel_to_recording_rel.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @name MusicBrainz relation editor: Replace release relations by recording relations
// @namespace mbz-loujine
// @author loujine
// @version 2023.3.9
// @version 2024.11.13
// @downloadURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-reledit-release_rel_to_recording_rel.user.js
// @updateURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-reledit-release_rel_to_recording_rel.user.js
// @supportURL https://github.com/loujine/musicbrainz-scripts
Expand Down Expand Up @@ -35,6 +35,7 @@ function moveAR() {
attributes: relEditor.createAttributeTree(artistRel.attributes),
begin_date: artistRel.begin_date,
entity0: artistRel.target,
entity0_credit: artistRel.entity0_credit,
entity1: rec,
end_date: artistRel.end_date,
ended: artistRel.ended,
Expand Down
10 changes: 5 additions & 5 deletions mb-reledit-set_instruments.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @name MusicBrainz relation editor: set role in recording-artist relation
// @namespace mbz-loujine
// @author loujine
// @version 2023.3.6
// @version 2024.11.25
// @downloadURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-reledit-set_instruments.user.js
// @updateURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-reledit-set_instruments.user.js
// @supportURL https://github.com/loujine/musicbrainz-scripts
Expand All @@ -29,7 +29,7 @@ const setInstrument = (fromType, toType, fromAttrId, toAttrId, toCredit) => {
).filter(
rel => (
(isNaN(fromAttrId) && rel.attributes.length === 0)
|| rel.attributes.map(attr => attr.type.id).includes(fromAttrId)
|| rel.attributes.map(attr => attr.typeID).includes(fromAttrId)
)
).forEach(async (rel, relIdx) => {
await helper.delay(relIdx * 10);
Expand Down Expand Up @@ -64,8 +64,8 @@ const setInstrument = (fromType, toType, fromAttrId, toAttrId, toCredit) => {
let idx;
let attrs = rel.attributes;
if (!isNaN(fromAttrId)) {
idx = attrs.findIndex(attr => attr.type.id == fromAttrId);
attrs = attrs.filter(attr => attr.type.id != fromAttrId);
idx = attrs.findIndex(attr => attr.typeID == fromAttrId);
attrs = attrs.filter(attr => attr.typeID != fromAttrId);
}
if (toAttr) {
// attrs order must be kept for credits, etc.
Expand All @@ -78,7 +78,7 @@ const setInstrument = (fromType, toType, fromAttrId, toAttrId, toCredit) => {
});
await helper.delay(1);

document.querySelector('.dialog-content button.positive').click();
document.querySelector('.relationship-dialog button.positive').click();
});
});
};
Expand Down
8 changes: 4 additions & 4 deletions mb-reledit-set_rec_artist_as_writer.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @name MusicBrainz relation editor: Set writer relation from recording artist
// @namespace mbz-loujine
// @author loujine
// @version 2023.3.28
// @version 2024.11.25
// @downloadURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-reledit-set_rec_artist_as_writer.user.js
// @updateURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-reledit-set_rec_artist_as_writer.user.js
// @supportURL https://github.com/loujine/musicbrainz-scripts
Expand Down Expand Up @@ -81,11 +81,11 @@ const fillWriterDialog = async (work, track, artistCredit) => {
});
await helper.delay(10);

if (document.querySelector('.dialog-content p.error')) {
if (document.querySelector('.relationship-dialog p.error')) {
console.error('Dialog error, probably an identical relation already exists');
document.querySelector('.dialog-content button.negative').click();
document.querySelector('.relationship-dialog button.negative').click();
} else {
document.querySelector('.dialog-content button.positive').click();
document.querySelector('.relationship-dialog button.positive').click();
}
};

Expand Down
4 changes: 2 additions & 2 deletions mb-reledit-set_relation_attrs.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// @name MusicBrainz relation editor: Set relation attributes
// @namespace mbz-loujine
// @author loujine
// @version 2023.3.6
// @version 2024.11.25
// @downloadURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-reledit-set_relation_attrs.user.js
// @updateURL https://raw.githubusercontent.com/loujine/musicbrainz-scripts/master/mb-reledit-set_relation_attrs.user.js
// @supportURL https://github.com/loujine/musicbrainz-scripts
Expand Down Expand Up @@ -58,7 +58,7 @@ const setAttributes = (targetType, attrName, toggle) => {
});
await helper.delay(1);

document.querySelector('.dialog-content button.positive').click();
document.querySelector('.relationship-dialog button.positive').click();
});
});
};
Expand Down
Loading

0 comments on commit 2f9b89e

Please sign in to comment.