实现收藏夹时如何从字符串文件中获取标题?

How can I get the title from the strings file when implementing favorites?

我正在尝试通过关注 this instruction 添加收藏夹,但我无法从字符串文件中读取标题。我做错了什么?

这是我的 getExtendedMetadata 回复:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.sonos.com/Services/1.1">
  <SOAP-ENV:Body>
    <ns1:getExtendedMetadataResponse>
      <ns1:getExtendedMetadataResult>
        <ns1:mediaMetadata>
          <ns1:id>album_track:17079|193549</ns1:id>
          <ns1:itemType>track</ns1:itemType>
          <ns1:title>Sabo &amp; Zeb - Sambafrica</ns1:title>
          <ns1:mimeType>audio/mp3</ns1:mimeType>
          <ns1:trackMetadata>
            <ns1:artistId>artist:1</ns1:artistId>
            <ns1:artist>Various Artists</ns1:artist>
            <ns1:albumArtistId>artist:1</ns1:albumArtistId>
            <ns1:albumArtist>Various Artists</ns1:albumArtist>
            <ns1:albumId>album:17079</ns1:albumId>
            <ns1:album>10 Years of SOL</ns1:album>
            <ns1:duration>451</ns1:duration>
            <ns1:albumArtURI>https://assets.s3.amazonaws.com/cover/30929/10.png</ns1:albumArtURI>
          </ns1:trackMetadata>
        </ns1:mediaMetadata>
        <ns1:relatedActions>
          <ns1:action>
            <ns1:id>add_track_to_my_library</ns1:id>
            <ns1:title>ADD_ITEM</ns1:title>
            <ns1:actionType>simpleHttpRequest</ns1:actionType>
            <ns1:simpleHttpRequestAction>
              <ns1:url>https://sonosdev.newmediasquad.com/v1/favorites/add/track/17079</ns1:url>
              <ns1:method>POST</ns1:method>
            </ns1:simpleHttpRequestAction>
          </ns1:action>
        </ns1:relatedActions>
      </ns1:getExtendedMetadataResult>
    </ns1:getExtendedMetadataResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

这是我的字符串文件:

<?xml version="1.0" encoding="utf-8" ?>
<stringtables xmlns="http://sonos.com/sonosapi">
  <stringtable rev="20040502" xml:lang="en-US">
    <string stringId="ServicePromo">Welcome to YogiTunes!</string>
    <string stringId="LOGIN">Login</string>
    <string stringId="SIGNUP">Sign up</string>
    <string stringId="ADD_ITEM">Add to My Library</string>
    <string stringId="REMOVE_ITEM">Remove from My Library</string>
    <string stringId="ADD_SUCCESS">Added successfully</string>
    <string stringId="ADD_FAILED">Something went wrong. Please try again or contact us at support@yogi-tunes.com.</string>
    <string stringId="REMOVE_SUCCESS">Removed successfully</string>
    <string stringId="REMOVE_FAILED">Something went wrong. Please try again or contact us at support@yogi-tunes.com.</string>
    <string stringId="Error5Message">Retry token request.</string>
    <string stringId="Error100Message">Namaste!! Have some obstacles that need removing? Gan Gan Ganapataye! Contact us at support@yogi-tunes.com and we will get back to you as soon as possible.</string>
  </stringtable>

  [snip other languages]

</stringtables>

(完整字符串文件 here

但是,这是我在应用程序中看到的:

其他字符串从字符串文件中正确加载的。我做错了什么?

Sonos 应用程序在 <relatedActions> 下的 <action> 中显示 <title> 条目的字符串文本的方式存在错误。这适用于 <relatedBrowse><relatedText>,这就是为什么您会看到它对这些操作的行为符合预期。我们的积压工作中有这个。修复后我会更新此答案。

此外,我们建议您使用 PUT 收藏请求。您的示例显示了一个 POST 请求。

2020 年 6 月 15 日更新 5:00 下午:这已在本周晚些时候 11.1 release. This will also be reflected in the Sonos developer portal blog 中修复。