Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions lib/gui/base_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
)
from lib.utils.general.utils import Indexer, IndexerType, truncate_text
from lib.utils.kodi.logging import summarize_locator_for_log
from lib.utils.parsers.pack_parser import detect_pack_scope
from lib.utils.kodi.utils import ADDON, kodilog, translation
from lib.clients.stremio.playback import resolve_stremio_playback_url

Expand Down Expand Up @@ -237,6 +238,22 @@ def prepare_source_data(
pack_select: bool = False,
) -> Dict[str, Any]:
"""Prepare the source data dictionary for resolving playback."""
tv_data = self.item_information.get("tv_data")
current_season = tv_data.get("season") if isinstance(tv_data, dict) else None
pack_scope = detect_pack_scope(
source.title,
current_season=current_season,
source_is_pack=bool(source.isPack or pack_select),
)
kodilog(
"Playback pack scope: type={!r}, seasons={!r}, reason={!r}, source={!r}".format(
pack_scope["pack_type"],
pack_scope["pack_seasons"],
pack_scope["pack_reason"],
source.title,
)
)

playback_data = {
"type": source.type,
"indexer": source.indexer,
Expand All @@ -246,11 +263,15 @@ def prepare_source_data(
"title": self.item_information.get("title")
or self.item_information.get("query")
or source.title,
"source_title": source.title,
"is_torrent": is_torrent,
"is_pack": pack_select,
"is_pack": pack_scope["is_pack"],
"pack_type": pack_scope["pack_type"],
"pack_seasons": pack_scope["pack_seasons"],
"pack_reason": pack_scope["pack_reason"],
"mode": self.item_information.get("mode"),
"ids": self.item_information.get("ids"),
"tv_data": self.item_information.get("tv_data"),
"tv_data": tv_data,
"poster": self.item_information.get("poster"),
"stream_subtitles": source.streamSubtitles,
}
Expand Down
23 changes: 19 additions & 4 deletions lib/gui/custom_dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def source_select(item_info: Dict[str, str], xml_file: str, sources: List[Torren


def run_next_dialog(params):
playback_session_id = ""
try:
playlist_size = PLAYLIST.size()
playlist_pos = PLAYLIST.getposition() if playlist_size > 0 else -1
Expand All @@ -143,6 +144,9 @@ def run_next_dialog(params):
window = None
try:
item_information = json.loads(params["item_info"])
playback_session_id = str(
item_information.get("playback_session_id") or ""
)
if playlist_size > 0 and playlist_pos >= 0 and playlist_pos < playlist_size - 1:
try:
next_item = PLAYLIST[playlist_pos + 1]
Expand All @@ -167,11 +171,22 @@ def run_next_dialog(params):

if action == "next_episode":
# Let Kodi finish restoring VideoNav focus after the modal close
# animation before the player monitor consumes this handoff.
# animation before the owning player monitor consumes this handoff.
sleep(200)
set_property("jacktook_next_dialog_action", "next_episode")
else:
clear_property("jacktook_next_dialog_action")
if playback_session_id:
set_property(
"jacktook_next_dialog_action",
json.dumps(
{
"action": "next_episode",
"session_id": playback_session_id,
}
),
)
else:
kodilog(
"[PLAYNEXT] Ignoring next action without playback session"
)


def run_resume_dialog(params):
Expand Down
Loading