Skip to content

Commit

Permalink
fix: Support for more playback items
Browse files Browse the repository at this point in the history
  • Loading branch information
svrooij committed Sep 15, 2021
1 parent 6d10393 commit b6df7ef
Show file tree
Hide file tree
Showing 7 changed files with 3,028 additions and 203 deletions.
10 changes: 7 additions & 3 deletions docs/control/2-playback.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permalink: /control/playback.html
# Playback
{: .no_toc }

You have a lot of ways to play stuff on your sonos speaker. Sonos devides this into two groups items and containers (eg. playlists). You might need some kind of metadata to play your track.
You have a lot of ways to play stuff on your sonos speaker. Sonos divides this into two groups **items** and **containers** (eg. playlists). You might need some kind of metadata to play your track.

1. TOC
{:toc}
Expand Down Expand Up @@ -39,6 +39,8 @@ Topic: `sonos/uuid_of_player/control`
|Spotify|Artist radio|`spotify:artistRadio:{artistId}`|`spotify:artistRadio:72qVrKXRp9GeFQOesj0Pmv`|
|TuneIn|Radio station|`radio:s{id}`||

This list might not be complete, check out [sonos-ts](https://svrooij.io/node-sonos-ts/sonos-device/methods.html#metadata) for a complete list.

### Play a single item for experts

To above sample tries to guess the required metadata based on the track uri. This is supported for the above links, if you want to play something that isn't supported this way, you have 2 options.
Expand All @@ -48,7 +50,7 @@ To above sample tries to guess the required metadata based on the track uri. Thi

You probably need set the following metadata properties `UpnpClass` and `CdUdn`, sometimes the `ItemId` is also required. You can start by skipping them if you don't know the required values. This sample command is in fact the same as the above (where the metadata is [guessed automatically](https://github.com/svrooij/node-sonos-ts/blob/46b95b18dd6c96cb93ed8442d4f067afbdb687f4/src/helpers/metadata-helper.ts#L175-L186)).

You can find the metadata by listening for events and changing the track with the regular sonos app. Or (how this was done originally) start WireShark on your laptop to monitor `port 1400` and capture the instruction from the regular sonos app.
You can find the metadata by listening for events and changing the track with the regular sonos app. Or (how this was done originally) start WireShark on your laptop to monitor `port 1400` and capture the instructions from the regular sonos app.

Topic: `sonos/uuid_of_player/control`

Expand Down Expand Up @@ -101,10 +103,12 @@ Topic: `sonos/uuid_of_player/control`
|Deezer|Track|`deezer:track:{id}`||
|Spotify|Album|`spotify:album:{id}`|`spotify:album:4q2mtBkyPrFynvTRbi5HOv`|
|Spotify|Artist top tracks|`spotify:artistTopTracks:{artistId}`|`spotify:artistTopTracks:72qVrKXRp9GeFQOesj0Pmv`|
|Spotify|Playlist|`spotify:playlist:{id}`|`spotify:playlist:??`|
|Spotify|Playlist|`spotify:playlist:{id}`|`spotify:playlist:37i9dQZF1DX4dyzvuaRJ0n`|
|Spotify|Track|`spotify:track:{id}`|`spotify:track:0GiWi4EkPduFWHQyhiKpRB`|
|Spotify|User Playlist|`spotify:user:{id}`|`spotify:user:??`|

This list might not be complete, check out [sonos-ts](https://svrooij.io/node-sonos-ts/sonos-device/methods.html#metadata) for a complete list.

### Add item to queue for experts

To above sample tries to guess the required metadata based on the track uri. This is supported for the above links, if you want to play something that isn't supported this way, you have 2 options.
Expand Down
18 changes: 16 additions & 2 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,27 @@ It's also important to start the app and test it in your local environment. If y

## Debugging

This library has a VSCode task defined, be sure to change your sonos host in the `.vscode/launch.json` file. You should be able to debug the library in VSCode with breakpoints and everything.
This library has a VSCode launch file (`.vscode/launch.json`). You should be able to debug the library in VSCode with breakpoints and everything. The launch file is configured to load a `.env` file from the root of the library.

Create a `.env` file in the root with the following config:

```bash
# Setting the Sonos device to start with
SONOS2MQTT_DEVICE=192.168.x.x

# Change default mqtt server
# SONOS2MQTT_MQTT=mqtt:https://some.host:port

# Text-to-speech stuff https://svrooij.io/node-sonos-ts/sonos-device/notifications-and-tts.html#text-to-speech
# SONOS_TTS_ENDPOINT=https://sonos-tts:5601/api/generate
# SONOS_TTS_LANG=en-US
```

## Run documentation generator locally

The documentation can be found in [/docs](https://github.com/svrooij/sonos2mqtt/tree/master/docs) and uses Jekyll to convert the markdown to html. To check the generated documenation locally you can use the following script. It uses docker, so it won't install anything on your machine. It also has live reload to you can edit and save and should see the changes instantly.

`npm run serve-docs`
`npm run serve-docs` or change dir to `docs` and run `docker-compose up`

## Contributors ✨

Expand Down
Loading

0 comments on commit b6df7ef

Please sign in to comment.