vjeranc / cmus-status-scrobbler

Standalone scrobbler program, not a continuously running process, written in Python 3 that works together with cmus. Allows offline mode, scrobbling multiple servers simultaneously, sending a now playing request and handles pause status well.
GNU General Public License v3.0
17 stars 1 forks source link

album titles with »« dont seem to work for now playing (works after track has finished) #11

Open worbgge opened 2 months ago

worbgge commented 2 months ago

Environment

Python version: 3.12.4 cmus version: 2.11.0

Log file

3276303 2024-09-15 10:22:48 INFO root Sending now playing for lastfm
3276303 2024-09-15 10:22:48 INFO root {'artist': 'Gustav Mahler', 'track': 'Symphony No. 2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Im Anfang Sehr Zurückgehalten«', 'album': 'Symphony No. 2 in C minor »Resurrection«', 'trackNum
ber': '7', 'duration': '79', 'albumArtist': 'Mahler; Leonard Bernstein, New York Philharmonic', 'mbid': '5478ac7a-a827-49be-ae25-ebe355791b05', 'sk': 'ZDJ05JNf2k-Df3jTedFtUR5TRhByZHTA', 'api_key': '3f427fc05464646ddf068ca2b02fbb6c', 'metho
d': 'track.updateNowPlaying', 'api_sig': '8b39a6d78850d4baf725c6aae25b46c8', 'format': 'json'}
3276303 2024-09-15 10:22:48 INFO root {"nowplaying":{"artist":{"corrected":"0","#text":"Gustav Mahler"},"track":{"corrected":"0","#text":"Symphony No. 2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Im Anfang Sehr Zurückgehalten«"},"ignoredMessage":{"code":"0","#text":""},"albumArtist":{"corrected":"0","#text":"Mahler; Leonard Bernstein, New York Philharmonic"},"album":{"corrected":"0","#text":"Symphony No. 2 in C minor »Resurrection«"}}}
3276303 2024-09-15 10:22:48 INFO root Sending now playing for listenbrainz
3276303 2024-09-15 10:22:48 INFO root {'artist': 'Gustav Mahler', 'track': 'Symphony No. 2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Im Anfang Sehr Zurückgehalten«', 'album': 'Symphony No. 2 in C minor »Resurrection«', 'trackNumber': '7', 'duration': '79', 'albumArtist': 'Mahler; Leonard Bernstein, New York Philharmonic', 'mbid': '5478ac7a-a827-49be-ae25-ebe355791b05', 'sk': '73bbfec236a99df8834219f320fe3bc4f9688f3d', 'api_key': '3f427fc05464646ddf068ca2b02fbb6c', 'method': 'track.updateNowPlaying', 'api_sig': '339d7f6be22ff469f647c8cc29cd4484'}
3276303 2024-09-15 10:22:48 INFO root <?xml version="1.0" encoding="utf-8"?>
<lfm status="ok">
  <nowplaying>
    <track corrected="0">Symphony No. 2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Im Anfang Sehr Zurückgehalten«</track>
    <artist corrected="0">Gustav Mahler</artist>
    <album corrected="0">Symphony No. 2 in C minor »Resurrection«</album>
    <albumArtist corrected="1">Gustav Mahler</albumArtist>
    <timestamp>1726392168</timestamp>
    <ignoredMessage code="0"></ignoredMessage>
  </nowplaying>
</lfm>
3277185 2024-09-15 10:24:07 INFO root Status(status='playing', file='/mnt/sdb/media/music/Mahler; Leonard Bernstein, New York Philharmonic/album; live/[1988] Symphony No. 2 in C minor »Resurrection«/2-8 Symphony No. 2 in C minor »Resurrection«_ V. Im Tempo des Scherzos »Wieder Sehr Breit«.mp3', artist='Gustav Mahler', albumartist='Mahler; Leonard Bernstein, New York Philharmonic', album='Symphony No. 2 in C minor »Resurrection«', discnumber='2', tracknumber='8', title='Symphony No. 2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Wieder Sehr Breit«', date='1988', duration='221', musicbrainz_trackid='cdb94e35-2ea5-4b9a-b9a5-113bc73fe0ac', cur_time=datetime.datetime(2024, 9, 15, 9, 24, 7, 161899))
3277185 2024-09-15 10:24:07 INFO root Scrobbling previous tracks for lastfm
3277185 2024-09-15 10:24:07 INFO root {'sk': 'ZDJ05JNf2k-Df3jTedFtUR5TRhByZHTA', 'artist[0]': 'Gustav Mahler', 'track[0]': 'Symphony No. 2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Im Anfang Sehr Zurückgehalten«', 'timestamp[0]': '1726392167', 'album[0]': 'Symphony No. 2 in C minor »Resurrection«', 'trackNumber[0]': '7', 'mbid[0]': '5478ac7a-a827-49be-ae25-ebe355791b05', 'albumArtist[0]': 'Mahler; Leonard Bernstein, New York Philharmonic', 'duration[0]': '79', 'api_key': '3f427fc05464646ddf068ca2b02fbb6c', 'method': 'track.scrobble', 'api_sig': 'c4aa29441ad6ef8397ba7fae28bc7ad0', 'format': 'json'}
3277185 2024-09-15 10:24:07 INFO root {"scrobbles":{"scrobble":{"artist":{"corrected":"0","#text":"Gustav Mahler"},"album":{"corrected":"0","#text":"Symphony No. 2 in C minor »Resurrection«"},"track":{"corrected":"0","#text":"Symphony No.
2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Im Anfang Sehr Zurückgehalten«"},"ignoredMessage":{"code":"0","#text":""},"albumArtist":{"corrected":"0","#text":"Mahler; Leonard Bernstein, New York Philharmonic"},"timestamp":"1726392167"},"@attr":{"ignored":0,"accepted":1}}}
3277185 2024-09-15 10:24:07 INFO root Scrobbling previous tracks for listenbrainz
3277185 2024-09-15 10:24:07 INFO root {'sk': '73bbfec236a99df8834219f320fe3bc4f9688f3d', 'artist[0]': 'Gustav Mahler', 'track[0]': 'Symphony No. 2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Im Anfang Sehr Zurückgehalten«', 'timestamp[0]': '1726392167', 'album[0]': 'Symphony No. 2 in C minor »Resurrection«', 'trackNumber[0]': '7', 'mbid[0]': '5478ac7a-a827-49be-ae25-ebe355791b05', 'albumArtist[0]': 'Mahler; Leonard Bernstein, New York Philharmonic', 'duration[0]':
'79', 'api_key': '3f427fc05464646ddf068ca2b02fbb6c', 'method': 'track.scrobble', 'api_sig': '87b3951d5f070ec3cfc52ae5917354d3'}
3277185 2024-09-15 10:24:07 INFO root <?xml version="1.0" encoding="utf-8"?>
<lfm status="ok">
  <scrobbles accepted="1" ignored="0">
    <scrobble>
      <track corrected="0">Symphony No. 2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Im Anfang Sehr Zurückgehalten«</track>
      <artist corrected="0">Gustav Mahler</artist>
      <album corrected="0">Symphony No. 2 in C minor »Resurrection«</album>
      <albumArtist corrected="1">Gustav Mahler</albumArtist>
      <timestamp>1726392167</timestamp>
      <ignoredMessage code="0"></ignoredMessage>
    </scrobble>
  </scrobbles>
</lfm>
3277185 2024-09-15 10:24:07 INFO root Sending now playing for lastfm
3277185 2024-09-15 10:24:07 INFO root {'artist': 'Gustav Mahler', 'track': 'Symphony No. 2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Wieder Sehr Breit«', 'album': 'Symphony No. 2 in C minor »Resurrection«', 'trackNumber': '8', 'duration': '221', 'albumArtist': 'Mahler; Leonard Bernstein, New York Philharmonic', 'mbid': 'cdb94e35-2ea5-4b9a-b9a5-113bc73fe0ac', 'sk': 'ZDJ05JNf2k-Df3jTedFtUR5TRhByZHTA', 'api_key': '3f427fc05464646ddf068ca2b02fbb6c', 'method': 'track.updateNowPlaying', 'api_sig': 'c46a5eb276f8bb36d66d438bd94fbf05', 'format': 'json'}
3277185 2024-09-15 10:24:07 INFO root {"nowplaying":{"artist":{"corrected":"0","#text":"Gustav Mahler"},"track":{"corrected":"0","#text":"Symphony No. 2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Wieder Sehr Breit«"},"ignoredMessage":{"code":"0","#text":""},"albumArtist":{"corrected":"0","#text":"Mahler; Leonard Bernstein, New York Philharmonic"},"album":{"corrected":"0","#text":"Symphony No. 2 in C minor »Resurrection«"}}}
3277185 2024-09-15 10:24:07 INFO root Sending now playing for listenbrainz
3277185 2024-09-15 10:24:07 INFO root {'artist': 'Gustav Mahler', 'track': 'Symphony No. 2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Wieder Sehr Breit«', 'album': 'Symphony No. 2 in C minor »Resurrection«', 'trackNumber': '8', 'duration': '221', 'albumArtist': 'Mahler; Leonard Bernstein, New York Philharmonic', 'mbid': 'cdb94e35-2ea5-4b9a-b9a5-113bc73fe0ac', 'sk': '73bbfec236a99df8834219f320fe3bc4f9688f3d', 'api_key': '3f427fc05464646ddf068ca2b02fbb6c', 'method': 'track.updateNowPlaying', 'api_sig': '406da36dde4627b0a26638331bc1523f'}
3277185 2024-09-15 10:24:07 INFO root <?xml version="1.0" encoding="utf-8"?>
<lfm status="ok">
  <nowplaying>
    <track corrected="0">Symphony No. 2 in C minor »Resurrection«: V. Im Tempo des Scherzos »Wieder Sehr Breit«</track>
    <artist corrected="0">Gustav Mahler</artist>
    <album corrected="0">Symphony No. 2 in C minor »Resurrection«</album>
    <albumArtist corrected="1">Gustav Mahler</albumArtist>
    <timestamp>1726392248</timestamp>
    <ignoredMessage code="0"></ignoredMessage>
  </nowplaying>
</lfm>

when an album is using »« in the album tag it doesn't scrobble an album when the track is now playing but once the track has finished it scrobbles with the album. 2024-09-15_10-23 2024-09-15_10-24

vjeranc commented 2 months ago

This might have something to do with <albumArtist corrected="1">Gustav Mahler</albumArtist>. Album artist changed from semicolon delimited list Mahler; Leonard Bernstein, New York Philharmonic to just a single entry. The display of the album fails for first request but then succeeds for the second scrobble request.

I think a fix could be to resend now playing if server responds with corrected="1" using the values sent by the server.

It is a bit of a shame that the server you're using does not use its corrections to display "now playing".