Mopidy-Local creating several albums from one album

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

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

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.

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

$ 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

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.

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.

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 :slight_smile:

_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)