MPD,如何获取当前播放列表的名称?
MPD, How to get the name of the current playlist?
我正在使用Python MPD2,有没有办法return当前选择的播放列表的名称?
谢谢,马克。
经过多方查找,终于在musicpd论坛上发帖了
https://forum.musicpd.org/viewtopic.php?f=7&t=4034
响应是:
"MPD does not remember of the most recently loaded playlist's name, so there's no way to query it.".
我在 bash 中的解决方案:
CURRENT="$(mpc -f "%file%" playlist | sha512sum )"
mpc lsplaylist | while read line
do
i="$(mpc -f "%file%" playlist $line | sha512sum )"
if [ "$i" = "$CURRENT" ]; then
echo "Current playlist is $line"
fi
done
我正在使用Python MPD2,有没有办法return当前选择的播放列表的名称?
谢谢,马克。
经过多方查找,终于在musicpd论坛上发帖了
https://forum.musicpd.org/viewtopic.php?f=7&t=4034
响应是:
"MPD does not remember of the most recently loaded playlist's name, so there's no way to query it.".
我在 bash 中的解决方案:
CURRENT="$(mpc -f "%file%" playlist | sha512sum )"
mpc lsplaylist | while read line
do
i="$(mpc -f "%file%" playlist $line | sha512sum )"
if [ "$i" = "$CURRENT" ]; then
echo "Current playlist is $line"
fi
done