Improved spotify resume/pause intent
This commit is contained in:
parent
411ddec237
commit
95b5f39381
@ -22,14 +22,26 @@ class SpotifySkill(Skill, metaclass=SkillRegistering):
|
|||||||
|
|
||||||
spotify.get_spotify().add_to_queue(uri=song_lists_matching[0]['uri'])
|
spotify.get_spotify().add_to_queue(uri=song_lists_matching[0]['uri'])
|
||||||
spotify.get_spotify().next_track()
|
spotify.get_spotify().next_track()
|
||||||
# spotify.get_spotify().start_playback(context_uri=song_lists_matching[0]['uri'])
|
|
||||||
else:
|
else:
|
||||||
print("Nothing found for :" + str(data))
|
print("Nothing found for :" + str(data))
|
||||||
|
|
||||||
@intent_file_handler("pause_music.intent", "PauseSpotifyIntent")
|
@intent_file_handler("pause_music.intent", "PauseSpotifyIntent")
|
||||||
def pause_music(self, data):
|
def pause_music(self, data):
|
||||||
spotify.get_spotify().pause_playback()
|
if spotify.is_music_playing():
|
||||||
print("[INFO INTENT] - Paused music for Spotify")
|
spotify.get_spotify().pause_playback()
|
||||||
|
print("[INFO INTENT] - Paused music for Spotify")
|
||||||
|
else:
|
||||||
|
# TODO: speak : nothing is playing on spotify
|
||||||
|
pass
|
||||||
|
|
||||||
|
@intent_file_handler("resume_music.intent", "ResumeSpotifyIntent")
|
||||||
|
def resume_music(self, data):
|
||||||
|
if not spotify.is_music_playing():
|
||||||
|
spotify.get_spotify().start_playback()
|
||||||
|
print("[INFO INTENT] - Resumed music for Spotify")
|
||||||
|
else:
|
||||||
|
# TODO: speak : already playing song on spotify
|
||||||
|
pass
|
||||||
|
|
||||||
@intent_file_handler("current_song.intent", "CurrentSongSpotifyIntent")
|
@intent_file_handler("current_song.intent", "CurrentSongSpotifyIntent")
|
||||||
def current_song(self, data):
|
def current_song(self, data):
|
||||||
|
@ -58,6 +58,10 @@ def query_song(song=None, artist=None):
|
|||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
def is_music_playing():
|
||||||
|
return sp.current_user_playing_track()['is_playing']
|
||||||
|
|
||||||
|
|
||||||
def best_confidence(title, query):
|
def best_confidence(title, query):
|
||||||
"""Find best match for a title against a query.
|
"""Find best match for a title against a query.
|
||||||
Some titles include ( Remastered 2016 ) and similar info. This method
|
Some titles include ( Remastered 2016 ) and similar info. This method
|
||||||
|
@ -1,8 +1 @@
|
|||||||
mets la musique sur pause
|
(mets|arrête|coupe) (moi voir|) (le|la|) (musique|son|spotify) ((sur|en) pause|)
|
||||||
arrête la musique
|
|
||||||
coupe la musique
|
|
||||||
mets sur pause
|
|
||||||
mets spotify en pause
|
|
||||||
mets spotify sur pause
|
|
||||||
pause
|
|
||||||
mets la musique en pause
|
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
(remets|relance|mets) (moi voir|) (la|le) (musique|son)
|
Reference in New Issue
Block a user