Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # This is just a test script to show off the 'gettags' function, which
- # reads the tags of FLAC files.
- if=$(readlink -f "$1")
- declare -A alltags
- gettags () {
- for field in "${!alltags[@]}"; do
- unset -v alltags[${field}]
- done
- mapfile -t lines < <(metaflac --no-utf8-convert --export-tags-to=- "$if")
- for (( z=0; z<${#lines[@]}; z++ )); do
- line="${lines[${z}]}"
- unset -v mflac
- mflac[0]="${line%%=*}"
- mflac[1]="${line#*=}"
- if [[ -z ${mflac[1]} ]]; then
- continue
- fi
- field="${mflac[0],,}"
- if [[ -n ${alltags[${field}]} ]]; then
- continue
- fi
- alltags["${field}"]="${mflac[1]}"
- done
- }
- gettags
- for field in "${!alltags[@]}"; do
- printf '%s\n' "${field}: ${alltags[${field}]}"
- done | sort
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement