# Writting artist country tag to file

**URL:** <https://discourse.beets.io/t/writting-artist-country-tag-to-file/1262>\
**Category:** Help\
**Created:** [May 7, 2020, 10:27am UTC](https://discourse.beets.io/t/writting-artist-country-tag-to-file/1262 "2020-05-07T10:27:13Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![djgeezer](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djgeezer](https://discourse.beets.io/u/djgeezer)\
**Post date:** [May 7, 2020, 10:27am UTC](https://discourse.beets.io/t/writting-artist-country-tag-to-file/1262/1 "2020-05-07T10:27:13Z")

</div>

Hi,

I’ve just discovered Beets and it’s fantastic. I think I’ve got it most set up as I’d like but was wondering if there’s any way to write the artist country to the file metadata in the grouping field, language field, or any other field to be honest. I use this a lot and this would be the only thing bothering me now ☹ I’ve searched through all the forums and stuff and can’t seem to find any solution.

I’ve got the beet-artistcountry plugin installed but from what I can tell that only changed the file path, which I’ve already done. I would like it written to the file so that I can browse by country in my music player.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [May 7, 2020, 11:43am UTC](https://discourse.beets.io/t/writting-artist-country-tag-to-file/1262/2 "2020-05-07T11:43:26Z")

</div>

Hello! There is, unfortunately, not a perfect solution to this. Fortunately, it would be pretty easy to write a quick custom plugin that essentially does `item.grouping = item.artistcountry; item.store()` for every item in your library matching a query. But a proper, Python-free version of this would need this oft-requested feature:

> <https://github.com/beetbox/beets/issues/488>
>
> There are a number of cool things we could do if the modify command supported templates in the value part. For...

---

<div class="post-metadata">

**Author:** ![djgeezer](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djgeezer](https://discourse.beets.io/u/djgeezer)\
**Post date:** [May 7, 2020, 11:02pm UTC](https://discourse.beets.io/t/writting-artist-country-tag-to-file/1262/3 "2020-05-07T23:02:14Z")

</div>

ah okay thanks! that doesn’t sound too difficult but i have no experience with python - would you be able to point me in the direction of a bit of a guide or intro to writing the plugin?

much appreciated!

---

<div class="post-metadata">

**Author:** ![adrian](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/adrian/32/4_2.png) [@adrian](https://discourse.beets.io/u/adrian)\
**Post date:** [May 7, 2020, 11:21pm UTC](https://discourse.beets.io/t/writting-artist-country-tag-to-file/1262/4 "2020-05-07T23:21:42Z")

</div>

A great place to start is our plugin development docs:  
[https://beets.readthedocs.io/en/stable/dev/plugins.html](https://beets.readthedocs.io/en/stable/dev/plugins.html)

Then take a look at one of the simpler beets-packaged plugins as an example—like this bit in `gmusic`:

> <https://github.com/beetbox/beets/blob/560d374a526893b0b9b5399ba5b83348541abe26/beetsplug/gmusic.py#L82-L83>

Good luck!

---

<div class="post-metadata">

**Author:** ![bogpatin](https://avatars.discourse-cdn.com/v4/letter/b/d9b06d/32.png) [@bogpatin](https://discourse.beets.io/u/bogpatin)\
**Post date:** [February 11, 2021, 8:39am UTC](https://discourse.beets.io/t/writting-artist-country-tag-to-file/1262/5 "2021-02-11T08:39:35Z")

</div>

Hi djgeezer, did you find the way to write the artist\_country as a tag? would you like to share how?  
Im in the same path… but also no python knowledge.  
thanks.

---

<div class="post-metadata">

**Author:** ![djgeezer](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@djgeezer](https://discourse.beets.io/u/djgeezer)\
**Post date:** [February 11, 2021, 12:48pm UTC](https://discourse.beets.io/t/writting-artist-country-tag-to-file/1262/6 "2021-02-11T12:48:59Z")

</div>

Hi, no I haven’t had a crack yet. I might have time on the future If I get to it I’ll share 🙂

---

<div class="post-metadata">

**Author:** ![kojoki1406](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/kojoki1406/32/573_2.png) [@kojoki1406](https://discourse.beets.io/u/kojoki1406)\
**Post date:** [October 7, 2021, 9:56pm UTC](https://discourse.beets.io/t/writting-artist-country-tag-to-file/1262/7 "2021-10-07T21:56:06Z")

</div>

I’m also looking for a means to add custom tags, but it’s really difficult to do so in beets, and I’ve already wasted too much time looking.

We can get the artist’s county name from this [edited](https://pastebin.com/raw/eUcjti67) artistcountry plugin. Now the question is how to use the value of `$artist_country` to make a new tag `ARTIST_COUNTRY`?
