diff --git a/config/config.go b/config/config.go index dda1381..ad32698 100644 --- a/config/config.go +++ b/config/config.go @@ -24,6 +24,7 @@ var ( "PORT": "6600", "DEFAULT_IMAGE_PATH": "default.jpg", "CACHE_DIR": utils.CheckDirectoryFmt(USER_CACHE_DIR), + "SEEK_OFFSET": 10, } ) diff --git a/config/kMap.go b/config/kMap.go index ad949e4..d75e4b9 100644 --- a/config/kMap.go +++ b/config/kMap.go @@ -50,6 +50,8 @@ var ( 100: "deleteSongFromPlaylist", 63: "FocusSearch", 47: "FocusBuffSearch", + 98: "SeekBackward", + 101: "SeekForward", } ) diff --git a/main.go b/main.go index de183d5..b881bec 100644 --- a/main.go +++ b/main.go @@ -65,6 +65,7 @@ func main() { var Volume int64 var Random, Repeat bool + var SeekOffset = viper.GetInt("SEEK_OFFSET") if _v, err := CONN.Status(); err != nil { utils.Print("RED", "Could Not Get the MPD Status\n") @@ -218,6 +219,16 @@ func main() { "FocusBuffSearch": func() { views.GetCurrentView().FocusBuffSearchView() }, + "SeekForward": func() { + if err := CONN.SeekCur(time.Second*time.Duration(SeekOffset), true); err != nil { + notify.Notify.Send("Could Not Seek Forward in the Song") + } + }, + "SeekBackward": func() { + if err := CONN.SeekCur(-1*time.Second*time.Duration(SeekOffset), true); err != nil { + notify.Notify.Send("Could Not Seek Backward in the Song") + } + }, } // Generating the Key Map Based on the Function Map Here Basically the Values will be flipped diff --git a/ui/progressBar.go b/ui/progressBar.go index 0143c7a..f950bb7 100644 --- a/ui/progressBar.go +++ b/ui/progressBar.go @@ -121,5 +121,8 @@ func progressFunction() (string, string, string, float64) { text = " ---:---" percentage = 0 } + if percentage > 100 { + percentage = 0 + } return song, top, text, percentage }