Add ability to get playback-time

This commit is contained in:
Alexander Heldt
2025-11-16 16:23:16 +01:00
parent 94212996d2
commit 417b5a2559
4 changed files with 69 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import gleam/list
import gleeunit
import mpv/control.{type Control}
import mpv/internal/control as control_internal
import mpv/key.{type Key, Char}
pub fn main() -> Nil {
@@ -22,3 +23,11 @@ pub fn control_from_key_test() {
assert tc.expected == control.from_key(tc.key)
})
}
pub fn parse_playback_time_test() {
let json_string =
"{\"data\":\"123.456789\",\"request_id\":0,\"error\":\"success\"}\n"
let assert Ok(data) = control_internal.parse_playback_time(json_string)
assert data == 123.456789
}