From b7a83c81c11b5a268e8aaf5c11a378cc796fe0d2 Mon Sep 17 00:00:00 2001 From: Milan Zamazal Date: Thu, 16 Jun 2022 07:30:52 +0200 Subject: [PATCH] Move formatting list of properties to a separate function --- pw-access.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pw-access.el b/pw-access.el index 732cfa2..dd6f212 100644 --- a/pw-access.el +++ b/pw-access.el @@ -207,11 +207,13 @@ Note this interface may not work with all PipeWire versions.") (defun pw-cli--format-property (property) (format "%s: %s" (car property) (pw-cli--format-property-value (cdr property)))) +(defun pw-cli--format-properties (properties) + (concat "{ " (mapconcat #'pw-cli--format-property properties ", ") " }")) + (defun pw-cli--set-parameter (object-id parameter value) - (let* ((formatted (mapconcat #'pw-cli--format-property value ", ")) - (param-value (concat "{ " formatted " }"))) + (let* ((formatted (pw-cli--format-properties value))) (call-process pw-cli-command nil pw-cli-command nil - "set-param" (number-to-string object-id) parameter param-value))) + "set-param" (number-to-string object-id) parameter formatted))) (cl-defmethod pw-access-set-properties ((_class pw-cli-accessor) node-id properties) (pw-cli--set-parameter node-id "Props" properties))