Add Discogs translator - #3451
Conversation
|
Still working on getting CI working again; don't worry about the errors. |
There was a problem hiding this comment.
Pull request overview
This PR adds a new Zotero translator for Discogs (www.discogs.com) to enable proper citation of music releases and audio recordings. The translator extracts metadata from Discogs release pages using JSON-LD structured data and maps it to Zotero's audioRecording item type.
Key Changes:
- New translator that parses JSON-LD data from Discogs release pages
- Maps release metadata including title, artists, label, format, date, catalog number, and genres
- Includes three test cases covering various vinyl release formats
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I tested this translator on localised Discogs URLs (e.g. Fix 1 — Fix 2 — let jsonLdScript = doc.querySelector('script[type="application/ld+json"]#release_schema')
|| doc.querySelector('script[type="application/ld+json"]');Addition 1 — country of release → if (jsonLd.releasedEvent?.location?.name) {
item.place = jsonLd.releasedEvent.location.name;
}Addition 2 — release notes → let notesEl = doc.querySelector('#release-notes .content_ETGfR [class^="notes_"]')
|| doc.querySelector('[class^="notes_"]');
if (notesEl) {
let notesText = notesEl.innerHTML
.replace(/<br\s*\/?>/gi, "\n")
.replace(/<[^>]+>/g, "")
.replace(/"/g, '"').replace(/&/g, "&")
.replace(/\n{3,}/g, "\n\n").trim();
if (notesText) item.extra = notesText;
}Full corrected file available on request. Tested on Zotero 9.0.3 / macOS Tahoe. |
Did your changes get accepted ? |
A Zotero translator for Discogs ( https://www.discogs.com/). Tested on https://www.discogs.com/release/126504-Micro-Vicious-Vic-Electric-Impact-The-Mixes
53288f7 to
09f47b5
Compare
|
@AbeJellinek The branch has been rebased onto current master and updated to address the requested changes:
Could you please re-review when convenient? |
A Zotero translator for Discogs, tested on a Discogs release.
Background
This translator was created to improve support for citing music releases and audio recordings, including physical formats such as vinyl, during BA(Hons) Creative Music Technology study at Falmouth University. Existing tools identified Discogs pages as audio recordings but did not reliably populate the relevant release metadata.
Method
The translator reads Discogs release-specific JSON-LD schema. It is intentionally limited to individual release pages, rather than master pages, because a release page supplies metadata such as the record label.
Changes in this update