Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions scripts/metadata_capture.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash

# Calls $TARGET_SCRIPT with the following parameters...
# $1: artist
# $2: title
# $3: album
# $4: genre
# $5: comment
# $6: The full pathname to the artwork file

TARGET_SCRIPT="/home/user/shairport_now_playing.sh"
METADATA_DIR="/tmp/shairport"

test -p $METADATA_DIR/now_playing || mkfifo $METADATA_DIR/now_playing

while exec 3<$METADATA_DIR/now_playing
do
declare -A METADATA
IFS="="
while read -u3 mK mV; do
if test "x$mK" = "x"; then break; fi
METADATA["$mK"]="$mV"
done
exec 3<&-
$TARGET_SCRIPT "${METADATA["artist"]}" "${METADATA["title"]}" "${METADATA["album"]}" \
"${METADATA["genre"]}" "${METADATA["comment"]}" "$METADATA_DIR/${METADATA["artwork"]}"

unset METADATA
done