# Automatically add decade genre

**URL:** https://community.mp3tag.de/t/automatically-add-decade-genre/13593
**Category:** Support
**Created:** [June 27, 2012, 7:59pm UTC](https://community.mp3tag.de/t/automatically-add-decade-genre/13593 "2012-06-27T19:59:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![epeternally](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/958977/32.png) [@epeternally](https://community.mp3tag.de/u/epeternally)
#### Post date: [June 27, 2012, 7:59pm UTC](https://community.mp3tag.de/t/automatically-add-decade-genre/13593/1 "2012-06-27T19:59:23Z")

</div>

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

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [June 27, 2012, 9:00pm UTC](https://community.mp3tag.de/t/automatically-add-decade-genre/13593/2 "2012-06-27T21:00:12Z")

</div>

> [@epeternally](#):
>
> 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....
> 
> (Semicolons are being used as separators for multiple tags)

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.

---

<div class="post-metadata">

### Author: ![epeternally](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/e/958977/32.png) [@epeternally](https://community.mp3tag.de/u/epeternally)
#### Post date: [June 27, 2012, 9:24pm UTC](https://community.mp3tag.de/t/automatically-add-decade-genre/13593/3 "2012-06-27T21:24:42Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![stevehero](https://community.mp3tag.de/user_avatar/community.mp3tag.de/stevehero/32/337_2.png) [@stevehero](https://community.mp3tag.de/u/stevehero)
#### Post date: [June 27, 2012, 10:08pm UTC](https://community.mp3tag.de/t/automatically-add-decade-genre/13593/4 "2012-06-27T22:08:26Z")

</div>

> [@epeternally](#):
>
> This works perfectly! Thanks.

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**"**\[1\]+$**"

Then you should be safe enough.

* * *

1. \w\s

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [June 28, 2012, 4:02am UTC](https://community.mp3tag.de/t/automatically-add-decade-genre/13593/5 "2012-06-28T04:02:21Z")

</div>

> [@epeternally](#):
>
> 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

**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

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:23pm UTC](https://community.mp3tag.de/t/automatically-add-decade-genre/13593/6 "2026-02-09T12:23:55Z")

</div>


