# Do Templates Such as "%title" Also Change Metadata / Tags, or Just file and Directory Names?

**URL:** <https://discourse.beets.io/t/do-templates-such-as-title-also-change-metadata-tags-or-just-file-and-directory-names/1150>\
**Category:** Help\
**Created:** [March 10, 2020, 10:16pm UTC](https://discourse.beets.io/t/do-templates-such-as-title-also-change-metadata-tags-or-just-file-and-directory-names/1150 "2020-03-10T22:16:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zemi](https://avatars.discourse-cdn.com/v4/letter/z/a8b319/32.png) [@Zemi](https://discourse.beets.io/u/Zemi)\
**Post date:** [March 10, 2020, 10:16pm UTC](https://discourse.beets.io/t/do-templates-such-as-title-also-change-metadata-tags-or-just-file-and-directory-names/1150/1 "2020-03-10T22:16:52Z")

</div>

Assuming everything’s organized in the _only_ structure `beet` understands; that is _Artist(s) - Album - Track# Artist - Title_, would introducing `%title{$artist} - %title{$title}` at the end of a `path` effectively _Title Case_ `artist` and `title` metadata / tags?

From what I understand, `%title` template affects only _file and directory_ names.

---

<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:** [March 10, 2020, 11:15pm UTC](https://discourse.beets.io/t/do-templates-such-as-title-also-change-metadata-tags-or-just-file-and-directory-names/1150/2 "2020-03-10T23:15:09Z")

</div>

Yep, just the paths.

---

<div class="post-metadata">

**Author:** ![Zemi](https://avatars.discourse-cdn.com/v4/letter/z/a8b319/32.png) [@Zemi](https://discourse.beets.io/u/Zemi)\
**Post date:** [March 11, 2020, 3:49am UTC](https://discourse.beets.io/t/do-templates-such-as-title-also-change-metadata-tags-or-just-file-and-directory-names/1150/3 "2020-03-11T03:49:25Z")

</div>

Any way to make it work on metadata / tags? Can tags be ASCII-fied too, or just file and folder names?

What’s the backend of `%title`? How does it determine what gets uppercased?

This information is missing from the docs. Users should be aware of `beet`'s weakneses, so as to not develop interest in the wrong solution. 🙂

---

<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:** [March 11, 2020, 11:41am UTC](https://discourse.beets.io/t/do-templates-such-as-title-also-change-metadata-tags-or-just-file-and-directory-names/1150/4 "2020-03-11T11:41:57Z")

</div>

That’s not currently possible, but this feature request seems relevant:

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

We are always looking for help improving the docs! Please pitch in if you can. Here’s how `%title` is implemented:

> <https://github.com/beetbox/beets/blob/4dee523ba23dca211b44682a9287fdf6ffa41563/beets/library.py#L1491-L1494>

Here’s a recent PR to improve it:

> <https://github.com/beetbox/beets/pull/3411>

---

<div class="post-metadata">

**Author:** ![Zemi](https://avatars.discourse-cdn.com/v4/letter/z/a8b319/32.png) [@Zemi](https://discourse.beets.io/u/Zemi)\
**Post date:** [March 11, 2020, 7:46pm UTC](https://discourse.beets.io/t/do-templates-such-as-title-also-change-metadata-tags-or-just-file-and-directory-names/1150/5 "2020-03-11T19:46:42Z")

</div>

> [@adrian](#):
>
> We are always looking for help improving the docs! Please pitch in if you can. Here’s how `%title` is implemented:
> 
> [github.com](https://github.com/beetbox/beets/blob/4dee523ba23dca211b44682a9287fdf6ffa41563/beets/library.py#L1491-L1494)
> 
> #### [beetbox/beets/blob/4dee523ba23dca211b44682a9287fdf6ffa41563/beets/library.py#L1491-L1494](https://github.com/beetbox/beets/blob/4dee523ba23dca211b44682a9287fdf6ffa41563/beets/library.py#L1491-L1494)
> 
> ```auto
> @staticmethod
> def tmpl_title(s):
> """Convert a string to title case."""
> return string.capwords(s)
> 
> ```

This I can help with! 🙂 Where do I register? Any guidelines / rules?

> [@adrian](#):
>
> That’s not currently possible, but this feature request seems relevant:
> 
> [github.com/beetbox/beets](https://github.com/beetbox/beets/issues/488)
> 
> #### [Formatted modify](https://github.com/beetbox/beets/issues/488)
> 
> opened Jan 7, 2014
> 
> [![sampsyo](https://canada1.discourse-cdn.com/flex029/uploads/beets/original/1X/dfac1030bc590033fc102d8e81288c93a301321e.jpeg) sampsyo ](https://github.com/sampsyo)
> 
> There are a number of cool things we could do if the modify command supported templates in the value part. For…

Is `asciify` (not the template) affected by this limitation?

Please correct me otherwise, but would `formatted modify` enable `beet`’s _paths_ (and templates) to change metadata / tags, as it currently does file and folder names?

> [@adrian](#):
>
> Here’s a recent PR to improve it:
> 
> [github.com/beetbox/beets](https://github.com/beetbox/beets/pull/3411)
> 
> #### [Capitalize letters after punctuations](https://github.com/beetbox/beets/pull/3411)
> 
> `beetbox:master` ← `austinmm:capitalize_letters_after_punctuations`
> 
> opened Oct 21, 2019
> 
> [![ColeBennett](https://canada1.discourse-cdn.com/flex029/uploads/beets/original/1X/b9533c0a05c110114e341eb66341d1b5d3cddf2a.png) ColeBennett ](https://github.com/ColeBennett)
> 
> [+50 -8](https://github.com/beetbox/beets/pull/3411/files)

Solid list of exceptions, capitalization after punctuations makes sense too! 😀

---

<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:** [March 12, 2020, 2:14am UTC](https://discourse.beets.io/t/do-templates-such-as-title-also-change-metadata-tags-or-just-file-and-directory-names/1150/6 "2020-03-12T02:14:19Z")

</div>

Great! The place to do it is on GitHub:

> **[GitHub - beetbox/beets: music library manager and MusicBrainz tagger](https://github.com/beetbox/beets)**
>
> music library manager and MusicBrainz tagger. Contribute to beetbox/beets development by creating an account on GitHub.

You can start by reading our “Hacking” page, most of which is irrelevant because it’s about code instead of documentation, but some of which would be helpful:

> **[Create new page · beetbox/beets Wiki](https://github.com/beetbox/beets/wiki/Hacking)**
>
> music library manager and MusicBrainz tagger. Contribute to beetbox/beets development by creating an account on GitHub.

> [@Zemi](#):
>
> Is `asciify` (not the template) affected by this limitation?

Yes. I’m not sure what you mean by “not the template”… it’s a template function.

> [@Zemi](#):
>
> Please correct me otherwise, but would `formatted modify` enable `beet` 's _paths_ (and templates) to change metadata / tags, as it currently does file and folder names?

It would led beets’s _templates_ (which are also used for path formatting) affect metadata.

---

<div class="post-metadata">

**Author:** ![beets\_vanuatu](https://avatars.discourse-cdn.com/v4/letter/b/73ab20/32.png) [@beets\_vanuatu](https://discourse.beets.io/u/beets_vanuatu)\
**Post date:** [August 20, 2020, 9:16pm UTC](https://discourse.beets.io/t/do-templates-such-as-title-also-change-metadata-tags-or-just-file-and-directory-names/1150/7 "2020-08-20T21:16:37Z")

</div>

In my WIP plugin I want to do modifications to the comments field in the metadata. But along the way I realized I have a pattern that would allow for any metadata field to be arbitrarily modified to fit a defined template string. There are probably some gotchas to be found along the way but I’m just looking at the comments field for now.

Feel free to dig through the `dev` branch and see if you can adapt anything to your needs. I would expand my plugin in the future for this use case if it can be done. There may be no point in having a general metadata modifying plugin and one just for comments 🤔 maybe?

It def a work in progress though, no time to work on it lately.

> **[michaeltoohig/BeetsPluginStructuredComments](https://github.com/michaeltoohig/BeetsPluginStructuredComments)**
>
> Contribute to michaeltoohig/BeetsPluginStructuredComments development by creating an account on GitHub.
