Skip to content

Commit

Permalink
Merge pull request #114 from svrooij/beta
Browse files Browse the repository at this point in the history
Januari release
  • Loading branch information
svrooij committed Jan 18, 2021
2 parents b6e7314 + bc53220 commit 76b13af
Show file tree
Hide file tree
Showing 90 changed files with 5,373 additions and 1,432 deletions.
2 changes: 0 additions & 2 deletions .eslintignore
@@ -1,4 +1,2 @@
examples/*
src/generator/*
src/musicservices/*
tests/helpers/legacy-helpers.js
42 changes: 17 additions & 25 deletions .eslintrc.js
Expand Up @@ -11,51 +11,43 @@ module.exports = {
},
rules: {
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"class-methods-use-this":"off",
"import/first": "warn",
"import/no-cycle": "off",
"import/no-duplicates": "warn",
"max-classes-per-file":"off",
"max-len":"off",
"no-console": "off",
"no-return-await": "off",
"linebreak-style": "off"
// e.g. '@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'class-methods-use-this':'off',
'max-classes-per-file':'off',
'max-len':'off',
'no-return-await': 'off',
'linebreak-style': 'off'
},
overrides: [
{
files: ['src/services/virtual-line-in.service.ts'],
files: ['src/helpers/metadata-helper.ts'],
rules: {
"@typescript-eslint/no-unused-vars": "off"
'no-underscore-dangle': 'off',
}
},
{
files: ['src/helpers/*.ts'],
files: ['src/models/*.ts'],
rules: {
'no-bitwise': 'warn',
'no-underscore-dangle': 'warn',
'no-useless-escape': 'warn',
'prefer-destructuring': 'warn'
'import/prefer-default-export': 'off'
}
},
{
files: ['src/models/*.ts'],
files: ['src/services/q-play.service.ts'],
rules: {
'import/prefer-default-export': 'warn'
'no-multiple-empty-lines': 'off'
}
},
{
files: ['src/services/*.ts'],
files: ['src/services/*.extension.ts'],
rules: {
'import/order': 'warn',
'no-multiple-empty-lines': 'warn'
'import/prefer-default-export': 'off',
}
},
{
files: ['src/sonos-device.ts'],
files: ['src/sonos-event-listener.ts', 'src/services/base-service.ts'],
rules: {
'@typescript-eslint/ban-types': 'warn'
'import/no-cycle': 'off',
}
}
]
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/test-and-release.yml
Expand Up @@ -5,8 +5,10 @@ on:
branches:
- master
- beta
# - feature/*
paths-ignore:
- 'docs/**'
- 'examples/**'
- 'README.md'
pull_request:
paths-ignore:
Expand All @@ -27,12 +29,11 @@ jobs:
run: npm ci
- name: Build library
run: npm run build
- name: Run code linting
run: npm run lint
- name: Run tests
run: npm run test
- name: Send data to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
if: ${{ always() }}
run: npm run jest
- uses: svrooij/secret-gate-action@v1
id: mygate
with:
Expand All @@ -46,3 +47,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Send data to Coveralls
if: ${{ always() }}
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

12 changes: 11 additions & 1 deletion docs/sonos-device/events.md
Expand Up @@ -84,7 +84,17 @@ Check out [this sample](https://github.com/svrooij/node-sonos-ts/blob/master/exa

## Event listener status

The event listener got 2 extra endpoints, a `/health` endpoint which will just respond with status code 200 if the listener is still running. There also is a `/status` endpoint, this will give some information about the event listener.
The event listener got 2 extra http endpoints, a `/health` endpoint which will just respond with status code 200 if the listener is still running. There also is a `/status` endpoint, this will give some information about the event listener.

The status endpoint is very handy if it looks you aren't receiving any events. It will show you the generated callback url. If that url isn't reachable from the network where the sonos speaker is in, you need to tweak your listener configuration.

### Event listener status in your app

You don't need to do an http call to the status endpoint, you can also directly get it from the `SonosEventListener`. Just call `SonosEventListener.DefaultInstance.GetStatus()` or `SonosEventListener.DefaultInstance.GetSubscriptions()`.

## Starting and stopping the listener

You probably won't need this, but if you want you can start and stop the event listener manually.

- `SonosEventListener.DefaultInstance.StartListener()` Start the listener (this will also enable the status and health endpoints)
- `SonosEventListener.DefaultInstance.StopListener()` Stop the listener, this will also unregister all subscriptions, but the services won't no you stopped the listener. It's better to unsubscribe first, see [event sample](https://github.com/svrooij/node-sonos-ts/blob/master/examples/events.js)
11 changes: 11 additions & 0 deletions docs/sonos-device/methods.md
Expand Up @@ -62,6 +62,17 @@ This library can guess the required metadata for certain track uri's. This is do

Currently supported url's for metadata guessing:

- `apple:album:1025210938` - Apple Music album (not in user's music library).
- `apple:libraryalbum:l.OIdA15a` - Apple Music album from user's music library.
- `apple:libraryplaylist:p.rQ5rCxE48W` - Apple Music playlist from user's music library.
- `apple:librarytrack:i.m3g9uLvzB7` - Apple Music track from user's music library.
- `apple:playlist:pl.cf589c8b40dc40cd9ddc2e61493d5efd` - Apple Music playlist (not in user's music library).
- `apple:track:1025212410` - Apple Music track (not in user's library).
- `deezer:album:123456` - A Deezer album by id
- `deezer:artistTopTracks:123456` - A Deezer artist top tracks
- `deezer:playlist:123456` - A Deezer playlist by id
- `deezer:track:123456` - A Deezer track by id
- `sonos:playlist:7` - A saved sonos playlist by number.
- `spotify:track:0GiWi4EkPduFWHQyhiKpRB` - Regular spotify track.
- `spotify:artistRadio:72qVrKXRp9GeFQOesj0Pmv` - Spotify artist radio (has to be added to queue).
- `spotify:artistTopTracks:72qVrKXRp9GeFQOesj0Pmv` - Spotify artist top tracks (has to be added to queue).
Expand Down

0 comments on commit 76b13af

Please sign in to comment.