Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easy Fix for a bug related to TIDAL library playback in the Roon Integration #50599

Closed
Divadeer opened this issue May 13, 2021 · 24 comments · Fixed by #51164
Closed

Easy Fix for a bug related to TIDAL library playback in the Roon Integration #50599

Divadeer opened this issue May 13, 2021 · 24 comments · Fixed by #51164
Assignees

Comments

@Divadeer
Copy link

Feedback

There is a bug that pops up when trying to play tracks in the Roon integration. It doesn't appear to be an issue when attempting to play an artist or album. The error that is thrown is "Found media does not have playable action list'['Play Now', 'Add Next', 'Queue', 'Start Radio']'".

I went into the roonapi and noticed the problem. It can be fixed by simply adding "/Play Now" to the end of the requested path. (e.g. the media_content_id would be something like:

"TIDAL/Your Favorites/Tracks/Africa/Play Now". You may want to add that to the documentation, or alternatively fix the integration by having that concatenation happen automatically in the background.

The reason it works is the play media command in the roon api accepts arguments of the form:

apiObject.play_media(speaker_id, [ "Parent Directory", "SubDirectory_1", ..., "fileName", "action_type"]). Clearly it defaults to "play now" for the action type in some situations (e.g. albums, artists, radio) but not in others.

URL

https://www.home-assistant.io/integrations/roon/

Version

2021.5.3

Additional information

No response

@pavoni
Copy link
Contributor

pavoni commented May 13, 2021

@Divadeer Thanks for the bug report.

As you thought that error is produced when the browsing code reaches a point where it doesn't find anything that roon describes as an action.

What the code should do is pick the first action if one isn't specified, so the default in your case should be `Play Now'.

What I suspect is happening is it isn't quite reaching the end of the path correctly.

Could you experiment with removing 'Play Now' but leaving the training \.

If that works I should improve the error message in that case (and fix the documentation).

@Divadeer
Copy link
Author

Divadeer commented May 13, 2021 via email

@pavoni
Copy link
Contributor

pavoni commented May 13, 2021

Your post is difficult to read - but I think I managed.

I may have to see if I can get a Tidal login.

The following works fine on Qobuz Qobuz/New Releases/Still Trending/Ella: The Lost Berlin Tapes

In the mean time - could you post the exact error message. It might give me a clue - but probably not!

@Divadeer
Copy link
Author

Divadeer commented May 13, 2021

Hey Sry, I did a direct reply via email. Didn't realize it would format it like that. Here is what I actually wrote, it included the error message:

Doesn’t appear to fix it. Throws the error Playback request for music / TIDAL/Your Favorites/Tracks/Lights/ / ['TIDAL', 'Your Favorites', 'Tracks', 'Lights', ''] was unsuccessful

I tried adding the ‘/’ to both the left hand side, before TIDAL, and the right hand side, after Lights, both with and without quotations, and it failed to play. That is:

Paths that don’t work:

media_content_id: /TIDAL/Your Favorites/Tracks/Lights

media_content_id: TIDAL/Your Favorites/Tracks/Lights/

media_content_id: “/TIDAL/Your Favorites/Tracks/Lights”

media_content_id: “TIDAL/Your Favorites/Tracks/Lights/”

media_content_id: TIDAL/“Your Favorites”/Tracks/Lights

media_content_id: TIDAL/“Your Favorites”/Tracks/Lights/

Paths that work:

media_content_id: TIDAL/Your Favorites/Tracks/Lights/Play Now

media_content_id: “TIDAL/Your Favorites/Tracks/Lights/Play Now”

Btw. I am running roon server on a windows 10 64-bit machine, and home assistant OS on a pi4. I know I was able to play some of my mp3 tracks from my actual library without adding the play now bit...it may be TIDAL specific. I have a Qobuz subscription as well I'll try it out and let you know.

Also, one more bit that may be relevant, I don't have TIDAL set to download songs from my TIDAL library locally for offline playback.

@Divadeer
Copy link
Author

Negative on Qobuz as well.

Doesn't Work --- media_content_id: Qobuz/My Qobuz/Favorite Tracks/Paranoid Android (as well as ending with Android/)

Works --- media_content_id: Qobuz/My Qobuz/Favorite Tracks/Paranoid Android/Play Now

Error: Found media does not have playable action list'['Play Now', 'Add Next', 'Queue', 'Start Radio']'

@Divadeer
Copy link
Author

Also, on reviewing the example you gave for Qobuz, I want to reiterate that I don't have this issue when the target is an album or artist, only when its a track. So when I use use something along the lines of your example:

Qobuz/New Releases/Still Trending/Random Access Memories (Hi-Res Version)

It works. You may want to try playing a specific track instead of an album, artist, radio station, or playlist.

@pavoni
Copy link
Contributor

pavoni commented May 14, 2021

Thanks for the extra info.

I wonder what the difference between our setups are. Roon allows you to customise those actions, but I think yours are the same as mine. I’m also running HA on a 64bit Pi, although my roon core is running on a Mac. I’m running the latest 1.8.

I suspect I’m going to need some extra debugging info. Do you have the ability to run python code easily? We can test with the underlying library directly.

https://github.com/pavoni/pyroon

Otherwise I can add something to the next HA release, although that will take a while to get released.

If you’re a developer I’d like to know the value of items[0]["hint"] on this line. If not I can modify one of the examples to trace the info I need.

https://github.com/pavoni/pyroon/blob/61b44027567bd7e00dec1ad2aed73dfa00d4ece7/roonapi/roonapi.py#L467

@frenck
Copy link
Member

frenck commented May 14, 2021

Guys, this issue is misplaced. This is the issue tracker for the documentation, but is seems like this is not related to documentation at all...

@pavoni
Copy link
Contributor

pavoni commented May 14, 2021

It’s not documentation!

@Divadeer Would you mind re-raising as a bug in the main HA Repo?

@frenck frenck transferred this issue from home-assistant/home-assistant.io May 14, 2021
@probot-home-assistant
Copy link

roon documentation
roon source
(message by IssueLinks)

@frenck
Copy link
Member

frenck commented May 14, 2021

Transferred the issue

@pavoni
Copy link
Contributor

pavoni commented May 14, 2021

Didn’t know that was possible - thanks @frenck

@pavoni
Copy link
Contributor

pavoni commented May 14, 2021

If you are able to make python work - I've added some api traces - and an example which should be easy to customise to allow you to reproduce.

https://github.com/pavoni/pyroon/blob/master/examples/play_error.py

You will need to enable the roon api extension for the library when you run (it doesn't use the same permissions as the HA roon integrations).

If you aren't able to install python etc - I'll release a library version with the traces - and then add to the next HA version - which will give me the info I need to fix in a future version.

@Divadeer
Copy link
Author

@frenck @pavoni Sorry about that. I had actually initially clicked on "leave feedback for this integrations documentation" as I was just going to recommend you mention in the documentation that if someone was having trouble that adding "/Play Now" to the path would likely fix the issue. I just started using HA about a month ago and am not super familiar with the protocols for the forums.To be clear, I'm not asking you to change anything, It was generous of you to take the time to share this with the community and I am grateful that I am able to use it at all. That being said, if you are desiring to undertake diagnostics and attempt to patch it up I am happy to help in whatever way I can. Its been nearly a decade since the last time I did any coding, and even then I tended to focus on low-level languages and logic design. Not super familiar with python but will give it a shot.

@pavoni
Copy link
Contributor

pavoni commented May 14, 2021

@Divadeer It's great you took the time to report and help analyse this.

I have no doubt that others will bump into this bug - so am keen to track down and fix if I can.

My suspicion is that I'll just need to check for an extra string value - so the fix will be very much easier than tracking down the problem! It's probably a slight inconsistency in the roon API (there have been a few) - but not one I can reproduce here.

If you're comfortable installing python, and pulling a library from github, I'm sure you'll find this pretty straightforward.

https://github.com/pavoni/pyroon

Obviously let me know if I can help you get this going.

@Divadeer
Copy link
Author

Divadeer commented May 14, 2021

Ok. Im all setup and registered with the server. I'm not certain how to get the value of "items[0]("hint")" because it is local to the class and out of scope. How should I proceed?

@pavoni
Copy link
Contributor

pavoni commented May 15, 2021

I added some better debug to the library, so I think if your playback fails, it should trace the variable.

Otherwise just change your local copy of my library.

@Divadeer
Copy link
Author

'hint' = 'action'

@pavoni
Copy link
Contributor

pavoni commented May 18, 2021

@Divadeer thanks very much.

If you're willing could you check this fixes the issue?

pavoni/pyroon#42

@Divadeer
Copy link
Author

Works. The only issue is it still throws the error. That is, instead of returning true it throws the playable action list error, but the song still plays. Each of these worked, despite the error being thrown:

s = roonapi.play_media(output_id, ["TIDAL", "Your Favorites", "Tracks", "Lights"])

 2021-05-20 00:55:29,017 ERROR  roonapi -- Found media does not have playable action 21st Century - action_list

s = roonapi.play_media(output_id, ["TIDAL", "Your Favorites", "Tracks", "Africa"])

  2021-05-20 00:56:55,808 ERROR  roonapi -- Found media does not have playable action 21st Century - action_list

s = roonapi.play_media(output_id, ["TIDAL", "Your Favorites", "Artists", "Bruce Springsteen"])

   2021-05-20 00:57:34,950 INFO   roonapi -- Play action was 'Play Artist' / 'Shuffle'

@Divadeer
Copy link
Author

Happens w/o assignment as well. Not sure if that bothers you:

session.play_media(output_id, ["TIDAL", "Your Favorites", "Tracks", "Lights"])
2021-05-20 01:20:08,440 ERROR roonapi -- Found media does not have playable action 21st Century - action_list
False

@pavoni
Copy link
Contributor

pavoni commented May 22, 2021

@Divadeer Thanks for the detailed report.

I've had a go at simulating what is happening - and come up with a possible fix.

Would you mind pulling and trying again? I'm hoping this one will play without errors - and report the play method like your final example!

pavoni/pyroon#42

@Divadeer
Copy link
Author

Divadeer commented May 27, 2021

Works! (and without screwing up the functionality of the parts that had worked correctly (e.g. artists). Well done.

session.play_media(output_id, ["TIDAL", "Your Favorites", "Tracks", "Lights", "Play Now"])
True
"
session.play_media(output_id, ["TIDAL", "Your Favorites", "Tracks", "Lights"])
2021-05-26 19:13:41,199 INFO roonapi -- Play action was 'Play Now' / 'Play Now'
True
Bruce Springsteen"
session.play_media(output_id, ["TIDAL", "Your Favorites", "Artists", "Bruce Springsteen"])
2021-05-26 19:15:03,070 INFO roonapi -- Play action was 'Play Artist' / 'Shuffle'
True

@pavoni pavoni mentioned this issue May 27, 2021
20 tasks
@pavoni
Copy link
Contributor

pavoni commented May 27, 2021

@Divadeer Thanks so much for following up on this. Very grateful for all your help on this.

I've now released the library with that fix - and raised an HA PR to upgrade the library in HA.

#51164

@github-actions github-actions bot locked and limited conversation to collaborators Jun 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants