mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-23 04:46:08 -08:00
Jellyfin playback now keeps the episodes around the playing one in mpv's playlist, so mpv's playlist keys and end-of-file advance move through the series (across seasons) in the same mpv and app session. - Queue neighbors only after the first time-pos, so startup is not slowed. - Adopt queued entries on mpv's path change without a loadfile: report the previous item stopped, then start reporting, stats, and subtitles for the new one. Runs before the immersion sync so stats metadata is recorded first. - Tell the mpv plugin which playlist paths the app manages so start-file skips subtitle rearm and overlay auto-start for them. - Add jellyfin.episodePlaylist.enabled (default on) and maxEpisodes (default 5, clamped 2-25), a rolling window centered on the current episode, under Settings > Integrations > Jellyfin > Episode Playlist. - Add a fake-Jellyfin e2e scenario covering next/prev in one session.
81 lines
2.6 KiB
Lua
81 lines
2.6 KiB
Lua
local M = {}
|
|
|
|
function M.create(ctx)
|
|
local mp = ctx.mp
|
|
local opts = ctx.opts
|
|
local process = ctx.process
|
|
local ui = ctx.ui
|
|
local state = ctx.state
|
|
|
|
local function register_script_messages()
|
|
mp.register_script_message("subminer-start", function(...)
|
|
process.start_overlay_from_script_message(...)
|
|
end)
|
|
mp.register_script_message("subminer-stop", function()
|
|
process.stop_overlay()
|
|
end)
|
|
mp.register_script_message("subminer-toggle", function()
|
|
process.toggle_overlay()
|
|
end)
|
|
mp.register_script_message("subminer-visible-overlay-hidden", function()
|
|
process.record_visible_overlay_visibility(false)
|
|
end)
|
|
mp.register_script_message("subminer-visible-overlay-shown", function()
|
|
process.record_visible_overlay_visibility(true)
|
|
end)
|
|
mp.register_script_message("subminer-managed-subtitles-loading", function()
|
|
state.skip_managed_subtitle_rearm_once = true
|
|
state.app_managed_playback_pending = true
|
|
end)
|
|
-- Playlist entries the app queued (Jellyfin neighbor episodes). mpv starts them on its own,
|
|
-- so start-file recognizes them by path instead of waiting for subminer-managed-subtitles-loading.
|
|
mp.register_script_message("subminer-managed-playlist-entries", function(...)
|
|
local paths = {}
|
|
for _, path in ipairs({ ... }) do
|
|
paths[path] = true
|
|
end
|
|
state.app_managed_playlist_paths = paths
|
|
end)
|
|
mp.register_script_message("subminer-menu", function()
|
|
ui.show_menu()
|
|
end)
|
|
mp.register_script_message("subminer-options", function()
|
|
process.open_options()
|
|
end)
|
|
mp.register_script_message("subminer-restart", function()
|
|
process.restart_overlay()
|
|
end)
|
|
mp.register_script_message("subminer-status", function()
|
|
process.check_status()
|
|
end)
|
|
mp.register_script_message("subminer-autoplay-ready", function()
|
|
process.notify_auto_play_ready()
|
|
end)
|
|
mp.register_script_message("subminer-autoplay-hold", function()
|
|
process.hold_auto_play_ready_gate()
|
|
end)
|
|
mp.register_script_message("subminer-overlay-loading-ready", function()
|
|
process.mark_overlay_content_ready()
|
|
end)
|
|
-- Sent when the app dismisses loading while its overlay window has no content (hidden mid-load,
|
|
-- or a replaced window).
|
|
mp.register_script_message("subminer-overlay-loading-dismissed", function()
|
|
process.mark_overlay_content_not_ready()
|
|
end)
|
|
mp.register_script_message("subminer-stats-toggle", function()
|
|
if opts.osd_messages then
|
|
mp.osd_message("Stats: press ` (backtick) in overlay", 3)
|
|
end
|
|
end)
|
|
mp.register_script_message("subminer-reload-session-bindings", function()
|
|
ctx.session_bindings.reload_bindings()
|
|
end)
|
|
end
|
|
|
|
return {
|
|
register_script_messages = register_script_messages,
|
|
}
|
|
end
|
|
|
|
return M
|