1
1
mirror of https://github.com/wader/fq.git synced 2024-11-24 03:05:22 +03:00
fq/doc/demo.sh

27 lines
572 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
}
2021-11-22 16:16:59 +03:00
c "Overview of mp3 file"
2021-10-10 03:17:29 +03:00
s "fq . file.mp3"
echo
2021-11-22 16:16:59 +03:00
c "Show ID3v2 tag inside mp3 file"
2021-10-10 03:17:29 +03:00
s "fq '.headers[0]' file.mp3"
echo
2021-11-22 16:16:59 +03:00
c "Resolution of embedded PNG cover art"
2021-10-10 03:17:29 +03:00
s "fq '.headers[0].frames[] | select(.id == \"APIC\").picture.chunks[] | select(.type == \"IHDR\") | {width, height}' file.mp3"
echo
2021-11-22 16:16:59 +03:00
c "Extract PNG file"
2021-10-10 03:17:29 +03:00
s "fq '.headers[].frames[] | select(.id == \"APIC\")?.picture | tobits' file.mp3 >file.png"
s "file file.png"
rm -f file.png