Doing Cache Related Initilisations and Setup

This commit is contained in:
aditya-K2 2021-11-20 21:47:29 +05:30
parent 84c4b4313c
commit 68ef09544c

View File

@ -5,6 +5,7 @@ import (
"strconv" "strconv"
"time" "time"
"github.com/aditya-K2/goMP/cache"
"github.com/aditya-K2/goMP/config" "github.com/aditya-K2/goMP/config"
"github.com/aditya-K2/goMP/search" "github.com/aditya-K2/goMP/search"
"github.com/fhs/gompd/mpd" "github.com/fhs/gompd/mpd"
@ -33,7 +34,8 @@ func main() {
panic(mpdConnectionError) panic(mpdConnectionError)
} }
defer CONN.Close() defer CONN.Close()
cache.SetCacheDir(viper.GetString("CACHE_DIR"))
cache.LoadCache(viper.GetString("CACHE_FILE"))
r := newRenderer() r := newRenderer()
c, _ := CONN.CurrentSong() c, _ := CONN.CurrentSong()
if len(c) != 0 { if len(c) != 0 {
@ -265,4 +267,5 @@ func main() {
if err := UI.App.Run(); err != nil { if err := UI.App.Run(); err != nil {
panic(err) panic(err)
} }
cache.WriteCache(viper.GetString("CACHE_FILE"))
} }