| Unpause and mark watched - mpv-jellyfin - MPV script for adding an interface fo… | |
| Log | |
| Files | |
| Refs | |
| README | |
| LICENSE | |
| --- | |
| commit 918c0caae3d93645c399c1e1df8a2861463a213c | |
| parent 18b6355d00f617f5ea919931bf30363a788aed37 | |
| Author: EmperorPenguin18 <[email protected]> | |
| Date: Sat, 21 Jan 2023 19:59:20 -0500 | |
| Unpause and mark watched | |
| Diffstat: | |
| M scripts/jellyfin.lua | 22 +++++++++++++++------- | |
| 1 file changed, 15 insertions(+), 7 deletions(-) | |
| --- | |
| diff --git a/scripts/jellyfin.lua b/scripts/jellyfin.lua | |
| @@ -138,7 +138,7 @@ local function update_overlay() | |
| update_data() | |
| end | |
| -local function property_change(name, data) | |
| +local function width_change(name, data) | |
| if shown then update_overlay() end | |
| end | |
| @@ -234,13 +234,21 @@ toggle_overlay = function() | |
| shown = not shown | |
| end | |
| -local function mark_watched(data) | |
| - if data.reason == "eof" then | |
| - send_request("POST", options.url.."/Users/"..user_id.."/Played… | |
| - video_id = "" | |
| +local function check_percent() | |
| + local pos = mp.get_property_number("percent-pos") | |
| + if pos then | |
| + if pos > 95 then | |
| + send_request("POST", options.url.."/Users/"..user_id..… | |
| + video_id = "" | |
| + end | |
| end | |
| end | |
| -mp.register_event("end-file", mark_watched) | |
| +local function unpause() | |
| + mp.set_property_bool("pause", false) | |
| +end | |
| + | |
| +mp.add_periodic_timer(1, check_percent) | |
| mp.add_key_binding("Ctrl+j", "jf", toggle_overlay) | |
| -mp.observe_property("osd-width", number, property_change) | |
| +mp.observe_property("osd-width", "number", width_change) | |
| +mp.register_event("file-loaded", unpause) |