Look up pulseaudio sink-input index by property
<p>The output of both <code>pactl list sink-inputs</code> and <code>pacmd list-sink-inputs</code> contains a Properties section:</p>

<pre><code>Properties:
    media.name = "ALSA Playback"
    application.name = "ALSA plug-in [snapclient]"
    native-protocol.peer = "UNIX socket client"
    native-protocol.version = "29"
    application.process.id = "6393"
    application.process.user = "root"
    application.process.host = "xxxxxx"
    application.process.binary = "snapclient"
    application.language = "C"
    application.process.machine_id = "8dadf95c2f504864bc0f8b3ab149cbe0"
    application.process.session_id = "c4"
    module-stream-restore.id = "sink-input-by-application-name:ALSA plug-in [snapclient]"
</code></pre>

<p>I am wondering if there is a way to directly look up the index of a sink-input by either the <code>application.process.id</code> or <code>application.process.binary</code>, without resorting to parsing the many lines of output of the aforementioned commands or writing a separate C program. </p>