diff --git a/CHANGELOG.md b/CHANGELOG.md index b24e61b9..fdffd5c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Fixed issue with missing extensions when downloading playlists. - Removed Fission/Webnative user layer (discontinued). - Minor improvements/fixes to the artwork downloading process. +- Added keyboard shortcuts to seek back and forward. - No longer cache all background images when first loading the app. - A lot of javascript code refactoring. diff --git a/src/Core/UI/Adjunct.elm b/src/Core/UI/Adjunct.elm index 46e2ffdb..9d8832c9 100644 --- a/src/Core/UI/Adjunct.elm +++ b/src/Core/UI/Adjunct.elm @@ -76,13 +76,40 @@ keyboardInput msg model = [ Keyboard.Character "]", Keyboard.Control ] -> Queue.shift m - -- TODO: - -- [ Keyboard.Character "{", Keyboard.Shift, Keyboard.Control ] -> - -- Audio.seek ((m.audioPosition - 10) / m.audioDuration) m - -- - -- [ Keyboard.Character "}", Keyboard.Shift, Keyboard.Control ] -> - -- Audio.seek ((m.audioPosition + 10) / m.audioDuration) m - -- + [ Keyboard.Character "{", Keyboard.Shift, Keyboard.Control ] -> + case m.nowPlaying of + Just { duration, item, playbackPosition } -> + case duration of + Just d -> + Audio.seek + { trackId = (Tuple.second item.identifiedTrack).id + , progress = (playbackPosition - 10) / d + } + m + + Nothing -> + Return.singleton m + + Nothing -> + Return.singleton m + + [ Keyboard.Character "}", Keyboard.Shift, Keyboard.Control ] -> + case m.nowPlaying of + Just { duration, item, playbackPosition } -> + case duration of + Just d -> + Audio.seek + { trackId = (Tuple.second item.identifiedTrack).id + , progress = (playbackPosition + 10) / d + } + m + + Nothing -> + Return.singleton m + + Nothing -> + Return.singleton m + -- Meta key -- [ Keyboard.Character "K", Keyboard.Meta ] ->