Skip to content

Commit

Permalink
PICARD-3012: Sort files by disc no. when submitting cluster as release
Browse files Browse the repository at this point in the history
This ensures the disc numbers are in order even if the cluster gets edited
after clustering.
  • Loading branch information
phw committed Jan 7, 2025
1 parent 7cc0e8c commit d508438
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions picard/browser/addrelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Picard, the next-generation MusicBrainz tagger
#
# Copyright (C) 2021-2023 Philipp Wolfer
# Copyright (C) 2021-2023, 2025 Philipp Wolfer
# Copyright (C) 2021-2024 Laurent Monin
# Copyright (C) 2022 Bob Swift
# Copyright (C) 2022 jesus2099
Expand All @@ -23,6 +23,7 @@


from html import escape
from operator import attrgetter
from secrets import token_bytes

from PyQt6.QtCore import QCoreApplication
Expand Down Expand Up @@ -214,7 +215,7 @@ def mkey(disc, track, name):
disc_counter = 0
track_counter = 0
last_discnumber = None
for f in files:
for f in sorted(files, key=attrgetter('discnumber', 'tracknumber')):
m = f.metadata
discnumber = extract_discnumber(m)
if last_discnumber is not None and discnumber != last_discnumber:
Expand Down

0 comments on commit d508438

Please sign in to comment.