This commit is contained in:
afkarxyz
2026-02-12 01:08:44 +07:00
parent df56049db2
commit cb3a6a32cb
24 changed files with 946 additions and 486 deletions
+29 -32
View File
@@ -364,9 +364,6 @@ func getBool(m map[string]interface{}, key string) bool {
func extractArtists(artistsData map[string]interface{}) []map[string]interface{} {
items := getSlice(artistsData, "items")
if items == nil {
return []map[string]interface{}{}
}
artists := []map[string]interface{}{}
for _, item := range items {
@@ -384,7 +381,7 @@ func extractArtists(artistsData map[string]interface{}) []map[string]interface{}
}
func extractCoverImage(coverData map[string]interface{}) map[string]interface{} {
if coverData == nil || len(coverData) == 0 {
if len(coverData) == 0 {
return nil
}
@@ -401,7 +398,7 @@ func extractCoverImage(coverData map[string]interface{}) map[string]interface{}
}
}
if sources == nil || len(sources) == 0 {
if len(sources) == 0 {
return nil
}
@@ -532,7 +529,7 @@ func FilterTrack(data map[string]interface{}, albumFetchData ...map[string]inter
}
var albumFetchDataMap map[string]interface{}
if len(albumFetchData) > 0 && albumFetchData[0] != nil {
if len(albumFetchData) > 0 {
albumFetchDataMap = albumFetchData[0]
}
@@ -541,39 +538,35 @@ func FilterTrack(data map[string]interface{}, albumFetchData ...map[string]inter
if len(artists) == 0 {
artists = []map[string]interface{}{}
firstArtistItems := getSlice(getMap(trackData, "firstArtist"), "items")
if firstArtistItems != nil {
for _, item := range firstArtistItems {
itemMap, ok := item.(map[string]interface{})
if !ok {
continue
}
if profile, exists := itemMap["profile"]; exists {
profileMap, ok := profile.(map[string]interface{})
if ok {
artistInfo := map[string]interface{}{
"name": getString(profileMap, "name"),
}
artists = append(artists, artistInfo)
for _, item := range firstArtistItems {
itemMap, ok := item.(map[string]interface{})
if !ok {
continue
}
if profile, exists := itemMap["profile"]; exists {
profileMap, ok := profile.(map[string]interface{})
if ok {
artistInfo := map[string]interface{}{
"name": getString(profileMap, "name"),
}
artists = append(artists, artistInfo)
}
}
}
otherArtistItems := getSlice(getMap(trackData, "otherArtists"), "items")
if otherArtistItems != nil {
for _, item := range otherArtistItems {
itemMap, ok := item.(map[string]interface{})
if !ok {
continue
}
if profile, exists := itemMap["profile"]; exists {
profileMap, ok := profile.(map[string]interface{})
if ok {
artistInfo := map[string]interface{}{
"name": getString(profileMap, "name"),
}
artists = append(artists, artistInfo)
for _, item := range otherArtistItems {
itemMap, ok := item.(map[string]interface{})
if !ok {
continue
}
if profile, exists := itemMap["profile"]; exists {
profileMap, ok := profile.(map[string]interface{})
if ok {
artistInfo := map[string]interface{}{
"name": getString(profileMap, "name"),
}
artists = append(artists, artistInfo)
}
}
}
@@ -710,6 +703,9 @@ func FilterTrack(data map[string]interface{}, albumFetchData ...map[string]inter
}
albumArtistsString = strings.Join(albumArtistNames, ", ")
}
if albumArtistsString == "" {
albumArtistsString = getString(albumUnionData, "artists")
}
albumLabel = getString(albumUnionData, "label")
}
}
@@ -977,6 +973,7 @@ func FilterAlbum(data map[string]interface{}) map[string]interface{} {
"discs": map[string]interface{}{
"totalCount": totalDiscs,
},
"label": getString(albumData, "label"),
}
return filtered