minor update

This commit is contained in:
Alexander Navarro 2025-10-09 16:39:15 -03:00
parent 64cfab7d40
commit 3129cc7bee
2 changed files with 28 additions and 1 deletions

28
bin/mb_csv.fish Normal file
View file

@ -0,0 +1,28 @@
set -l artist_id $argv[1]
set -l total 999
set -l offset 0
set -l out ""
set query '.["release-groups"][] | [(.["artist-credit"] | (map(.name) | join(";") )), .title, .["first-release-date"], .["primary-type"], (.["secondary-types"] | join(";")), "https://musicbrainz.org/release-group/" + .id] | @csv'
while test $offset -lt $total;
echo "fetching offset $offset of $total"
set -l json (curl -SsL -H "Accept: application/json" "http://musicbrainz.org/ws/2/release-group?inc=artist-credits+aliases&release-group-status=website-default&artist=$artist_id&offset=$offset" | tee /tmp/foo.json)
set total (echo $json | jq -r '.["release-group-count"]')
set offset (math $offset + 25)
set -l csv (echo $json | jq -r $query | string collect -N)
set out (string collect -N $out $csv)
end
echo $out | wl-copy -n
echo $out