Change in Formatting

This commit is contained in:
aditya-K2 2021-11-16 00:14:00 +05:30
parent fd2a4af4c7
commit 41c77722e9

27
main.go
View File

@ -12,13 +12,15 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
) )
var CONN *mpd.Client var (
var UI *Application CONN *mpd.Client
var NOTIFICATION_SERVER *NotificationServer UI *Application
var Volume int64 NOTIFICATION_SERVER *NotificationServer
var Random bool Volume int64
var Repeat bool Random bool
var InsidePlaylist bool = true Repeat bool
InsidePlaylist bool = true
)
func main() { func main() {
config.ReadConfig() config.ReadConfig()
@ -175,20 +177,19 @@ func main() {
} }
config.GenerateKeyMap(FUNC_MAP) config.GenerateKeyMap(FUNC_MAP)
a, _ := GenerateArtistTree() ARTIST_TREE, _ := GenerateArtistTree()
UI.SearchBar.SetAutocompleteFunc(func(c string) []string { UI.SearchBar.SetAutocompleteFunc(func(c string) []string {
if c != "" && c != " " && c != " " { if c != "" && c != " " && c != " " {
var p search.PairList var p search.PairList
for k2, v := range a { for k2, v := range ARTIST_TREE {
p = append(p, search.Pair{k2, search.GetLevenshteinDistance(c, k2)}) p = append(p, search.Pair{Key: k2, Value: search.GetLevenshteinDistance(c, k2)})
for k1, v1 := range v { for k1, v1 := range v {
p = append(p, search.Pair{k1, search.GetLevenshteinDistance(c, k1)}) p = append(p, search.Pair{Key: k1, Value: search.GetLevenshteinDistance(c, k1)})
for k := range v1 { for k := range v1 {
p = append(p, search.Pair{k, search.GetLevenshteinDistance(c, k)}) p = append(p, search.Pair{Key: k, Value: search.GetLevenshteinDistance(c, k)})
} }
} }
} }
sort.Sort(p) sort.Sort(p)
var suggestions []string var suggestions []string
i := 0 i := 0