Open TreMorNZ opened 1 year ago
Hi. It's not currently possible to do math on tag values. However, the template engine used in exif2findertags
is the same one used a few other projects of mine (e.g. autofile and osxphotos) and the engine supports using a custom filter function written in python. e..g "{AvgBitRate|template_filter.py::myfilter}"
though this feature is not enabled in exif2findertags.
If you're familiar with python, it would be trivial to write a custom filter to manipulate the bit rate. There are some other enhancements to the template engine that could be added back in to exif2findertags, for example, in other projects I've new filters to convert a value to a float ("1" --> "1.0") and to an int ("1.0" --> "1"), etc. It would be good to backport these to exif2findertags as well.
I'm in the middle of several projects but will take a look to see if I can get the filter function feature implemented in the next week or two.
The idea of math filters in general is interesting but to be useful would need to implement a lot of these (add, sub, mul, div, floor, round, ceiling, modulus, etc.) Since python can already do all this and would be relatively easy for even a newcomer to following an example (see for example, this it's likely easier to just defer to python for doing any math.
Thanks for the fast response. I am just beginning to learn the potential of working in terminal, so the whole process of code still seems very daunting. That being said, I'm realising that for all the ideas I have to improve efficiency of my workflows, I need to learn it eventually, so thanks for the pushback on figuring this out myself :)
I opened a new issue (#11) to add the function template referenced above. I should be able to get to that in a week or two. I've also been thinking over your idea about doing math on tag values and I think I've got a workable design for a calc()
template that would perform calculations and would not be hard to implement. This might be useful in my other projects that use the same template engine. It would work something like this:
{tag|calc(hex2dec + 3 / 2)}
Which translates to:
This would let you string arbitrary operations together.
the whole process of code still seems very daunting
It is but the journey is well worth it! You don't need to be an expert to get a lot of utility out of a small amount of python. Learning a few basics is well worth your time and will be helpful for automating workflows, etc. There are many good resources, many of them free. Automate the Boring Stuff With Python is one such resource that's great for people who "aren't programmers" but want to automate workflows.
Hey there. Thanks a lot for creating this, it's a huge help. One thing i'm trying and struggling with is the formatting of the metadata values coming out of my Fuji XT3 camera - some are integers/plain text, while others are hexadecimal. The AvgBitrate value is written in bytes per second, when generally video bitrates are discussed in Mbps. I couldn't find much in the documentation about converting values, so figured I'd ask directly if it's supported.