Open hernikplays opened 1 year ago
You'll have to pardon me as I haven't looked at this code in months. Having said that, I don't really have enough info here to reproduce the issue. In trying to do so I realized my logging method was broken and I've pushed a small change to address that which you can read more about in the bottom of the README if you're interested. It mostly just logs variables that it seems your debugger can already see.
The error you got appears to indicate an error specifically with the MusicBrainz server (https://python-musicbrainzngs.readthedocs.io/en/v0.7.1/api/#musicbrainzngs.ResponseError). That might be why you got partial data in your get_playing_now
request. You could try later or try another ListenBrainz user like me (qouesm) and see if anything changes. You may also want to make sure your release is in the MusicBrainz database. The easier thing might be to just listen to something very popular. This is how one of my responses looks for the sake of comparison:
DEBUG:root:get_playing_now()
DEBUG:root:{'additional_info': {'artist_mbids': ['955ff0c2-502a-4aea-92fd-1810fba171c2'],
'release_mbid': 'cc9f8260-7f8e-49f2-b71b-b9443c8d010d',
'submission_client': 'navidrome',
'submission_client_version': '0.49.3 (8b93962f)',
'track_mbid': '56e2b4b4-7556-4363-acce-a3aa5010b4c7',
'tracknumber': 4},
'artist_mbids': ['955ff0c2-502a-4aea-92fd-1810fba171c2'],
'artist_name': 'Wolfgang Muthspiel',
'isrc': None,
'listened_at': None,
'listening_from': None,
'recording_mbid': None,
'release_group_mbid': [],
'release_mbid': 'cc9f8260-7f8e-49f2-b71b-b9443c8d010d',
'release_name': 'Rising Grace',
'spotify_id': None,
'tags': [],
'track_name': 'Father and Sun',
'tracknumber': 4,
'username': None,
'work_mbids': []}
DEBUG:root:Status.PLAYING
I do believe this has to be something to do with the listenbrainz API.
When I query the playing-now
API endpoint (which the python library is using) with curl on my PC, it also does not return release_mbid
anywhere. This is probably related to this bug report, basically it doesn't return the mbid, until it's a permanent listen (and I don't think the endpoint returns it even after that) so the only solution would probably be to either fetch it from listens, which will be delayed, or use the metadata/lookup
endpoint to find the data, which might not be reliable if for example a song is not tagged properly.
curl https://api.listenbrainz.org/1/user/hernikplays/playing-now
{"payload":{"count":1,"listens":[{"playing_now":true,"track_metadata":{"additional_info":{"duration":284,"music_service_name":"YouTube Music","origin_url":"https://music.youtube.com/watch?v=8WEe-MmC4ag&list=RDATiXvuz9NT98_ulk","submission_client":"Web Scrobbler","submission_client_version":"3.0.15"},"artist_name":"Max Coveri","release_name":"SEB presents \u982d\u6587\u5b57[\u30a4\u30cb\u30b7\u30e3\u30eb]D \uff5eD SELECTION\uff5e","track_name":"Running in the 90's"}}],"playing_now":true,"user_id":"hernikplays"}}
There's a chance your scrobbler may be affecting things. I built this project around the scrobbler built into the Navidrome project and so it may be different depending on that but I'm not knowledgeable enough on that to say how they work and if that's really the problem. If you wanted to consider rebuilding it for your own use case, try seeing what data pylistenbrainz gives you as opposed to the pure http API. You can run these lines just in a Python console:
import pylistenbrainz
from pprint import pformat
USER = [YOUR USERNAME]
client = pylistenbrainz.ListenBrainz()
listen = client.get_playing_now(USER)
print(pformat(vars(listen)))
Beyond that, I'm really not sure how to help. Additionally, that bug report link is dead for me so I cannot comment on that. I'm considering a TS rewrite such that I can run this as a plugin for a modded Discord client instead of as a bare Python script I manage with my WM autostart if you want to check back another time.
Closing due to inactivity and not being able to replicate the issue. Additionally, I've finished work on the aforementioned modded client (Vencord) plugin which I will be using instead of this program: https://github.com/qouesm/vencord-listenbrainz-rpc
@hernikplays I've laid the readme rather bare but feel free to contact me via Discord (@qouesm) if you are comfortable using a modded client and would like help installing said plugin.
Hey, when I tried to run the program, it threw a
musicbrainzngs.musicbrainz.ResponseError: caused by: HTTP Error 400: Bad Request
and exited. I'm running Arch Linux and I tried to run the program using python 3.11 and 3.8 to no avail.From what I saw, it was trying to run
get_status
and on line 61 it's trying to get release info using therelease_mbid
property of thelisten
variablehttps://github.com/qouesm/listenbrainz-discord-presence/blob/3686147be525339113b8797d838983721e43d60d/main.py#L61-L62
However, the![Screenshot of variable debug section in VSCodium](https://files.catbox.moe/uajwc7.png)
release_mbid
isNone
(at least according to VSCodium)Don't know if I set up something wrong or if it's an error in the library. Cheers!