Playerctl/dbus가 Spotify에서 작동하지 않습니다

Playerctl/dbus가 Spotify에서 작동하지 않습니다

명령줄에서 Spotify를 재생/일시 중지하는 방법이 필요하지만 dbus 메서드와 playerctl 모두 "연결이 거부되었습니다"라고 표시됩니다. 이 문제를 어떻게 해결/해결할 수 있나요?

답변1

이제 2018년에 playerctl이 실행 중입니다.

playerctl -p spotify play-pause

를 사용하면 playerctl --help사용 가능한 모든 옵션을 볼 수 있습니다. 그러나 Spotify에서는 아직 positionvolume옵션을 사용할 수 없습니다.

답변2

다음 내용이 귀하의 질문에 대답하지 못할 수도 있고 다음 dbus 명령을 이미 시도했을 수도 있다는 것을 알고 있습니다. 하지만 관심 있는 다른 분들을 위해 여기에 게시하겠습니다.

저는 ubuntu gnome을 사용하고 있으며 다음/이전 등에 액세스하기 위해 Spotify의 .desktop 파일에 개인적으로 작업을 생성했습니다.

여기에 이미지 설명을 입력하세요.

이렇게 보이는데 도움이 될 수도 있겠네요

[Desktop Entry]
Name=Spotify
GenericName=Music Player
Comment=Spotify streaming music client
Icon=spotify-client
Exec=spotify %U
TryExec=spotify
Terminal=false
Type=Application
Categories=Audio;Music;Player;AudioVideo;
MimeType=x-scheme-handler/spotify;

Actions=PlayPause;Next;Previous;Stop

[Desktop Action PlayPause]
Name=Play-Pause
Exec=dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

[Desktop Action Next]
Name=Next
Exec=dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next

[Desktop Action Previous]
Name=Previous
Exec=dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous

[Desktop Action Stop]
Name=Stop
Exec=dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop

관련 정보