我raspotify
按照以下方法安装在我的树莓派 3 上本指南希望我的手机可以使用 Spotify Connect 输出到连接到 pi 的扬声器。
curl -sSL https://dtcooper.github.io/raspotify/key.asc | sudo tee /usr/share/keyrings/raspotify-archive-keyrings.asc >/dev/null
echo 'deb [signed-by=/usr/share/keyrings/raspotify-archive-keyrings.asc] https://dtcooper.github.io/raspotify raspotify main' | sudo tee /etc/apt/sources.list.d/raspotify.list
sudo apt install raspotify
这看上去似乎安装正确了。
通过设置LIBRESPOT_NAME="pi_spotify"
并/etc/raspotify/conf
重新启动 pi,我可以在手机上访问 Spotify,Settings / Connect to a device
并且pi_spotify
可用。触摸它,它似乎连接了,如屏幕底部的反馈所示:
但是播放暂停,没有声音。当我触摸播放按钮时,@pi_spotify
似乎断开了连接。
否则,pi 上的声音会正常工作。如果我 ssh 到它aplay /foo/bar.wav
,它会通过扬声器播放。
我发现这个journalctl --system | grep spotify
Jan 17 09:45:07 raspberrypi systemd[1]: Started raspotify.service - Raspotify (Spotify Connect Client).
Jan 17 09:45:07 raspberrypi systemd[1]: raspotify-crash-report-generator.service: Deactivated successfully.
Jan 17 09:45:07 raspberrypi systemd[1]: Finished raspotify-crash-report-generator.service - Raspotify Crash Report Generator.
Jan 17 09:45:07 raspberrypi systemd[1]: raspotify-crash-report-generator.service: Consumed 1.697s CPU time.
Jan 17 09:45:19 raspberrypi librespot[4364]: [2024-01-17T09:45:19Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gue1.spotify.com:4070
Jan 17 09:45:19 raspberrypi librespot[4364]: [2024-01-17T09:45:19Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gew4.spotify.com:443
Jan 17 09:45:20 raspberrypi systemd[1]: raspotify.service: Main process exited, code=exited, status=1/FAILURE
Jan 17 09:45:20 raspberrypi systemd[1]: raspotify.service: Failed with result 'exit-code'.
Jan 17 09:45:20 raspberrypi systemd[1]: raspotify.service: Triggering OnFailure= dependencies.
Jan 17 09:45:20 raspberrypi systemd[1]: Starting raspotify-crash-report-generator.service - Raspotify Crash Report Generator...
我不确定该如何理解这句话,但我天真地接受了前两条信息
Started raspotify.service - Raspotify (Spotify Connect Client).
raspberrypi systemd[1]: raspotify-crash-report-generator.service: Deactivated successfully.
在我看来它好像在连接后立即停用。
我读过一些尝试journalctl -u raspotify.service -b
,但输出略有不同:
Jan 17 09:45:07 raspberrypi systemd[1]: Started raspotify.service - Raspotify (Spotify Connect Client).
Jan 17 09:45:19 raspberrypi librespot[4364]: [2024-01-17T09:45:19Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gue1.spotify.com:4070
Jan 17 09:45:19 raspberrypi librespot[4364]: [2024-01-17T09:45:19Z WARN librespot_core::apresolve] Ignoring blacklisted access point ap-gew4.spotify.com:443
Jan 17 09:45:20 raspberrypi librespot[4364]: Failed to get home directory.
Jan 17 09:45:20 raspberrypi librespot[4364]: [2024-01-17T09:45:20Z ERROR librespot_playback::player] Audio Sink Error Connection Refused: <AlsaSink> Device default May be Invalid, Busy, or Already in Use, ALSA>
Jan 17 09:45:20 raspberrypi systemd[1]: raspotify.service: Main process exited, code=exited, status=1/FAILURE
Jan 17 09:45:20 raspberrypi systemd[1]: raspotify.service: Failed with result 'exit-code'.
Jan 17 09:45:20 raspberrypi systemd[1]: raspotify.service: Triggering OnFailure= dependencies.
Jan 17 09:45:32 raspberrypi systemd[1]: Started raspotify.service - Raspotify (Spotify Connect Client).
在这里我注意到
librespot[4364]: Failed to get home directory.
librespot[4364]: [2024-01-17T09:45:20Z ERROR librespot_playback::player] Audio Sink Error Connection Refused: <AlsaSink> Device default May be Invalid, Busy, or Already in Use, ALSA>
我不知道这些是否有关联。
speaker-test -t wav -c 2
当在 pi 上运行时,会在连接的扬声器上产生预期的声音,因此 alsa 可以工作。
答案1
尝试更改默认设备。对我来说
LIBRESPOT_DEVICE=hw:CARD=Headphones,DEV=0
在/etc/conf
解决了这个问题。