Workaround for "Youtube Music playlist stalls on uploaded music" music-assistant/support#4469#3156
Workaround for "Youtube Music playlist stalls on uploaded music" music-assistant/support#4469#3156whitty wants to merge 2 commits intomusic-assistant:devfrom
Conversation
|
I would like to solve the root of the issue rather than implementing an 'except workaround'. Can you let me know what the album id is of your custom uploaded track that is triggering the issue? That might shed some light on this case. |
| except ytmusicapi.exceptions.YTMusicUserError as e: | ||
| if prov_album_id is not None and "must start with MPRE" in str(e): | ||
| logging.getLogger("music_assistant").getChild("YouTube Music").debug("ytmusicapi refused to handle prov_album_id: '%s'", prov_album_id) | ||
| return None |
There was a problem hiding this comment.
Note None is not a normal return path for ytm.get_album() there is no obvious "not-found" result
Understood. As I've pointed out the
Can you explain exactly what information you are after? As described the I do not know where this value came from - presumably from a query of the youtube api elsewhere and/or stored by MA itself from some source. |
|
That's exactly the info I was after. It looks like YTM internally stores this value as the album id for a track that was manually uploaded. Now of course we cannot link this to any album out there, which ultimately causes this error. My suggestion is to prevent this value from ever creeping into MA. So instead of failing on a invalid album id in the |
MarvinSchenkel
left a comment
There was a problem hiding this comment.
Please have a look at my suggestion and mark this PR 'Ready for review' again once you have made the changes.
|
@whitty any progress on this? Would be good to get it into 2.8 |
Sorry - I've been busy and not gotten back to this. I haven't had a chance to play around here. I'm trying to parse your suggestion, and also clarify the behaviour I see (before attempting the change). I know these are true:
My concern with this, is that it might "throw out the baby with the bathwater". Would that change leave the track "orphaned" in MA - just a track, but not on an album? Is What I can't tell from the stack-traces is what information is being fetched, but I'd prefer to keep the album for its "Identity value", just return any metadata queries as if there was no data attached to that album. Not knowing the structure of how MA manages things I might be saying the wrong thing. I know my change doesn't really do that, but it kind of does by effect. I suspect there's a point in the middle where this could be managed more cleanly. Trying to look a little deeper: This is replacing Did we have enough information in I will instrument the code you have mentioned, then try preventing the mapping from being created, though I'm worried about the side-effects and whether |
117afe5 to
9d3b9e0
Compare
|
OK - I've looked deeper and I'm happier with this, though I still class it as "workaround" at this point - it prevents the playback errors. Digging through ytmusicapi This seems to resolve an OK Is there a place to put test-data - eg unittests for |
9d3b9e0 to
14694b2
Compare
As per the API source ytm.get_library_upload_album() is the correct API for fetching uploaded albums: https://github.com/sigma67/ytmusicapi/blob/a8a120f37c5363ffb4d36d226c1afb2051bd4d79/ytmusicapi/mixins/uploads.py#L197 The result seems mostly compatible, except for the "playlist patch" a few lines below, so just make that permissive.
14694b2 to
7aa54b9
Compare
|
Yep there is a |
|
Marking this PR as draft so we can keep track of which PRs needs our attention. Please mark as 'Ready for review' when you want us to have another look 🙏 . |
This is a workaround for the "stalling" aspect of music-assistant/support#4469
MA tries to resolve albums providing the
prov_album_idof the formFEmusic_library_privately_owned_release_detailb_po_<probably private_letters_and_numbers_id>which triggers an exception inytmusic.get_album()as it checks that the ID.startswith('MPRE').The handling of the exception seems to lead to playback stalling in this case. Catching and returning
None(presumably like "not found") instead leads to a warning as follows, but playback doesn't stall.This may not resolve the base issues:
get_album()in that case)Approach:
I preferred to catch the exception rather than check the prefix, in case
ytmusicapiresolves the issue and allows non MPRE prefixes in the future.Since the Exception is a generic
UserErrortype I specifically check the message and propagate any other exceptions..Additionally I removed a duplicate lookup rather than expand the
tryblock further.