# Mopidy-Local creating several albums from one album

**URL:** <https://discourse.mopidy.com/t/mopidy-local-creating-several-albums-from-one-album/3967>\
**Category:** Misc\
**Created:** [April 27, 2020, 9:00am UTC](https://discourse.mopidy.com/t/mopidy-local-creating-several-albums-from-one-album/3967 "2020-04-27T09:00:18Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hans-martijn](https://avatars.discourse-cdn.com/v4/letter/h/ea666f/32.png) [@hans-martijn](https://discourse.mopidy.com/u/hans-martijn)\
**Post date:** [April 27, 2020, 9:00am UTC](https://discourse.mopidy.com/t/mopidy-local-creating-several-albums-from-one-album/3967/1 "2020-04-27T09:00:18Z")

</div>

Hi. The last few weeks I have been playing with Mopidy and backends, to create a sound system on my boat. I like it a lot, so I will probably use it at home too in the near future. I have only one problem: if i do a local scan, I get several albums with the same name, album art, etc. for one album. I have, for instance, ABBA - ABBA Gold, for which de local backend created eight different albums. Can I change settings to the scan so this doesn’t happen anymore?

Thanks in advance,  
Hans

---

<div class="post-metadata">

**Author:** ![sapristi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/sapristi/32/1364_2.png) [@sapristi](https://discourse.mopidy.com/u/sapristi)\
**Post date:** [April 28, 2020, 10:35am UTC](https://discourse.mopidy.com/t/mopidy-local-creating-several-albums-from-one-album/3967/2 "2020-04-28T10:35:22Z")

</div>

I guess the best way to solve the issue would be to fix the id3 tags of your music files.

---

<div class="post-metadata">

**Author:** ![hans-martijn](https://avatars.discourse-cdn.com/v4/letter/h/ea666f/32.png) [@hans-martijn](https://discourse.mopidy.com/u/hans-martijn)\
**Post date:** [April 28, 2020, 11:11am UTC](https://discourse.mopidy.com/t/mopidy-local-creating-several-albums-from-one-album/3967/3 "2020-04-28T11:11:12Z")

</div>

That’s what I figured, but for some reason on some albums, with the same album name (even after editing), every one or two tracks become a seperate album.

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [April 28, 2020, 12:11pm UTC](https://discourse.mopidy.com/t/mopidy-local-creating-several-albums-from-one-album/3967/4 "2020-04-28T12:11:21Z")

</div>

You could take two tracks which are being split into different albums and seeing what Gstreamer sees differently about them. e.g.

```auto
$ diff <(gst-discoverer-1.0 'Foo Fighters - Doll.m4a' | grep " ") <(gst-discoverer-1.0 'Foo Fighters - Everlong.m4a' | grep " ")

5,6c5,6
< title: Doll
< composer: Dave Grohl and Foo Fighters
---
> title: Everlong
> composer: Dave Grohl
12c12
< track number: 1
---
> track number: 11
19d18
< track ID: 348a67a4-f364-439c-bb8d-94eb13dba508
22a22
> track ID: 9160e42b-8fae-402d-9cee-d6826c5cce33

```

---

<div class="post-metadata">

**Author:** ![hans-martijn](https://avatars.discourse-cdn.com/v4/letter/h/ea666f/32.png) [@hans-martijn](https://discourse.mopidy.com/u/hans-martijn)\
**Post date:** [April 28, 2020, 12:12pm UTC](https://discourse.mopidy.com/t/mopidy-local-creating-several-albums-from-one-album/3967/5 "2020-04-28T12:12:38Z")

</div>

I found the problem, but still don’t know how to fix it: there’s an md5 checksum which is different, as is the date of the song(s). The album name is the same. Now to figure a way to fix it.

---

<div class="post-metadata">

**Author:** ![hans-martijn](https://avatars.discourse-cdn.com/v4/letter/h/ea666f/32.png) [@hans-martijn](https://discourse.mopidy.com/u/hans-martijn)\
**Post date:** [April 28, 2020, 1:15pm UTC](https://discourse.mopidy.com/t/mopidy-local-creating-several-albums-from-one-album/3967/6 "2020-04-28T13:15:58Z")

</div>

The album date is different, and only now I see that all albums with multiple entries are compilations of previous albums, like ‘the best of’ or ‘the hits’ or similar. Is there a way to ignore the date and then reindex? My whole library is my iTunes library (over 40GB) in m4a.

---

<div class="post-metadata">

**Author:** ![varungujjar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/varungujjar/32/2554_2.png) [@varungujjar](https://discourse.mopidy.com/u/varungujjar)\
**Post date:** [April 29, 2025, 6:56pm UTC](https://discourse.mopidy.com/t/mopidy-local-creating-several-albums-from-one-album/3967/7 "2025-04-29T18:56:14Z")

</div>

Sorry I may be late on this conversation I had the same issue but after spending hours I found a solution to this, this will group all album with same names together

mopidy/audio/tags.py

replace the following function and then clear your database and do a mopidy scan again it should work 🙂

> \_album\_cache = {}  
> def convert\_tags\_to\_track(tags):  
> global \_album\_cache
> 
> ```
> album_kwargs = {}
> track_kwargs = {}
> 
> track_kwargs["composers"] = _artists(tags, Gst.TAG_COMPOSER)
> track_kwargs["performers"] = _artists(tags, Gst.TAG_PERFORMER)
> track_kwargs["artists"] = _artists(
> tags,
> Gst.TAG_ARTIST,
> "musicbrainz-artistid",
> "musicbrainz-sortname",
> )
> album_kwargs["artists"] = _artists(tags, Gst.TAG_ALBUM_ARTIST)
> 
> track_kwargs["genre"] = "; ".join(tags.get(Gst.TAG_GENRE, []))
> track_kwargs["name"] = "; ".join(tags.get(Gst.TAG_TITLE, [])) or "; ".join(tags.get(Gst.TAG_ORGANIZATION, []))
> track_kwargs["comment"] = (
> "; ".join(tags.get("comment", [])) or
> "; ".join(tags.get(Gst.TAG_LOCATION, [])) or
> "; ".join(tags.get(Gst.TAG_COPYRIGHT, []))
> )
> track_kwargs["track_no"] = tags.get(Gst.TAG_TRACK_NUMBER, [None])[0]
> track_kwargs["disc_no"] = tags.get(Gst.TAG_ALBUM_VOLUME_NUMBER, [None])[0]
> track_kwargs["bitrate"] = tags.get(Gst.TAG_BITRATE, [None])[0]
> track_kwargs["musicbrainz_id"] = tags.get("musicbrainz-albumid", [None])[0]
> album_kwargs["date"] = tags.get(Gst.TAG_DATE, [None])[0]
> if not album_kwargs["date"]:
> datetime = tags.get(Gst.TAG_DATE_TIME, [None])[0]
> if datetime is not None:
> album_kwargs["date"] = datetime.split("T")[0]
> track_kwargs["date"] = album_kwargs["date"]
> 
> # Clear out any empty values we found
> track_kwargs = {k: v for k, v in track_kwargs.items() if v}
> album_kwargs = {k: v for k, v in album_kwargs.items() if v}
> 
> album_name = tags.get(Gst.TAG_ALBUM, [None])[0]
> if album_name:
> if album_name in _album_cache:
> track_kwargs["album"] = _album_cache[album_name]
> else:
> album = Album(name=album_name)
> _album_cache[album_name] = album
> track_kwargs["album"] = album
> 
> track_kwargs = {k: v for k, v in track_kwargs.items() if v}
> return Track(**track_kwargs)
> 
> ```
