oniony / TMSU

TMSU lets you tags your files and then access them through a nifty virtual filesystem from any other application.
Other
2.01k stars 115 forks source link

key-value tags will not work with rename #249

Open TheChymera opened 2 years ago

TheChymera commented 2 years ago
chymera@decohost ~/collections $ tmsu rename value1 key=value1
chymera@decohost ~/collections $ tmsu tags
key\=value1
chymera@decohost ~/collections $ tmsu rename "key\=value1" key=value1
tmsu: tag 'key=value1' already exists
chymera@decohost ~/collections $ tmsu rename "key\=value1" key\=value1
tmsu: tag 'key=value1' already exists
chymera@decohost ~/collections $ tmsu rename "key\=value1" "key=value1"
tmsu: tag 'key=value1' already exists
chymera@decohost ~/collections $ tmsu rename "key\=value1" 'key=value1'
tmsu: tag 'key=value1' already exists
oniony commented 2 years ago

tmsu rename value1 key=value1

Here you have renamed your tag to contain an equals and additional text. It is not considered to be a tag value.

tmsu rename "key\=value1" key=value1

Here you are trying to rename a tag to the name it already has.

What you probably want to do is to apply a tsg with value to all files that have an existing tag:

tmsu tag --where="key" key=value

Paul

TheChymera commented 2 years ago

ok, that solves my problem, and thank you. Nevertheless, the title of the issue still remains a thing, right? key-value pairs do not work with rename, so instead you need to use tag and then delete.

If time does not suffice for this to be fixed, perhaps the concept distinction could be highlighted more clearly. I.e. “renametag” instead of “rename” with some sort of mention that it will not operate on values.

oniony commented 2 years ago

ok, that solves my problem, and thank you. Nevertheless, the title of the issue still remains a thing, right? key-value pairs do not work with rename, so instead you need to use tag and then delete.

Yes, the title remains true, in that rename does not convert a vanilla tag into a tag with value, but it was never intended to do so. Rename's intention is to give a tag or value a new name. Converting a tag to one with a value is not a rename, so I don't see this as a bug.

The intended solution to applying a tag with value to a bunch of files that have an existing tag is to use tag --where, if the tag used in the where is then redundant, then untag can be used to unapply it.

If you thinking promoting a tag to a particular tag-with-value combination is such a common task that it should have first-rate support, then I'm open to hearing the arguments for adding a convert sub-command.

TheChymera commented 2 years ago

Well, barring anything else, I would like such a command, but I'm just one user :) Not sure whether that's a high percentage of users.

I assume the difference between a vanilla tag and a tag with values is more acutely obvious given familiarity with the actual code, but to me as a mere user it seems like a distinction that only encumbers tag management, after all tags with values can also not have values. g (I use it to rate whether a photo is good at all) and g=1 to g=10 (I fill it in if a series has many good ones) do not show up as different tags in tmsu tags.

oniony commented 2 years ago

g (I use it to rate whether a photo is good at all) and g=1 to g=10 (I fill it in if a series has many good ones) do not show up as different tags in tmsu tags.

Yes, you can apply a vanilla tag, or you can apply a tag with a value. You can also have both on the same file. The values don't show up as extra tags because they're not extra tags, they're applications of the tag with values.

Rather than tagging something 'g' for good you might be better off tagging it rating, with a value. So you tag some stuff rating=1 because they're bad and some stuff rating=10 because they're good, and a whole bunch of stuff in between. But you haven't rated every file, so you might want to see which files even have a rating. tmsu files rating lets you do that, irrespective of what you have rated it. If 'rating=1' were a tag in its own right, you couldn't do that. It also lets you do tmsu files rating > 7, which, again, wouldn't be possible (or would be harder) if these were considered as separate, distonct tags.