removed function fetch list
This commit is contained in:
@@ -166,41 +166,6 @@ func Fetch(musicObject data.MusicObject) (data.MusicObject, error) {
|
||||
return musicObject, nil
|
||||
}
|
||||
|
||||
func FetchList(musicObject data.MusicObject) ([]data.MusicObject, error) {
|
||||
res := []data.MusicObject{}
|
||||
|
||||
musicObject, err := Fetch(musicObject)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
if a, ok := musicObject.(data.Song); ok {
|
||||
for _, ar := range a.Artists {
|
||||
res = append(res, ar)
|
||||
}
|
||||
if a.Album.Name != "" {
|
||||
res = append(res, a.Album, a)
|
||||
}
|
||||
} else if a, ok := musicObject.(data.Album); ok {
|
||||
for _, ar := range a.Artists {
|
||||
res = append(res, ar)
|
||||
}
|
||||
res = append(res, a)
|
||||
for _, s := range a.Songs {
|
||||
res = append(res, s)
|
||||
}
|
||||
} else if a, ok := musicObject.(data.Artist); ok {
|
||||
res = append(res, a)
|
||||
for _, al := range a.Albums {
|
||||
res = append(res, al)
|
||||
}
|
||||
} else {
|
||||
res = append(res, musicObject)
|
||||
}
|
||||
|
||||
return res, nil
|
||||
}
|
||||
|
||||
type SearchConfig struct {
|
||||
IgnoreErrors bool
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ func TestRegister(t *testing.T) {
|
||||
func TestFetchSong(t *testing.T) {
|
||||
RegisterPlugin(&MusifyTest{})
|
||||
|
||||
s, err := Fetch(data.Source{
|
||||
s, err := FetchSource(data.Source{
|
||||
Url: "https://musify.club/track/linkin-park-in-the-end-3058",
|
||||
})
|
||||
|
||||
@@ -108,7 +108,7 @@ func TestFetchSong(t *testing.T) {
|
||||
func TestFetchAlbum(t *testing.T) {
|
||||
RegisterPlugin(&MusifyTest{})
|
||||
|
||||
a, err := Fetch(data.Source{
|
||||
a, err := FetchSource(data.Source{
|
||||
Url: "https://musify.club/release/linkin-park-hybrid-theory-2000-188",
|
||||
})
|
||||
|
||||
@@ -129,7 +129,7 @@ func TestFetchAlbum(t *testing.T) {
|
||||
func TestFetchArtist(t *testing.T) {
|
||||
RegisterPlugin(&MusifyTest{})
|
||||
|
||||
a, err := Fetch(data.Source{
|
||||
a, err := FetchSource(data.Source{
|
||||
Url: "https://musify.club/artist/linkin-park-5",
|
||||
})
|
||||
|
||||
@@ -150,7 +150,7 @@ func TestFetchArtist(t *testing.T) {
|
||||
func TestFetchWrongUrl(t *testing.T) {
|
||||
RegisterPlugin(&MusifyTest{})
|
||||
|
||||
_, err := Fetch(data.Source{
|
||||
_, err := FetchSource(data.Source{
|
||||
Url: "https://musify.club/",
|
||||
})
|
||||
|
||||
@@ -162,7 +162,7 @@ func TestFetchWrongUrl(t *testing.T) {
|
||||
func TestNonExistentSourceType(t *testing.T) {
|
||||
RegisterPlugin(&MusifyTest{})
|
||||
|
||||
_, err := Fetch(data.Source{
|
||||
_, err := FetchSource(data.Source{
|
||||
Url: "https://musify.club/",
|
||||
SourceType: &data.SourceType{
|
||||
Name: "doesn't exist",
|
||||
|
||||
Reference in New Issue
Block a user