Automatically add decade genre


#1

Would it be possible to automatically append the decade that an album was released in to the genre? This would mean an album that was released between 1980 and 1989, it would be labeled as 80s, something between 1990 and 1999 would be labeled as 90s, etc.

For example, something with a year field of "1989" would have ";80s" added to the end of the genre string, "1992" would have ";90s", "2000" would get ";2000s", and so on. I've been writing these in automatically, but it would be a lot easier to have something that would populate them automatically. (Semicolons are being used as separators for multiple tags)

Thanks for any help you can offer. <3


#2

Yes, you can do it with the the following:

Begin Action Group _Script Test#TEST

Action #1 Actiontype 5: Format value Field ______: GENRE Formatstring: $regexp($regexp($regexp($regexp($regexp(%genre% - %year%,'197\d','70''s'),'198\d','80''s'),'199\d','90''s'),'200\d','00''s'),'201\d','10''s')

End Action Group _Script Test#TEST (1 Action)

PS. I'm not sure what you mean by append the decade. Is this the %year% field? If so then the action is good to go. If not replace %year% with %decade% if that's where you stored the tag. Try this on a couple of test files first and come back to me if you have any problems.


#3

This works perfectly! Thanks.

All I meant was for it to figure out the applicable decade from %year%, which is exactly what you did. Thanks again!


#4

No problem. Just make sure you run that once. But to be on the safe side use a filter which will filter any %genre% the only contains letters, numbers and spaces which basically means anything without a '-' in them.

Press F3: "%genre%" MATCHES "^[\w\s]+$"

Then you should be safe enough.


#5

Build decade string value

$if($eql($left(%YEAR%,2),'19'),$mid(%YEAR%,3,1),$left(%YEAR%,3))'0s'

Examples:
Years before 1900 are treated as years after 1999.
1888 ==> 1880s
1971 ==> 70s
1985 ==> 80s
2002 ==> 2000s
2012 ==> 2010s
2022 ==> 2020s

Do you want to append the decade string
... to an existing standard string GENRE tag-field?
... to an existing multi-value GENRE tag-field?

Add new genre to GENRE tag-field

For GENRE as single value ...
Action: Format Value
Field: GENRE
Formatstring: $if(%GENRE%,%GENRE%'; ',)'New Genre'

For GENRE as multi value ...
Action: Format Value
Field: GENRE
Formatstring: $if(%GENRE%,$meta_sep(GENRE,'\\')'\\',)'New Genre'

Just to build a decade string value as simple as possible ...

$left(%YEAR%,3)'0s'

Examples:
1888 ==> 1880s
1971 ==> 1970s
1985 ==> 1980s
2002 ==> 2000s
2012 ==> 2010s
2022 ==> 2020s

DD.20120628.0824.CEST