feature request: “tmsu value TAG FILE”
Hello, I currently use the following trick from the wiki to show the tags of many files:
$ tmsu files QUERY | xargs tmsu tags
I think a command value should be added, to allow doing things like:
$ tmsu files QUERY | xargs tmsu value TAG
This could be helpful because I sometimes want to compare the values of just one tag over many files, but the first command above gives me a lot of irrelevant output, because my files have many tags.
For example, the new feature could go like this:
$ tmsu files song | xargs tmsu value year
song1.ogg: 2004
song2.ogg: 2017
song3.ogg: 2149
Could you not use:
$ tmsu file song | xargs tmsu tags | grep -o "year=\w\+"
Or is that too unwieldy or slow?
OK, above works but omits the filenames, so obviously is a bit crap. Perhaps the proposed value subcommand makes sense.
Actually, you could match both the filename and the tag, but it's even more obtuse:
$ tmsu files song | xargs tmsu tags | grep -o -e "^.*: " -e "year=\w\+"
Thanks for the tip!
@oniony : that should be egrep -oe "^(.*)[^\\]: " -e "year=\w\+" , since a) 0-length filenames should never exist on disk or be output by tmsu, and b) the string ": " may exist in the filename or in a tag, which is rendered as \: when in a filename, and such strings should not be treated as a match.
-- Department of Regexp Paranoia ;)