Skip to content

Commit

Permalink
Merge pull request #508 from svrooij/bugfixes-2021-03
Browse files Browse the repository at this point in the history
Bugfixes 2021 03
  • Loading branch information
svrooij authored Mar 17, 2021
2 parents 16c64e1 + b499043 commit 010dafe
Show file tree
Hide file tree
Showing 7 changed files with 255 additions and 6,049 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ node_modules
typings

# VS
.vscode
.vscode/*.json
!.vscode/launch.json
config/*local.json

# Ignore Mac DS_Store files
Expand Down
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch current example",
"program": "${file}",
"skipFiles": [
"<node_internals>/**"
],
"env": {
"DEBUG":"sonos:*",
"SONOS_HOST":"192.168.96.56"
},
}
]
}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ DeviceDiscovery().once('DeviceAvailable', (device) => {
console.log('found device at ' + device.host)

// get all groups
sonos = new Sonos(device.host)
sonos.getAllGroups().then(groups => {
device.getAllGroups().then(groups => {
groups.forEach(group => {
console.log(group.Name);
})
Expand Down
9 changes: 9 additions & 0 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,14 @@ Helpers.GenerateMetadata = function (uri, title = '', region = '3079') {
.replace('##SPOTIFYTYPE##', 'object.container.playlistContainer')
.replace('##PARENTID##', '')
}
} else if (uri.startsWith('spotify:playlist:')) { // Playlist
return {
uri: 'x-rincon-cpcontainer:1006206c' + spotifyUri,
metadata: meta.replace('##SPOTIFYURI##', '1006206c' + spotifyUri)
.replace('##RESOURCETITLE##', '')
.replace('##SPOTIFYTYPE##', 'object.container.album.playlistContainer')
.replace('##PARENTID##', '')
}
} else if (uri.startsWith('spotify:user:')) {
return {
uri: 'x-rincon-cpcontainer:10062a6c' + spotifyUri + '?sid=9&flags=10860&sn=7',
Expand Down Expand Up @@ -276,6 +284,7 @@ Helpers.ParseDIDLItem = function (item, host, port, trackUri) {
title: item['r:streamContent'] || item['dc:title'] || null,
artist: item['dc:creator'] || null,
album: item['upnp:album'] || null,
albumArtist: item['r:albumArtist'] || null,
albumArtURI
}
if (trackUri) track.uri = trackUri
Expand Down
2 changes: 1 addition & 1 deletion lib/sonos.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Sonos.prototype.searchMusicLibrary = async function (searchType, searchTerm, req
let searches = `${searchTypes[searchType]}${separator}`

if (searchTerm && searchTerm !== '') {
searches = searches.concat(encodeURIComponent(searchTerm))
searches = searches.concat(searchType === 'share' ? searchTerm : encodeURIComponent(searchTerm))
}

var opts = {
Expand Down
Loading

0 comments on commit 010dafe

Please sign in to comment.