Hi List, I am writing an audio player that exclusively plays FLAC sound files, with CUE sheets. It is written in Python, so it is cross-platform, and it is working very well so far. The soundfile IO is handled by the Audiere library. For metadata (aside from the CUE sheet), I make system calls to metaflac to do things like extract album art for display, and I have a question concerning metaflac. Is there a way to check for the existence of a tag before retrieving it? When I try to get an image from a FLAC file, if it does not exist, FLAC returns an error. This is really not a big deal, because my program runs fine through the error, but it does show up in my programs output, and anyway it seems like the more proper way to do it is to first check to see if the tag is present before retrieving it. Not really a big deal, I just wanted to know if I overlooked something, because I don't see how to do it. -- Chris
i put this in a script and called it metaflac-showall since that was more intuitive to me, but here is how to dump all tags and then you can check the output for the specific one you want: metaflac --export-tags-to=- but i guess that returns more info than you want (the tag names and their values) On 7/16/07, Christopher Brown <c-b@asu.edu> wrote:> I am writing an audio player that exclusively plays FLAC sound files, > with CUE sheets. It is written in Python, so it is cross-platform, and > it is working very well so far. The soundfile IO is handled by the > Audiere library. For metadata (aside from the CUE sheet), I make system > calls to metaflac to do things like extract album art for display, and I > have a question concerning metaflac. > > Is there a way to check for the existence of a tag before retrieving it? > When I try to get an image from a FLAC file, if it does not exist, FLAC > returns an error. This is really not a big deal, because my program > runs fine through the error, but it does show up in my programs output, > and anyway it seems like the more proper way to do it is to first check > to see if the tag is present before retrieving it. Not really a big > deal, I just wanted to know if I overlooked something, because I don't > see how to do it.
--- Christopher Brown <c-b@asu.edu> wrote:> Hi List, > > I am writing an audio player that exclusively plays FLAC sound files, > with CUE sheets. It is written in Python, so it is cross-platform, > and > it is working very well so far. The soundfile IO is handled by the > Audiere library. For metadata (aside from the CUE sheet), I make > system > calls to metaflac to do things like extract album art for display, > and I have a question concerning metaflac. > > Is there a way to check for the existence of a tag before retrieving > it? > When I try to get an image from a FLAC file, if it does not exist, > FLAC > returns an error. This is really not a big deal, because my program > runs fine through the error, but it does show up in my programs > output, > and anyway it seems like the more proper way to do it is to first > check > to see if the tag is present before retrieving it. Not really a big > deal, I just wanted to know if I overlooked something, because I > don't see how to do it.not sure I understand... is the image in a tag? if you do "metaflac --show-tag=TAG" and TAG does not exist, metaflac prints nothing and the exit code is 0. if it does, it prints the matching tags and the exit code is 0. so how are you getting the error? images are now supposed to be stored in the dedicated PICTURE block and that should be accessed via libFLAC http://flac.sourceforge.net/format.html#metadata_block_picture http://flac.sourceforge.net/api/group__flac__metadata__level0.html#ga3 you can check for the existence of a PICTURE block with "metaflac --list |grep ..." or with libFLAC using the metadata iterators. Josh ____________________________________________________________________________________ Pinpoint customers who are looking for what you sell. http://searchmarketing.yahoo.com/