rickyphewitt / emby-skill

This skill allows audio playback from an emby server
11 stars 19 forks source link

Playlists not working #61

Open ghostbuster84 opened 2 years ago

ghostbuster84 commented 2 years ago

Whenever I try to play a playlist by saying "hey mycroft, play playlist country music from emby" it returns saying "unable to find or play playlist country music".

ghostbuster84 commented 2 years ago

Update: after reading other issues, i tried installing from msm and it worked first try. However, it doesnt play anything without the "from emby" at the end.

rickyphewitt commented 2 years ago

Hello @ghostbuster84,

Thanks for creating this issue! I need to update the official mycroft skills repo and then you won't have to install from MSM. let me add an issue for that if I don't have one already.

Now back to your specific issue, are you having similar problems as noted here: https://github.com/rickyphewitt/emby-skill/issues/40

I wasn't able to replicate this issue on my end. Can you provide additional data like the logs you are seeing? That may help us track down what isn't working.

ghostbuster84 commented 2 years ago

Here are the logs. I tried without the "from emby", then with it, and once again without. The 2 without the "from emby" did not work. 17:42:40.819 | INFO | 780 | Playback Control Skill | Resolving Player for: fancy like 17:42:51.177 | INFO | 780 | Playback Control Skill | No matches 17:42:56.400 | INFO | 780 | Emby | fancy like 17:42:56.401 | INFO | 780 | root | phrase: fancy like 17:42:56.402 | INFO | 780 | emby_rickyphewitt.emby_client | ?SearchTerm=fancy like 17:42:56.510 | INFO | 780 | root | Found: 2 to parse 17:42:56.511 | INFO | 780 | Emby | Found match of type: song 17:42:56.512 | INFO | 780 | Emby | match levelCPSMatchLevel.TITLE 17:42:56.513 | INFO | 780 | Emby | First 3 item urls returned 17:42:56.513 | INFO | 780 | Emby | http://192.168.100.71:8096/Audio/58/universal.mp3?userId=efde8f4e1fa044ee803b6fd964c92565&API_KEY=d5d6075026044e5bb31cd0dcab2b10ea&MaxStreamingBitrate=140000000&AudioCodec=mp3 17:42:56.513 | INFO | 780 | Emby | http://192.168.100.71:8096/Audio/324045/universal.mp3?userId=efde8f4e1fa044ee803b6fd964c92565&API_KEY=d5d6075026044e5bb31cd0dcab2b10ea&MaxStreamingBitrate=140000000&AudioCodec=mp3 17:43:05.647 | INFO | 780 | Emby | {'media': 'fancy like', 'utterance': 'play fancy like from emby'} 17:43:13.677 | INFO | 780 | emby_rickyphewitt.emby_client | ?SearchTerm=fancy like 17:43:13.706 | INFO | 780 | emby_rickyphewitt.emby_croft | Instant Mix potential match: Fancy Like 17:43:13.742 | INFO | 780 | emby_rickyphewitt.emby_croft | Instant Mix potential match: Fancy Like Gramps (1h) 17:44:09.358 | INFO | 780 | Playback Control Skill | Resolving Player for: fancy like 17:44:16.480 | INFO | 780 | Playback Control Skill | No matches 17:44:20.277 | INFO | 780 | Emby | fancy like 17:44:20.278 | INFO | 780 | root | phrase: fancy like 17:44:20.278 | INFO | 780 | emby_rickyphewitt.emby_client | ?SearchTerm=fancy like 17:44:20.308 | INFO | 780 | root | Found: 2 to parse 17:44:20.309 | INFO | 780 | Emby | Found match of type: song 17:44:20.309 | INFO | 780 | Emby | match levelCPSMatchLevel.TITLE 17:44:20.310 | INFO | 780 | Emby | First 3 item urls returned 17:44:20.310 | INFO | 780 | Emby | http://192.168.100.71:8096/Audio/58/universal.mp3?userId=efde8f4e1fa044ee803b6fd964c92565&API_KEY=d5d6075026044e5bb31cd0dcab2b10ea&MaxStreamingBitrate=140000000&AudioCodec=mp3 17:44:20.311 | INFO | 780 | Emby | http://192.168.100.71:8096/Audio/324045/universal.mp3?userId=efde8f4e1fa044ee803b6fd964c92565&API_KEY=d5d6075026044e5bb31cd0dcab2b10ea&MaxStreamingBitrate=140000000&AudioCodec=mp3

rickyphewitt commented 2 years ago

It looks like the top one is the call without the 'from' Emby. But I can't see the 'utterance' in the logs for that one to be sure.

Both calls are working as I would expect. The lines you see that look like: http://192.168.100.71:8096/Audio/58/universal.mp3?userId=efde8f4e1fa044ee803b6fd964c92565&API_KEY=d5d6075026044e5bb31cd0dcab2b10ea&MaxStreamingBitrate=140000000&AudioCodec=mp3 are the fully qualified urls to play the song and are sent to the mycroft audio layer.

It does look like in both cases the same songs were chosen and sent to the audio layer. I should have some time to run additional tests in this area. What is the source format of the song? I'm wondering if transcoding is causing some issues here. Just very strange that it works when you add the 'from' emby. The code path for finding/playing the song is the same regardless of if 'from' emby is added or not.

ghostbuster84 commented 2 years ago

The song format is mp3 at 48000 sample rate and 128 kbps bit rate.

rickyphewitt commented 2 years ago

What are you running mycroft on, The Mark 1 or on a linux laptop? Also what version of mycroft are you running?

I do most of my testing/development with mycroft running on my linux laptop. I do have a Mark 1 as well, I"ll try to test that in the next few days to see if I can replicate this issue.

ghostbuster84 commented 2 years ago

I use it on Linux desktop and on raspberry pi 3

blissb commented 2 years ago

I'm having what seems to be the same issues ghostbuster84 describes -- I am unable to play anything without the "from emby" tag, and cannot play playlists at all. I did try uninstalling and re-installing using mycroft-msm, but there was no change. From my skills.log file using utterance "Hey Mycroft, play under pressure":

2022-01-29 23:11:22.896 | INFO | 18936 | TimerSkill | stopping repeating event to check for timer expiration 2022-01-29 23:11:27.145 | INFO | 18936 | Playback Control Skill | Resolving Player for: under pressure 2022-01-29 23:11:34.072 | INFO | 18936 | Playback Control Skill | No matches -- at this moment, mycroft says: "I'm not sure how to play under pressure" 2022-01-29 23:11:38.020 | INFO | 18936 | Emby | under pressure 2022-01-29 23:11:38.021 | INFO | 18936 | root | phrase: under pressure 2022-01-29 23:11:38.022 | INFO | 18936 | emby_rickyphewitt.emby_client | ?SearchTerm=under pressure 2022-01-29 23:11:38.066 | INFO | 18936 | root | Found: 2 to parse 2022-01-29 23:11:38.067 | INFO | 18936 | Emby | Found match of type: song 2022-01-29 23:11:38.068 | INFO | 18936 | Emby | match levelCPSMatchLevel.TITLE 2022-01-29 23:11:38.069 | INFO | 18936 | Emby | First 3 item urls returned 2022-01-29 23:11:38.070 | INFO | 18936 | Emby | http://emby.billbliss.us:8096/Audio/963/stream.mp3?api_key=f20ad7a79227436bb413325b52a70359 2022-01-29 23:11:38.071 | INFO | 18936 | Emby | http://emby.billbliss.us:8096/Audio/3904/stream.mp3?api_key=f20ad7a79227436bb413325b52a70359

Here's the skills.log output when using the utterance "Hey Mycroft, play under pressure from emby" 2022-01-29 23:12:14.588 | INFO | 18936 | Emby | {'media': 'under pressure', 'utterance': 'play under pressure from emby', 'utterances': ['play under pressure from emby']} 2022-01-29 23:12:23.158 | INFO | 18936 | emby_rickyphewitt.emby_client | ?SearchTerm=under pressure 2022-01-29 23:12:23.188 | INFO | 18936 | emby_rickyphewitt.emby_croft | Instant Mix potential match: Under Pressure 2022-01-29 23:12:23.217 | INFO | 18936 | emby_rickyphewitt.emby_croft | Instant Mix potential match: Under Pressure

To my completely untrained eye, it looks like in the first example, the Playback Control Skill is giving up before EMBY returns results -- perhaps before it's even called -- whereas in the second, the Plaback Control Skill is completely bypassed.

Is this an EMBY Skill issue, or a Playback Control Skill issue -- or something else?

blissb commented 2 years ago

Just a follow up after a little bit of playing around... I tweaked the query timeout in in the Playback control skill and have had some success -- I can now say "play pentatonix" and it will play.

In the mycroft-playback-control.mycroftai/init.py file, around line 199:

if message.data["searching"]:

extend the timeout by 5 seconds

                self.cancel_scheduled_event("PlayQueryTimeout")
                self.schedule_event(self._play_query_timeout, 10,  <--- I changed this from 5 to 10
                                    data={"phrase": search_phrase},
                                    name='PlayQueryTimeout')

However, if I add "album," "artist" to the query I still get nothing unless I add "from emby" -- I still can't play a playlist no matter what I try.

Please let me know if any of this is helpful or not -- I don't want to give you information you already have, or that is not useful. I have this functionality working as much as I need it to work, and know how to fix it if an update overwrites my tweak.

rickyphewitt commented 2 years ago

@blissb,

This is great information! This was my next area of investigation, just havn't had the time to as of late. Let me dig into the mycroft docs and maybe there is a way this can be configured at the skill level. If that is an option we could add a config option that would allow uses to specify the timeout based on their network/emby hardware.

blissb commented 2 years ago

@rickyphewitt

Glad it's helpful. I bumped it up to 15 seconds because some queries were still returning after picroft gave up. Occasionally (usually after I haven't played anything through Mycroft for a day or so), the "I don't know how to play that" announcement comes back within a second or two -- but asking again resolves that. I haven't found anything that will make it play from a playlist configured in emby. I'm happy to do some testing if that would be useful.

Bill

rickyphewitt commented 2 years ago

@blissb, I think the right solution is for mycroft to allow for that timeout to be configurable. However I was thinking of an alternative solution. Right now the emby skill waits until it connects and finds media based on the phrase said and then returns to the common skill framework. I could add a config option like 'Common Skill Override' which would return instantaneously with the highest match guaranteeing it is chosen as the skill to use. This isn't really playing 'nice' with other skills but having it off by default (use the current path) would ensure that a default skill install would still function 'nicely' with other skills.

For the playlist issue did you try using the dedicated intent "Play Playlist Rockin Tunes From Emby". Or were you attempting to play a playlist using the common skill framework.

blissb commented 2 years ago

@rickyphewitt I tried "play playlist stuff from emby" -- here's the log:

2022-02-20 21:31:38.233 | INFO | 9612 | Emby | {'media': 'playlist stuff', 'utterance': 'play playlist stuff from emby', 'utterances': ['play playlist stuff from emby']} 2022-02-20 21:31:46.738 | INFO | 9612 | emby_rickyphewitt.emby_client | ?SearchTerm=playlist stuff 2022-02-20 21:31:46.767 | INFO | 9612 | Emby | No songs Returned

I have confirmed the playlist called "stuff" is on my Emby server. In case it matters: I'm using Emby server 4.6.7.0 on windows 10.

Everything else (artist, album, genre) is working, and doesn't need "from emby". It's just play lists that have a problem. I've tried it both with and without the word "playlist"

I just tried it from the cli client with "play playlist stuff from emby" -- here's what was returned.

21:48:16.329 | ERROR | 9612 | mycroft.skills.intent_service:handle_converse_error:193 | emby.rickyphewitt: skill id does not exist 21:48:16.399 | INFO | 9612 | Emby | {'media': 'playlist stuff', 'utterance': 'play playlist stuff from emby', 'utterances': ['play playlist stuff from emby']} 21:48:26.149 | INFO | 9612 | emby_rickyphewitt.emby_client | ?SearchTerm=playlist stuff 21:48:26.176 | INFO | 9612 | Emby | No songs Returned

edit: I just tried the same request in the cli (play playlist stuff from emby") and it did NOT return an error. It still did not play, but that "skill id does not exist" message did not show up.

BTW - thanks for all your time and effort on this. I use mycroft to play music almost every day now.