2021-10-12 18:30:16 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2021-10-17 17:00:57 +00:00
|
|
|
"strconv"
|
|
|
|
"time"
|
|
|
|
|
2021-12-25 18:48:23 +00:00
|
|
|
"github.com/aditya-K2/gomp/cache"
|
|
|
|
"github.com/aditya-K2/gomp/client"
|
|
|
|
"github.com/aditya-K2/gomp/config"
|
2022-08-31 18:12:15 +00:00
|
|
|
"github.com/aditya-K2/gomp/globals"
|
2022-08-29 05:34:12 +00:00
|
|
|
"github.com/aditya-K2/gomp/notify"
|
2021-12-22 15:49:37 +00:00
|
|
|
"github.com/aditya-K2/gomp/render"
|
|
|
|
"github.com/aditya-K2/gomp/ui"
|
2021-12-16 19:36:18 +00:00
|
|
|
"github.com/aditya-K2/gomp/utils"
|
2022-08-31 18:12:15 +00:00
|
|
|
"github.com/aditya-K2/gomp/views"
|
2021-12-12 20:05:40 +00:00
|
|
|
|
2021-11-28 18:03:34 +00:00
|
|
|
"github.com/aditya-K2/fuzzy"
|
2021-10-14 16:34:16 +00:00
|
|
|
"github.com/fhs/gompd/mpd"
|
|
|
|
"github.com/gdamore/tcell/v2"
|
2021-11-05 07:10:46 +00:00
|
|
|
"github.com/spf13/viper"
|
2021-10-12 18:30:16 +00:00
|
|
|
)
|
|
|
|
|
2021-10-17 17:00:57 +00:00
|
|
|
func main() {
|
2021-11-11 16:27:01 +00:00
|
|
|
config.ReadConfig()
|
2021-11-13 06:02:00 +00:00
|
|
|
var mpdConnectionError error
|
2022-08-31 05:58:02 +00:00
|
|
|
del := ""
|
|
|
|
nt := viper.GetString("NETWORK_TYPE")
|
|
|
|
port := viper.GetString("MPD_PORT")
|
|
|
|
if nt == "tcp" {
|
|
|
|
del = ":"
|
|
|
|
} else if nt == "unix" && port != "" {
|
|
|
|
port = ""
|
|
|
|
}
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Conn, mpdConnectionError = mpd.Dial(nt,
|
2022-08-31 05:58:02 +00:00
|
|
|
viper.GetString("NETWORK_ADDRESS")+del+port)
|
2021-11-13 06:02:00 +00:00
|
|
|
if mpdConnectionError != nil {
|
2021-12-31 10:18:58 +00:00
|
|
|
utils.Print("RED", "Could Not Connect to MPD Server\n")
|
|
|
|
utils.Print("GREEN", "Make Sure You Mention the Correct MPD Port in the config file.\n")
|
2021-11-13 06:02:00 +00:00
|
|
|
panic(mpdConnectionError)
|
2021-10-14 16:34:16 +00:00
|
|
|
}
|
2022-08-31 18:12:15 +00:00
|
|
|
CONN := globals.Conn
|
2021-11-13 06:02:00 +00:00
|
|
|
defer CONN.Close()
|
2021-12-22 15:49:37 +00:00
|
|
|
|
|
|
|
client.SetConnection(CONN)
|
|
|
|
ui.SetConnection(CONN)
|
|
|
|
render.SetConnection(CONN)
|
|
|
|
|
2021-11-20 16:17:29 +00:00
|
|
|
cache.SetCacheDir(viper.GetString("CACHE_DIR"))
|
2021-12-24 10:07:21 +00:00
|
|
|
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Renderer = render.NewRenderer()
|
2021-12-24 10:07:21 +00:00
|
|
|
// Connecting the Renderer to the Main UI
|
2022-08-31 18:12:15 +00:00
|
|
|
ui.ConnectRenderer(globals.Renderer)
|
2021-12-24 10:07:21 +00:00
|
|
|
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Ui = ui.NewApplication()
|
2021-12-24 10:07:21 +00:00
|
|
|
|
|
|
|
// Connecting the Notification Server to the Main UI
|
2022-08-31 18:12:15 +00:00
|
|
|
notify.ConnectUI(globals.Ui)
|
2021-10-14 16:34:16 +00:00
|
|
|
|
2021-12-28 05:02:48 +00:00
|
|
|
fileMap, err := CONN.ListAllInfo("/")
|
2021-12-31 10:18:58 +00:00
|
|
|
if err != nil {
|
|
|
|
utils.Print("RED", "Could Not Generate the File Map\n")
|
|
|
|
utils.Print("GREEN", "Make Sure You Mention the Correct MPD Port in the config file.\n")
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-12-24 10:07:21 +00:00
|
|
|
|
|
|
|
// Generating the Directory Tree for File Navigation.
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.DirTree = client.GenerateDirectoryTree(fileMap)
|
2021-10-17 17:00:57 +00:00
|
|
|
|
2021-12-24 10:07:21 +00:00
|
|
|
// Default View upon Opening is of Playlist.
|
2022-08-31 18:12:15 +00:00
|
|
|
views.PView.Update(globals.Ui.ExpandedView)
|
2021-10-17 17:00:57 +00:00
|
|
|
|
2021-12-31 10:18:58 +00:00
|
|
|
var Volume int64
|
|
|
|
var Random, Repeat bool
|
|
|
|
|
|
|
|
if _v, err := CONN.Status(); err != nil {
|
|
|
|
utils.Print("RED", "Could Not Get the MPD Status\n")
|
|
|
|
panic(err)
|
|
|
|
} else {
|
|
|
|
// Setting Volume, Random and Repeat Values
|
|
|
|
Volume, _ = strconv.ParseInt(_v["volume"], 10, 64)
|
|
|
|
Random, _ = strconv.ParseBool(_v["random"])
|
|
|
|
Repeat, _ = strconv.ParseBool(_v["repeat"])
|
|
|
|
}
|
2021-10-17 17:00:57 +00:00
|
|
|
|
2021-12-23 14:50:27 +00:00
|
|
|
ArtistTree, err := client.GenerateArtistTree()
|
2021-12-31 10:18:58 +00:00
|
|
|
if err != nil {
|
|
|
|
utils.Print("RED", "Could Not Generate the ArtistTree\n")
|
|
|
|
utils.Print("GREEN", "Make Sure You Mention the Correct MPD Port in the config file.\n")
|
|
|
|
panic(err)
|
|
|
|
}
|
2021-12-24 10:07:21 +00:00
|
|
|
|
|
|
|
// Used for Fuzzy Searching
|
2021-12-22 15:11:48 +00:00
|
|
|
ArtistTreeContent := utils.ConvertToArray(ArtistTree)
|
2021-12-24 10:07:21 +00:00
|
|
|
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify = notify.NewNotificationServer()
|
|
|
|
globals.Notify.Start()
|
2021-12-24 10:07:21 +00:00
|
|
|
|
2022-08-03 22:02:58 +00:00
|
|
|
if c, err := CONN.CurrentSong(); err != nil {
|
|
|
|
utils.Print("RED", "Could Not Retrieve the Current Song\n")
|
|
|
|
panic(err)
|
|
|
|
} else {
|
|
|
|
if len(c) != 0 {
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Renderer.Start(c["file"])
|
2022-08-03 22:02:58 +00:00
|
|
|
} else {
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Renderer.Start("stop")
|
2022-08-03 22:02:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-24 10:07:21 +00:00
|
|
|
// Connecting Notification Server to Client and Rendering Module so that they can send Notifications
|
2022-08-31 18:42:17 +00:00
|
|
|
client.SetNotificationServer(globals.Notify)
|
|
|
|
render.SetNotificationServer(globals.Notify)
|
2021-11-16 15:23:22 +00:00
|
|
|
|
2021-12-24 10:07:21 +00:00
|
|
|
// This Function Is Responsible for Changing the Focus it uses the Focus Map and Based on it Chooses
|
|
|
|
// the Draw Function
|
2022-08-31 18:12:15 +00:00
|
|
|
views.SetCurrentView(views.PView)
|
|
|
|
globals.Ui.ExpandedView.SetDrawFunc(func(s tcell.Screen, x, y, width, height int) (int, int, int, int) {
|
|
|
|
views.GetCurrentView().Update(globals.Ui.ExpandedView)
|
|
|
|
return globals.Ui.ExpandedView.GetInnerRect()
|
2021-10-18 06:48:51 +00:00
|
|
|
})
|
|
|
|
|
2021-12-24 10:07:21 +00:00
|
|
|
// Function Maps is used For Mapping Keys According to the Value mapped to the Key the respective Function is called
|
|
|
|
// For e.g. in the config if the User Maps T to togglePlayBack then whenever in the input handler the T is received
|
|
|
|
// the respective function in this case togglePlayBack is called.
|
2021-12-22 15:11:48 +00:00
|
|
|
var FuncMap = map[string]func(){
|
2021-11-11 16:27:01 +00:00
|
|
|
"showChildrenContent": func() {
|
2022-08-31 18:12:15 +00:00
|
|
|
views.GetCurrentView().ShowChildrenContent()
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"togglePlayBack": func() {
|
2021-12-31 10:18:58 +00:00
|
|
|
if err := client.TogglePlayBack(); err != nil {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Could not Toggle Play Back")
|
2021-12-31 10:18:58 +00:00
|
|
|
}
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"showParentContent": func() {
|
2022-08-31 18:12:15 +00:00
|
|
|
views.GetCurrentView().ShowParentContent()
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"nextSong": func() {
|
2021-12-31 10:18:58 +00:00
|
|
|
if err := CONN.Next(); err != nil {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Could not Select the Next Song")
|
2021-12-31 10:18:58 +00:00
|
|
|
}
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"clearPlaylist": func() {
|
2021-12-31 10:18:58 +00:00
|
|
|
if err := CONN.Clear(); err != nil {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Could not Clear the Playlist")
|
2021-12-31 10:18:58 +00:00
|
|
|
} else {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Playlist Cleared")
|
2021-12-31 10:18:58 +00:00
|
|
|
}
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"previousSong": func() {
|
2021-12-31 10:18:58 +00:00
|
|
|
if err := CONN.Previous(); err != nil {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Could Not Select the Previous Song")
|
2021-12-31 10:18:58 +00:00
|
|
|
}
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"addToPlaylist": func() {
|
2022-08-31 18:12:15 +00:00
|
|
|
views.GetCurrentView().AddToPlaylist()
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"toggleRandom": func() {
|
2021-12-31 10:18:58 +00:00
|
|
|
if err := CONN.Random(!Random); err == nil {
|
2021-11-11 16:27:01 +00:00
|
|
|
Random = !Random
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"toggleRepeat": func() {
|
2021-12-31 10:18:58 +00:00
|
|
|
if err := CONN.Repeat(!Repeat); err == nil {
|
2021-11-11 16:27:01 +00:00
|
|
|
Repeat = !Repeat
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"decreaseVolume": func() {
|
|
|
|
if Volume <= 0 {
|
|
|
|
Volume = 0
|
|
|
|
} else {
|
|
|
|
Volume -= 10
|
|
|
|
}
|
2021-12-31 10:18:58 +00:00
|
|
|
if err := CONN.SetVolume(int(Volume)); err != nil {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Could Not Decrease the Volume")
|
2021-12-31 10:18:58 +00:00
|
|
|
}
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"increaseVolume": func() {
|
|
|
|
if Volume >= 100 {
|
|
|
|
Volume = 100
|
|
|
|
} else {
|
|
|
|
Volume += 10
|
|
|
|
}
|
2021-12-31 10:18:58 +00:00
|
|
|
if err := CONN.SetVolume(int(Volume)); err != nil {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Could Not Increase the Volume")
|
2021-12-31 10:18:58 +00:00
|
|
|
}
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"navigateToFiles": func() {
|
2022-08-31 18:12:15 +00:00
|
|
|
views.SetCurrentView(views.FView)
|
|
|
|
globals.Ui.Navbar.Select(1, 0)
|
|
|
|
views.FView.Update(globals.Ui.ExpandedView)
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"navigateToPlaylist": func() {
|
2022-08-31 18:12:15 +00:00
|
|
|
views.SetCurrentView(views.PView)
|
|
|
|
globals.Ui.Navbar.Select(0, 0)
|
|
|
|
views.PView.Update(globals.Ui.ExpandedView)
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"navigateToMostPlayed": func() {
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Ui.Navbar.Select(2, 0)
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
2021-11-16 15:23:22 +00:00
|
|
|
"navigateToSearch": func() {
|
2022-08-31 18:12:15 +00:00
|
|
|
views.SetCurrentView(views.SView)
|
|
|
|
globals.Ui.Navbar.Select(3, 0)
|
|
|
|
views.SView.Update(globals.Ui.ExpandedView)
|
2021-11-16 15:23:22 +00:00
|
|
|
},
|
2021-11-11 16:27:01 +00:00
|
|
|
"quit": func() {
|
2022-08-31 18:12:15 +00:00
|
|
|
views.GetCurrentView().Quit()
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"stop": func() {
|
2021-12-31 10:18:58 +00:00
|
|
|
if err := CONN.Stop(); err != nil {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Could not Stop the Playback")
|
2021-12-31 10:18:58 +00:00
|
|
|
} else {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Playback Stopped")
|
2021-12-31 10:18:58 +00:00
|
|
|
}
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
|
|
|
"updateDB": func() {
|
2021-11-13 06:02:00 +00:00
|
|
|
_, err = CONN.Update("")
|
2021-11-11 16:27:01 +00:00
|
|
|
if err != nil {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Could Not Update the Database")
|
2021-12-31 10:18:58 +00:00
|
|
|
} else {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Database Updated")
|
2021-11-11 16:27:01 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"deleteSongFromPlaylist": func() {
|
2022-08-31 18:12:15 +00:00
|
|
|
views.GetCurrentView().DeleteSongFromPlaylist()
|
2021-11-11 16:27:01 +00:00
|
|
|
},
|
2021-11-15 11:02:59 +00:00
|
|
|
"FocusSearch": func() {
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Ui.App.SetFocus(globals.Ui.SearchBar)
|
2021-11-15 11:02:59 +00:00
|
|
|
},
|
2021-12-25 18:48:23 +00:00
|
|
|
"FocusBuffSearch": func() {
|
2022-08-31 18:12:15 +00:00
|
|
|
views.GetCurrentView().FocusBuffSearchView()
|
2021-12-25 18:48:23 +00:00
|
|
|
},
|
2021-11-11 16:27:01 +00:00
|
|
|
}
|
|
|
|
|
2021-12-24 10:07:21 +00:00
|
|
|
// Generating the Key Map Based on the Function Map Here Basically the Values will be flipped
|
|
|
|
// In the config if togglePlayBack is mapped to [ T , P, SPACE ] then here Basically we will receive a map
|
|
|
|
// for each event T, P, SPACE mapped to the same function togglePlayBack
|
2021-12-22 15:11:48 +00:00
|
|
|
config.GenerateKeyMap(FuncMap)
|
2021-11-16 15:23:22 +00:00
|
|
|
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Ui.SearchBar.SetAutocompleteFunc(func(c string) []string {
|
|
|
|
if views.GetCurrentView().GetViewName() == "BuffSearchView" {
|
2021-12-25 18:48:23 +00:00
|
|
|
return nil
|
|
|
|
} else {
|
|
|
|
if c != "" && c != " " && c != " " {
|
2022-08-31 18:12:15 +00:00
|
|
|
_, _, w, _ := globals.Ui.SearchBar.GetRect()
|
2021-12-25 18:48:23 +00:00
|
|
|
matches := fuzzy.Find(c, ArtistTreeContent)
|
|
|
|
var suggestions []string
|
|
|
|
for i, match := range matches {
|
|
|
|
if i == 10 {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
suggestions = append(suggestions, utils.GetFormattedString(match.Str, w-2))
|
2021-11-15 11:02:59 +00:00
|
|
|
}
|
2021-12-25 18:48:23 +00:00
|
|
|
return suggestions
|
|
|
|
} else {
|
|
|
|
return make([]string, 0)
|
2021-11-15 11:02:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2021-11-16 15:23:22 +00:00
|
|
|
|
2021-12-24 10:07:21 +00:00
|
|
|
// Input Handler
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Ui.ExpandedView.SetInputCapture(func(e *tcell.EventKey) *tcell.EventKey {
|
2021-11-11 18:00:40 +00:00
|
|
|
if val, ok := config.KEY_MAP[int(e.Rune())]; ok {
|
2021-12-22 15:11:48 +00:00
|
|
|
FuncMap[val]()
|
2021-11-11 18:00:40 +00:00
|
|
|
return nil
|
|
|
|
} else {
|
2022-08-31 18:12:15 +00:00
|
|
|
if views.GetCurrentView().GetViewName() == "PlaylistView" {
|
2022-04-05 18:02:29 +00:00
|
|
|
if e.Rune() == 'j' || e.Rune() == 'k' {
|
|
|
|
if p, err := CONN.PlaylistInfo(-1, -1); err != nil {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Error Getting PlaylistInfo")
|
2022-04-05 18:02:29 +00:00
|
|
|
} else {
|
|
|
|
if len(p) == 0 {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Empty Playlist")
|
2022-04-05 18:02:29 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-31 18:42:17 +00:00
|
|
|
} else if views.GetCurrentView().GetViewName() == "SearchView" {
|
|
|
|
if e.Rune() == 'j' || e.Rune() == 'k' {
|
|
|
|
if globals.SearchContentSlice == nil || len(globals.SearchContentSlice) == 0 {
|
|
|
|
globals.Notify.Send("No Search Results")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
2022-04-05 18:02:29 +00:00
|
|
|
}
|
2021-11-11 18:00:40 +00:00
|
|
|
return e
|
2021-10-17 17:00:57 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Ui.SearchBar.SetDoneFunc(func(e tcell.Key) {
|
2021-11-16 15:23:22 +00:00
|
|
|
if e == tcell.KeyEnter {
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Ui.ExpandedView.Select(0, 0)
|
|
|
|
if views.GetCurrentView().GetViewName() == "BuffSearchView" {
|
|
|
|
globals.Ui.App.SetFocus(globals.Ui.ExpandedView)
|
2021-12-25 18:48:23 +00:00
|
|
|
} else {
|
2022-08-31 18:12:15 +00:00
|
|
|
views.SetCurrentView(views.SView)
|
|
|
|
globals.SearchContentSlice = nil
|
|
|
|
globals.SearchContentSlice, err = client.GenerateContentSlice(globals.Ui.SearchBar.GetText())
|
2021-12-25 18:48:23 +00:00
|
|
|
if err != nil {
|
2022-08-31 18:42:17 +00:00
|
|
|
globals.Notify.Send("Could Not Retrieve the Results")
|
2021-12-25 18:48:23 +00:00
|
|
|
} else {
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Ui.SearchBar.SetText("")
|
|
|
|
globals.Ui.App.SetFocus(globals.Ui.ExpandedView)
|
|
|
|
globals.Ui.Navbar.Select(3, 0)
|
2021-12-25 18:48:23 +00:00
|
|
|
}
|
2021-11-16 15:23:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if e == tcell.KeyEscape {
|
2022-08-31 18:12:15 +00:00
|
|
|
if views.GetCurrentView().GetViewName() == "SearchView" {
|
|
|
|
} else if views.GetCurrentView().GetViewName() == "BuffSearchView" {
|
|
|
|
views.SetCurrentView(views.FView)
|
|
|
|
globals.Matches = nil
|
2021-12-25 18:48:23 +00:00
|
|
|
}
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Ui.SearchBar.SetText("")
|
|
|
|
globals.Ui.App.SetFocus(globals.Ui.ExpandedView)
|
2021-11-16 15:23:22 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Ui.ExpandedView.SetDoneFunc(func(e tcell.Key) {
|
2021-12-26 13:53:58 +00:00
|
|
|
if e == tcell.KeyEscape {
|
2022-08-31 18:12:15 +00:00
|
|
|
if views.GetCurrentView().GetViewName() == "BuffSearchView" {
|
|
|
|
views.SetCurrentView(views.FView)
|
|
|
|
globals.Ui.SearchBar.SetText("")
|
|
|
|
globals.Matches = nil
|
2021-12-26 13:53:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Ui.SearchBar.SetChangedFunc(func(text string) {
|
|
|
|
if views.GetCurrentView().GetViewName() == "BuffSearchView" {
|
|
|
|
var f client.FileNodes = globals.DirTree.Children
|
|
|
|
globals.Matches = fuzzy.FindFrom(text, f)
|
|
|
|
views.BuffSView.Update(globals.Ui.ExpandedView)
|
2021-12-25 18:48:23 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2021-10-17 17:00:57 +00:00
|
|
|
go func() {
|
|
|
|
for {
|
2022-08-31 18:12:15 +00:00
|
|
|
globals.Ui.App.Draw()
|
2021-10-17 17:00:57 +00:00
|
|
|
time.Sleep(time.Second)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
2022-08-31 18:12:15 +00:00
|
|
|
if err := globals.Ui.App.Run(); err != nil {
|
2021-10-12 18:30:16 +00:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|