Giter VIP home page Giter VIP logo

musicbrainz-scripts's Introduction

Musicbrainz scripts

Code validation

Collection of greasemonkey scripts I wrote for MusicBrainz display and editing.

Contact me for bug reports/suggestions/patches: loujine on github, loujin on Musicbrainz (sadly 'loujine' was already taken)

Compatibility

Scripts are tested with the latest stable version of Firefox and Tampermonkey. They should work with most recent browsers and with ViolentMonkey, but are not compatible with Greasymonkey 4 since December 2017.

Historical note: this repo was first a mercurial repo on bitbucket (mirrored as a git repo on github); now that bitbucket has removed mercurial support, github is the home of the repo and the bitbucket repo is outdated.

Historical note 2: scripts were also hosted on Greasyfork but were removed there in summer 2020. If you installed scripts through Greasyfork, make sure they can update to versions using github in @updateURL or reinstall them.

Content

Documentation was moved to a wiki.

Discussions on these scripts sometimes take place on the musicbrainz forums.

Installing

For installation, follow the Greasemonkey manual

Scripts to add/modify information display

Display (missing) work relations for an artist recordings

Mark recordings not linked to any work on an artist recordings or relationships page

Source Install

Display RG timeline

Display release groups timeline on artist overview page

Source Install

Display alias count

Display alias count on work/artist pages

Source Install

Display sort button on table columns

Make table columns sortable

Source Install

Show recordings of subworks on Work page

Source Install

Scripts to edit entities

MusicBrainz edit: Add entity aliases in batch

Source Install

MusicBrainz edit: Change release quality

Source Install

MusicBrainz edit: Create entity or fill data from wikipedia / wikidata / VIAF / ISNI

Source Install

MusicBrainz edit: Create work arrangement from existing work

Source Install

MusicBrainz edit: Display acoustIDs and merge recordings with common acoustID

Source Install

MusicBrainz edit: Mark recordings as video

Source Install

MusicBrainz edit: Replace recording artists from a Release page

Source Install

MusicBrainz edit: Replace recording artists from an Artist or Work page

Source Install

MusicBrainz edit: Replace subwork titles and attributes in Work edit page

Source Install

MusicBrainz edit: Set recording names as work aliases

Source Install

MusicBrainz edit: Set work attributes from the composer Work page

Set attributes (type, lang, key) from the composer Work page

Source Install

MusicBrainz event editor: Fill event setlist

Source Install

MusicBrainz recording: Create broadcast release from the current recording

Create a "Broadcast" release containing the current recording

Source Install

MusicBrainz recording: Seed concert event from recording

Seed a "Concert" event with the same content as the current recording

Source Install

Merge recordings from acoustID page

Source Install

Scripts to edit relations

MusicBrainz relation editor: Clone recording relations onto other recordings

Source Install

MusicBrainz relation editor: Copy dates on recording relations

Copy/remove dates on recording relations

Source Install

MusicBrainz relation editor: Guess related works in batch

Source Install

MusicBrainz relation editor: Replace release relations by recording relations

Source Install

MusicBrainz relation editor: Set relation attributes

Set attributes (live, partial, solo...)

Source Install

MusicBrainz relation editor: set role in recording-artist relation

Set/unset role relations on selected recordings

Source Install

Importer scripts

Importer scripts should be installed from murdos's repo when possible (e.g. Naxos Library)

Import Idagio releases to MusicBrainz

Add a button to import Idagio releases to MusicBrainz

Source Install

Import Hyperion/Helios releases to MusicBrainz

Add a button to import Hyperion/Helios releases to MusicBrainz

Source Install

Contributors

List of contributors

… and thanks to many MusicBrainz editors/MetaBrainz developers for suggestions and feedback.

!m everyone

License

MIT

Tests

You can run automatic python tests with e.g.:

SHOW=1 pytest -s tests/

Reporting bugs & Contributing

Please submit all patches to github for review.

musicbrainz-scripts's People

Contributors

dukeyin avatar jerome-roy avatar jesus2099 avatar josef-friedrich avatar kellnerd avatar loujine avatar reosarevok avatar ropdebee avatar serdioa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

musicbrainz-scripts's Issues

Edit Note in new Line

Regarding script:

Set guessed works

GM script: "MusicBrainz relation editor: Guess related works in batch"

Hi I'm currently using this script frequently; and these text get add in the Edit note. But it always get add at the end of my current text (I'm also using Elephant memory by jesus2009) which mess up the URL a bit.

Is it possible that this line of text get create/add in a new line? instead of after the latest character. So it currently like this at the moment:

Please see: https://musicbrainz.org/Set guessed works
 —
GM script: "MusicBrainz relation editor: Guess related works in batch"

Instead can it be like this:

Please see: https://musicbrainz.org/
Set guessed works
 —
GM script: "MusicBrainz relation editor: Guess related works in batch"

[display split recordings] Does not work on non classical works

Sub works with no artist relationships: https://musicbrainz.org/work/8f32fb44-fde9-4e44-ad54-d7ac12703b4f
The recording table remains empty.

I am completely clueless with ES6 syntax so I tried really hard but really could not help with a PR.
You should include inc=artist-credits too and props['artists'] should get the recording list of artists from json["artist-credit"].

function fetchRelatedRecordings(mbid, props) {
// wsUrl
fetch(`/ws/2/recording/${mbid}?fmt=json&inc=artist-rels releases`).then(
resp => resp.json()
).then(json => {
if (
json.relations == undefined || json.relations.length === 0 || json.releases.length === 0
) {
return;
}
const rels = json.relations.filter(
rel => ['instrument', 'vocal', 'orchestra', 'conductor'].includes(rel.type)
);
if (rels.length === 0) {
return;
}
for (const rel of json.releases) {
counts[rel.id] = counts[rel.id] || [];
props['artists'] = rels.map(rel => rel.artist.name).join(', ');
counts[rel.id].push(props);
}
})
}

Replace jquery syntax

No reason to use jquery nowadays, we should replace all jquery syntax step by
step (when updating scripts for other reasons)

Set video recordings not working on beta.mb.org

The script gets stuck at "Fetching required data".
The browser console shows the following:

Uncaught TypeError: (new RegExp(...)).exec(...) is null
    getEditParams moz-extension://662a72d0-a6f2-423b-8f8c-6c05d5eb0256/ MusicBrainz edit: Mark recordings as video.user.js#16:592
    GET moz-extension://662a72d0-a6f2-423b-8f8c-6c05d5eb0256/ MusicBrainz edit: Mark recordings as video.user.js#16:561
    onreadystatechange moz-extension://662a72d0-a6f2-423b-8f8c-6c05d5eb0256/ MusicBrainz edit: Mark recordings as video.user.js#16:541
    ce https://staticbrainz.org/MB/common-chunks-a7f66eb.js:2
    r https://staticbrainz.org/MB/common-chunks-a7f66eb.js:2
[5694a93e-ea67-4bd2-b8fc-605980b75e9b:592:60](https://beta.musicbrainz.org/release/5694a93e-ea67-4bd2-b8fc-605980b75e9b?unset_beta=1)
    getEditParams moz-extension://662a72d0-a6f2-423b-8f8c-6c05d5eb0256/ MusicBrainz edit: Mark recordings as video.user.js#16:592
    GET moz-extension://662a72d0-a6f2-423b-8f8c-6c05d5eb0256/ MusicBrainz edit: Mark recordings as video.user.js#16:561
    onreadystatechange moz-extension://662a72d0-a6f2-423b-8f8c-6c05d5eb0256/ MusicBrainz edit: Mark recordings as video.user.js#16:541
    ce https://staticbrainz.org/MB/common-chunks-a7f66eb.js:2
    r https://staticbrainz.org/MB/common-chunks-a7f66eb.js:2

remove styling

It would be good if all styling was removed from the code. Functionality and style should not be mixed. It now clashes with some dark mode style which makes it ugly and hard to read.

image

Issues from bitbucket

Since bitbucket will remove the musicbrainz-scripts mercurial repo and its issues today, I'm making a short list of open issues there, in case I want to open them again:

  • BB#3: "set work attributes" script: add all languages
  • BB#16: New script to merge recordings from Work page
  • BB#19: "sort columns" script: deal separately with subtables
  • BB#27: New script: batch-add aliases
  • BB#39: Firefox57/Greasemonkey4 compatibility
  • BB#44: Release timeline on Mac/Firefox zooms unexpectedly and way too far
  • BB#48: Display favicon for every external link
  • BB#54: Problem with link import data from Wikidata (bandcamp links, https://www.wikidata.org/wiki/Q3481131)

Scripts won't display.

Continued from #9 (comment)

@loujine: Thanks, Jérôme.

what version of the scripts do you have?

Scripts 2020.9.8, 2020.9.8.1
Tampermonkey 4.11.6117
Safari 13.1.2
macOS 10.14.6

what error message can you see in the console?

[Error] Syntax error @ "MusicBrainz edit: Create entity or fill data from wikipedia / wikidata / VIAF / ISNI"!
##########################
JSHINT output:
##########################

eval@[native code]
https://musicbrainz.org/artist/foobar
c@https://musicbrainz.org/artist/foobar
https://musicbrainz.org/artist/foobar
na
create
d
runListeners

P@https://musicbrainz.org/artist/foobar
dispatchEvent@[native code]
send@safari-extension://5834CAFB-16E5-4929-8B50-99BF49DD63EB/6fd470cf/content.js:7:278
safari-extension://5834CAFB-16E5-4929-8B50-99BF49DD63EB/6fd470cf/content.js:27:157
processQueue@safari-extension://5834CAFB-16E5-4929-8B50-99BF49DD63EB/6fd470cf/content.js:3:121
a@safari-extension://5834CAFB-16E5-4929-8B50-99BF49DD63EB/6fd470cf/content.js:9:397
	error
	(anonymous function) (Anonymous Script 1 (line 60:378))
	(anonymous function) (Anonymous Script 1 (line 22:150))
	I (Script Element 2:11)
	P (Script Element 2:11:117)
	dispatchEvent
	(anonymous function) (content.js:7:149)
	b (topee-content.js:2277)

If you have a too old version, the upgrade won't work. Reinstall the scripts instead.

Reinstalled. Still no luck.

Set video recordings: Add per medium checkbox

First of all, thanks for the great user script.

Currently we can select individual recordings or all recordings on a release, but we miss an option for what could be the most common case: all recordings on a medium, but not all mediums on a release. Would it be possible to add a medium-level checkbox (automatically selecting all recordings on that medium) for quicker editing?

Port userscripts to the new relationship editor

Userscripts which will be broken by MBS-11847 - Port the relationship editors to React:

  • MusicBrainz relation editor: Clone recording relations onto other recordings
  • MusicBrainz relation editor: Copy dates on recording relations
  • MusicBrainz relation editor: Guess related works in batch
  • MusicBrainz relation editor: Replace release relations by recording relations
  • MusicBrainz relation editor: set role in recording-artist relation
  • MusicBrainz relation editor: Set relation attributes

Let me know if you need any help with that task, as I've already tackled the new relationship editor for my own userscripts and even requested some userscript hooks to be exposed by MBS client-side code.
You can find the relevant parts of my code which automate the React relationship editor inside this directory. If you want, you can just copy the helper functions that you need or I could provide a bundled library script, which could be @required by your userscripts.

Wikidata importer no longer triggers autocomplete

For some time, the importer fills e.g. the area fields of an artist with the MBID of the area.
One has to manually type e.g. a space after the MBID to make the autocomplete input recognize the change and turn green with the name of the area.

Crashes MBS menu on pages with no sidebar change quality links

Go to a release (open) edits page.
The MBS menu will be blocked by mb-edit-change_release_quality script crash:

Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')

document.getElementById('upgrade_quality').addEventListener('click', () => {
_changeQuality(1)
});

It is not supposed to run this line if the change quality link is not found.
The change quality link presence check is coming too late.

for aliases for ff44

Hi, this is for https://github.com/loujine/musicbrainz-scripts/tree/aliases_for_ff44

I've got some instruments + new ones added since (MBS-12527) that I'd like to have added to the drop down for language selection in the batch aliases script

.arz (arb in egypt add) (basically the arabic egypt sub option)
.chr (cherokee add)
.gv (manx add)
.mai (maithili add)
.no (general norwegian add)
.rm (romansh add)
.sa (sanskrit add)
.sc (sardinian add)
.su (sundanese add)

Display Mising work

Hi

Display Missing work does not work anymore. I also don't see the button anymore. Checked for updates and there werent any.

Working with Firefox

Hope you understand what I mean my english is very bad

ty for this wonderful addon Now im feeling sad

Love
Tis

Add tests using selenium

Add tests (written in Python) checking on test.mb.o that

  • userscript code can be loaded
  • buttons/menus appear
  • clicking buttons changes the page

Would be nice to test with Chrome and with Firefox webdrivers

No need to test that edits are valid for the moment

mb-edit-create_from_wikidata does nothing

It seems like there’s a script error:

Script error in [Greasemonkey script mbz-loujine/MusicBrainz edit: Create entity or fill data from wikipedia / wikidata / VIAF / ISNI; version 2023.3.11]:
ReferenceError: $ is not defined ISNI:1703:19
    <anonymous> user-script:mbz-loujine/MusicBrainz edit: Create entity or fill data from wikipedia / wikidata / VIAF / ISNI:1703

Peek 2023-07-27 11-18

Firefox 115.0.2
Greasemonkey 4.11

mb-reledit-copy_dates.user.js: Copy dates on recordings” script only works if used as first action after "Edit Relationships" on a release

When I try to use the “Copy dates on recordings” script from loujine it must be the FIRST action after pressing the “Edit Relationships” tab on a release. Otherwise it does just nothing.

My typical use case is copying dates of a live event to all the performers of a recording. First of all it ONLY works if the date is already set on the recordings “place” (it will NOT work if the recording has an “event” set with the date of the live live event.

But what really bugs me is that the script only works when it is executed right after pressing “Edit Relationships” as the FIRST event.

The other bug has already been mentioned. Pressing one of the two script buttons “Copy Dates” or “Removes Dates” has no visual feedback except that it either works when being the FIRST action after “Edit Relationships” or it only pretends doing its work and adding a comment to the notes section if it is NOT called as the FIRST action after “Edit Relationships”

mb-reledit-set_instruments does nothing

After selecting instruments to change and clicking apply, nothing happens.
I think this is a simple fix to change on line 32 to use attr.typeID instead of attr.type.id :

|| rel.attributes.map(attr => attr.typeID).includes(fromAttrId)

Making that change locally seems to work for me at least (Tampermonkey 4.19, Chrome, Windows 11).

ISNI import broken in wikidata/VIAF/ISNI script

Follow-up to #14

ISNI import doesn't do anything, due to a failed parsing of the ISNI page where we are looking for links.
GM_XHR returns a XML tree that would need to be parsed with XPath (or regexps to find href links?)

NB: We can't use fetch because of CORS errors, we need to use GM_XHR.

Add languages to the add alias script

Hi! Posting on behalf of CatCat who can't access Github.

Requested languages are:

chinese traditional
chinese simplified
singaporean (Chinese Singapore Simplified)
taiwanese (Chinese Taiwan Traditional)
Chinese Hong Kong (Chinese Hong Kong SAR China Traditional)
marathi
kannada
tamil
gujarati
telugu
sinhala
burmese
georgian
Kurdish (Central)
Asturian
Galician
Gaelic
Frisian (Western)
Mongolian
Kyrgyz
Quechua
Interlingua
Somali
Yoruba
Zulu
Filipino
Uyghur
Breton
Faroese
Yiddish
Luxembourgish
Amharic
Low German

Also:

additionally, if it was possible to prepend languages with their two-letter id code (as seen f.ex on the side https://www.wikidata.org/wiki/Q1365218 ) which would let me simply write "es" for spanish, "nn" for nynorsk, "fa" for persian etc. in the language list.

relation editor: Set relation attributes not working

The above mentioned script doesn't work for me since the new relationship editor was integrated. Clicking the buttons doesn't seem to do anything.

I verified I'm on the latest version (2023.3.6).
Running with

  • Chrome 112.0.5615.138
  • Violentmonkey 2.14.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.