refactor: introduce typed resource kind

This commit is contained in:
Mathis Maquenne
2026-08-05 11:33:13 +02:00
parent 3ec258b876
commit 714d567603
11 changed files with 113 additions and 96 deletions
+7 -7
View File
@@ -25,15 +25,15 @@ type downloadStats struct {
}
type progressTracker struct {
stats downloadStats
totalTracks int
resourceType string
stats downloadStats
totalTracks int
kind deezer.Kind
}
func newProgressTracker(totalTracks int, resourceType string) *progressTracker {
func newProgressTracker(totalTracks int, kind deezer.Kind) *progressTracker {
return &progressTracker{
totalTracks: totalTracks,
resourceType: resourceType,
totalTracks: totalTracks,
kind: kind,
}
}
@@ -84,7 +84,7 @@ func (pt *progressTracker) handleResult(index int, track *deezer.Track, result d
}
func (pt *progressTracker) printSummary(outputDir string, elapsed time.Duration) {
if pt.resourceType != "track" {
if pt.kind != deezer.KindTrack {
warningsLine := ""
if pt.stats.warnings > 0 {
warningsLine = fmt.Sprintf("\nWarnings: %d", pt.stats.warnings)