refactor: move resource info rendering into downloader

This commit is contained in:
Mathis Maquenne
2026-08-05 11:41:24 +02:00
parent dbd7837b17
commit 12dbbb5e10
6 changed files with 112 additions and 98 deletions
-25
View File
@@ -2,10 +2,7 @@ package deezer
import (
"encoding/json"
"fmt"
"path"
"strconv"
"time"
)
type Single struct {
@@ -14,28 +11,6 @@ type Single struct {
} `json:"results"`
}
func (s *Single) String() string {
if s.Results.Data == nil {
return "Track: No data available"
}
duration, err := strconv.Atoi(s.Results.Data.Duration)
if err != nil {
duration = 0
}
return fmt.Sprintf(
`================= [ Track Info ] =================
Title: %s
Artist: %s
Duration: %s
==================================================`,
s.Results.Data.GetTitle(),
s.Results.Data.Artist,
time.Duration(duration)*time.Second,
)
}
func (s *Single) GetTitle() string {
if s.Results.Data == nil {
return ""