How To Copy Part Of The Album Name To The Year Field


#1

Hello, and thanks in advance for any help. Long story short, I stupidly cleared the year field on 15,000 mp3 files and was trying to figure out how to create a regular expression to correct this mistake. All of my album titles are in the format Album Title{Year}, where the year(s) within the brackets is one of three ways, either:

An Example Album Title{1966}

or

Another Example Album Title{1980-89}

or

A Third Example Album Title{1723-1928}

I know it's possible to make an action that will take the numbers between the brackets and copy them to the year field, and in the past I've even made a couple of very, very simple actions, but the fact that I need to copy only part of one field to another field has me rather confused. Please, could some kind soul show me how to do this? Thank you again for your time.


#2

Create an action of the type "Guess value" for %ALBUM%
Enter as value:
%album%{%year%}

I am not sure what will happen to the "{1723-1928}"


#3

ohrenkino: thanks for your reply. I tried your suggestion and, while it did add the year to the year field, it removed the year-in-brackets from the end of the album field in order to accomplish this :flushed: . Do you have any other ideas :slight_smile: . Thanks again for your time, I appreciate it.


#4

It is not always clear what is meant by "copy" as some use it in the sense of "move". In your case it was meant in the original sense, so sorry that you are left without the year.
BUT: there is help!

If you create an action of the type "Import value" for %album% and enter this string:
%dummy%{%year%}

then the album should be left untouched but the year should get filled with that what can be found in the brackets.

If I have spoiled your collection and removed the year at a lot of tracks (sorry for that!), you can easily restore that data with an action of the type "FOrmat value" for ALBUM.
Enter as format string:
%album% {%year%}

Run this action only once on the files or you get the year appended more than once.


#5

When I attempt to create a new action there's no option for "Import value"; the only options with "Import" are "Import cover from file" and "Import text file". I'm using v2.55a, too.


#6

I had my German version running ... it is "Guess values"


#7

Thanks again for your help. Unfortunately your last suggestion made a real mess of things; luckily I've a recent backup I can employ to fix things. Seems the guess value isn't guessing very well :wink: , as only files with album titles of the format Album Title{xxxx} are having the year added and being properly tagged. Any variation--for example, Album Title{xxxx-xx} or Album Title[Live]{xxxx}--are being mangled. I'm pretty sure that a regular expression can be created that specifies something like "take the numbers within the brackets, not parentheses or braces but brackets only, and copy them to the year field without changing anything else" but I don't know how to create it. Guess I'll put my morning coffee to use and try to figure it out.


#8

Please describe "mangled".
I am not at all sure whether the year field actually allows to enter a range. Any year that is more elaborate is probably "releasedate".

You could do a twostep with an action of the type format value for YEAR
Format string:
$mid(%album%,$add($strstr(%album%,'{'),1),$len(%album%))

and a replace action:
Replace }
with noting.


#9

By mangled I meant that the Album field was being corrupted with braces and bits of the word(s) within the braces, as if the Guess value was confused by the presence of both braces and brackets. No big deal, though, as I simply took my backup, sorted it as well as possible, then used it to replace the original files. Everything is as I'd hoped, I just took the roundabout way there :music: . Thanks again for your input, ohrenkino, and I'll check out your two-step action for future use :slight_smile: .


#10

For the honour of MP3tag: I tested a file with "Album Title{xxxx-xx}" and also "Album Title[live]{xxxx-xx}" it worked like a charm.
I can only be as good as the facts you give me.
As you described your problem on an abstract level I could only assume that you are able to follow the syntax and know where variations are necessary.
In short: I doubt that the Guess Value action gets confused. If the pattern is set correctly, then it will transfer the data.


#11

For my own honor, and the honor of Mp3tag (which I've been using since version 2.37 and appreciate so much that I've donated), I've no reason to lie. So I took 39 folders (each an album), consisting of every possible album title variation I could find, and put them in a single folder. I then opened this folder in Mp3tag and ran a Guess value with the Source format %ALBUM% and the Guessing pattern %dummy%{%year%}--in fact, the same, unedited Action that I'd used before--and it worked perfectly. I'm thus left to believe that I made a mistake when I ran it before, probably something like running the single Action when testing it but then accidentally running multiple Actions when doing the entire 15,000 files. That would be my guess, at least. Anyway, the above Guess value seems dandy, provided you use it properly :wink: . Thanks again for your help ohrenkino, I appreciate it.


#12

That's a relief to hear. Have fun! :wink: