Generating %DISCNUMBER% Tags


#16

Hoping, that we have it now:

$if($eql($regexp(%_directory%,'^.* *(CD) *\d+.*$','$1',0),'CD'),$regexp(%_directory%,'^.* *CD *0*(\d+).*$','$1',0)'/2','1/1')

DD.20070119.1735


#17
Yep - I think we do.

#18

Wow - I haven't checked this topic in forever. Thanks very much for all your hard work, guys!

Would it be possible for me to get you to alter this? My directory format is a bit different.

Here's how I have my directories:

Ben Harper - Both Sides Of The Gun (2006)\CD1\Files

Thanks again!


#19

Well, I know, that the problem is not solved in general so far (we really need a ready made Discnumber Assistant), but now we have a practical way to handle cases like ...

  • If there is no folder 'CDn' between album and file:
    album/file
  • If there are two folders 'CDn' between album and file:
    album/CD1/file
    album/CD2/file
... by using this
Action #1:
Action type: Format value
Field: DISCNUMBER
Formatstring: $if($eql($regexp(%_directory%,'^.* (CD) \d+.$','$1',0),'CD'),$regexp(%_directory%,'^. CD 0(\d+).$','$1',0)'/2','1/1')

If there is only one folder 'CD1' between album and file:
album/CD1/file
you can simply set DISCNUMBER to '1/1' by
Action #1:
Action type: Format value
Field: DISCNUMBER
Formatstring: 1/1

DD.20070120.1020


#20

Sorry - the problem I was having before was on my end. Another action was interfearing with it.

Either way, the script you posted works perfectly! Thanks very much! :smiley:


#21

[...to count discs...] we need an extra storage place to hold a user defined value while
an action runs against the selected tracks

Since then, Mp3tag as acquired actions for Export and Import. So perhaps a solution is: an Export action counts the discs and writes the results to a text file, and then a Import Text File action does a lookup to write them into the tags.

Though this would not work before the fix to the bug at /t/5799/1 .


#22
Actually, import\export did exist when we came to this solution, however we were looking for something that could be done without text files.

Thanks for the input though.


#23

import\export did exist when we came to this solution

Oops! Sorry.

we were looking for something that could be done without text files.

May I ask why?


#24

Yet I didn't tested the new export/import actions in full scope. Today I thought about the discnumber problem of this thread can be solved by export/import action.
I was in great hope that export/import actions can be used as a temporary storage while running a stream of actions, but we have to realize that the export/import actions are not so powerful and flexible like the other actions. Now we have to find a new workaround for this upcoming new Mp3tag design glitch. That's a pity.

DD.20071126.2357.CET


#25

Florian will surely be unable to resist the urge to allow Export first! This will unleash the power of scripting for action data!

If we then also had Action Tagfile - Tag it would permit very neat solutions to two-pass problems such as tagging disc quantity and track quantity, plsu album keying and more exotic things like Album Artist deduction.

Florian, if you would consider this, please also add a %tempfilepath% placeholder, to allow Export and Import to link up without deployment problems. Simple %tempfolderpath% would be incompatible with possible future multiple instances.


#26

The export method is a roundabout way to solve the problem, what we really need is a internal placeholder.


#27

I see no overlap. What problem is it that Export solves roundabout but an internal placeholder solves better?


#28
Why go outside the app and interface with the filesystem when you can accomplish your goal inside the app?

#29

What goal is it that you can accomplish with an internal placeholder?


#30
In this specific situation, keeping a running count of discs for a specific album so that you can go back and populate 'm' in disc n of m.

#31

Well, I don't see how you are going to go back and populate anything, since one action group cannot go back.

The only automatic solution I see uses an initial Export to go forward to do the counting, and then subsequent actions to put the count into the tags.


#32
You would need two actions, one to either set or increment the placeholder and another to read it and set total_discs.

#33

OK, then my answer to

Why go outside the app and interface with the filesystem when
you can accomplish your goal inside the app?

is: to accomplish the goal in a single operation.


#34
You don't have a single operation, you need to export, then import.

Either method will work, it is just a mattter of opinion as to where it is best accomplished.


#35

You don't have a single operation, you need to export, then import.

The user has a single operation: run an action group. The author has put the Export and Import as multiple actions within the group, no more so that your proposed two-operation method has multiple actions within the group(s)

Either method will work, it is just a mattter of opinion as to where it is best accomplished.

Agreed. Let's try both!