# ovos-media-plugin-spotify
spotify plugin for [ovos-audio](https://github.com/OpenVoiceOS/ovos-audio) and [ovos-media](https://github.com/OpenVoiceOS/ovos-media)
allows OVOS to initiate playback on spotify
> NOTE: [the companion skill](https://github.com/OpenVoiceOS/skill-ovos-spotify) 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](https://github.com/Spotifyd/spotifyd).
The easiest way is to use the provided `ovos-spotify-autoconfigure` command
```bash
$ 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
```javascript
{
"Audio": {
"backends": {
"spotify": {
"type": "ovos_spotify",
"identifier": "device_name_in_spotify",
"active": true
}
}
}
}
```
### ovos-media
> **WARNING**: `ovos-media' has not yet been released, WIP
```javascript
{
"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](https://github.com/OpenVoiceOS/skill-ovos-spotify), you can also write your own integrations
```python
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())
```
Raw data
{
"_id": null,
"home_page": "https://github.com/OpenVoiceOS/ovos-media-plugin-spotify",
"name": "ovos-media-plugin-spotify",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "ovos audio video OCP plugin",
"author": "JarbasAi",
"author_email": "jarbasai@mailfence.com",
"download_url": "https://files.pythonhosted.org/packages/6c/db/1e7f9ee09cbd668c0cbef15edd7ac00a18ae82cafd3d330018dfb5953c1f/ovos-media-plugin-spotify-0.2.3.tar.gz",
"platform": null,
"description": "# ovos-media-plugin-spotify\n\nspotify plugin for [ovos-audio](https://github.com/OpenVoiceOS/ovos-audio) and [ovos-media](https://github.com/OpenVoiceOS/ovos-media)\n\nallows OVOS to initiate playback on spotify \n\n> NOTE: [the companion skill](https://github.com/OpenVoiceOS/skill-ovos-spotify) is needed to integrate with voice search\n\n## Install\n\n`pip install ovos-media-plugin-spotify`\n\n## Oauth\n\nCurrently Oauth needs to be performed manually\n\nafter installing the plugin run `ovos-spotify-oauth` on the command line and follow the instructions\n\n```\n$ ovos-spotify-oauth\nThis script creates the token information needed for running spotify\n with a set of personal developer credentials.\n\n It requires the user to go to developer.spotify.com and set up a\n developer account, create an \"Application\" and make sure to whitelist\n \"https://localhost:8888\".\n\n After you have done that enter the information when prompted and follow\n the instructions given.\n\nYOUR CLIENT ID: xxxxx\nYOUR CLIENT SECRET: xxxxx\nGo 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\nEnter the URL you were redirected to: https://localhost:8888/?code=.....\nocp_spotify oauth token saved\n```\n\n## Configuration\n\nedit your mycroft.conf with any spotify players you want to expose\n\n> NOTE: If you want to make the OVOS device itself a spotify player, we recommend [spotifyd](https://github.com/Spotifyd/spotifyd).\n\nThe easiest way is to use the provided `ovos-spotify-autoconfigure` command\n\n```bash\n$ ovos-spotify-autoconfigure\nThis script will auto configure ALL spotify devices under your mycroft.conf\n\n SPOTIFY PREMIUM is required!\n\n If you have not yet authenticated your spotify account, run 'ovos-spotify-oauth' first!\n\nFound device: OpenVoiceOS-TV\n\nmycroft.conf updated!\n\n# Legacy Audio Service:\n{'backends': {'spotify-OpenVoiceOS-TV': {'active': True,\n 'identifier': 'OpenVoiceOS-TV',\n 'type': 'ovos_spotify'}}}\n\n# ovos-media Service:\n{'audio_players': {'spotify-OpenVoiceOS-TV': {'active': True,\n 'aliases': ['OpenVoiceOS-TV'],\n 'identifier': 'OpenVoiceOS-TV',\n 'module': 'ovos-media-audio-plugin-spotify'}}}\n```\n\n### ovos-audio\n\n```javascript\n{\n \"Audio\": {\n \"backends\": {\n \"spotify\": {\n \"type\": \"ovos_spotify\",\n \"identifier\": \"device_name_in_spotify\",\n \"active\": true\n }\n }\n }\n}\n```\n\n### ovos-media\n\n> **WARNING**: `ovos-media' has not yet been released, WIP\n\n```javascript\n{\n \"media\": {\n \"audio_players\": {\n \"desk_speaker\": {\n \"module\": \"ovos-media-audio-plugin-spotify\",\n\n // this needs to be the name of the device on spotify!\n \"identifier\": \"Mark2\",\n\n // users may request specific handlers in the utterance\n // using these aliases\n \"aliases\": [\"office spotify\", \"office\", \"desk\", \"workstation\"],\n\n // deactivate a plugin by setting to false\n \"active\": true\n }\n }\n}\n```\n\n## Python usage\n\nif you don't want to use [the companion skill](https://github.com/OpenVoiceOS/skill-ovos-spotify), you can also write your own integrations\n\n```python\ns = SpotifyClient()\n# pprint(s.query_album(\"hail and kill by manowar\")[1])\n\nfrom ovos_utils.skills.audioservice import ClassicAudioServiceInterface\nfrom ovos_utils.messagebus import FakeBus\n\nbus = FakeBus()\naudio = ClassicAudioServiceInterface(bus)\n\naudio.play(\"spotify:playlist:37i9dQZF1DX08jcQJXDnEQ\")\naudio.play([\"spotify:track:5P2Ghhv0wFYThHfDQaS0g5\",\n \"spotify:playlist:37i9dQZF1DX08jcQJXDnEQ\"])\ntime.sleep(5)\naudio.pause()\ntime.sleep(5)\n\naudio.resume()\ntime.sleep(5)\n\naudio.next()\ntime.sleep(5)\n\naudio.prev()\ntime.sleep(5)\n\nprint(audio.track_info())\n```\n\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "spotify plugin for ovos",
"version": "0.2.3",
"project_urls": {
"Homepage": "https://github.com/OpenVoiceOS/ovos-media-plugin-spotify"
},
"split_keywords": [
"ovos",
"audio",
"video",
"ocp",
"plugin"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a8d27449f08e367770fc8320f757b1932289a76e918e4de3909c09b43b8923cb",
"md5": "616d96f24bc227031f1f0a80a8629ac2",
"sha256": "8affb747f51e40b56587e4b860494e72e04102b564809abb9492be5c2fda442c"
},
"downloads": -1,
"filename": "ovos_media_plugin_spotify-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "616d96f24bc227031f1f0a80a8629ac2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 16591,
"upload_time": "2024-09-11T18:11:50",
"upload_time_iso_8601": "2024-09-11T18:11:50.346620Z",
"url": "https://files.pythonhosted.org/packages/a8/d2/7449f08e367770fc8320f757b1932289a76e918e4de3909c09b43b8923cb/ovos_media_plugin_spotify-0.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6cdb1e7f9ee09cbd668c0cbef15edd7ac00a18ae82cafd3d330018dfb5953c1f",
"md5": "274b073e91c1945b7ee573cdf104a357",
"sha256": "d0c3f563f6f078036e99d4116acd34b160f817d7580300bfcd0e8790291938bf"
},
"downloads": -1,
"filename": "ovos-media-plugin-spotify-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "274b073e91c1945b7ee573cdf104a357",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15301,
"upload_time": "2024-09-11T18:11:51",
"upload_time_iso_8601": "2024-09-11T18:11:51.473639Z",
"url": "https://files.pythonhosted.org/packages/6c/db/1e7f9ee09cbd668c0cbef15edd7ac00a18ae82cafd3d330018dfb5953c1f/ovos-media-plugin-spotify-0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-11 18:11:51",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "OpenVoiceOS",
"github_project": "ovos-media-plugin-spotify",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ovos-media-plugin-spotify"
}