可能的 Spotify 肖像元数据缓存错误

发布于 2024-12-24 21:00:24 字数 1115 浏览 1 评论 0原文

要复制的代码

In my app I have the following code.

var seed = "spotify:artist:3UbyYnvNIT5DFXU4WgiGpP";
  sp.core.getMetadata(seed, {
    onSuccess: function (metadata) {
      console.log(metadata);       
    },
    onFailure: function () {}
  });

查看行为的步骤

  1. 如果 Spotify 已打开,请关闭它,然后重新打开它,打开 Spotify 后运行应用程序并查看显示为的控制台,
Object
    name: "Whitesnake"
    portrait: ""
    type: "artist"
    uri: "spotify:artist:3UbyYnvNIT5DFXU4WgiGpP"
  __proto__: Object
  1. 然后单击广播应用程序并创建一个基于 Whitesnake 乐队的电台。
  2. 重新运行原始应用程序并查看将显示的控制台输出。
Object
    name: "Whitesnake"
    portrait: "spotify:image:3c4aa30d845dd456d750cf16bef8e2cadb2af342"
    type: "artist"
    uri: "spotify:artist:3UbyYnvNIT5DFXU4WgiGpP"
  __proto__: Object
  1. 退出 Spotify 并重新运行原始应用程序并查看将显示的控制台
Object
    name: "Whitesnake"
    portrait: ""
    type: "artist"
    uri: "spotify:artist:3UbyYnvNIT5DFXU4WgiGpP"
  __proto__: Object

问题

为什么无线电应用程序能够访问肖像 uri,然后在使用无线电应用程序后可以从我的应用程序访问该 uri?是否需要首先完成某种初始化,或者这是一个错误?

Code to replicate

In my app I have the following code.

var seed = "spotify:artist:3UbyYnvNIT5DFXU4WgiGpP";
  sp.core.getMetadata(seed, {
    onSuccess: function (metadata) {
      console.log(metadata);       
    },
    onFailure: function () {}
  });

Steps to view the behaviour

  1. If spotify is already open close it and then reopen it, after opening spotify run the app and view the console Which displays as
Object
    name: "Whitesnake"
    portrait: ""
    type: "artist"
    uri: "spotify:artist:3UbyYnvNIT5DFXU4WgiGpP"
  __proto__: Object
  1. Then click on the radio app and create a station based on the the band Whitesnake.
  2. Rerun the original app and view the console output which will display.
Object
    name: "Whitesnake"
    portrait: "spotify:image:3c4aa30d845dd456d750cf16bef8e2cadb2af342"
    type: "artist"
    uri: "spotify:artist:3UbyYnvNIT5DFXU4WgiGpP"
  __proto__: Object
  1. Quit spotify and rerun the original application and view the console which will display
Object
    name: "Whitesnake"
    portrait: ""
    type: "artist"
    uri: "spotify:artist:3UbyYnvNIT5DFXU4WgiGpP"
  __proto__: Object

Question

Why is the radio app able to access a portrait uri that is then accessible from my app after using the radio app? Is there some sort of initialization, that needs to be done first or is this a bug?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

最笨的告白 2024-12-31 21:00:24

有关艺术家(和专辑等)的某些信息只有在您“浏览”该 URI 后才可用 - 在此之前,Spotify 仅下载有关项目的基本信息以保持性能。

您所看到的是 Radio 正在进行浏览,这会导致 Spotify 客户端填写缺失的信息。

Spotify 即将推出更新,这将改善这种行为。

Some information on an artist (and album, etc) isn't available until you do a "browse" on that URI - until then, Spotify only downloads basic information on an item to keep performance up.

What you're seeing is the Radio doing a browse, which causes the Spotify client to fill in the missing information.

An update to Spotify is coming soon that will improve this behaviour.

烟雨扶苏 2024-12-31 21:00:24

如果我理解正确的话,您是否注意到,在从收音机中获得带有纵向 URI 的结果后,您在应用程序中使用它时会填充该对象数据?

另一方面;您应该使用 Artist 类而不是 sp.core。

var sp = getSpotifyApi(1);
var models = sp.require('sp://import/scripts/api/models');
models.Artist.fromURI("spotify:artist:3UbyYnvNIT5DFXU4WgiGpP", function(album) {
    console.log(album);
});

这应该会为您提供带有纵向 uri 字符串的正确输出。

Artist
    data: Object
    name: "Whitesnake"
    portrait: "spotify:image:3c4aa30d845dd456d750cf16bef8e2cadb2af342"
    type: "artist"
    uri: "spotify:artist:3UbyYnvNIT5DFXU4WgiGpP"

If I understood you correctly, you've noticed that after you get the result with a portrait URI from the radio, you get that object data populated when using it in your app?

On another note; you should be using the Artist class instead of sp.core.

var sp = getSpotifyApi(1);
var models = sp.require('sp://import/scripts/api/models');
models.Artist.fromURI("spotify:artist:3UbyYnvNIT5DFXU4WgiGpP", function(album) {
    console.log(album);
});

This should give you the correct output with a portrait uri string.

Artist
    data: Object
    name: "Whitesnake"
    portrait: "spotify:image:3c4aa30d845dd456d750cf16bef8e2cadb2af342"
    type: "artist"
    uri: "spotify:artist:3UbyYnvNIT5DFXU4WgiGpP"
风铃鹿 2024-12-31 21:00:24

正如 iKendac 提到的,尝试进行“浏览”:

var seed = "spotify:artist:3UbyYnvNIT5DFXU4WgiGpP";
sp.core.browseUri(seed, {  
    onSuccess: function (metadata) {
        console.log(metadata);       
    },
    onFailure: function () {}
});

示例如下: https://github.com/ptrwtts/kitchensink

As iKenndac mentioned, try doing a 'browse':

var seed = "spotify:artist:3UbyYnvNIT5DFXU4WgiGpP";
sp.core.browseUri(seed, {  
    onSuccess: function (metadata) {
        console.log(metadata);       
    },
    onFailure: function () {}
});

Examples here: https://github.com/ptrwtts/kitchensink

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文