Skip to content

Instantly share code, notes, and snippets.

@infojunkie
Last active April 15, 2023 04:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save infojunkie/d8c2bf6221fcd661c2253df3d4938298 to your computer and use it in GitHub Desktop.
Save infojunkie/d8c2bf6221fcd661c2253df3d4938298 to your computer and use it in GitHub Desktop.
Discogs artists to flac metatag
#! /bin/bash
#
# Requirements: curl, jq, metaflac
#
# Assumes that the files are already sorted by track number.
#
curl -s https://api.discogs.com/releases/$1 --user-agent "discogs-tag/1.0" | jq -r '.tracklist[].artists | map(.name) | join(", ") | gsub(" \\(\\d+\\)"; "")' > artists
IFS=$'\n' artists=($(<artists)) i=0; for f in *.flac; do metaflac "$f" --remove-tag=ARTIST --set-tag="ARTIST=${artists[$i]}"; ((i=i+1)); done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment