# Pick some fields from a metadata source, and some other elsewhere?

**URL:** <https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147>\
**Category:** Help\
**Created:** [September 7, 2022, 10:05pm UTC](https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147 "2022-09-07T22:05:12Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![ryancey](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ryancey](https://discourse.beets.io/u/ryancey)\
**Post date:** [September 7, 2022, 10:05pm UTC](https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147/1 "2022-09-07T22:05:12Z")

</div>

I’d like to default to Musicbrainz for every fields, but fetch genre & style from Discogs, and audio features from Spotify.

The best way I found in my minimal test is to do 3 imports, and choosing the right source each time. This is indeed time consuming and some fields get overwritten as I didn’t found a way to limit the fields a source can fetch & save.

How should I proceed in your opinion?

---

<div class="post-metadata">

**Author:** ![planetearth](https://avatars.discourse-cdn.com/v4/letter/p/82dd89/32.png) [@planetearth](https://discourse.beets.io/u/planetearth)\
**Post date:** [September 8, 2022, 12:08pm UTC](https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147/2 "2022-09-08T12:08:21Z")

</div>

There is an open [feature request](https://github.com/beetbox/beets/issues/4087) to allow configuring which fields should be overwritten. Currently, a plugin overwrites everything that it can find.

---

<div class="post-metadata">

**Author:** ![ryancey](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ryancey](https://discourse.beets.io/u/ryancey)\
**Post date:** [September 9, 2022, 6:37pm UTC](https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147/3 "2022-09-09T18:37:35Z")

</div>

I’ve been drafting something that solves my problem: [GitHub - raphaelyancey/beets at filters](https://github.com/raphaelyancey/beets/tree/filters)

Takes 4 steps and 3 configs but it works 😄

```auto
# Initial MusicBrainz import
beet import foobar/

# Discogs genre/style
beet -c config_discogs.yaml import foobar/

# Spotify audio features
beet -c config_spotify.yaml import foobar/
beet -c config_spotify.yaml spotifysync

```

* * *

**config\_discogs.yaml**

```nohighlight
plugins: discogs

musicbrainz:
    enabled: no

discogs:
    fields:
      - genre 
      - discogs_albumid
      - discogs_labelid
      - discogs_artistid
    append_style_genre: true

```

**config\_spotify.yaml**

```nohighlight
plugins: spotify

musicbrainz:
    enabled: no

spotify:
    fields:
      - spotify_album_id 
      - spotify_artist_id
      - spotify_track_id
      - spotify_track_popularity
      - spotify_acousticness
      - spotify_danceability
      - spotify_energy
      - spotify_instrumentalness
      - spotify_key
      - spotify_liveness
      - spotify_loudness
      - spotify_mode
      - spotify_speechiness
      - spotify_tempo
      - spotify_time_signature
      - spotify_valence
      - spotify_updated

```

---

<div class="post-metadata">

**Author:** ![planetearth](https://avatars.discourse-cdn.com/v4/letter/p/82dd89/32.png) [@planetearth](https://discourse.beets.io/u/planetearth)\
**Post date:** [September 9, 2022, 8:15pm UTC](https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147/4 "2022-09-09T20:15:50Z")

</div>

I like the idea of splitting up the configs. However, multiple imports are going to be tough for a large library. More importantly, these things are connected already, we just need to figure out a way to translate identifiers from one service to other.

@jojo is already working on extracting Discogs id from MB. It will be great if we can extend it to have a generic function to translate attributes.

---

<div class="post-metadata">

**Author:** ![ryancey](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ryancey](https://discourse.beets.io/u/ryancey)\
**Post date:** [September 9, 2022, 8:22pm UTC](https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147/5 "2022-09-09T20:22:19Z")

</div>

> [@planetearth](#):
>
> However, multiple imports are going to be tough for a large library.

It will indeed. It’s mostly a workaround with the aim of writing as less code as possible to do what I needed.

> [@planetearth](#):
>
> More importantly, these things are connected already, we just need to figure out a way to translate identifiers from one service to other.

Wouldn’t the UI need to be revamped anyway? At the moment you have to manually choose a candidate from a specific source. With `n` multiples sources, you would have to pick `n` choices anyway wouldn’t you?

---

<div class="post-metadata">

**Author:** ![planetearth](https://avatars.discourse-cdn.com/v4/letter/p/82dd89/32.png) [@planetearth](https://discourse.beets.io/u/planetearth)\
**Post date:** [September 9, 2022, 8:37pm UTC](https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147/6 "2022-09-09T20:37:31Z")

</div>

> [@ryancey](#):
>
> Wouldn’t the UI need to be revamped anyway? At the moment you have to manually choose a candidate from a specific source. With `n` multiples sources, you would have to pick `n` choices anyway wouldn’t you?

The way I anticipate this to work is that we still only import once and use that information to match with other services. For example, let us say we use MB as a tag source. We can then use the `mb_album_id` to obtain the identifier for the other services (assuming it is available in MB). See [this discussion](https://github.com/beetbox/beets/discussions/4220) for additional information.

---

<div class="post-metadata">

**Author:** ![planetearth](https://avatars.discourse-cdn.com/v4/letter/p/82dd89/32.png) [@planetearth](https://discourse.beets.io/u/planetearth)\
**Post date:** [September 10, 2022, 6:47pm UTC](https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147/7 "2022-09-10T18:47:07Z")

</div>

@ryancey BTW…do you use the `-W` flag to prevent writing the tags on subsequent imports (and only get the values for the database)? For example, I want to use the tags from Spotify (in the first import) and then only want to obtain the MB\_IDs in the subsequent import without overwriting the tags.

---

<div class="post-metadata">

**Author:** ![ryancey](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ryancey](https://discourse.beets.io/u/ryancey)\
**Post date:** [September 11, 2022, 10:23am UTC](https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147/8 "2022-09-11T10:23:44Z")

</div>

Yes as a global option in my configs, but that was kind of custom in my case so I didn’t include it in the examples.

For your case my code won’t help you because it only skip fields for Discogs & Spotify plugins, but it could easily be set as a top-level property now that I think of it… And then you’d use multiple configs to enable/disable sources including MB.

For the record, my goal is then to set “meta-genres” based on Spotify audio features, like _# Danceable_ or _# Acoustic_.

I’d achieve it with something like

```bash
beet modify spotify_danceability:0.6..1.0 genre='$genre; # Danceable'
beet modify spotify_acousticness:0.8..1.0 genre='$genre; # Acoustic'

```

so it is somewhat “standard” and can be used in any library manager (Emby in my case) to create smart playlists for example.

---

<div class="post-metadata">

**Author:** ![planetearth](https://avatars.discourse-cdn.com/v4/letter/p/82dd89/32.png) [@planetearth](https://discourse.beets.io/u/planetearth)\
**Post date:** [September 12, 2022, 2:56pm UTC](https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147/9 "2022-09-12T14:56:33Z")

</div>

Looks like musicbrainz does not allow configuring fields to be imported. It overwrites everything ☹

---

<div class="post-metadata">

**Author:** ![jojo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/jojo/32/709_2.png) [@jojo](https://discourse.beets.io/u/jojo)\
**Post date:** [September 17, 2022, 5:14am UTC](https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147/10 "2022-09-17T05:14:08Z")

</div>

Probably one of the first features that’s required for making some of the ideas in this thread work: Making MB plugin configurable. I think there is a thread/issue/discussion open already for that. Let me check…

---

<div class="post-metadata">

**Author:** ![jojo](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.beets.io/jojo/32/709_2.png) [@jojo](https://discourse.beets.io/u/jojo)\
**Post date:** [September 17, 2022, 5:28am UTC](https://discourse.beets.io/t/pick-some-fields-from-a-metadata-source-and-some-other-elsewhere/2147/11 "2022-09-17T05:28:01Z")

</div>

The issue discussing this feature request currently has a misleading title but here it is: [discogs: Add a configuration option to avoid providing the genre field · Issue #4087 · beetbox/beets · GitHub](https://github.com/beetbox/beets/issues/4087#issuecomment-1250003965)
