Iterate based on last result in set

Hello, I have been using mp3tag forever and I love it. Currently using 2.66 and was trying to deal with a specific issue I have been having. If you look at the attachment you will see a set of classical music songs by grieg. In this particular example I was fortunate enough to have all the track and disc number information so manually inputting them is not hard, but say I "needed" to do this?

Six Songs, Op.4 - The Orphan

simply put we regex: (.+?) - (.+) and replace $1 -$it. $2 where the value $it would be an iterated value from 1 to infinity. Each time we evaluate regex we would store the value of $1 and if it doesn't match the last value $it would be reset to 1 so we would have

Six Songs, Op.4 -1. The Orphan to Six Songs, Op.4 -6. Where Have They Gone? and Four Songs by Bj. Bjшrnson, Op.21 -1. The First Meeting etc.

Granted there are a number of hurdles that make this hard to pin down what we are looking for. For instance how do we know that the regex is ungreedy then split by - and then a greedy to end instead of : or some other character. So perhaps we let the user choose the regex at outset and show the last few regex's we used (you have this method on a number of scripts in the conversion tree 'tag-tag' 'tag-filename' where it will show the last few results. and if the regex results false on the first trigger then we should exit the script with a 'no results' thing.

The main feature request here then is how can we perform loops as we normally do but specify certain variables which we can access the next pass. I have till now created several script action groups to accomplish my formatting goals.


Do you know the pseudo-variable %_counter%?

Together with a format value action you will probably get such an incremented value.
It counts from 1 to the end for each call of the the actions.
E.g. Six Songs, Op.4 -%_counter%. The Orphan

I've worked with format value before, so I took your suggestion and got to this (see attachment).

So now how do we use %_counter% with field mindless 1 to then format new value for title

%mindless1% -%_counter%. %mindless2%

thereafter removing the mindless fields created.
thanks for your assistance!

Edit: By the way, we will eventually run into the issue where we need to specify the regexp pattern we're using or we'll be modifying the action every time it doesn't conveniently match '(.+?) - (.+)' but that's something for later)


Sorry to double post but it's the only way to add this attachment.

I have reached a solution based on your suggestion above. We select each 'batch' and %_counter% performs much as we'd expect. It's quite unfortunate that we cant specify %_counter% or some variable like it to do something akin to the auto-numbering wizard as we could then avoid all this. We'll also have to manually reset the regexp pattern we need for each unique case we'll have but 99% of all the files I get will wind up in this form so it's not a big deal I guess.

I appreciate any further feedback anyone would be willing to suppl. You might also see the number of action groups I have created for other things I need to organize my music (an OCD assuredly but that's what we're all here for) that I'd be willing to share with people somehow.

Best.


Yes, quite,
On the other hand: an action that copies the original track number to a user-defined field, a quick renumbering of track with the correct offset, an import of the correct numbers into the target field, a restore action to copy the track number back to the original field and a deletion of the track number backup field can be done almost at the click of a button.
Alternatively, you can enclose the %_counter% in a $add(10,%_counter%) to get an offset of (e.g.) 10.
So there are still some options for tuning.

Hi. Yea that wouldn't work. I tried putting discnumber and track data into dummy fields then I used the data from mindless1 then used the counter variable. Even with the new disc information counter still iterated. The reason for this is it only resets for directory (in the same action at least as I didn't want nor try multiple actions as it should be a one click thing). Once I discovered this i instead tried saving the parent directory field then thought of moving these files into validate()'d directories base on mindless1 but stopped because the potential for problems down the road opened by this would be too great even if we can move the folders back to the old directory afterwards. (remember mjndless1 value would be very variable).

Anyways I combined my solution with a keyboard macro to run the action I want then press enter to close the confirmation dialogue. That at least saves 2-3 seconds a click.

Best.