Solved playerctl alternative/substitute

Writing a little script that does exactly what you want and handles the players you are actually using might be the easier way. Or even easier just alias the commands you want like vnxt or vprv for next/prev in vlc or snxt for spotify. Most players are easy to control from commandline, just read their manpages.
 
If you enjoy this program then why not simply build it?

I gave it a try in my test jail and although it is a bit picky about its requirements I can fully build and use it. Note: I don't have vlc, spotify and any of that installed so I don't know if it actually controls them. Still, considering that it build cleanly I don't see why it wouldn't:
Code:
root@psi:~/playerctl/playerctl # ls -F
.libs/                          playerctl-generated.h
Makefile                        playerctl-generated.lo
Makefile.am                     playerctl-generated.o
Makefile.in                     playerctl-player.c
Playerctl-1.0.gir               playerctl-player.h
Playerctl-1.0.typelib           playerctl-player.lo
libplayerctl-1.0.la             playerctl-player.o
meson.build                     playerctl-playerctl-cli.o
mpris-dbus-interface.xml        playerctl-version.h
playerctl*                      playerctl-version.h.in
playerctl-1.0.pc                playerctl.h
playerctl-cli.c                 playerctl.pc
playerctl-generated.c           playerctl.pc.in
As I said, it is quite picky and it requires several building tools, in specific:
Also keep in mind that these are the main ports, they all have dependencies of their own which also need to be satisfied. Like I said: I used my test jail for this so I simply installed the binary packages for that.

But if you install those tools you should be able to run autogen.sh which will eventually run configure after which you might need to run it manually: ./configure --disable-dependency-tracking; for some reason I had an issue with the setup trying to run depfiles, something I'm not familiar with nor can I track this in the ports collection. I assume it's part of some GNU make toolset but couldn't be bothered to try and find it, also because using the commandline parameter also works.

Hope this can help!
 
Thank guys for ideas, I've solve it using audtool which is part of audacious and sh scripting. Now I can control (play/pause/status) audacious from i3blocks.
Code:
#!/bin/sh

INSTANCE="${BLOCK_INSTANCE}"

ICON_PLAY=""
ICON_PAUSE=""
ICON_STOP=""
CUR_ICON=""


if [ "${BLOCK_BUTTON}" -eq 1 ]; then
    $(audtool playlist-reverse)
elif [ "${BLOCK_BUTTON}" -eq 2 ]; then
    $(audtool playback-playpause)
elif [ "${BLOCK_BUTTON}" -eq 3 ]; then
    $(audtool playlist-advance)
fi

PLAYER_STATUS="$(audtool playback-status)"
INFO_TITLE="$(audtool current-song | cut -d "-" -f3)"
INFO_ARTIST="$(audtool current-song | cut -d "-" -f1)"

if [ "${PLAYER_STATUS}" = "paused" ]; then
  CUR_ICON="${ICON_PAUSE}"
elif [ "${PLAYER_STATUS}" = "playing" ]; then
  CUR_ICON="${ICON_PLAY}"
else
  exit 33
fi

if [ "${INFO_TITLE}" != "" ] && [ "${INFO_ARTIST}" != "" ]; then
  echo "${INFO_ARTIST} - ${INFO_TITLE} ${CUR_ICON}"
  echo "${INFO_ARTIST} - ${INFO_TITLE} ${CUR_ICON}"
fi

i3wm41-24.07.2018.png
 
Back
Top