2016-04-21 61 views
0

我正在实施我们的平台上的双按钮评级,我正在细细地分析一些细节。理解双按钮评级实施

首先,我真的试着在这里解释一下我所做的简单的麻烦!

我们有三种状态处理,并通过rateItemgetExtendedMetadata终端和用户返回可在三种状态之间切换:

0 - 未分级
1 - 最多投票
2 - 下投

所以rateItem接受这三个选项之一。

看着documentation,我的演示地图应该沿着这些线。

<Match propname="vote" value="0"> 
    <!-- the track is unrated --> 
    <Ratings> 
    <Rating AutoSkip="NEVER" Id="1" StringId="VoteUp" OnSuccessStringId="VoteUpSuccess"> 
    ... 
    </Rating> 
    <Rating AutoSkip="ALWAYS" Id="0" StringId="VoteDown" OnSuccessStringId="VoteDownSuccess"> 
    ... 
    </Rating> 
    </Ratings> 
</Match> 
<Match propname="vote" value="1"> 
    <!-- the track is rated thumbs up --> 
    <Ratings> 
    <Rating AutoSkip="NEVER" Id="3" StringId="VoteUp" OnSuccessStringId="VoteUpSuccess"> 
    ... 
    </Rating> 
    <Rating AutoSkip="ALWAYS" Id="2" StringId="VoteDown" OnSuccessStringId="VoteDownSuccess"> 
    ... 
    </Rating> 
    </Ratings> 
</Match> 
<Match propname="vote" value="2"> 
    <!-- the track is rated thumbs down --> 
    <Ratings> 
    <Rating AutoSkip="NEVER" Id="5" StringId="VoteUp" OnSuccessStringId="VoteUpSuccess"> 
    ... 
    </Rating> 
    <Rating AutoSkip="ALWAYS" Id="6" StringId="VoteDown" OnSuccessStringId="VoteDownSuccess"> 
    ... 
    </Rating> 
    </Ratings> 
</Match> 

这是我开始陷入困境的地方。 <Match ... value="X">元素看起来很好,并与我的数据显示相匹配。 但单击按钮时,所述rateItem端点出现通过6.接收的ID 0

的文档状态(ID 4中的例子中丢失):

ID(INT)这是一个该值将传递给rateItem方法。对于给定的属性名称,Id必须是唯一的。

因此,为了解决这个问题,我修改了我的演示文稿映射,以便从0 Match属性发送的ID为1和2(向上和向下投票)。有那么一个链接到0和2 1个匹配属性,以及2链接到0和1。这里就是我在:

<Match propname="vote" value="0"> 
    <!-- the track is unrated --> 
    <Ratings> 
    <Rating AutoSkip="NEVER" Id="1" StringId="VoteUp" OnSuccessStringId="VoteUpSuccess"> 
    ... 
    </Rating> 
    <Rating AutoSkip="NEVER" Id="2" StringId="VoteDown" OnSuccessStringId="VoteDownSuccess"> 
    ... 
    </Rating> 
    </Ratings> 
</Match> 
<Match propname="vote" value="1"> 
    <!-- the track is rated thumbs up --> 
    <Ratings> 
    <Rating AutoSkip="NEVER" Id="0" StringId="VoteUpCancel" OnSuccessStringId="VoteUpCancelSuccess"> 
    ... 
    </Rating> 
    <Rating AutoSkip="NEVER" Id="2" StringId="VoteDown" OnSuccessStringId="VoteDownSuccess"> 
    ... 
    </Rating> 
    </Ratings> 
</Match> 
<Match propname="vote" value="2"> 
    <!-- the track is rated thumbs down --> 
    <Ratings> 
    <Rating AutoSkip="NEVER" Id="1" StringId="VoteUp" OnSuccessStringId="VoteUpSuccess"> 
    ... 
    </Rating> 
    <Rating AutoSkip="NEVER" Id="0" StringId="VoteDownCancel" OnSuccessStringId="VoteDownCancelSuccess"> 
    ... 
    </Rating> 
    </Ratings> 
</Match> 

注字符串ID也更新了,我相信我的字符串文件和图像都很好。

这对我来说很有意义,但实际上是抛出我的图像和警报,并且我在不同的平台上有不同的结果(迄今在iOS和Mac控制器上测试过)。

在这一点上,任何人都可以提供任何建议吗?我希望我在这里有足够的感觉!我非常感谢任何人可以提供的提示。

回答

0

根据http://musicpartners.sonos.com/node/368的文档,您对第一个示例是正确的,并且该标识是您应该在rateItem端点上看到的内容。该值描绘了一个更一般的类别(竖起大拇指,竖起大拇指向下,中立),但id是类别中的特定状态。在你的第二个例子中,你在重复同一个propname中的id号,这就是你看到不一致行为的原因。

一般来说,当rateItem请求通过ID的唯一标识符进入您的服务时,流程应该如下,这将允许您在后端对音轨进行适当的评级。您应该使用rateItemResponse进行响应,然后进行getLastUpdate请求(它将更新所有连接到家庭的控制器的评级状态)和getExtendedMetdata请求,以便可以将属性值更新为与发送的ID。