mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-24 04:46:07 -08:00
feat(jellyfin): queue series neighbor episodes in the mpv playlist (#338)
This commit is contained in:
1 parent
713cdb3ef8
commit
926e6b047e
45 files changed
+2295
-197
No files matched your search
@@ -210,8 +210,17 @@ function M.create(ctx)
|
||||
})
|
||||
end
|
||||
|
||||
local function is_app_managed_playlist_entry()
|
||||
local path = mp.get_property("path")
|
||||
local managed_paths = state.app_managed_playlist_paths or {}
|
||||
return type(path) == "string" and managed_paths[path] == true
|
||||
end
|
||||
|
||||
local function on_start_file()
|
||||
if should_show_overlay_loading_osd() then
|
||||
if is_app_managed_playlist_entry() then
|
||||
state.skip_managed_subtitle_rearm_once = true
|
||||
state.app_managed_playback_pending = true
|
||||
elseif should_show_overlay_loading_osd() then
|
||||
process.start_overlay_loading_osd()
|
||||
end
|
||||
if state.pending_reload_media_identity ~= nil then
|
||||
@@ -322,12 +331,27 @@ function M.create(ctx)
|
||||
state.pending_reload_reason = nil
|
||||
state.app_managed_playback_pending = false
|
||||
state.app_managed_playback_active = false
|
||||
state.app_managed_playlist_paths = {}
|
||||
state.app_playlist_entry_options = {}
|
||||
end
|
||||
|
||||
-- Applies the app's per-file options to an entry it loaded with loadlist, the way loadfile
|
||||
-- options would apply.
|
||||
local function apply_app_playlist_entry_options()
|
||||
local path = mp.get_property("path")
|
||||
local options = type(path) == "string" and state.app_playlist_entry_options[path] or nil
|
||||
for _, option in ipairs(options or {}) do
|
||||
mp.set_property("file-local-options/" .. option[1], option[2])
|
||||
end
|
||||
end
|
||||
|
||||
local function register_lifecycle_hooks()
|
||||
mp.register_event("start-file", on_start_file)
|
||||
mp.register_event("file-loaded", on_file_loaded)
|
||||
mp.register_event("shutdown", on_shutdown)
|
||||
mp.add_hook("on_load", 50, apply_app_playlist_entry_options)
|
||||
-- Tells the app it can rely on the hook above (read as PLUGIN_ENTRY_OPTIONS_USER_DATA).
|
||||
mp.set_property_native("user-data/subminer/playlist-entry-options", true)
|
||||
mp.register_event("end-file", function(event)
|
||||
process.stop_overlay_loading_osd()
|
||||
process.disarm_auto_play_ready_gate()
|
||||
|
||||
Reference in new issue
Block a user