From b0983f1ad484b5a978535544feb9a4878eb7de67 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Sat, 30 Jul 2022 00:20:19 +0200 Subject: [PATCH] spotify-client: tentative to fix --- bin/spotify-clean | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/spotify-clean b/bin/spotify-clean index f0726dd..e3a7e03 100755 --- a/bin/spotify-clean +++ b/bin/spotify-clean @@ -1,10 +1,14 @@ #!/bin/sh -# Kill all spotify streams, except the most recent one. +# Kill all spotify streams, except the most recent one. We need to use +# the serial to know which one this is as ID are not monotonous. -pw-cli dump short | grep spotify pw-cli dump short client \ | grep -F 'ap="spotify"' \ - | head -n-1 \ | cut -d: -f1 \ - | xargs -rn1 pw-cli destroy + | while read id; do + echo $(pw-cli dump $id | sed -nE 's/^\s*object.serial = "([0-9]*)"/\1/p') $id +done \ + | sort -n \ + | head -n-1 \ + | xargs -trn1 pw-cli destroy