rickyphewitt / emby-skill

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

CommonPlayFramework v2 #40

Open rickyphewitt opened 4 years ago

rickyphewitt commented 4 years ago

The initial implementation works but never returns an exact match no adds any weight if the utterance includes emby keywords.

The common play framework should be smarter about identifying what the user wants and attempt to provide a more accurate match level when a song/album/artist is specifically found.

In addition the common play framework should be tested with other skills that also use this framework to see how both skills interact and if there are ways to increase the odds that the correct skill (based on intent) receives and plays the media.

Also increase the response time of the skill. Right now the skill returns to the common play framework after it has searched emby, found a media item, gather additional media items from the 1st one (think artist, gathering songs), and converted all those gathered items to playable audio streams. In some cases this is slow enough that the common play framework wait times out.

astrowave commented 4 years ago

I've noticed it doesn't work for albums. If you say "play album " mycroft doesn't know how to play it and you have to say "Play album from emby"

rickyphewitt commented 4 years ago

@astrowave,

I've just added the ability to the common skill framework path to recognize keywords such as artist/album/song and use them to further narrow the search. This should allow you to say 'play artist foo fighters'.

gabipintea commented 4 years ago

Hi! Love the skill. Keep up the good work! Unfortunately it still does not work without "..from Emby". I had also Spotify skill installed until today, when i had to clean install mycroft and for testing purposes i installed just emby skill. For the moment i have to say "from emby" everytime, no matter if it is a song, artist, album.

rickyphewitt commented 4 years ago

@gabiwhyme,

Glad to hear you like the skill! How did you install the skill, if you installed from the mycroft website, that skill is a few commits behind. If you would like the latest you will need to ssh into mycroft and run msm -l install https://github.com/rickyphewitt/emby-skill I've been thinking about a better way to show what version of the skill/features is available via the mycroft website and what functionality is only available on master. Maybe adding a release and have those always match the functionality that was committed to the mycroft skills repo. If you install directly from this repo and are still having to say 'from emby', please provide the logs and I'll take a look!

gabipintea commented 4 years ago

I have uninstalled the skill using voice ("uninstall emby"->"yes") and installed it using msm, changed the settings in home.mycroft.ai and this is the result. Working one: ("play album samba from emby")

18:06:11.077 | INFO     |  2214 | Emby | {'album': 'samba', 'utterance': 'play album samba from emby'}
 18:06:20.403 | INFO     |  2214 | emby_rickyphewitt.emby_client | ?SearchTerm=samba&IncludeItemTypes=MusicAlbum

Not working: ("play album samba")

~~~~980 | INFO     |  2214 | mycroft.util:wait_while_speaking:448 | mycroft.utils.wait_while_speaking() is depreciated, use mycroft.audio.wait_while_speaking() instead.
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
 18:11:35.512 | INFO     |  2214 | Playback Control Skill |    No matches
 18:11:40.504 | INFO     |  2214 | Emby | album samba
 18:11:40.506 | INFO     |  2214 | root | phrase: album samba
 18:11:40.506 | INFO     |  2214 | emby_rickyphewitt.emby_client | ?SearchTerm=album samba

Working: ("play havana from emby")

18:12:43.625 | INFO     |  2214 | Emby | {'media': 'havana', 'utterance': 'play havana from emby'}
 18:12:53.005 | INFO     |  2214 | emby_rickyphewitt.emby_client | ?SearchTerm=havana
 18:12:53.024 | INFO     |  2214 | emby_rickyphewitt.emby_croft | Instant Mix potential match: Havana

Not working: ("play havana")

~~~~630 | INFO     |  2214 | mycroft.util:wait_while_speaking:448 | mycroft.utils.wait_while_speaking() is depreciated, use mycroft.audio.wait_while_speaking() instead.
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
 18:13:50.295 | INFO     |  2214 | Playback Control Skill |    No matches
 18:13:54.644 | INFO     |  2214 | Emby | havana
 18:13:54.645 | INFO     |  2214 | root | phrase: havana
 18:13:54.645 | INFO     |  2214 | root | phrase: havana
 18:13:54.646 | INFO     |  2214 | emby_rickyphewitt.emby_client | ?SearchTerm=havana
 18:13:54.668 | INFO     |  2214 | root | Found: 1 to parse
 18:13:54.669 | INFO     |  2214 | Emby | Found match of type: song
 18:13:54.670 | INFO     |  2214 | Emby | match levelCPSMatchLevel.TITLE
 18:13:54.670 | INFO     |  2214 | Emby | First 3 item urls returned
 18:13:54.670 | INFO     |  2214 | Emby | http://192.168.0.135:8096/Audio/34/stream.mp3?api_key=ba743652e32a4fca8370a6b2d8d27cdd

Hope you'll find something useful. It looks like is trying to use "havana" as SearchTerm for example, but nothing is playing after that.

rickyphewitt commented 4 years ago

@gabiwhyme,

Are you sure the skill is updated to the latest? When I run 'play album deadweight' I get the below logs:

15:36:46.578 | INFO     | 28361 | Emby | album deadweight
 15:36:46.578 | INFO     | 28361 | root | phrase: album deadweight
 15:36:46.578 | INFO     | 28361 | root | Found intent in common phrase: album
 15:36:46.579 | INFO     | 28361 | emby-skill.emby_client | ?SearchTerm= deadweight&IncludeItemTypes=MusicAlbum
 15:36:46.639 | INFO     | 28361 | root | Found: 1 to parse
 15:36:46.663 | INFO     | 28361 | Emby | Found match of type: album
 15:36:46.663 | INFO     | 28361 | Emby | match levelCPSMatchLevel.TITLE
 15:36:46.663 | INFO     | 28361 | Emby | First 3 item urls returned
 15:36:46.664 | INFO     | 28361 | Emby | http://emby:8096/Audio/9279/stream.mp3?api_key=138c0716b68c4c599cfdc58e946b67a8
 15:36:46.664 | INFO     | 28361 | Emby | http://emby:8096/Audio/9274/stream.mp3?api_key=138c0716b68c4c599cfdc58e946b67a8
 15:36:46.664 | INFO     | 28361 | Emby | http://emby:8096/Audio/9276/stream.mp3?api_key=138c0716b68c4c599cfdc58e946b67a8

Specifically the lines:

15:36:46.578 | INFO     | 28361 | Emby | album deadweight
 15:36:46.578 | INFO     | 28361 | root | phrase: album deadweight
 15:36:46.578 | INFO     | 28361 | root | Found intent in common phrase: album

the log line Found intent in common phrase: album only exists if the skill has been updated to master.

Did you use the -l option when installing the skill via msm?

gabipintea commented 4 years ago

@rickyphewitt yes. I did use -l option. Maybe I am on another branch?

gabipintea commented 4 years ago

@rickyphewitt Hi! Reinstalled it the same. Using msm -l. Nothing else besides that. It shows me that phrase but still nothing playing.

 20:58:03.152 | INFO     |   637 | Playback Control Skill | Resolving Player for: album samba
~~~~166 | INFO     |   637 | mycroft.util:wait_while_speaking:448 | mycroft.utils.wait_while_speaking() is depreciated, use mycroft.audio.wait_while_speaking() instead.
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
Removing event mycroft-playback-control.mycroftai:PlayQueryTimeout
 20:58:12.084 | INFO     |   637 | Playback Control Skill |    No matches
 20:58:16.592 | INFO     |   637 | Emby | album samba
 20:58:16.593 | INFO     |   637 | root | phrase: album samba
 20:58:16.594 | INFO     |   637 | root | Found intent in common phrase: album
 20:58:16.594 | INFO     |   637 | emby_rickyphewitt.emby_client | ?SearchTerm= saa&IncludeItemTypes=MusicAlbum
rickyphewitt commented 4 years ago

@gabiwhyme,

That is now showing the correct log lines. Is that the end of the log? Right after the last log line the skill actually does the api call to emby. I would have expected a few more logs to indicate what happened after the api call was made.

gabipintea commented 4 years ago

@rickyphewitt yes Ricky! That was the last log, unfortunately. I haven't time to dig more until today. I'll try again and let you know. Is there other logging place or method, besides cli?