Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate albums #611

Closed
ajpanton opened this issue Feb 10, 2025 · 20 comments
Closed

Duplicate albums #611

ajpanton opened this issue Feb 10, 2025 · 20 comments
Labels
Milestone

Comments

@ajpanton
Copy link

Importing songs that (as far as I can tell) have identical album and artist data, are sometimes split into two albums with identical names. I checked the database, and the table "release" (which I assume is the albums) contains multiple duplicate rows where all columns (except id) are identical.

What info do I have provide to help recreate the issue?

Speaking of this topic, I noticed that the "release" table also has a column for the artist. If a single album has songs with different artists, how are those handled?

@epoupon
Copy link
Owner

epoupon commented Feb 10, 2025

What info do I have provide to help recreate the issue?

Please run lms-metadata on one file of each split release and paste the result here, we will likely find out what is wrong.

Speaking of this topic, I noticed that the "release" table also has a column for the artist. If a single album has songs with different artists, how are those handled?

I guess you mean the artist_display_name column. LMS does handle multiple artists per track and also multi album artists per album. it is explained in https://github.com/epoupon/lms/?tab=readme-ov-file#multiple-album-artists

@ajpanton
Copy link
Author

ajpanton commented Feb 11, 2025

Here's one where one of the songs unfortunately got left out because of capitalization:

Songs 01-12 are in one album

Parsing file '"12 - Sleep.m4a"'
Using TagLib:
139807568919352 [info] [METADATA] Using TagLib parser with read style = accurate
139807568919352 [debug] [METADATA] Key = 'ALBUM', value = 'Signs of Life'
139807568919352 [debug] [METADATA] Key = 'ARTIST', value = 'Poets of the Fall'
139807568919352 [debug] [METADATA] Key = 'COMMENT', value = '                            '
139807568919352 [debug] [METADATA] Key = 'DATE', value = '2005'
139807568919352 [debug] [METADATA] Key = 'GENRE', value = 'Rock'
139807568919352 [debug] [METADATA] Key = 'ITUNSMPB', value = ' 00000000 00000640 00000384 0000000000C92A3C 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000'
139807568919352 [debug] [METADATA] Key = 'TITLE', value = 'Sleep'
139807568919352 [debug] [METADATA] Key = 'TRACKNUMBER', value = '12'
Parsing time: 59.63ms
Audio properties:
        Bitrate: 123000 bps
        BitsPerSample: 16
        ChannelCount: 2
        Duration: 299.00s
        SampleRate: 44100

Parsed metadata:
Display artist: Poets of the Fall
Artist: Poets of the Fall
Title: Sleep
Genre: Rock
Position: 12
Date: 2005
HasCover = false
Medium:
Release: Signs of Life
        IsCompilation: false

Song 13 ended up in its own album

Parsing file '"13 - Lift (Dramadance Remix) [Bonus Track].m4a"'
Using TagLib:
139791838116664 [info] [METADATA] Using TagLib parser with read style = accurate
139791838116664 [debug] [METADATA] Key = 'ALBUM', value = 'Signs Of Life'
139791838116664 [debug] [METADATA] Key = 'ARTIST', value = 'Poets Of The Fall'
139791838116664 [debug] [METADATA] Key = 'DATE', value = '2005'
139791838116664 [debug] [METADATA] Key = 'GENRE', value = 'Rock'
139791838116664 [debug] [METADATA] Key = 'ITUNSMPB', value = ' 00000000 00000640 00000309 00000000010A32B7 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000'
139791838116664 [debug] [METADATA] Key = 'TITLE', value = 'Lift (Dramadance Remix) [Bonus Track]'
139791838116664 [debug] [METADATA] Key = 'TRACKNUMBER', value = '13'
Parsing time: 49.66ms
Audio properties:
        Bitrate: 143000 bps
        BitsPerSample: 16
        ChannelCount: 2
        Duration: 395.64s
        SampleRate: 44100

Parsed metadata:
Display artist: Poets Of The Fall
Artist: Poets Of The Fall
Title: Lift (Dramadance Remix) [Bonus Track]
Genre: Rock
Position: 13
Date: 2005
HasCover = false
Medium:
Release: Signs Of Life
        IsCompilation: false

If that's the cause, would it be possible to handle these cases somehow? Or do I just have to manually fix every one?

Here's another example where I see no difference in the album/artist, but apparently there's some "compilation" tag that's only present in the first song.

Song 01 is in its own album

Parsing file '"01. Glasgow 1877.mp3"'
Using TagLib:
139706258135864 [info] [METADATA] Using TagLib parser with read style = accurate
139706258135864 [debug] [METADATA] Key = 'ALBUM', value = 'The Life and Times of Scrooge'
139706258135864 [debug] [METADATA] Key = 'ALBUMARTIST', value = 'Tuomas Holopainen'
139706258135864 [debug] [METADATA] Key = 'ARTIST', value = 'Tuomas Holopainen'
139706258135864 [debug] [METADATA] Key = 'COMPILATION', value = '1'
139706258135864 [debug] [METADATA] Key = 'DATE', value = '2014'
139706258135864 [debug] [METADATA] Key = 'DISCNUMBER', value = '1/1'
139706258135864 [debug] [METADATA] Key = 'GENRE', value = 'Rock'
139706258135864 [debug] [METADATA] Key = 'ORIGINALARTIST', value = 'Tuomas Holopainen'
139706258135864 [debug] [METADATA] Key = 'TITLE', value = 'Glasgow 1877'
139706258135864 [debug] [METADATA] Key = 'TRACKNUMBER', value = '1/11'
139706258135864 [debug] [METADATA] Unknown value: 'APIC'
Parsing time: 5.55ms
Audio properties:
        Bitrate: 320000 bps
        BitsPerSample: 0
        ChannelCount: 2
        Duration: 387.53s
        SampleRate: 44100

Parsed metadata:
Display artist: Tuomas Holopainen
Artist: Tuomas Holopainen
Title: Glasgow 1877
Genre: Rock
Position: 1
Date: 2014
HasCover = true
Medium:
        Position: 1
        TrackCount: 11
Release: The Life and Times of Scrooge
        MediumCount: 1
        Display artist: Tuomas Holopainen
        IsCompilation: true
        Release artist: Tuomas Holopainen

Songs 02-11 are in the other album

Parsing file '"02. Into The West.mp3"'
Using TagLib:
140574596451128 [info] [METADATA] Using TagLib parser with read style = accurate
140574596451128 [debug] [METADATA] Key = 'ALBUM', value = 'The Life and Times of Scrooge'
140574596451128 [debug] [METADATA] Key = 'ALBUMARTIST', value = 'Tuomas Holopainen'
140574596451128 [debug] [METADATA] Key = 'ARTIST', value = 'Tuomas Holopainen'
140574596451128 [debug] [METADATA] Key = 'DATE', value = '2014'
140574596451128 [debug] [METADATA] Key = 'DISCNUMBER', value = '1/1'
140574596451128 [debug] [METADATA] Key = 'GENRE', value = 'Rock'
140574596451128 [debug] [METADATA] Key = 'ORIGINALARTIST', value = 'Tuomas Holopainen'
140574596451128 [debug] [METADATA] Key = 'TITLE', value = 'Into The West'
140574596451128 [debug] [METADATA] Key = 'TRACKNUMBER', value = '2/11'
140574596451128 [debug] [METADATA] Unknown value: 'APIC'
Parsing time: 4.64ms
Audio properties:
        Bitrate: 320000 bps
        BitsPerSample: 0
        ChannelCount: 2
        Duration: 301.71s
        SampleRate: 44100

Parsed metadata:
Display artist: Tuomas Holopainen
Artist: Tuomas Holopainen
Title: Into The West
Genre: Rock
Position: 2
Date: 2014
HasCover = true
Medium:
        Position: 1
        TrackCount: 11
Release: The Life and Times of Scrooge
        MediumCount: 1
        Display artist: Tuomas Holopainen
        IsCompilation: false
        Release artist: Tuomas Holopainen

@ajpanton
Copy link
Author

At least deleting the compilation tag resolved that issue, so I'm guessing fixing the case of the other one will fix that as well. Is there some better way to determine which songs are in the same album, like just being in the same directory and having identical-ish (trim whitespace, ignore case) album? Or are there cases where it has to be strict like this? I guess it's my fault for having such sloppy tagging on my music, but I haven't noticed before because previous software hasn't cared.

@simonbun
Copy link

I believe the current rule is:

tracks/discs are considered to belong to the same releases if they share the same album name (+ sort name), same disc count, same Compilation flag, same labels and now same barcodes.

If you keep all the tracks of an album in one folder, this SQL will show you which folders have been divided into different albums:

select c.absolute_path 
  from release   a
         inner join
       track     b on (a.id = b.release_id)
         inner join
       directory c on (b.directory_id = c.id)
  group by 1
  having count(distinct a.id) > 1;

If your tracks are organized into disc subfolders, you'll have to replace c.absolute_path with rtrim(c.absolute_path, replace(c.absolute_path, '/', '')).

I hope that works and helps ;-)

@epoupon
Copy link
Owner

epoupon commented Feb 12, 2025

Well indeed it is always better to fix tags (and even better to use musicbrainz identifiers)
These constraints may be relaxed in case of single disc album that is in a single directory, will have to check.
About the case, this is more annoying, as we have to choose between two names. lms already raises warnings in logs for releases that have been scanned using different names though.

@kartikynwa
Copy link

kartikynwa commented Feb 15, 2025

I get this problem too. In my case it is happening because of inconsistent "composer" tag across songs in an album though this should not cause any problems.

If I run this query:

SQL query
select 
  t.id as track_id, 
  t.name as track_name, 
  t.artist_display_name, 
  a.id as artist_id, 
  a.name as artist_name 
from 
  track t 
  join track_artist_link tal on t.id = tal.track_id 
  join artist a on tal.artist_id = a.id 
  join release r on t.release_id = r.id 
where 
  r.name = 'Hot Thoughts';

I get this output:

Output
| track_id | track_name                    | artist_display_name | artist_id | artist_name                    |
|----------+-------------------------------+---------------------+-----------+--------------------------------|
|     2121 | Shotgun                       | Spoon               |       769 | Spoon                          |
|     2121 | Shotgun                       | Spoon               |       769 | Spoon                          |
|     2121 | Shotgun                       | Spoon               |       772 | Britt Daniel, Sean Dineen      |
|     2113 | Hot Thoughts                  | Spoon               |       769 | Spoon                          |
|     2113 | Hot Thoughts                  | Spoon               |       769 | Spoon                          |
|     2113 | Hot Thoughts                  | Spoon               |       772 | Britt Daniel, Sean Dineen      |
|     2119 | I Ain't the One               | Spoon               |       769 | Spoon                          |
|     2119 | I Ain't the One               | Spoon               |       769 | Spoon                          |
|     2119 | I Ain't the One               | Spoon               |       770 | Britt Daniel                   |
|     2118 | Can I Sit Next to You         | Spoon               |       769 | Spoon                          |
|     2118 | Can I Sit Next to You         | Spoon               |       769 | Spoon                          |
|     2118 | Can I Sit Next to You         | Spoon               |       770 | Britt Daniel                   |
|     2117 | Pink Up                       | Spoon               |       769 | Spoon                          |
|     2117 | Pink Up                       | Spoon               |       769 | Spoon                          |
|     2117 | Pink Up                       | Spoon               |       770 | Britt Daniel                   |
|     2115 | Do I Have to Talk You Into It | Spoon               |       769 | Spoon                          |
|     2115 | Do I Have to Talk You Into It | Spoon               |       769 | Spoon                          |
|     2115 | Do I Have to Talk You Into It | Spoon               |       770 | Britt Daniel                   |
|     2114 | WhisperI'lllistentohearit     | Spoon               |       769 | Spoon                          |
|     2114 | WhisperI'lllistentohearit     | Spoon               |       769 | Spoon                          |
|     2114 | WhisperI'lllistentohearit     | Spoon               |       770 | Britt Daniel                   |
|     2116 | First Caress                  | Spoon               |       769 | Spoon                          |
|     2116 | First Caress                  | Spoon               |       769 | Spoon                          |
|     2116 | First Caress                  | Spoon               |       773 | Alex Frischel, Britt Daniel    |
|     2120 | Tear It Down                  | Spoon               |       769 | Spoon                          |
|     2120 | Tear It Down                  | Spoon               |       769 | Spoon                          |
|     2120 | Tear It Down                  | Spoon               |       774 | Britt Daniel, Laura Pergolizzi |
|     2122 | Us                            | Spoon               |       769 | Spoon                          |
|     2122 | Us                            | Spoon               |       769 | Spoon                          |
|     2122 | Us                            | Spoon               |       775 | Britt Daniel, Ted Taforo       |

Tangential but there should be a unique index on track_id and artist_id here.

If I filter out rows where artist_id=769 (Spoon), order by (artist_name, track_id), I get this:

| track_id | track_name                    | artist_display_name | artist_id | artist_name                    |
|----------+-------------------------------+---------------------+-----------+--------------------------------|
|     2116 | First Caress                  | Spoon               |       773 | Alex Frischel, Britt Daniel    |
|     2114 | WhisperI'lllistentohearit     | Spoon               |       770 | Britt Daniel                   |
|     2115 | Do I Have to Talk You Into It | Spoon               |       770 | Britt Daniel                   |
|     2117 | Pink Up                       | Spoon               |       770 | Britt Daniel                   |
|     2118 | Can I Sit Next to You         | Spoon               |       770 | Britt Daniel                   |
|     2119 | I Ain't the One               | Spoon               |       770 | Britt Daniel                   |
|     2120 | Tear It Down                  | Spoon               |       774 | Britt Daniel, Laura Pergolizzi |
|     2113 | Hot Thoughts                  | Spoon               |       772 | Britt Daniel, Sean Dineen      |
|     2121 | Shotgun                       | Spoon               |       772 | Britt Daniel, Sean Dineen      |
|     2122 | Us                            | Spoon               |       775 | Britt Daniel, Ted Taforo       |

This is consistent with how LMS is grouping the songs into albums:

Image

Here is an example ffprobe output for one of the files (Tear It Down) which shows that the artist name comes from the composer tag:

ffprobe output
# /usr/lib/jellyfin-ffmpeg/ffprobe -hide_banner 08\ Tear\ It\ Down.mp3
Input #0, mp3, from '08 Tear It Down.mp3':
  Metadata:
    title           : Tear It Down
    artist          : Spoon
    track           : 08/10
    album           : Hot Thoughts
    disc            : 1/1
    genre           : Alternative
    album_artist    : Spoon
    comment         : Freak37
    TSRC            : USMTD1609120
    copyright       : 2017 Matador Records Limited
    composer        : Britt Daniel, Laura Pergolizzi
    publisher       : Sell The House Sell The Car Sell The Kids (BMI), TCBINAFLASHSONGS/Primary Wave, administered by BMG (BMI)
    replaygain_track_gain: -10.77 dB
    replaygain_track_peak: 1.097889
    replaygain_album_gain: -10.73 dB
    replaygain_album_peak: 1.163349
    replaygain_reference_loudness: -18.00 LUFS
    replaygain_track_range: 4.19 dB
    replaygain_album_range: 7.85 dB
    date            : 2017
  Duration: 00:04:20.34, start: 0.025056, bitrate: 345 kb/s
  Stream #0:0: Audio: mp3 (mp3float), 44100 Hz, stereo, fltp, 320 kb/s
      Metadata:
        encoder         : LAME3.98r
      Side data:
        replaygain: track gain - -10.770000, track peak - 0.000026, album gain - -10.730000, album peak - 0.000027,
  Stream #0:1: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 800x800 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn (attached pic)
      Metadata:
        comment         : Cover (front)

EDIT: Wanted to add that there are five albums that appear for Hot Thoughts, equal to the number of distinct artist_ids in the second SQL output

Image

@simonbun
Copy link

This is consistent with how LMS is grouping the songs into albums

That the split aligns with composer is a red herring, it's actually because the publisher/label tag varies across tracks.

@kartikynwa
Copy link

kartikynwa commented Feb 15, 2025

That the split aligns with composer is a red herring, it's actually because the publisher/label tag varies across tracks.

How do you know that? And what is the publisher label/tag in the ffprobe output I shared? If I know what tag you are talking about I can check your claim.

Edit: I am an idiot. The tag is right there. Let me check.

Edit 2: Yeah you are absolutely right. Thanks for pointing it out.

for f in *.mp3; do ffprobe -hide_banner "$f" 2>&1 | rg '(title|publisher)'; echo ""; done
    title           : Hot Thoughts
    publisher       : Ranchito Granada (BMI), Sell The House Sell The Car Sell The Kids (BMI)

    title           : WhisperI'lllistentohearit
    publisher       : Precious Fluids (BMI)

    title           : Do I Have to Talk You Into It
    publisher       : Precious Fluids (BMI)

    title           : First Caress
    publisher       : Sell The House Sell The Car Sell The Kids (BMI), Trash Boy Unlimited (BMI)

    title           : Pink Up
    publisher       : Precious Fluids (BMI)

    title           : Can I Sit Next to You
    publisher       : Precious Fluids (BMI)

    title           : I Ain't the One
    publisher       : Precious Fluids (BMI)

    title           : Tear It Down
    publisher       : Sell The House Sell The Car Sell The Kids (BMI), TCBINAFLASHSONGS/Primary Wave, administered by BMG (BMI)

    title           : Shotgun
    publisher       : Ranchito Granada (BMI), Sell The House Sell The Car Sell The Kids (BMI)

    title           : Us
    publisher       : Sell The House Sell The Car Sell The Kids (BMI), Taforo Music (BMI)

@simonbun
Copy link

How do you know that?

Input #0, mp3, from '08 Tear It Down.mp3':
  Metadata:
    comment         : Freak37

;-)

Glad you got it sorted.

@AverageHoarder
Copy link

I can open a new issue for this, but I'm fairly certain that there's a bug in the label parsing for mp3s. To avoid having albums split by label/publisher, I'm using actions in mp3tag that always set Label and Publisher to the same value (which is decided by what is present). If label is present, both are set to that, if only publisher is present, both are set to that. Which is correctly parsed for flac files where it is stored as LABEL and ORGANIZATION:

Parsing file '"01 Going To A Town.flac"'
Using TagLib:
137527274437432 [info] [METADATA] Using TagLib parser with read style = accurate
137527274437432 [debug] [METADATA] Key = 'ALBUM', value = 'Pop Bop'
137527274437432 [debug] [METADATA] Key = 'ALBUMARTIST', value = 'Gascoyne, Geoff'
137527274437432 [debug] [METADATA] Key = 'ARTIST', value = 'Geoff Gascoyne'
137527274437432 [debug] [METADATA] Key = 'BARCODE', value = '5032396009522'
137527274437432 [debug] [METADATA] Key = 'DATE', value = '2009'
137527274437432 [debug] [METADATA] Key = 'DISCNUMBER', value = '1'
137527274437432 [debug] [METADATA] Key = 'DISCTOTAL', value = '1'
137527274437432 [debug] [METADATA] Key = 'GENRE', value = 'Jazz'
137527274437432 [debug] [METADATA] Key = 'ISRC', value = 'GBNQL0910533'
137527274437432 [debug] [METADATA] Key = 'LABEL', value = 'Jazzizit Records'
137527274437432 [debug] [METADATA] Key = 'ORGANIZATION', value = 'Jazzizit Records'
137527274437432 [debug] [METADATA] Key = 'REPLAYGAIN_ALBUM_GAIN', value = '-4.97 dB'
137527274437432 [debug] [METADATA] Key = 'REPLAYGAIN_ALBUM_PEAK', value = '1.000000'
137527274437432 [debug] [METADATA] Key = 'REPLAYGAIN_TRACK_GAIN', value = '-5.00 dB'
137527274437432 [debug] [METADATA] Key = 'REPLAYGAIN_TRACK_PEAK', value = '0.988495'
137527274437432 [debug] [METADATA] Key = 'TITLE', value = 'Going To A Town'
137527274437432 [debug] [METADATA] Key = 'TRACKNUMBER', value = '1'
137527274437432 [debug] [METADATA] Key = 'TRACKTOTAL', value = '13'
Parsing time: 9.41ms
Audio properties:
        Bitrate: 1022000 bps
        BitsPerSample: 16
        ChannelCount: 2
        Duration: 419.80s
        SampleRate: 44100

Parsed metadata:
Display artist: Geoff Gascoyne
Artist: Geoff Gascoyne
Title: Going To A Town
Genre: Jazz
Position: 1
Date: 2009
HasCover = false
Track replay gain: -5.00
Medium: 
        Position: 1
        TrackCount: 13
        Replay gain: -4.97
Release: Pop Bop
        Label: Jazzizit Records
        MediumCount: 1
        Display artist: Gascoyne, Geoff
        IsCompilation: false
        Barcode: 5032396009522
        Release artist: Gascoyne, Geoff

But not for mp3s.

Parsing file '"12 Star.mp3"'
Using TagLib:
131755300346680 [info] [METADATA] Using TagLib parser with read style = accurate
131755300346680 [debug] [METADATA] Key = 'ALBUM', value = 'Pop Bop'
131755300346680 [debug] [METADATA] Key = 'ALBUMARTIST', value = 'Gascoyne, Geoff'
131755300346680 [debug] [METADATA] Key = 'ARTIST', value = 'Geoff Gascoyne'
131755300346680 [debug] [METADATA] Key = 'BARCODE', value = '5032396009522'
131755300346680 [debug] [METADATA] Key = 'DATE', value = '2009'
131755300346680 [debug] [METADATA] Key = 'DISCNUMBER', value = '1'
131755300346680 [debug] [METADATA] Key = 'DISCTOTAL', value = '1'
131755300346680 [debug] [METADATA] Key = 'GENRE', value = 'Jazz'
131755300346680 [debug] [METADATA] Key = 'ISRC', value = 'GBNQL0910544'
131755300346680 [debug] [METADATA] Key = 'LABEL', value = 'Jazzizit Records'
131755300346680 [debug] [METADATA] Key = 'LABEL', value = 'Jazzizit Records'
131755300346680 [debug] [METADATA] Key = 'REPLAYGAIN_ALBUM_GAIN', value = '-4.97 dB'
131755300346680 [debug] [METADATA] Key = 'REPLAYGAIN_ALBUM_PEAK', value = '1.000000'
131755300346680 [debug] [METADATA] Key = 'REPLAYGAIN_TRACK_GAIN', value = '-7.66 dB'
131755300346680 [debug] [METADATA] Key = 'REPLAYGAIN_TRACK_PEAK', value = '1.000000'
131755300346680 [debug] [METADATA] Key = 'TITLE', value = 'Star'
131755300346680 [debug] [METADATA] Key = 'TRACKNUMBER', value = '12'
131755300346680 [debug] [METADATA] Key = 'TRACKTOTAL', value = '13'
Parsing time: 12.19ms
Audio properties:
        Bitrate: 320000 bps
        BitsPerSample: 0
        ChannelCount: 2
        Duration: 349.52s
        SampleRate: 44100

Parsed metadata:
Display artist: Geoff Gascoyne
Artist: Geoff Gascoyne
Title: Star
Genre: Jazz
Position: 12
Date: 2009
HasCover = false
Track replay gain: -7.66
Medium: 
        Position: 1
        TrackCount: 13
        Replay gain: -4.97
Release: Pop Bop
        Label: Jazzizit Records
        Label: Jazzizit Records
        MediumCount: 1
        Display artist: Gascoyne, Geoff
        IsCompilation: false
        Barcode: 5032396009522
        Release artist: Gascoyne, Geoff

In the case of mp3s, the label is saved as TPUB and TXXX LABEL, which leads to it being parsed twice and results in each track being split into an individual album.

Image

@epoupon
Copy link
Owner

epoupon commented Feb 17, 2025

Ah, this reminds me another issue: if the same info is stored into two different tags (like a custom one and an official one), taglib can end up presenting both values under the same tag. Lms then consider they are multi-valued.

@ajpanton
Copy link
Author

ajpanton commented Feb 17, 2025

Just an update, since I started this. I gave up and found this software called Picard. I'm in the process of updating all tags of all my music. Maybe it will work better then =). Only problem is that LMS doesn't seem to like it when I change tags while moving/renaming a song, as I will lose playcounts and ratings. So I'm updating the tags first, rescan, then move/rename, and rescan again.

@simonbun
Copy link

Only problem is that LMS doesn't seem to like it when I change tags while moving/renaming a song, as I will lose playcounts and ratings.

It looks like v3.64.0 should address that! a3dfc08

@ajpanton
Copy link
Author

Only problem is that LMS doesn't seem to like it when I change tags while moving/renaming a song, as I will lose playcounts and ratings.

It looks like v3.64.0 should address that! a3dfc08

It says "if the track file just moved", but in my case that's already working. What's not working is when it's not just moving, but also getting its tags changed.

@simonbun
Copy link

It says "if the track file just moved", but in my case that's already working. What's not working is when it's not just moving, but also getting its tags changed.

Sorry, I misunderstood.
My understanding is that it currently uses musicbrainz track_id to track file moves which shouldn't be affected by other metadata.

Maybe @epoupon can confirm.

@epoupon
Copy link
Owner

epoupon commented Feb 17, 2025

On file moves:

  • in 3.63.0, db entries are kept only if they contain a track mbid (you can move and change tags, as long as the track mbid is still here)
  • in 3.64.0, same as 3.63.0 + db entries are also kept for tracks that do not contain a track mbid, only if you don't modify the files (just a move)

@AverageHoarder
Copy link

Ah, this reminds me another issue: if the same info is stored into two different tags (like a custom one and an official one), taglib can end up presenting both values under the same tag. Lms then consider they are multi-valued.

Even so, a multi-value for the label should not split each track into a new album, or should it?

Here are the tags of 2 tracks from my screenshot above, where each of the 15 tracks was considered its own album:

Parsing file '"01 The Fall of Paul.mp3"'
Using TagLib:
123711966997304 [info] [METADATA] Using TagLib parser with read style = accurate
123711966997304 [debug] [METADATA] Key = 'ALBUM', value = 'Live'
123711966997304 [debug] [METADATA] Key = 'ALBUMARTIST', value = 'District, The'
123711966997304 [debug] [METADATA] Key = 'ARTIST', value = 'The District'
123711966997304 [debug] [METADATA] Key = 'BARCODE', value = '707541900225'
123711966997304 [debug] [METADATA] Key = 'DATE', value = '2012'
123711966997304 [debug] [METADATA] Key = 'DISCNUMBER', value = '1'
123711966997304 [debug] [METADATA] Key = 'DISCTOTAL', value = '1'
123711966997304 [debug] [METADATA] Key = 'GENRE', value = 'Alternative'
123711966997304 [debug] [METADATA] Key = 'ISRC', value = 'USCGH1265654'
123711966997304 [debug] [METADATA] Key = 'LABEL', value = 'Mike Ruiz, INC'
123711966997304 [debug] [METADATA] Key = 'LABEL', value = 'Mike Ruiz, INC'
123711966997304 [debug] [METADATA] Key = 'REPLAYGAIN_ALBUM_GAIN', value = '-6.49 dB'
123711966997304 [debug] [METADATA] Key = 'REPLAYGAIN_ALBUM_PEAK', value = '1.000000'
123711966997304 [debug] [METADATA] Key = 'REPLAYGAIN_TRACK_GAIN', value = '-6.57 dB'
123711966997304 [debug] [METADATA] Key = 'REPLAYGAIN_TRACK_PEAK', value = '0.974396'
123711966997304 [debug] [METADATA] Key = 'TITLE', value = 'The Fall of Paul'
123711966997304 [debug] [METADATA] Key = 'TRACKNUMBER', value = '1'
123711966997304 [debug] [METADATA] Key = 'TRACKTOTAL', value = '15'
Parsing time: 133.95ms
Audio properties:
        Bitrate: 128000 bps
        BitsPerSample: 0
        ChannelCount: 2
        Duration: 217.65s
        SampleRate: 44100

Parsed metadata:
Display artist: The District
Artist: The District
Title: The Fall of Paul
Genre: Alternative
Position: 1
Date: 2012
HasCover = false
Track replay gain: -6.57
Medium: 
        Position: 1
        TrackCount: 15
        Replay gain: -6.49
Release: Live
        Label: Mike Ruiz, INC
        Label: Mike Ruiz, INC
        MediumCount: 1
        Display artist: District, The
        IsCompilation: false
        Barcode: 707541900225
        Release artist: District, The
Parsing file '"02 Daddy's Little Girl.mp3"'
Using TagLib:
139700537015096 [info] [METADATA] Using TagLib parser with read style = accurate
139700537015096 [debug] [METADATA] Key = 'ALBUM', value = 'Live'
139700537015096 [debug] [METADATA] Key = 'ALBUMARTIST', value = 'District, The'
139700537015096 [debug] [METADATA] Key = 'ARTIST', value = 'The District'
139700537015096 [debug] [METADATA] Key = 'BARCODE', value = '707541900225'
139700537015096 [debug] [METADATA] Key = 'DATE', value = '2012'
139700537015096 [debug] [METADATA] Key = 'DISCNUMBER', value = '1'
139700537015096 [debug] [METADATA] Key = 'DISCTOTAL', value = '1'
139700537015096 [debug] [METADATA] Key = 'GENRE', value = 'Alternative'
139700537015096 [debug] [METADATA] Key = 'ISRC', value = 'USCGH1265655'
139700537015096 [debug] [METADATA] Key = 'LABEL', value = 'Mike Ruiz, INC'
139700537015096 [debug] [METADATA] Key = 'LABEL', value = 'Mike Ruiz, INC'
139700537015096 [debug] [METADATA] Key = 'REPLAYGAIN_ALBUM_GAIN', value = '-6.49 dB'
139700537015096 [debug] [METADATA] Key = 'REPLAYGAIN_ALBUM_PEAK', value = '1.000000'
139700537015096 [debug] [METADATA] Key = 'REPLAYGAIN_TRACK_GAIN', value = '-6.29 dB'
139700537015096 [debug] [METADATA] Key = 'REPLAYGAIN_TRACK_PEAK', value = '0.999969'
139700537015096 [debug] [METADATA] Key = 'TITLE', value = 'Daddy's Little Girl'
139700537015096 [debug] [METADATA] Key = 'TRACKNUMBER', value = '2'
139700537015096 [debug] [METADATA] Key = 'TRACKTOTAL', value = '15'
Parsing time: 69.26ms
Audio properties:
        Bitrate: 128000 bps
        BitsPerSample: 0
        ChannelCount: 2
        Duration: 315.09s
        SampleRate: 44100

Parsed metadata:
Display artist: The District
Artist: The District
Title: Daddy's Little Girl
Genre: Alternative
Position: 2
Date: 2012
HasCover = false
Track replay gain: -6.29
Medium: 
        Position: 1
        TrackCount: 15
        Replay gain: -6.49
Release: Live
        Label: Mike Ruiz, INC
        Label: Mike Ruiz, INC
        MediumCount: 1
        Display artist: District, The
        IsCompilation: false
        Barcode: 707541900225
        Release artist: District, The

@epoupon
Copy link
Owner

epoupon commented Feb 18, 2025

No indeed... Would you mind sending me these two files? [email protected]

@AverageHoarder
Copy link

No problem. I've uploaded them here. Password is epoupon_lms_split

@epoupon
Copy link
Owner

epoupon commented Feb 18, 2025

Ok thanks! I confirm the issue is because of these bad label handling...
When writing labels in base, since they refer to the same entry, the orm layer seems to only write it once.
So for each track, lms basically comparses one label vs the duplicate labels, and recreate a release for track...

Well, deduping the values seems to fix, but I think I will raise an issue on taglib side first

@epoupon epoupon added the bug label Feb 22, 2025
@epoupon epoupon added this to the v3.64.0 milestone Feb 22, 2025
@epoupon epoupon closed this as completed Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants