Multi-formatting Tech Demo
Reply #4 – 2013-08-19 19:30:14
So, your approach would limit each tag to single a single branch? I.e. each subsequent %<tag>% would return the same single value? Correct, although I don't see it as a limitation. In title formatting, you generally get the same value of all occurrences of %tag%. My approach preserves that property for %<tag>%.I don't know what possible use there is to having multiple branches of the same tag, but I would still like to have the option. Technically, it would be an easy change to my code and I thought about which uses it might have. I could only come up with two kinds of use cases:Artificial examples which hardly anyone would use. Elaborate use cases which would require additional features bolted onto title formatting to achieve satisfying results. I then chose to go with the current approach for two reasons. Firstly, the performance of my approach would deteriorate in both cases. Secondly, as far as I know there are third-party components which provide greater control over the tree construction by using a different language. They thereby avoid the limitations of title formatting entirely.The Album List titleformat wiki page says at the very bottom "The value of a branching expression can be stored in variables and retrieved without loss." I don't think that is true. It would seem to me that currently the branch value is not stored but the branching operation itself is. (If I am wrong, please point me to the correct usage.) Yes, that is one way to visualise it.I'd prefer if one could use variables to "unbranch" or pin down the value, e.g. $puts(constant,%<tag>%), so that the variable value $get(constant) could then be used safely for e.g. string operations. I prefer to not use variables in title formatting because I find all the $puts and $get rather cumbersome. So I tried to optimise the most common use cases. Consider the following lines of code, starting with a version without branching:$upper($left(%artist%,1))|%artist%|%title% $upper($left(%<artist>%,1))|%<artist>%|%title% $upper($left($put(artist,%<artist>%),1))|$get(artist)|%title% There is also a usability perspective here. What does $get(artist) do? You won't know until you find the corresponding $put or $puts. What does %<artist>% do? Always the same thing, it returns the current artist value. If needed, it would be easy to add a $meta_branch_ex(tag) function which would branch each time it is called.