skuethe / MMM-Spotify

Spotify display and controller for MagicMirror
MIT License
66 stars 17 forks source link

Spotify and Mk2 Assistant #29

Closed defiantlibra closed 4 years ago

defiantlibra commented 4 years ago

hi, i have installed this module but i don't know how implement spotify in MK2 assistant.. i have created a recipe like that, but it didn't work. if i ask to the mirror to play a song it didn't respond

var recipe = { transcriptionHook: { SPOTIFY_SEARCH: { pattern: "(.*) on Spotify", // Will play any song, artist, track or playlist on spotify command: "SPOTIFY_SEARCH" }, }, command: { SPOTIFY_SEARCH: { notificationExec: { notification: "SPOTIFY_SEARCH",

    payload: (params) => {
            console.log("SPOTIFY_SEARCH @",params)
            return {
                    type: "artist,track,album,playlist",
                    query: params[1],   // params[1] is the value of (.*) in the pattern. 
                    random:false,
                    }
                 }
            }
    },
},

} exports.recipe = recipe // Don't remove this line.

eouia commented 4 years ago

So we should check it's the issue of transcriptionHook or command or MMM-Spotify itself. Can you print out the result of console.log("SPOTIFY_SEARCH @",params)?

defiantlibra commented 4 years ago

{46015708-6734-482A-918E-DA1BAA5BD78D} png

for example i have search "Paracetamolo su Spotify" and he search correctly the song on spotify but it didn't play anything..

eouia commented 4 years ago

How about front-end log? You can activate it with Ctrl+i on MM screen or get it with npm start dev. To make things simple, it's better to remove other modules from configuration temporally.

mister-heisenberg commented 4 years ago

Hi, i have the same issue of @defiantlibra

pi@raspberrypi:~/MagicMirror $ npm start

> magicmirror@2.9.0 start /home/pi/MagicMirror
> sh run-start.sh

Starting MagicMirror: v2.9.0
Loading config ...
Loading module helpers ...
No helper found for module: compliments.
No helper found for module: clock.
Initializing new module helper ...
Module helper loaded: calendar
No helper found for module: currentweather.
No helper found for module: weatherforecast.
Initializing new module helper ...
Module helper loaded: MMM-AssistantMk2
Initializing new module helper ...
Module helper loaded: MMM-Hotword
Initializing new module helper ...
Module helper loaded: MMM-Spotify
All module helpers loaded.
Starting server on port 8082 ... 
Server started ...
Connecting socket for: calendar
Starting node helper for: calendar
Connecting socket for: MMM-AssistantMk2
Connecting socket for: MMM-Hotword
[HOTWORD] MMM-Hotword starts
Connecting socket for: MMM-Spotify
[SPOTIFY_AUTH] Token is fresh.
Sockets connected & modules started ...
Launching application.
Create new calendar fetcher for url: https://calendar.google.com/calendar/ical/XXXXXXXXXX%40gmail.com/private-XXXXXXXXXXXXXXX/basic.ics - Interval: 2000
Create new calendar fetcher for url: https://p17-calendars.icloud.com/holiday/IT_it.ics - Interval: 2000
[AMK2] Recipe is loaded: hide_and_show_all_modules.js
[AMK2] Recipe is loaded: reboot.js
[AMK2] Recipe is loaded: screen_onoff.js
[AMK2] Recipe is loaded: shutdown.js
[AMK2] Temporal storage directory is clearing.
[HOTWORD] begins.
[HOTWORD] Detector starts listening.
[HOTWORD] Detected: jarvis
[HOTWORD] stops.
[HOTWORD] Final Result: { detected: true, hotword: 'jarvis', file: null }
[AMK2] assistant ready
[AMK2] Conversation starts.
[AMK2] Assistant Text Response: 
[AMK2] Transcription: paracetamolo  --- Done: false
[AMK2] Transcription: paracetamolo su  --- Done: false
[AMK2] Transcription: paracetamolo su  --- Done: false
[AMK2] Transcription: paracetamolo su Spotify  --- Done: false
[AMK2] Transcription: paracetamolo su Spotify  --- Done: false
[AMK2] Transcription: paracetamolo su Spotify  --- Done: false
[AMK2] end-of-utterance
[AMK2] Transcription: paracetamolo su Spotify  --- Done: true
[AMK2] openSpotify found: https://open.spotify.com/album/7yY8pBmTgibF2MEzv4qjfw
{ requestId: '5de5e1d4-0000-2fb1-8b2c-24058871753c' } { profileFile: 'default.json', lang: 'it-IT' }
[AMK2] Device Action: { requestId: '5de5e1d4-0000-2fb1-8b2c-24058871753c' }
[AMK2] Assistant Text Response: 
[AMK2] Conversation Completed
[HOTWORD] begins.
[HOTWORD] Detector starts listening.
[HOTWORD] Detected: jarvis
[HOTWORD] stops.
[HOTWORD] Final Result: { detected: true, hotword: 'jarvis', file: null }
[AMK2] assistant ready
[AMK2] Conversation starts.
[AMK2] Assistant Text Response: 
[AMK2] Transcription: Play  --- Done: false
[AMK2] Transcription: Play su  --- Done: false
[AMK2] Transcription: Play Store  --- Done: false
[AMK2] Transcription: Play Spotify  --- Done: false
[AMK2] Transcription: Play Spotify  --- Done: false
[AMK2] Transcription: Play Spotify  --- Done: false
[AMK2] end-of-utterance
[AMK2] Transcription: Play Spotify  --- Done: true
{ requestId: '5deafc7b-0000-27fc-8f1e-089e0827c8e4' } { profileFile: 'default.json', lang: 'it-IT' }
[AMK2] Device Action: { requestId: '5deafc7b-0000-27fc-8f1e-089e0827c8e4' }
[AMK2] Assistant Text Response: 
[AMK2] Conversation Completed
[HOTWORD] begins.
[HOTWORD] Detector starts listening.

the assistant answer to me that she is going to open the app but nothing happen...

eouia commented 4 years ago

if you enable spotifyAutoplay: true, of MMM-AssistantMk2 config option, MMM-Spotify should be activated. You need to confirm your Spotify player(RASPOTIFY or any your existing spotify player - like smart speaker or handy app) would be turned on already.

defiantlibra commented 4 years ago

ok but there is some way to stream spotify music with assistant on raspberry without raspotify? for example can i use "user-agent switcher" for Chromium as player instead of raspotify?

eouia commented 4 years ago

On RPI, Chrome(Or other browsers) cannot play Spotify on the web. Real Google Home has streaming feature, but that is not allowed on SDK level.

The only way to play Spotify on RPI is RASPOTIFY.

defiantlibra commented 4 years ago

i mean this. https://www.raspberrypi.org/forums/viewtopic.php?t=176529

defiantlibra commented 4 years ago

i mean this. https://www.raspberrypi.org/forums/viewtopic.php?t=176529

defiantlibra commented 4 years ago

i was wondering if there is a way to use this with mmm-assistant and mmm-spotify

defiantlibra commented 4 years ago

i was wondering if there is a way to use this with mmm-assistant and mmm-spotify

eouia commented 4 years ago

i mean this. https://www.raspberrypi.org/forums/viewtopic.php?t=176529

That was very old post. That method was blocked already. And Spotify developer confirmed web connect features are not supported yet on chrome(Exactly Chromium of Electron) of RPI(and some Linux clones) due to DRM plugins. There was also a way to build chrome from source to avoid this issue, but as far as I see, there is no success yet.

i was wondering if there is a way to use this with mmm-assistant and mmm-spotify

Well, possible to use them together. You can control MMM-Spotify by your commands. But there is no ready-made out-of-box recipe. You should build your own commands to do those things. Anyway, The answer itself is, "Yes".

diegoshh commented 3 years ago

I got the MMM-GoogleAssistant, can please someone help to to embed spotify to the google assiatant please!