Skip to content

Conversation

@tikhonp
Copy link
Contributor

@tikhonp tikhonp commented Dec 11, 2025

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)

If adding a new feature, the PR's description includes:

  • A convincing reason for adding this feature (it's best to open a suggestion issue first and wait for approval before working on it)

Other information:

I have an album in my library the contents of which look like this:

.
└── Pink Floyd - The Wall (Remastered 2011 Version) (1979) [24B-96kHz]
    ├── cover.jpg
    ├── Disc 1
    │   ├── 01. In the Flesh?.flac
    │   ├── 02. The Thin Ice.flac
    │   ├── 03. Another Brick in the Wall, Pt. 1.flac
    │   ├── 04. The Happiest Days of Our Lives.flac
    │   ├── 05. Another Brick in the Wall, Pt. 2.flac
    │   ├── 06. Mother.flac
    │   ├── 07. Goodbye Blue Sky.flac
    │   ├── 08. Empty Spaces.flac
    │   ├── 09. Young Lust.flac
    │   ├── 10. One of My Turns.flac
    │   ├── 11. Don't Leave Me Now.flac
    │   ├── 12. Another Brick in the Wall, Pt. 3.flac
    │   └── 13. Goodbye Cruel World.flac
    └── Disc 2
        ├── 01. Hey You.flac
        ├── 02. Is There Anybody Out There.flac
        ├── 03. Nobody Home.flac
        ├── 04. Vera.flac
        ├── 05. Bring the Boys Back Home.flac
        ├── 06. Comfortably Numb.flac
        ├── 07. The Show Must Go On.flac
        ├── 08. In the Flesh.flac
        ├── 09. Run Like Hell.flac
        ├── 10. Waiting for the Worms.flac
        ├── 11. Stop.flac
        ├── 12. The Trial.flac
        └── 13. Outside the Wall.flac

There are two tracks, 01. In the Flesh? on Disc 1 and 08. In the Flesh on Disc 2. However, in SwingMusic only the second track appears:

image image

As I discovered, this happens because the track hashes are identical for both tracks, even though the songs are different. The reason is that the hashing function ignores non-alphanumeric characters in the title, which generally makes sense but causes a bug in albums like this.

In this case, it might be enough to track only the track number, but in the worst-case scenario there may be albums where songs share the same track numbers across different discs, so I think it makes sense to include the disc number in the hash as well.

Copilot AI review requested due to automatic review settings December 11, 2025 11:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR attempts to fix a bug where tracks with the same title (excluding special characters) are incorrectly deduplicated from albums. The issue is demonstrated with Pink Floyd's "The Wall" album, where "In the Flesh?" (Disc 1, Track 1) and "In the Flesh" (Disc 2, Track 8) are treated as duplicates because the hash function strips non-alphanumeric characters.

Key Changes:

  • Modified recreate_trackhash() method to include track and disc numbers in the hash calculation

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

@tikhonp
Copy link
Contributor Author

tikhonp commented Dec 11, 2025

There was also an inconsistency with the hashing in taglib.py, the arguments were passed in a different order, that is now resolved too

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant