diff --git a/lib/helpers.js b/lib/helpers.js
index 5cd048e..5aadeab 100644
--- a/lib/helpers.js
+++ b/lib/helpers.js
@@ -129,12 +129,26 @@ Helpers.GenerateLocalMetadata = function (uri, artUri = '') {
* @return {Object} options {uri: Spotify uri, metadata: metadata}
*/
Helpers.GenerateMetadata = function (uri, title = '', region = '3079') {
+ let meta = '- ##RESOURCETITLE####SPOTIFYTYPE####REGION##
'
+
+ // Soundcloud track
+ const match = uri.match(/x-sonos-http:track:(\d+).mp3\?sid=160&flags=8224&sn=4/)
+ if (match) {
+ return {
+ uri,
+ metadata: meta.replace('##SPOTIFYURI##', '10032020track%3a' + match[1])
+ .replace('##RESOURCETITLE##', title || 'Soundcloud Track')
+ .replace('##SPOTIFYTYPE##', 'object.item.audioItem.musicTrack')
+ .replace('##PARENTID##', '')
+ .replace('##REGION##', 'SA_RINCON40967_X_#Svc40967-0-Token')
+ }
+ }
+
const parts = uri.split(':')
if (!((parts.length === 2 && (parts[0] === 'radio' || parts[0] === 'x-sonosapi-stream' || parts[0] === 'x-rincon-cpcontainer')) || (parts.length >= 3 && parts[0] === 'spotify'))) {
debug('Returning string because it isn\'t recognized')
return Helpers.GenerateLocalMetadata(uri)
}
- let meta = '- ##RESOURCETITLE####SPOTIFYTYPE####REGION##
'
if (parts[0] === 'radio' || parts[0] === 'x-sonosapi-stream') {
const radioTitle = title || 'TuneIn Radio'
@@ -233,6 +247,16 @@ Helpers.GenerateMetadata = function (uri, title = '', region = '3079') {
.replace('##PARENTID##', '')
.replace(`SA_RINCON${region}_X_#Svc${region}-0-Token`, 'SA_RINCON40967_X_#Svc40967-0-Token')
}
+ } else if (uri.startsWith('x-rincon-cpcontainer:100f206cuser-tracks')) { // Sound Cloud user
+ const [id] = uri.replace('x-rincon-cpcontainer:', '').split('?')
+ return {
+ uri: uri,
+ metadata: meta.replace('##SPOTIFYURI##', id)
+ .replace('##RESOURCETITLE##', title || 'Sound Cloud User')
+ .replace('##SPOTIFYTYPE##', 'object.container.playlistContainer.sameArtist')
+ .replace('##PARENTID##', '')
+ .replace(`SA_RINCON${region}_X_#Svc${region}-0-Token`, 'SA_RINCON40967_X_#Svc40967-0-Token')
+ }
} else if (uri.startsWith('x-rincon-cpcontainer:1006206cplaylist')) { // Sound Cloud playlists
const [id] = uri.replace('x-rincon-cpcontainer:', '').split('?')
return {