owntone / owntone-server

Linux/FreeBSD DAAP (iTunes) and MPD audio server with support for AirPlay 1 and 2 speakers (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
https://owntone.github.io/owntone-server
GNU General Public License v2.0
2.08k stars 234 forks source link

Album split in multiple albums during import #1696

Closed hacketiwack closed 10 months ago

hacketiwack commented 10 months ago

For some albums I have, I've discovered that when imported into the OwnTone database, they are split into multiple albums. I can't figure out why they are split.

An example below of what is returned by the API call /api/library/albums?media_kind=music

{
  "items": [
    {
      "id": "2667289888762390960",
      "name": "A.I. Artificial Intelligence",
      "name_sort": "A.I. Artificial Intelligence",
      "artist": "John Williams",
      "artist_id": "628737532861436891",
      "track_count": 46,
      "length_ms": 10544224,
      "time_added": "2023-12-15T17:14:09Z",
      "in_progress": false,
      "media_kind": "music",
      "data_kind": "file",
      "year": 2015,
      "uri": "library:album:2667289888762390960",
      "artwork_url": "./artwork/group/30941"
    },
    {
      "id": "1335596877965614741",
      "name": "A.I. Artificial Intelligence",
      "name_sort": "A.I. Artificial Intelligence",
      "artist": "John Williams",
      "artist_id": "628737532861436891",
      "track_count": 1,
      "length_ms": 280816,
      "time_added": "2023-12-15T17:14:08Z",
      "in_progress": false,
      "media_kind": "music",
      "data_kind": "file",
      "year": 2015,
      "uri": "library:album:1335596877965614741",
      "artwork_url": "./artwork/group/30942"
    }]
}

There should be only one album. I don't know what triggers the creation of another album for some tracks. Do I miss something? Is there a specific configuration that I miss? I can provide an example album that provokes this behaviour.

I'm using the latest master branch of OwnTone (Docker image created by this Dockerfile. I doubt that this is due to the build done under Alpine Linux. I will test with another Docker image in the meantime to check if I obtain any different result.

Thanks in advance for any help.

hacketiwack commented 10 months ago

In the database, I have the following data:

sqlite> select id, songalbumid,fname,album from files where album like '%Intelligence';
381235|1335596877965614741|a5d5b552-e02b-4b6e-863a-379b75cca96e.mp3|A.I. Artificial Intelligence
381236|2667289888762390960|9b1eb417-725c-4fcc-b2d2-b5ca2d07bde8.mp3|A.I. Artificial Intelligence
381237|2667289888762390960|a6546177-4543-417c-abb3-48c0bee2250d.mp3|A.I. Artificial Intelligence
381238|2667289888762390960|1bd17d33-17ab-464c-817b-b4905b3d5b99.mp3|A.I. Artificial Intelligence
381239|2667289888762390960|5d046be9-acb8-47a7-927c-67d7276acd6f.mp3|A.I. Artificial Intelligence
381240|2667289888762390960|802ff2c8-b757-4c36-8a4e-5985b1fbf34c.mp3|A.I. Artificial Intelligence
381241|2667289888762390960|85a20596-6e0b-4cd2-b427-2127fb7d9bef.mp3|A.I. Artificial Intelligence
381242|2667289888762390960|52837661-2a76-4e3e-bf78-b7ed30a68e70.mp3|A.I. Artificial Intelligence
381243|2667289888762390960|1672d332-ece8-4bb2-bdee-352daad523c4.mp3|A.I. Artificial Intelligence
381244|2667289888762390960|3c537ba1-1e05-409d-bf84-fdae4e987f7d.mp3|A.I. Artificial Intelligence
381245|2667289888762390960|4a34ab96-ad93-4ce2-8984-fdbe55dfd99f.mp3|A.I. Artificial Intelligence
381246|2667289888762390960|95769787-7130-4c63-ba29-b1e00c8d7c6e.mp3|A.I. Artificial Intelligence
381247|2667289888762390960|7d733ace-8f83-4cbc-8bb1-8cc32e2790ad.mp3|A.I. Artificial Intelligence
381248|2667289888762390960|03d683de-1e7d-4b88-b304-4cb90a5f9982.mp3|A.I. Artificial Intelligence
381249|2667289888762390960|03bc286a-c7e4-47c4-8254-c22a9ce6d33b.mp3|A.I. Artificial Intelligence
381250|2667289888762390960|10beffd9-a283-41c8-a78d-05772559b3a5.mp3|A.I. Artificial Intelligence
381251|2667289888762390960|510b4fb4-f51a-4823-89dd-4e087685b43c.mp3|A.I. Artificial Intelligence
381252|2667289888762390960|fcfec769-b3d2-4e68-88f0-f70f572dbfe5.mp3|A.I. Artificial Intelligence
381253|2667289888762390960|aa9fcc2c-4d18-4ce2-af1b-848fbd2f505a.mp3|A.I. Artificial Intelligence
381254|2667289888762390960|1013da01-f208-4f79-9d56-ab4b5c06bdde.mp3|A.I. Artificial Intelligence
381255|2667289888762390960|cd4c3c0e-2c70-4262-8369-256795afc89a.mp3|A.I. Artificial Intelligence
381256|2667289888762390960|c3e217b0-74cd-45c1-aa7a-b847d9710c08.mp3|A.I. Artificial Intelligence
381257|2667289888762390960|7798fe74-27e4-40e0-8394-669d1b8f90cf.mp3|A.I. Artificial Intelligence
381258|2667289888762390960|f1f9c121-35c4-40a9-95f2-f851fbde2f43.mp3|A.I. Artificial Intelligence
381259|2667289888762390960|b26b9325-7126-4a0d-b8bd-4f96200e9aff.mp3|A.I. Artificial Intelligence
381260|2667289888762390960|07c65b20-e6a9-473c-8cd8-15f00fa665a7.mp3|A.I. Artificial Intelligence
381261|2667289888762390960|f757b418-80da-4fd7-b608-df7382489940.mp3|A.I. Artificial Intelligence
381262|2667289888762390960|38b436bd-1c8a-489b-bf34-a4493ff79c5a.mp3|A.I. Artificial Intelligence
381263|2667289888762390960|05564df6-c4bd-42fd-acae-689b8db3ee86.mp3|A.I. Artificial Intelligence
381264|2667289888762390960|818991cf-4683-499d-867c-f38509de0fc2.mp3|A.I. Artificial Intelligence
381265|2667289888762390960|1030e790-34f3-4613-a25e-6a2ea25c1356.mp3|A.I. Artificial Intelligence
381266|2667289888762390960|c7df9ab9-aab3-476a-a967-41ca6ea558d1.mp3|A.I. Artificial Intelligence
381267|2667289888762390960|703de320-cc25-4773-ba8d-062ce50b6905.mp3|A.I. Artificial Intelligence
381268|2667289888762390960|e5027dbe-9059-4092-82b4-4328661f8f5f.mp3|A.I. Artificial Intelligence
381269|2667289888762390960|259588d4-0297-491f-9d27-4ebd71bc9358.mp3|A.I. Artificial Intelligence
381270|2667289888762390960|0b203615-5920-45a3-843f-c87005113899.mp3|A.I. Artificial Intelligence
381271|2667289888762390960|e456c62a-4964-45e2-b227-2e1dc10bfccd.mp3|A.I. Artificial Intelligence
381272|2667289888762390960|a21b9bb8-2cfb-47cf-8369-257d40a25283.mp3|A.I. Artificial Intelligence
381273|2667289888762390960|faefdb7d-44ba-47ec-a944-48a26eab84dd.mp3|A.I. Artificial Intelligence
381274|2667289888762390960|ff3061fd-6620-4bfc-ad17-e5f29eb57e84.mp3|A.I. Artificial Intelligence
381275|2667289888762390960|095f221a-6567-44bf-b612-2b77b81b518a.mp3|A.I. Artificial Intelligence
381276|2667289888762390960|bcfd18a0-3cf3-4c54-bbe1-cb675d1d7d09.mp3|A.I. Artificial Intelligence
381277|2667289888762390960|f89e34b9-3061-444b-a0ff-e3b54f47fb56.mp3|A.I. Artificial Intelligence
381278|2667289888762390960|0b46a800-2f3d-4875-8cdd-6ff0d6c29527.mp3|A.I. Artificial Intelligence
381279|2667289888762390960|a039efaf-7f46-4c0a-a0d4-cfd53c2f91de.mp3|A.I. Artificial Intelligence
381280|2667289888762390960|d4576fdd-6380-42ea-8701-968c2d97cf9c.mp3|A.I. Artificial Intelligence
381281|2667289888762390960|3d60b4cf-4c1a-40d7-ab78-7baf07e5f8c1.mp3|A.I. Artificial Intelligence
ejurgensen commented 10 months ago

Try running with ffprobe on some of the tracks to check the metadata. It is probably one of these that is the cause of it.

hacketiwack commented 10 months ago

Thanks for the speedy reply. I checked with ffprobe (command below).

for i in *.mp3; do ffprobe -loglevel quiet -show_entries stream_tags:format_tags -of json -i "$i" |jq '.format.tags.["MusicBrainz Album Id"]' ; done;

All tracks have the following metadata:

{
  "title": "Wearing Perfume",
  "artist": "John Williams",
  "track": "8/22",
  "album": "A.I. Artificial Intelligence",
  "disc": "1/3",
  "genre": "Classical/Pop",
  "TMED": "CD",
  "MusicBrainz Release Group Id": "eede62fc-9356-3818-a8aa-b4c31a654a26",
  "TORY": "2001",
  "MusicBrainz Release Track Id": "ff3061fd-6620-4bfc-ad17-e5f29eb57e84",
  "TSRC": "USWB11504429",
  "SCRIPT": "Latn",
  "album_artist": "John Williams",
  "TSO2": "Williams, John",
  "artist-sort": "Williams, John",
  "publisher": "La‐La Land Records",
  "originalyear": "2001",
  "BARCODE": "826924135327",
  "ARTISTS": "John Williams",
  "CATALOGNUMBER": "LLLCD 1353",
  "MusicBrainz Album Status": "official",
  "MusicBrainz Album Release Country": "US",
  "MusicBrainz Album Type": "album/soundtrack",
  "Acoustid Id": "fe7def0e-948a-4853-979d-88fe36d994df",
  "MusicBrainz Album Id": "7985f15c-350a-4198-bc51-8b58490ec35f",
  "MusicBrainz Artist Id": "53b106e7-0cc6-42cc-ac95-ed8d30a3a98e",
  "MusicBrainz Album Artist Id": "53b106e7-0cc6-42cc-ac95-ed8d30a3a98e",
  "date": "2015-06-16"
}

All the files have the same:

Command used:

for i in *.mp3; do ffprobe -loglevel quiet -show_entries stream_
tags:format_tags -of json -i $i | grep '"MusicBrainz Album Id"' | sed 's/.*: "\(.*\)".*/\1/' ; done | uniq

They were tagged with MusicBrainz Picard.

ejurgensen commented 10 months ago

Weird. Then I would suggest you run OwnTone in a debugger and set a breakpoint at the end of parse_albumid in filescanner_ffmpeg.c. Or add a log statement. Then use "touch" to trigger a rescan of two files that are in different albums. You should then be seeing two different songalbumids, and you can check the id_string that is used as input. That should give a clue.

ejurgensen commented 10 months ago

I think I know what the cause is. It's a regression from the lyrics change, PR #1655, where the way the metadata tags are read was changed to no longer be in the order of the struct. I will try to make a fix for it.

hacketiwack commented 10 months ago

Wow! You're great! Thanks a lot!

ejurgensen commented 10 months ago

I think it should be fixed with the latest commit. Unfortunately you will need to rescan the entire library to get the ID's set to the correct values.

hacketiwack commented 10 months ago

It works! Thanks a lot!