From d2fcd92399c78b12fc9bc3aa488b856ab3665ff6 Mon Sep 17 00:00:00 2001 From: natedogg058 Date: Mon, 20 Apr 2026 12:01:11 +0000 Subject: [PATCH] feat: surface filename on stream behaviorHints for client-side release fingerprinting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Stremio's behaviorHints.filename is the standard field clients use to identify the underlying release for features like IntroDB-based skip intro, OpenSubtitles hash matching, and Trakt scrobbling. Plexio already extracts the filename from the Plex part object for use inside the stream description, but never surfaced it on the standard field. Diagnostic evidence (diagnostics/plexio-stream-pitt-s01e01.json vs aiostreams-stream-pitt-s01e01.json): AIOStreams populates behaviorHints.filename, Plexio does not — explaining why Nuvio's IntroDB integration works for one and not the other despite both pointing at the same Plex server. Also adds video_size to the StremioStreamBehaviorHints model as a Stremio-standard field. Not populated yet (requires guarded .get() against media Part object); will follow in a later commit if useful. Changes: - plexio/models/stremio.py: add filename and video_size optional fields to StremioStreamBehaviorHints - plexio/models/plex.py: populate filename on all three stream construction sites (Direct Play, Transcode Original, Transcode Down) --- plexio/models/plex.py | 6 +++--- plexio/models/stremio.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/plexio/models/plex.py b/plexio/models/plex.py index b6afcc2..17719c5 100644 --- a/plexio/models/plex.py +++ b/plexio/models/plex.py @@ -218,7 +218,7 @@ def get_stremio_streams(self, configuration): }, ), subtitles=external_subtitles, - behaviorHints={'bingeGroup': quality_description}, + behaviorHints={'bingeGroup': quality_description, 'filename': filename}, ), ) @@ -250,7 +250,7 @@ def get_stremio_streams(self, configuration): ), url=str(transcode_url % {'videoQuality': 100}), subtitles=external_subtitles, - behaviorHints={'bingeGroup': quality_description}, + behaviorHints={'bingeGroup': quality_description, 'filename': filename}, ), ) @@ -270,7 +270,7 @@ def get_stremio_streams(self, configuration): ), url=str(transcode_url % quality_params['plex_args']), subtitles=external_subtitles, - behaviorHints={'bingeGroup': quality_description}, + behaviorHints={'bingeGroup': quality_description, 'filename': filename}, ), ) diff --git a/plexio/models/stremio.py b/plexio/models/stremio.py index 970653e..6d9e47b 100644 --- a/plexio/models/stremio.py +++ b/plexio/models/stremio.py @@ -55,6 +55,8 @@ class StremioStreamBehaviorHints(StremioBase): not_web_ready: bool = False binge_group: str | None = None proxy_headers: dict | None = None + filename: str | None = None # For client-side release fingerprinting (IntroDB, etc.) + video_size: int | None = None # Stremio-standard byte size of the underlying file class StremioStream(StremioBase):