Fix import pipeline not placing multi-disc albums into Disc N/ subfolders

import_album_process never computed total_discs, so spotify_album.total_discs
always defaulted to 1 in _build_final_path_for_track. Now pre-computes
total_discs from the matched tracks before the per-track loop.
This commit is contained in:
Broque Thomas 2026-04-14 08:04:15 -07:00
parent 3b8b369492
commit ab9064d3f6

View file

@ -51901,6 +51901,12 @@ def import_album_process():
except Exception:
pass
# Compute total_discs across all matched tracks for multi-disc subfolder support
total_discs = max(
(m['spotify_track'].get('disc_number', 1) for m in matches if m.get('spotify_track')),
default=1
)
for match in matches:
staging_file = match.get('staging_file')
spotify_track = match.get('spotify_track')
@ -51929,6 +51935,7 @@ def import_album_process():
'name': album_name,
'release_date': album.get('release_date', ''),
'total_tracks': album.get('total_tracks', len(matches)),
'total_discs': total_discs,
'image_url': album.get('image_url', '')
},
'track_info': {