Skip to content

Commit 010dafe

Browse files
authored
Merge pull request #508 from svrooij/bugfixes-2021-03
Bugfixes 2021 03
2 parents 16c64e1 + b499043 commit 010dafe

File tree

7 files changed

+255
-6049
lines changed

7 files changed

+255
-6049
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ node_modules
88
typings
99

1010
# VS
11-
.vscode
11+
.vscode/*.json
12+
!.vscode/launch.json
1213
config/*local.json
1314

1415
# Ignore Mac DS_Store files

.vscode/launch.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Launch current example",
11+
"program": "${file}",
12+
"skipFiles": [
13+
"<node_internals>/**"
14+
],
15+
"env": {
16+
"DEBUG":"sonos:*",
17+
"SONOS_HOST":"192.168.96.56"
18+
},
19+
}
20+
]
21+
}

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ DeviceDiscovery().once('DeviceAvailable', (device) => {
7676
console.log('found device at ' + device.host)
7777

7878
// get all groups
79-
sonos = new Sonos(device.host)
80-
sonos.getAllGroups().then(groups => {
79+
device.getAllGroups().then(groups => {
8180
groups.forEach(group => {
8281
console.log(group.Name);
8382
})

lib/helpers.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,14 @@ Helpers.GenerateMetadata = function (uri, title = '', region = '3079') {
187187
.replace('##SPOTIFYTYPE##', 'object.container.playlistContainer')
188188
.replace('##PARENTID##', '')
189189
}
190+
} else if (uri.startsWith('spotify:playlist:')) { // Playlist
191+
return {
192+
uri: 'x-rincon-cpcontainer:1006206c' + spotifyUri,
193+
metadata: meta.replace('##SPOTIFYURI##', '1006206c' + spotifyUri)
194+
.replace('##RESOURCETITLE##', '')
195+
.replace('##SPOTIFYTYPE##', 'object.container.album.playlistContainer')
196+
.replace('##PARENTID##', '')
197+
}
190198
} else if (uri.startsWith('spotify:user:')) {
191199
return {
192200
uri: 'x-rincon-cpcontainer:10062a6c' + spotifyUri + '?sid=9&flags=10860&sn=7',
@@ -276,6 +284,7 @@ Helpers.ParseDIDLItem = function (item, host, port, trackUri) {
276284
title: item['r:streamContent'] || item['dc:title'] || null,
277285
artist: item['dc:creator'] || null,
278286
album: item['upnp:album'] || null,
287+
albumArtist: item['r:albumArtist'] || null,
279288
albumArtURI
280289
}
281290
if (trackUri) track.uri = trackUri

lib/sonos.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Sonos.prototype.searchMusicLibrary = async function (searchType, searchTerm, req
118118
let searches = `${searchTypes[searchType]}${separator}`
119119

120120
if (searchTerm && searchTerm !== '') {
121-
searches = searches.concat(encodeURIComponent(searchTerm))
121+
searches = searches.concat(searchType === 'share' ? searchTerm : encodeURIComponent(searchTerm))
122122
}
123123

124124
var opts = {

0 commit comments

Comments
 (0)