1
1
mirror of https://github.com/wader/fq.git synced 2024-10-04 15:38:17 +03:00
fq/doc/demo.sh

27 lines
558 B
Bash
Raw Normal View History

2021-10-10 03:17:29 +03:00
#!/bin/bash
FQ="$1"
c() {
echo -e "\x1b[97m# $1\x1b[0m"
}
s() {
echo "\$ $1"
2021-10-10 18:24:43 +03:00
sh -c "${1/fq/$FQ -o unicode=true -C}"
2021-10-10 03:17:29 +03:00
}
c "Overview of mp3"
s "fq . file.mp3"
echo
c "Show ID3v2 tag in mp3 file"
s "fq '.headers[0]' file.mp3"
echo
c "Resolution of ID3v2 cover art"
s "fq '.headers[0].frames[] | select(.id == \"APIC\").picture.chunks[] | select(.type == \"IHDR\") | {width, height}' file.mp3"
echo
c "Extract image file"
s "fq '.headers[].frames[] | select(.id == \"APIC\")?.picture | tobits' file.mp3 >file.png"
s "file file.png"
rm -f file.png