I am actually trying to get the metadata of a flac file with python. I used this as a base, but i have a problem. metaflac gives me an hexdump (also in terminal) with this command:
Python:
flacdata = os.popen("metaflac --list --block-number 2 /data/Music/test.flac")
Terminal:
metaflac --list --block-number 2 /data/Music/test.flac
But the man page states:
--list
List the contents of one or more metadata blocks to stdout.
By default, all metadata blocks are listed in text format.
Terminal Output:
metaflac --list --block-number 2 --data-format=text /data/Music/test.flac | tail
000497D0: F7 68 A2 BA 3F 94 C9 0E 87 FD 62 9E FB 7A FF 00 .h..?.....b..z..
000497E0: C0 56 8C 63 CE EF F3 77 E7 F8 68 A2 AA 3F 11 9C .V.c...w..h..?..
000497F0: F6 2D C7 23 79 6D C9 FF 00 F5 74 AD 28 24 78 D1 .-.#ym....t.($x.
00049800: A1 56 61 16 F6 6D B9 E3 28 C3 67 E5 BD BF 3A 28 .Va..m..(.g...:(
00049810: AC 24 74 33 D8 7E 03 78 3F 47 D7 BC 75 E1 F8 EF .$t3.~.x?G..u...
00049820: EC 84 E8 D7 B1 A9 5D EC B9 03 C8 C7 42 3F BE DF ......].....B?..
00049830: 9D 7E C2 C3 6D 15 AB 45 6B 0A 08 ED D2 25 55 8D .~..m..Ek....%U.
00049840: 7A 01 45 15 34 BF 88 7C BE 73 F1 44 41 F3 47 93 z.E.4..|.s.DA.G.
00049850: C9 F9 A9 D1 C4 9B 07 CA 28 A2 B6 AD F1 9E 11 FF ........(.......
00049860: D9 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .
Any hints how to solve this? I want text output...
It looks like the block being returned is a PICTURE block, which cannot be listed as text as it is binary data.
If you don't want to display the picture block add
although if block 2 is a picture block, you won't get any output.
You could parse the output and cut out the data section if you want just the data about the image.