spotify mp3
Instead of selecting a record, a minifigure is selected for this Jukebox Portal.
无需选择记录,而是为此Jukebox Portal选择了一个小人像。
The “toys-to-life” LEGO Dimensions console game was discontinued in October 2017. Now you can bring it back to life as a Spotify controller by connecting the USB toy pad to a Raspberry Pi and running the Open Source “Jukebox Portal” app.
“玩具到生活” LEGO Dimensions控制台游戏于2017年10月停产。现在,您可以通过将USB玩具垫连接到Raspberry Pi并运行开放源代码“ Jukebox Portal”应用,使其重新成为Spotify控制器。
Listen to songs, albums or playlists by placing a LEGO minifigure on the LEGO Dimensions pad and enjoy the audio and light show!
将LEGO minifigure放置在LEGO Dimensions垫上,聆听歌曲,专辑或播放列表,并享受音频和灯光表演!
As seen in the video, the LEGO Dimensions base is transformed into a concert stage. The LEGO 40173 Iconic Picture Frame holds a phone with the Spotify app running between scaffolding and spot lights. Finally, two actual speakers are on the pad to appear as a rock concert stage.
从视频中可以看到,乐高维度基地已转变为音乐会舞台。 LEGO 40173 Iconic Picture Frame可容纳一部带有Spotify应用程序的手机,该应用程序在脚手架和聚光灯之间运行。 最后,两个实际的扬声器将出现在摇滚音乐会舞台上。
Spotify control is not limited to just LEGO minifigures. Disney Infinity characters, NFC tags, stickers or cards can be assigned to a Spotify song, album or playlist too.
Spotify的控制不仅限于乐高人仔。 迪士尼Infinity角色,NFC标签,贴纸或卡片也可以分配给Spotify歌曲,专辑或播放列表。

While the light show plays for the duration of the track, on the Jukebox Portal web app, the album art of the current track is displayed. In the demo video, this is shown in full screen on the TV in the background. A web browser screenshot is shown below.
当灯光秀在曲目持续时间内播放时,在Jukebox Portal Web应用程序上,将显示当前曲目的专辑封面。 在演示视频中,将在背景电视上全屏显示该视频。 Web浏览器的屏幕截图如下所示。

My 7 year old enjoys playing with LEGO and with these toys he can play his favourite songs in the old fashioned tactile way, as it was with cassettes, vinyl and compact disc. Albeit, his choice of music The Chicken Dance and the Ninja Kidz is on constant repeat.
我7岁的孩子喜欢与乐高玩,通过这些玩具,他可以用老式的触觉方式播放自己喜欢的歌曲,例如带盒式录音带,黑胶唱片和光盘。 虽然如此,他对音乐的选择《鸡舞》和《忍者小子》却不断重复。
The Jukebox Portal is also an attraction with the grown ups, serving as a novelty during visits and gatherings.
自动点唱机门户网站也吸引了大人,在参观和聚会中成为一种新颖事物。
Instead of selecting a record or CD, a minifigure is selected for this Jukebox Portal.
无需选择记录或CD,而是为此Jukebox Portal选择了一个小图。
The Jukebox Portal lights up, the connected Spotify device plays the track and on a nearby TV, the currently playing track image is displayed.
点唱机门户会亮起,连接的Spotify设备播放曲目,并在附近的电视上显示当前播放的曲目图像。
怎么运行的: (How it works:)
The LEGO minifigures are attached to a LEGO Dimensions disc, which has a NFC tag embedded inside.
LEGO minifigures附在LEGO Dimensions光盘上,该光盘内嵌NFC标签。

Each tag contains a small amount of data (such as 180 bytes for NTAG213 types) including a Unique ID, such as “04 83 1a 62 71 40 80”. This UID is used by the Jukebox Portal app, to uniquely identify a tag and therefore something that tag is attached to, along with the Spotify “action” assigned to it. For example, the Ironman minifigure will play Black Sabbath’s Iron Man track.
每个标签包含少量数据(例如,NTAG213类型为180字节),包括唯一ID,例如“ 04 83 1a 62 71 40 80”。 Jukebox Portal应用程序使用此UID来唯一地标识标签,并因此标识该标签所附加的内容以及为其分配的Spotify“操作”。 例如,Ironman minifigure将播放Black Sabbath的Iron Man曲目。
Since the Jukebox Portal leverages the NFC technology in the Lego Dimensions base, most NFC enabled devices or tags can be used, such as the Disney Infinity toy characters.
由于Jukebox Portal在Lego Dimensions基础中利用了NFC技术,因此可以使用大多数支持NFC的设备或标签,例如Disney Infinity玩具角色。
Tags are defined in a NFC tags configuration file, for example:
标签是在NFC标签配置文件中定义的,例如:
# NFC tags have unique identifiers which are assigned "Spotify URI" actions.
identifier:
04831a62714080:
# LEGO minifigure. Play 11s into the Black Sabbath track.
name: Ironman
spotify: track:0TI8TP4FitVPoEHPTySx48
position_ms: 11000
04d5dbd2534280:
# LEGO minifigure. Play Lego Movie 2 soundtrack.
name: Everything is Awesome
spotify: album:7vUakEBYI3YXIoAHHRufrq
ea508007:
# NTAG213 card
name: Iron DJ triathlon playlist
spotify: playlist:2srSxWasD4ZZh4B7ckyihH
042c52f23d2d80:
# Disney Infinity character
name: Jack Sparrow
spotify: track:4AD2dterIUjNt1LFNI9Bvi
042f1cf2272380:
# Clipper card. Sends a Slack message to the Troupe home
# automation chat bot to toggle the lights on. See:
# https://chatbotsmagazine.com/the-travelling-slack-bot-troupe-c47e80dd48d9
name: Clipper card
slack: Toggle dining light
The tag identifier can be obtained by initially placing the tag on the LEGO Dimensions base. The Jukebox Portal app will display the unknown tag’s identifier in the logs. Copy this into the tags.yml file along with the relevant name and tag action. Now, take the physical tag off and on again for the app to recognize the new tag and perform the assigned action.
可以通过将标签最初放置在LEGO Dimensions基座上来获得标签标识符。 Jukebox Portal应用程序将在日志中显示未知标签的标识符。 将其连同相关的名称和标记操作一起复制到tags.yml文件中。 现在,关闭然后再打开物理标签,以使应用识别新标签并执行分配的操作。
The Spotify action is obtained from a Spotify client, selecting the track, album or playlist to obtain the “Spotify URI”, as shown below:
从Spotify客户端获得Spotify操作,选择曲目,专辑或播放列表以获取“ Spotify URI”,如下所示:

A Slack action is also available to send messages via a webhook to a Slack channel. In my use case (see the aforementioned tag.yml file example), a tag will trigger a Slack message to a home automation chat bot to toggle the lights on or off. By proxy, the LEGO Dimensions pad also becomes a home automation controller! See the Medium article on “The Traveling Slack Bot Troupe” to extend the Jukebox Portal’s capabilities.
Slack操作也可用于通过Webhook将消息发送到Slack通道。 在我的用例中(请参阅前面的tag.yml文件示例),标签将触发Slack消息到家庭自动化聊天机器人,以打开或关闭灯。 通过代理,乐高Dimensions pad也可以成为家庭自动化控制器! 请参阅“旅行中的休闲Bot团”中的文章,以扩展自动存储塔门户的功能。
您将需要: (You will require:)
A LEGO Dimensions base is limited to the PS3, PS4 or Wii gaming consoles. Sorry, Xbox bases are not supported by the Jukebox Portal app.
乐高尺寸基础仅限于PS3,PS4或Wii游戏机。 抱歉,Jukebox Portal应用程序不支持Xbox基础。

Any NFC Tag that contains an UID, such as LEGO Dimensions character discs, Disney Infinity characters, NFC NTAG213 tags, stickers or cards.
包含UID的任何NFC标签,例如LEGO Dimensions角色光盘,迪士尼Infinity角色,NFC NTAG213标签,贴纸或卡片。
A Raspberry Pi with Python 3.8 installed to run the Jukebox Portal app.
安装了Python 3.8的Raspberry Pi,用于运行Jukebox Portal应用程序。
A Spotify Premium account is required to leverage the API resources.
需要Spotify Premium帐户才能利用API资源。
使用说明 (Instructions)
先决条件(Prerequisites)
Python 3.8. You may need to download and compile this version on the Raspberry Pi.
Python 3.8 。 您可能需要在Raspberry Pi上下载并编译此版本。
To install Python 3.8 follow these command line steps:
要安装Python 3.8,请遵循以下命令行步骤:
sudo apt-get -y update
sudo apt-get -y install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev libjpeg-dev
wget https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz
tar xf Python-3.8.5.tar.xz
cd Python-3.8.5
sudo ./configure-enable-optimizations
sudo make -j 4
sudo make altinstall
cd ..
sudo rm -r Python-3.8.5
rm Python-3.8.5.tar.xz
sudo apt-get -y autoremove
sudo apt-get -y clean
cd
python3.8 -m venv venv
. ./venv/bin/activate
Download the Jukebox Portal software:
下载Jukebox Portal软件:
git clone https://github.com/meltaxa/jukebox-portal.git
cd jukebox-portal
Install dependencies:
安装依赖项:
./install.sh
Optional. Make the Raspberry Pi a Spotify device:
可选的。 使Raspberry Pi成为Spotify设备:
pip install raspotify
Spotify设定 (Spotify Setup)
1. Login to the Spotify API developer dashboard:
1.登录到Spotify API开发人员仪表板:
https://developer.spotify.com/dashboard/
https://developer.spotify.com/dashboard/
2. Click the CREATE AN APP button. Fill in the App name and description, accept the conditions and click CREATE.
2.单击创建应用程序按钮。 填写应用名称和说明,接受条件,然后点击创建。

3. Take note of the Client ID and Client Secret. These will be pasted into the config.py file later.
3.记录客户端ID和客户端密钥。 这些将稍后粘贴到config.py文件中。
4. Click EDIT SETTINGS. Add a Redirect URI: http://localhost:5000/callback and click SAVE.
4.单击编辑设置。 添加重定向URI: http:// localhost:5000 / callback ,然后单击SAVE 。

配置自动存储塔门户 (Configure the Jukebox Portal)
Edit the config.py file. Replace the Spotify API app credential values:
编辑config.py文件。 替换Spotify API应用凭据值:
CLIENT_ID = "<...>"
CLIENT_SECRET = "<...>"
Optional: To add a Slack webhook for tag actions, add this line to the tags.yml file:
可选:要为标记操作添加Slack Webhook,请将此行添加到tags.yml文件:
slack_hook: <REPLACE_THIS_WITH_THE_WEBHOOK_URL>
启动自动存储塔门户 (Start the Jukebox Portal)
./run.py
Visit in the browser: http://localhost:5000/
在浏览器中访问: http:// localhost:5000 /
You will be asked to login and connect to Spotify:
系统将要求您登录并连接到Spotify:

The Jukebox Portal will flash the lights on the LEGO Dimension pad to indicate it is now ready.
“自动点唱机”门户将使“乐高”尺寸垫上的指示灯闪烁,以指示现已准备就绪。
In the Spotify client, connect to a device to where you want the audio to be streamed.
在Spotify客户端中,连接到要将音频流传输到的设备。
Place a tag on the pad.
在标签上放置一个标签。
New tags will be identified in the app console logs. Edit the tags.yml file with the identifier and the Spotify URI action that should be assigned to it. No need to restart the app. Now place the tag off and on again.
新标签将在应用程序控制台日志中标识。 编辑具有标识符和应分配给它的Spotify URI操作的tags.yml文件。 无需重启应用。 现在,将标签重新打开。
Spotify will start playing a track.
Spotify将开始播放曲目。
In the browser, the app will display the currently playing track’s album art. If nothing is playing, the Jukebox Portal home page is shown:
在浏览器中,该应用程序将显示当前播放曲目的专辑封面。 如果没有播放任何内容,则会显示Jukebox Portal主页:

Hope you enjoy the Jukebox Portal app.
希望您喜欢Jukebox Portal应用程序。
Share your LEGO Dimensions set and musical LEGO minifigure character creations in the comments section.
在评论部分中分享您的乐高尺寸图集和乐高乐高人物角色的创作。
Thanks for reading, building and playing!
感谢您的阅读,建设和娱乐!
翻译自: https://medium.com/@mellican/my-lego-minifigures-play-spotify-dc397e83280e
spotify mp3