diff --git a/README.md b/README.md index 44b52d8..dbd2878 100644 --- a/README.md +++ b/README.md @@ -354,6 +354,7 @@ information about the error. }, ], "duration": 6.024, # <-- seconds + "end": null, # <-- seconds as string or null "filename": "01 - dummy.mp3", "fullscreen": false, "loop-file": false, # <-- false, true or integer @@ -381,6 +382,7 @@ information about the error. "position": -0.0, # <-- seconds "remaining": 6.024, # <-- seconds "speed": 1, # <-- multiplier + "start": null, , # <-- seconds as string or null "sub-delay": 0, # <-- milliseconds "track-list": [ # <-- all available video, audio and sub tracks { diff --git a/main.lua b/main.lua index 825ecbb..1d5ab8d 100644 --- a/main.lua +++ b/main.lua @@ -118,6 +118,7 @@ local function build_status_response() ["chapter-list"] = mp.get_property_native("chapter-list") or '', chapters = mp.get_property_native("chapters") or '', duration = mp.get_property_native("duration") or '', + ["end"] = mp.get_property_native("end") or '', filename = mp.get_property('filename') or '', fullscreen = mp.get_property_native("fullscreen"), ["loop-file"] = mp.get_property_native("loop-file"), @@ -128,6 +129,7 @@ local function build_status_response() position = mp.get_property_native("time-pos") or '', remaining = mp.get_property_native("playtime-remaining") or '', speed = mp.get_property_native('speed') or '', + start = mp.get_property_native('start') or '', ["sub-delay"] = mp.get_property_osd("sub-delay") or '', ["track-list"] = mp.get_property_native("track-list") or '', volume = mp.get_property_native("volume") or '', @@ -163,7 +165,11 @@ local function build_status_response() return false end - return utils.format_json(values) + local result = utils.format_json(values) + -- hack to have null values in the resulting json + result = result:gsub('"none"', "null") + + return result end local function get_content_type(file_type) diff --git a/tests/snapshots/snap_tests.py b/tests/snapshots/snap_tests.py index a5671b2..d09cf63 100644 --- a/tests/snapshots/snap_tests.py +++ b/tests/snapshots/snap_tests.py @@ -199,6 +199,7 @@ "chapter-list": [], "chapters": 0, "duration": 6.024, + "end": None, "filename": "01 - dummy.mp3", "fullscreen": False, "loop-file": False, @@ -226,6 +227,7 @@ "position": -0.0, "remaining": 6.024, "speed": 1, + "start": None, "sub-delay": 0, "track-list": [ { diff --git a/webui-page/index.html b/webui-page/index.html index 0efdf3b..acb0f24 100644 --- a/webui-page/index.html +++ b/webui-page/index.html @@ -115,6 +115,14 @@