bencevans / node-sonos

🔈 Sonos Media Player Interface/Client
https://www.npmjs.com/package/sonos
MIT License
700 stars 146 forks source link

deviceDescription() property '_' - strange value #465

Closed hklages closed 4 years ago

hklages commented 4 years ago

deviceDescription() now returns asproperty '_' with strange content: "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\n \n \n \n \n #DEACTIVATION_STATE_TAG_AND_VALUE#\n #DEACTIVATION_TTL_TAG_AND_VALUE#\n #DEACTIVATION_DATE_TIME_TAG_AND_VALUE#\n \n \n \n \n "

Expected Behavior

no property '_'

Current Behavior

see above

Possible Solution

delete that property

Versions (and Environment)

node-sonos version: current

svrooij commented 4 years ago

The Sonos software seems to have a bug. The http://192.168.2.4:1400/xml/device_description.xml file seems incorrect. The used xml parser cannot handle it.

This issue isn’t solve able without changing the entire xml library, I’m tempted to close this issue since I don’t have a solution for this.

<?xml version="1.0" encoding="utf-8" ?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
  <specVersion>
    <major>1</major>
    <minor>0</minor>
  </specVersion>
  <device>
    <deviceType>urn:schemas-upnp-org:device:ZonePlayer:1</deviceType>
    <minCompatibleVersion>56.0-00000</minCompatibleVersion>
    <legacyCompatibleVersion>36.0-00000</legacyCompatibleVersion>
    <apiVersion>1.18.9</apiVersion>
    <minApiVersion>1.1.0</minApiVersion>
    <displayVersion>11.2</displayVersion>
    <extraVersion>OTP: 1.1.1(1-16-4-zp5s-0.5)</extraVersion>
    <roomName>Kantoor</roomName>
    <displayName>Play:5</displayName>
    <zoneType>5</zoneType>
    <feature1>0x02000002</feature1>
    <feature2>0x00006172</feature2>
    <feature3>0x0003102a</feature3>
    <seriesid>P100</seriesid>
    <variant>0</variant>
    <internalSpeakerSize>3</internalSpeakerSize>
    <bassExtension>0.000</bassExtension>
    <satGainOffset>0.000</satGainOffset>
    <memory>32</memory>
    <flash>32</flash>
    #DEACTIVATION_STATE_TAG_AND_VALUE#
    #DEACTIVATION_TTL_TAG_AND_VALUE#
    #DEACTIVATION_DATE_TIME_TAG_AND_VALUE#
    <flashRepartitioned>1</flashRepartitioned>
    <ampOnTime>425</ampOnTime>
    <retailMode>0</retailMode>
  </device>
</root>
pascalopitz commented 4 years ago

What about replacing the strings with some nodes, before handing it to the XML parser?

On Mon, 29 Jun 2020 at 07:08, Stephan van Rooij notifications@github.com wrote:

The Sonos software seems to have a bug. The http://192.168.2.4:1400/xml/device_description.xml file seems incorrect. The used xml parser cannot handle it.

This issue isn’t solve able without changing the entire xml library, I’m tempted to close this issue since I don’t have a solution for this.

<?xml version="1.0" encoding="utf-8" ?>

1 0 urn:schemas-upnp-org:device:ZonePlayer:1 56.0-00000 36.0-00000 1.18.9 1.1.0 11.2 OTP: 1.1.1(1-16-4-zp5s-0.5) Kantoor Play:5 5 0x02000002 0x00006172 0x0003102a P100 0 3 0.000 0.000 32 32 #DEACTIVATION_STATE_TAG_AND_VALUE# #DEACTIVATION_TTL_TAG_AND_VALUE# #DEACTIVATION_DATE_TIME_TAG_AND_VALUE# 1 425 0

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bencevans/node-sonos/issues/465#issuecomment-650825297, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACCK7EAUETPXXJGPGYOUQTRY6Z67ANCNFSM4NZEMPNQ .

svrooij commented 4 years ago

I think it would then be best to use a regular expression to remove #...# with letters and underscores in between. And maybe make it optional.

We welcome every contribution, so if you want to give it a go.

Looking forward to see your PR.

pascalopitz commented 4 years ago

I made the tags into comments ... that shouldn't throw the xml parser

bencevans commented 4 years ago

:tada: This issue has been resolved in version 1.13.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

svrooij commented 4 years ago

Once this build completes a new version will be online https://travis-ci.org/github/bencevans/node-sonos/builds/703139452 I wasn't fast enough....