Skip to content

OR / Fallback Between two metadata keys #142

@ghost

Description

The usecase is to be able to select xesam:albumArtist when it exists, and fallback to xesam:artist if it does not.

Currently I work around this using the below:

IFS='|' read -ra METADATA <<< "$(playerctl metadata --format '{{xesam:albumArtist}}|{{artist}}|{{title}}' 2>/dev/null)"

if [ "${METADATA[0]}" ]; then
	echo "${METADATA[0]} - ${METADATA[2]}"

elif [ "${METADATA[1]}" ]; then
	echo "${METADATA[1]} - ${METADATA[2]}"

fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions