diff --git a/config/kMap.go b/config/kMap.go index bf952c5..eafd3e9 100644 --- a/config/kMap.go +++ b/config/kMap.go @@ -4,12 +4,35 @@ import ( "errors" ) -var KMAP = map[string]int{ - "TAB": 9, - "RETURN": 13, - "ENTER": 13, - "SPACE": 32, -} +var ( + SPECIAL_KEYS = map[string]int{ + "TAB": 9, + "RETURN": 13, + "ENTER": 13, + "SPACE": 32, + } + + KEY_MAP = map[int]string{ + 108: "showChildrenContent", + 112: "togglePlayBack", + 104: "showParentContent", + 110: "nextSong", + 99: "clearPlaylist", + 78: "previousSong", + 97: "addToPlaylist", + 122: "toggleRandom", + 114: "toggleRepeat", + 45: "decreaseVolume", + 61: "increaseVolume", + 50: "navigateToFiles", + 49: "navigateToPlaylist", + 51: "navigateToMostPlayed", + 113: "quit", + 115: "stop", + 117: "updateDB", + 100: "deleteSongFromPlaylist", + } +) func GetAsciiValue(s string) (int, error) { if len([]rune(s)) == 1 { @@ -19,7 +42,7 @@ func GetAsciiValue(s string) (int, error) { } else { return -1, errors.New("Not Found") } - } else if val, ok := KMAP[s]; ok { + } else if val, ok := SPECIAL_KEYS[s]; ok { return val, nil } else { return -1, errors.New("Not Found") diff --git a/config/kMap_test.go b/config/kMap_test.go index 92bb4f5..a85b2ff 100644 --- a/config/kMap_test.go +++ b/config/kMap_test.go @@ -5,7 +5,7 @@ import ( ) func TestGetAsciiValue(t *testing.T) { - for k, v := range KMAP { + for k, v := range SPECIAL_KEYS { result, err := GetAsciiValue(k) if result != v { t.Errorf("Values From KMAP Failed")