murdos / musicbrainz-userscripts

Collection of userscripts for MusicBrainz, by various authors
535 stars 89 forks source link

Track Discrepancy Warning Included in Release Name When Scrobbling #551

Open zabe40 opened 9 months ago

zabe40 commented 9 months ago

When I listen to a Bandcamp Album with bonus tracks like this one, the "Warning: 50 vs 48 tracks" text is included in the "release_name" value of my scrobble, as seen below. (I scrobble to ListenBrainz with Web Scrobbler on Firefox.)

{
  "inserted_at": 1700948113,
  "listened_at": 1700948092,
  "recording_msid": "168ac1d4-e84b-4d6e-9914-4ad1c4ebdb83",
  "track_metadata": {
    "additional_info": {
      "duration": 40,
      "music_service_name": "Bandcamp",
      "origin_url": "https://knucklesandwichgame.bandcamp.com/album/knuckle-sandwich-soundtrack-the-gyms-tracks",
      "recording_msid": "168ac1d4-e84b-4d6e-9914-4ad1c4ebdb83",
      "submission_client": "Web Scrobbler",
      "submission_client_version": "3.2.0"
    },
    "artist_name": "Gyms",
    "release_name": "Knuckle Sandwich Soundtrack: The Gyms Tracks\n\nWarning: 50 vs 48 tracks",
    "track_name": "Knuckle Sandwich"
  },
  "user_name": "zabey"
}

I think I've found how Web Scrobbler gets the album name from the page: https://github.com/web-scrobbler/web-scrobbler/blob/d0a183bf72a8acc17c3a0a93dbeb0bfe92200533/src/connectors/bandcamp.ts#L112 and it looks like it's just this line that captures everything in the trackTitle class.

    Connector.albumSelector = '#name-section .trackTitle';
<div id="name-section">
        <h2 class="trackTitle">
            Knuckle Sandwich Soundtrack: The Gyms Tracks

        <p style="font-size: 70%; font-style: italic; margin: 0.1em 0;">Warning: 50 vs 48 tracks</p></h2>

        <h3 style="margin:0px;">by 
        <span> 
          <a href="https://knucklesandwichgame.bandcamp.com">Gyms</a>
          </span>

        </h3>
<omitted>
</div>