将Spotify URI编码为Spotify代码 [英] Encoding Spotify URI to Spotify Codes

查看:195
本文介绍了将Spotify URI编码为Spotify代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Spotify代码是小的条形码,可让您共享歌曲,艺术家,用户,播放列表等.

它们以条"的不同高度对信息进行编码. 23条可以设置8个离散的高度,这意味着8 ^ 23个不同的可能条形码.

Spotify根据其URI模式生成条形码.此URI spotify:playlist:37i9dQZF1DXcBWIGoYBM5M映射到以下条形码:

与代码相比,URI中包含更多的信息(62 ^ 22).您如何将URI映射到条形码?似乎您不能简单地直接对URI进行编码.有关更多背景信息,请参见我对这个问题的答案": https://stackoverflow.com/a/62120952/10703868

解决方案

您的怀疑是正确的-他们正在使用查找表.有关所有有趣的技术细节,请参见以下相关专利: https://data.epo.org/publication-server/rest/v1.0/publication-dates/20190220/patents/EP3444755NWA1/document.pdf

Spotify Codes are little barcodes that allow you to share songs, artists, users, playlists, etc.

They encode information in the different heights of the "bars". There are 8 discrete heights that the 23 bars can be, which means 8^23 different possible barcodes.

Spotify generates barcodes based on their URI schema. This URI spotify:playlist:37i9dQZF1DXcBWIGoYBM5M gets mapped to this barcode:

The URI has a lot more information (62^22) in it than the code. How would you map the URI to the barcode? It seems like you can't simply encode the URI directly. For more background, see my "answer" to this question: https://stackoverflow.com/a/62120952/10703868

解决方案

Your suspicion was correct - they're using a lookup table. For all of the fun technical details, the relevant patent is available here: https://data.epo.org/publication-server/rest/v1.0/publication-dates/20190220/patents/EP3444755NWA1/document.pdf

这篇关于将Spotify URI编码为Spotify代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆