-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: Support for stream urls fixed #192 * feat: Support for Group ID Fixed #182 Co-authored-by: H. Klages <[email protected]> Co-authored-by: Stephan van Rooij <[email protected]
- Loading branch information
Showing
8 changed files
with
90 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { expect } from 'chai' | ||
import { EventEmitter } from 'events'; | ||
import { randomUUID } from 'crypto'; | ||
import SonosDevice from '../src/sonos-device' | ||
import { TestHelpers } from './test-helpers'; | ||
import SonosEventListener from '../src/sonos-event-listener'; | ||
import { SmapiClient } from '../src/musicservices/smapi-client'; | ||
import { PlayMode, Repeat, TransportState } from '../src/models'; | ||
|
||
|
||
describe('SonosDevice Metadata', () => { | ||
describe('SetTransportUri', () => { | ||
// This tests fails for some reason, not sure is Artist radio ever worked. | ||
it.skip('should work with artist radio', async() => { | ||
const trackUri = 'spotify:artistRadio:72qVrKXRp9GeFQOesj0Pmv' | ||
const scope = TestHelpers.mockRequestToService('/MediaRenderer/AVTransport/Control', | ||
'AVTransport', | ||
'SetAVTransportURI', | ||
'<InstanceID>0</InstanceID><CurrentURI>x-sonosapi-radio:spotify%3aartistRadio%3a72qVrKXRp9GeFQOesj0Pmv?sid=9&flags=8300&sn=2</CurrentURI><CurrentURIMetaData><DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="100c206cspotify%3aartistRadio%3a72qVrKXRp9GeFQOesj0Pmv" parentID="10052064spotify%3aartist%3a72qVrKXRp9GeFQOesj0Pmv" restricted="true"><dc:title>Guus Meeuwis Radio</dc:title><upnp:class>object.item.audioItem.audioBroadcast.#artistRadio</upnp:class><dc:creator>Guus Meeuwis</dc:creator><upnp:albumArtURI>https://i.scdn.co/image/ab6761610000e5ebf5eda5ecd45cdbc2cc3c184a</upnp:albumArtURI><r:albumArtist>Guus Meeuwis</r:albumArtist><r:description>Guus Meeuwis</r:description><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">SA_RINCON2311_X_#Svc2311-0-Token</desc></item></DIDL-Lite></CurrentURIMetaData>' | ||
) | ||
const device = new SonosDevice(TestHelpers.testHost, 1400); | ||
const result = await device.SetAVTransportURI(trackUri); | ||
expect(scope.isDone()).to.be.true; | ||
expect(result).to.be.true | ||
}) | ||
|
||
it('should work with a stream url', async() => { | ||
const trackUri = 'x-rincon-mp3radio://https://kexp.streamguys1.com/kexp160.aac' | ||
const scope = TestHelpers.mockRequestToService('/MediaRenderer/AVTransport/Control', | ||
'AVTransport', | ||
'SetAVTransportURI', | ||
'<InstanceID>0</InstanceID><CurrentURI>x-rincon-mp3radio://https://kexp.streamguys1.com/kexp160.aac</CurrentURI><CurrentURIMetaData><DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="-1" restricted="true"><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">RINCON_AssociatedZPUDN</desc></item></DIDL-Lite></CurrentURIMetaData>' | ||
) | ||
const device = new SonosDevice(TestHelpers.testHost, 1400); | ||
const result = await device.SetAVTransportURI(trackUri); | ||
expect(scope.isDone()).to.be.true; | ||
expect(result).to.be.true | ||
}) | ||
}) | ||
}); |