mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2026-04-27 14:00:34 +00:00
fix: use mediasegments instead of introskipper
This commit is contained in:
parent
34cd23ea72
commit
0fdb99e2a6
5 changed files with 12 additions and 72 deletions
|
|
@ -1,15 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import division, absolute_import, print_function, unicode_literals
|
||||
|
||||
##################################################################################################
|
||||
|
||||
import xbmcgui
|
||||
|
||||
from ..helper import LazyLogger
|
||||
from ..helper.translate import translate
|
||||
|
||||
##################################################################################################
|
||||
|
||||
LOG = LazyLogger(__name__)
|
||||
|
||||
# Action IDs
|
||||
|
|
@ -32,8 +26,6 @@ SEGMENT_LABELS = {
|
|||
"Commercial": "Ad",
|
||||
}
|
||||
|
||||
##################################################################################################
|
||||
|
||||
|
||||
class SkipDialog(xbmcgui.WindowXMLDialog):
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -508,27 +508,13 @@ class API(object):
|
|||
response = self.send_request(server_address, "system/info/public")
|
||||
return response.url.replace("/system/info/public", "")
|
||||
|
||||
def get_intro_skipper_segments(self, item_id):
|
||||
"""Get intro-skipper plugin segments (Introduction, Credits, Recap, Preview)."""
|
||||
try:
|
||||
return self._get("Episode/%s/IntroSkipperSegments" % item_id)
|
||||
except HTTPException as e:
|
||||
if e.status == 404:
|
||||
LOG.debug("Intro-skipper plugin not installed or no segments for %s", item_id)
|
||||
else:
|
||||
LOG.warning("Error fetching intro-skipper segments: %s", e)
|
||||
return None
|
||||
except Exception as e:
|
||||
LOG.warning("Error fetching intro-skipper segments: %s", e)
|
||||
return None
|
||||
|
||||
def get_media_segments(self, item_id):
|
||||
"""Get native Media Segments API data (Jellyfin 10.10+ fallback)."""
|
||||
"""Get media segments for an item (Jellyfin 10.10+)."""
|
||||
try:
|
||||
return self._get("MediaSegments", params={"itemId": item_id})
|
||||
return self._get("MediaSegments/%s" % item_id)
|
||||
except HTTPException as e:
|
||||
if e.status == 404:
|
||||
LOG.debug("Media Segments API not available for %s", item_id)
|
||||
LOG.debug("Media Segments not available for %s", item_id)
|
||||
else:
|
||||
LOG.warning("Error fetching media segments: %s", e)
|
||||
return None
|
||||
|
|
|
|||
|
|
@ -522,15 +522,13 @@ class Player(xbmc.Player):
|
|||
pass
|
||||
self.skip_dialog = None
|
||||
|
||||
segments = item["Server"].jellyfin.get_intro_skipper_segments(item_id)
|
||||
if not segments:
|
||||
segments = item["Server"].jellyfin.get_media_segments(item_id)
|
||||
if segments:
|
||||
segments = self._convert_media_segments(segments)
|
||||
segments = item["Server"].jellyfin.get_media_segments(item_id)
|
||||
if segments:
|
||||
segments = self._convert_media_segments(segments)
|
||||
|
||||
if segments:
|
||||
self.skip_segments[item_id] = segments
|
||||
LOG.info("Loaded intro-skipper segments for %s: %s", item_id, list(segments.keys()))
|
||||
LOG.info("Loaded media segments for %s: %s", item_id, list(segments.keys()))
|
||||
|
||||
def _convert_media_segments(self, response):
|
||||
if not response or "Items" not in response:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue