style: Some tidy up / logging

This commit is contained in:
KaNaDaAT 2025-05-15 20:05:35 +02:00
parent 112b90968a
commit 98e4d46a31
2 changed files with 3 additions and 2 deletions

View file

@ -28,13 +28,12 @@ const DELETE_SONG_FILE = false
var yellow = color.New(color.FgYellow)
func DlSingleTrack(url, savePath string) (int, error) {
fmt.Println("Getting track info (" + url + ")...")
trackInfo, err := TrackInfo(url)
if err != nil {
return 0, err
}
fmt.Println("Getting track info...")
time.Sleep(500 * time.Millisecond)
track := []Track{*trackInfo}
fmt.Println("Now, downloading track...")
@ -198,6 +197,7 @@ func downloadYTaudio(id, path, filePath string) error {
client := youtube.Client{}
video, err := client.GetVideo(id)
if err != nil {
fmt.Println("Error: ", err)
return err
}

View file

@ -96,6 +96,7 @@ func GetYoutubeId(track Track) (string, error) {
allowedDurationRangeEnd := songDurationInSeconds + durationMatchThreshold
resultSongDuration := convertStringDurationToSeconds(result.Duration)
if resultSongDuration >= allowedDurationRangeStart && resultSongDuration <= allowedDurationRangeEnd {
fmt.Println("INFO: ", fmt.Sprintf("Found song with id '%s'", result.ID))
return result.ID, nil
}
}