mirror of
https://github.com/Viren070/MediaFusion.git
synced 2025-12-01 23:21:11 +01:00
Fix Stremthru token header & refactor passing stremio id for cache status
This commit is contained in:
@@ -36,7 +36,7 @@ class StremThru(DebridClient):
|
||||
elif isinstance(self.auth, dict):
|
||||
self.headers["X-StremThru-Store-Name"] = self.auth["store"]
|
||||
self.headers["X-StremThru-Store-Authorization"] = (
|
||||
f"Bearer {self.auth["token"]}"
|
||||
f"Bearer {self.auth['token']}"
|
||||
)
|
||||
|
||||
def __del__(self):
|
||||
@@ -119,12 +119,10 @@ class StremThru(DebridClient):
|
||||
async def get_torrent_instant_availability(
|
||||
self,
|
||||
magnet_links: list[str],
|
||||
stremio_video_id: Optional[str] = None,
|
||||
stremio_video_id: str,
|
||||
is_http_response: bool = False,
|
||||
):
|
||||
params = {"magnet": ",".join(magnet_links)}
|
||||
if stremio_video_id:
|
||||
params["sid"] = stremio_video_id
|
||||
params = {"magnet": ",".join(magnet_links), "sid": stremio_video_id}
|
||||
return await self._make_request(
|
||||
"GET",
|
||||
"/v0/store/magnets/check",
|
||||
|
||||
@@ -69,10 +69,7 @@ async def get_video_url_from_stremthru(
|
||||
|
||||
|
||||
async def update_st_cache_status(
|
||||
streams: list[TorrentStreams],
|
||||
user_data: UserData,
|
||||
stremio_video_id: str | None,
|
||||
**kwargs,
|
||||
streams: list[TorrentStreams], user_data: UserData, stremio_video_id: str, **kwargs
|
||||
) -> str | None:
|
||||
"""Updates the cache status of streams based on StremThru's instant availability."""
|
||||
|
||||
|
||||
+7
-3
@@ -31,8 +31,8 @@ from utils.validation_helper import validate_m3u8_or_mpd_url_with_cache
|
||||
async def filter_and_sort_streams(
|
||||
streams: list[TorrentStreams],
|
||||
user_data: UserData,
|
||||
stremio_video_id: str,
|
||||
user_ip: str | None = None,
|
||||
stremio_video_id: str | None = None,
|
||||
) -> list[TorrentStreams]:
|
||||
# Convert to sets for faster lookups
|
||||
selected_resolutions_set = set(user_data.selected_resolutions)
|
||||
@@ -227,8 +227,12 @@ async def parse_stream_data(
|
||||
if not streams:
|
||||
return []
|
||||
|
||||
stremio_video_id = f"{streams[0].meta_id}:{season}:{episode}" if is_series else streams[0].meta_id
|
||||
streams = await filter_and_sort_streams(streams, user_data, user_ip, stremio_video_id)
|
||||
stremio_video_id = (
|
||||
f"{streams[0].meta_id}:{season}:{episode}" if is_series else streams[0].meta_id
|
||||
)
|
||||
streams = await filter_and_sort_streams(
|
||||
streams, user_data, stremio_video_id, user_ip
|
||||
)
|
||||
|
||||
# Precompute constant values
|
||||
show_full_torrent_name = user_data.show_full_torrent_name
|
||||
|
||||
Reference in New Issue
Block a user