Created
April 23, 2019 13:57
-
-
Save kronoc/df158d5eadbf99a758119ce6569033b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IFS=";;;" | |
function tag() { tail -c 128 "$1" | head -c 3; } | |
function title() { tail -c 125 "$1" | head -c 30 | rtrim; } | |
function artist() { tail -c 95 "$1" | head -c 30 | rtrim; } | |
function album() { tail -c 65 "$1" | head -c 30 | rtrim; } | |
function year() { tail -c 35 "$1" | head -c 4 | rtrim; } | |
function comment() { tail -c 31 "$1" | head -c 28 | rtrim; } | |
function track() { tail -c 3 "$1" | hexdump -ve '/1 "%02i "' \ | |
| awk '{ if ($1 == 0 && $2 != 0) print $2" " }'; } | |
function genre() { tail -c 1 "$1" | hexdump -ve '/1 "%03i"'; } | |
function rtrim() { sed 's/\([^ ]*\) *$/\1/'; } | |
function filt() { tr -d '/*?'; } | |
while [ $# -ge 1 ]; do | |
file=$1 | |
[ "$(tag "$file")" == "TAG" ] | |
artist="$(artist "$file" | filt)"; | |
album="$(album "$file" | filt)"; | |
title="$(title "$file" | filt)"; | |
track="$(track "$file" | filt)"; | |
#echo "album:$album"; | |
if [ "${album:0:1}" = " " ] | |
then | |
echo "$artist:$album"; | |
fi | |
shift 1; | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment