feat(debrid/stremthru): pass stremio video id for magnet cache check

This commit is contained in:
Munif Tanjim
2024-12-31 16:44:23 +06:00
parent f0b029d793
commit 786a2985ca
7 changed files with 20 additions and 11 deletions
+1
View File
@@ -411,6 +411,7 @@ async def stream(
season,
episode,
kitsu,
video_id=full_id,
)
ranked_files = set()
+1 -1
View File
@@ -44,7 +44,7 @@ class AllDebrid:
)
async def get_files(
self, torrent_hashes: list, type: str, season: str, episode: str, kitsu: bool
self, torrent_hashes: list, type: str, season: str, episode: str, kitsu: bool, **kwargs
):
chunk_size = 500
chunks = [
+1 -1
View File
@@ -48,7 +48,7 @@ class DebridLink:
return responses
async def get_files(
self, torrent_hashes: list, type: str, season: str, episode: str, kitsu: bool
self, torrent_hashes: list, type: str, season: str, episode: str, kitsu: bool, **kwargs
):
chunk_size = 10
chunks = [
+1 -1
View File
@@ -49,7 +49,7 @@ class Premiumize:
)
async def get_files(
self, torrent_hashes: list, type: str, season: str, episode: str, kitsu: bool
self, torrent_hashes: list, type: str, season: str, episode: str, kitsu: bool, **kwargs
):
chunk_size = 100
chunks = [
+1 -1
View File
@@ -42,7 +42,7 @@ class RealDebrid:
)
async def get_files(
self, torrent_hashes: list, type: str, season: str, episode: str, kitsu: bool
self, torrent_hashes: list, type: str, season: str, episode: str, kitsu: bool, **kwargs
):
chunk_size = 100
chunks = [
+14 -6
View File
@@ -58,11 +58,12 @@ class StremThru:
return False
async def get_instant(self, magnets: list):
async def get_instant(self, magnets: list, sid: Optional[str] = None):
try:
magnet = await self.session.get(
f"{self.base_url}/magnets/check?magnet={','.join(magnets)}&client_ip={self.client_ip}"
)
url = f"{self.base_url}/magnets/check?magnet={','.join(magnets)}&client_ip={self.client_ip}"
if sid:
url = f"{url}&sid={sid}"
magnet = await self.session.get(url)
return await magnet.json()
except Exception as e:
logger.warning(
@@ -70,7 +71,14 @@ class StremThru:
)
async def get_files(
self, torrent_hashes: list, type: str, season: str, episode: str, kitsu: bool
self,
torrent_hashes: list,
type: str,
season: str,
episode: str,
kitsu: bool,
video_id: Optional[str] = None,
**kwargs,
):
chunk_size = 25
chunks = [
@@ -80,7 +88,7 @@ class StremThru:
tasks = []
for chunk in chunks:
tasks.append(self.get_instant(chunk))
tasks.append(self.get_instant(chunk, sid=video_id))
responses = await asyncio.gather(*tasks)
+1 -1
View File
@@ -41,7 +41,7 @@ class TorBox:
)
async def get_files(
self, torrent_hashes: list, type: str, season: str, episode: str, kitsu: bool
self, torrent_hashes: list, type: str, season: str, episode: str, kitsu: bool, **kwargs
):
chunk_size = 50
chunks = [