1#!/bin/bash
2
3FQ="$1"
4
5c() {
6    echo -e "\x1b[97m# $1\x1b[0m"
7}
8
9s() {
10    echo "\$ $1"
11    sh -c "${1/fq/$FQ -o unicode=true -C}"
12}
13
14c "Overview of mp3 file"
15s "fq . file.mp3"
16echo
17c "Show ID3v2 tag inside mp3 file"
18s "fq '.headers[0]' file.mp3"
19echo
20c "Resolution of embedded PNG cover art"
21s "fq '.headers[0].frames[] | select(.id == \"APIC\").picture.chunks[] | select(.type == \"IHDR\") | {width, height}' file.mp3"
22echo
23c "Extract PNG file"
24s "fq '.headers[].frames[] | select(.id == \"APIC\")?.picture | tobits' file.mp3 >file.png"
25s "file file.png"
26rm -f file.png
27