mirror of
https://github.com/cgzirim/seek-tune.git
synced 2025-12-16 16:34:21 +00:00
style: Some tidy up / logging
This commit is contained in:
parent
112b90968a
commit
98e4d46a31
2 changed files with 3 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue