-
Notifications
You must be signed in to change notification settings - Fork 2
/
spotify.go
50 lines (42 loc) · 1.04 KB
/
spotify.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package utils
import (
"strings"
"github.com/zmb3/spotify/v2"
)
func CompareSong(s1, s2 spotify.FullTrack) bool {
if s1.ID == "" || s2.ID == "" {
return false
}
return s1.ID == s2.ID
}
func ArtistNamesOfSong(s *spotify.FullTrack) []string {
var names []string
for _, a := range s.Artists {
names = append(names, a.Name)
}
return names
}
func ArtistNameStrOfSong(s *spotify.FullTrack) string {
return strings.Join(ArtistNamesOfSong(s), ",")
}
func ArtistNamesOfAlbum(s *spotify.SimpleAlbum) []string {
var names []string
for _, a := range s.Artists {
names = append(names, a.Name)
}
return names
}
func ArtistNameStrOfAlbum(s *spotify.SimpleAlbum) string {
return strings.Join(ArtistNamesOfAlbum(s), ",")
}
type LyricsResp struct {
Error bool `json:"error"`
SyncType string `json:"syncType"`
Lines []Lines `json:"lines"`
}
type Lines struct {
StartTimeMs string `json:"startTimeMs"`
Words string `json:"words"`
Syllables []interface{} `json:"syllables"`
EndTimeMs string `json:"endTimeMs"`
}