ovos-media-plugin-spotify
spotify plugin for ovos-audio and ovos-media
allows OVOS to initiate playback on spotify
NOTE: the companion skill is needed to integrate with voice search
Install
pip install ovos-media-plugin-spotify
Oauth
Currently Oauth needs to be performed manually
after installing the plugin run ovos-spotify-oauth on the command line and follow the instructions
$ ovos-spotify-oauth
This script creates the token information needed for running spotify
with a set of personal developer credentials.
It requires the user to go to developer.spotify.com and set up a
developer account, create an "Application" and make sure to whitelist
"https://localhost:8888".
After you have done that enter the information when prompted and follow
the instructions given.
YOUR CLIENT ID: xxxxx
YOUR CLIENT SECRET: xxxxx
Go to the following URL: https://accounts.spotify.com/authorize?client_id=xxx&response_type=code&redirect_uri=https%3A%2F%2Flocalhost%3A8888&scope=user-library-read+streaming+playlist-read-private+user-top-read+user-read-playback-state
Enter the URL you were redirected to: https://localhost:8888/?code=.....
ocp_spotify oauth token saved
Configuration
edit your mycroft.conf with any spotify players you want to expose
NOTE: If you want to make the OVOS device itself a spotify player, we recommend spotifyd.
The easiest way is to use the provided ovos-spotify-autoconfigure command
$ ovos-spotify-autoconfigure
This script will auto configure ALL spotify devices under your mycroft.conf
SPOTIFY PREMIUM is required!
If you have not yet authenticated your spotify account, run 'ovos-spotify-oauth' first!
Found device: OpenVoiceOS-TV
mycroft.conf updated!
# Legacy Audio Service:
{'backends': {'spotify-OpenVoiceOS-TV': {'active': True,
'identifier': 'OpenVoiceOS-TV',
'type': 'ovos_spotify'}}}
# ovos-media Service:
{'audio_players': {'spotify-OpenVoiceOS-TV': {'active': True,
'aliases': ['OpenVoiceOS-TV'],
'identifier': 'OpenVoiceOS-TV',
'module': 'ovos-media-audio-plugin-spotify'}}}
ovos-audio
{
"Audio": {
"backends": {
"spotify": {
"type": "ovos_spotify",
"identifier": "device_name_in_spotify",
"active": true
}
}
}
}
ovos-media
WARNING: `ovos-media' has not yet been released, WIP
{
"media": {
"audio_players": {
"desk_speaker": {
"module": "ovos-media-audio-plugin-spotify",
// this needs to be the name of the device on spotify!
"identifier": "Mark2",
// users may request specific handlers in the utterance
// using these aliases
"aliases": ["office spotify", "office", "desk", "workstation"],
// deactivate a plugin by setting to false
"active": true
}
}
}
Python usage
if you don't want to use the companion skill, you can also write your own integrations
s = SpotifyClient()
# pprint(s.query_album("hail and kill by manowar")[1])
from ovos_utils.skills.audioservice import ClassicAudioServiceInterface
from ovos_utils.messagebus import FakeBus
bus = FakeBus()
audio = ClassicAudioServiceInterface(bus)
audio.play("spotify:playlist:37i9dQZF1DX08jcQJXDnEQ")
audio.play(["spotify:track:5P2Ghhv0wFYThHfDQaS0g5",
"spotify:playlist:37i9dQZF1DX08jcQJXDnEQ"])
time.sleep(5)
audio.pause()
time.sleep(5)
audio.resume()
time.sleep(5)
audio.next()
time.sleep(5)
audio.prev()
time.sleep(5)
print(audio.track_info())
Metadata
Release files for ovos-media-plugin-spotify 0.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ovos_media_plugin_spotify-0.2.7.tar.gz | 15.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ovos_media_plugin_spotify-0.2.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.8 kB
Release files / ovos_media_plugin_spotify-0.2.7.tar.gz
| Download URL | ovos_media_plugin_spotify-0.2.7.tar.gz |
|---|---|
| Size | 15.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9c67c6c521fbf7c87b29413c7cea384fd0f266340f42d395cc1bc2ceb0eb211
|
|
BLAKE2b-256 checksum How to use checksums |
f3875915e60e7209ecf9d4acc804ec1fc7a0e8cff48688611419bf95bf59d8af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|
Release files / ovos_media_plugin_spotify-0.2.7-py3-none-any.whl
| Download URL | ovos_media_plugin_spotify-0.2.7-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1343bb0f8d71fb9ec899f79fd9a98baf0231e2192784c067af33e5665445caf5
|
|
BLAKE2b-256 checksum How to use checksums |
bf30cdc3462e026634ca8d413440d00b5fb5ed4970537da3029601e691ec1b64
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.25
|