GNOME Bugzilla – Bug 141686
[PATCH] Proposal for printf-style tag formatting element
Last modified: 2005-03-25 19:55:17 UTC
Right now, the only way I know of to get the tags out of a file from the command line is to actually decode the file with `gst-launch --tags`. I suggest that a printf-style tag formatting element be written that could be used in a command line like: `gst-launch filesrc="file" ! spider ! formattags format="%{album}:%{title}" ! filesink=/dev/stdout`. This could then be easily wrapped up in a shell script. The element should have a sink of type application/x-gst-tags and a source of type text/plain. I think format specifiers like %{tagname} work well for inserting tag values because the names are variable length and more will be added. For other metadata, the more traditional %c style could be used, or other delimiters, ex. %(non-tag_data) At the very least, all tags gstreamer knows about should be supported by %{}, %% should insert a '%', and all C '\' escapes should work. If possible, there should be format specifiers that insert the filename and mime type (%f and %m?). It might be nice to also support format-specific tag names, like id3's TPE4, etc. I have a simple program that does this formatting for mp3 and vorbis files in arch. Archive at http://bluejay.dyndns.org/archives/2003/ version jyasskin@mail.utexas.edu--2003/mprintf--main--0.1 (sorry, it's in haskell) We need to decide what to do when a tag doesn't exist. So far, I've just been inserting the empty string, but it might be better to let the user decide. Also, tags with a list of values need to have those values separated with something. I've been using ',', but again the user should have a choice. Finally, if we support format-specific tags, a way to disambiguate their names from gstreamer offical tag names is needed. Perhaps "artist" would select the gst tag, while "id3v1:artist" would take the id3v1 tag specifically. (This solution would constrain gst tag names to never contain ':') I hope to be able to start writing this element after the 15th, but I figure a bug is appropriate in case I don't get around to it or someone has a better idea.
Forgot about another complication for format-specific tags: Certain ID3v2 tags contain a map of values, rather than a simple list (COMM, TXXX, WXXX). This also needs to be handled in the format specifier.
Why? Isn't all this up to the application? Why do we need the element?
This element should exist for the same reason gst-launch exists: to help with scripting. AFAIK, there are no elements available for manipulating tags in scripts; I think this one would make a good start.
some thoughts: application/x-gst-tags is deprecated. It is replaced by using the actual pipeline and stopping that one when the tags are read. Rhythmbox uses that approach. You really want to write your own tagging tool, because gst-launch does not support tag writing, which is the logical second step.
I have a working prototype of this element in my arch repository mirrored at "http://bluejay.dyndns.org/archives/2003/". The version is "arch://jyasskin@mail.utexas.edu--2003/gstformattags--main--0.8". Unfortunately, my mirror will be offline for an indefinite period starting next weekend, so that url may not do you much good after that. I'll attach the source so you won't stumble on the lack of an arch repo. Read the README for a description of what the element does, how to use it, and what I'd like to eventually add.
Created attachment 27944 [details] gstformattags--main--0.8--patch-2.tar.bz2
Created attachment 27945 [details] gst-format-tags-0.7.0.1.tar.bz2 Result of `make dist`
Comment on attachment 27944 [details] gstformattags--main--0.8--patch-2.tar.bz2 Result of `tla get ...`
I second Benjamin's original comment, gst-launch is a test toy, not a fully featured do-it-all tool. It is seriously out-of-scope, please write a small python tagging tool for this purpose.