improved shell
This commit is contained in:
@@ -12,9 +12,14 @@ import (
|
||||
)
|
||||
|
||||
func printResults(musicObjects []data.MusicObject) {
|
||||
if len(musicObjects) <= 0 {
|
||||
return
|
||||
}
|
||||
|
||||
for _, m := range musicObjects {
|
||||
if a, ok := m.(data.Artist); ok {
|
||||
fmt.Println("artist: " + a.Name)
|
||||
|
||||
} else if a, ok := m.(data.Album); ok {
|
||||
fmt.Print("release: " + a.Name)
|
||||
|
||||
@@ -27,15 +32,30 @@ func printResults(musicObjects []data.MusicObject) {
|
||||
} else {
|
||||
fmt.Println()
|
||||
}
|
||||
|
||||
} else if a, ok := m.(data.Song); ok {
|
||||
fmt.Println("track: " + a.Name)
|
||||
fmt.Print("track: " + a.Name)
|
||||
if len(a.Artists) > 0 {
|
||||
names := make([]string, len(a.Artists))
|
||||
for i, artist := range a.Artists {
|
||||
names[i] = artist.Name
|
||||
}
|
||||
fmt.Println(" by " + strings.Join(names, ", "))
|
||||
} else {
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Println()
|
||||
}
|
||||
|
||||
func Shell() {
|
||||
plugin.RegisterPlugin(&plugin.Musify{})
|
||||
|
||||
fmt.Println("== MusicKraken Shell ==")
|
||||
fmt.Println()
|
||||
|
||||
for {
|
||||
fmt.Print("> ")
|
||||
|
||||
@@ -54,6 +74,5 @@ func Shell() {
|
||||
|
||||
fmt.Println()
|
||||
printResults(searchResults)
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user