From c5915d26e5ed0b0cab08699de7afd2126f02e04d Mon Sep 17 00:00:00 2001 From: mhdzumair Date: Thu, 2 Jan 2025 11:59:13 +0530 Subject: [PATCH] Fix debrid cache sync endpoint url --- db/schemas.py | 2 ++ streaming_providers/cache_helpers.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/db/schemas.py b/db/schemas.py index f5341dc..eb6b27f 100644 --- a/db/schemas.py +++ b/db/schemas.py @@ -439,6 +439,7 @@ class CacheStatusRequest(BaseModel): "seedr", "pikpak", "torbox", + "easydebrid", ] info_hashes: list[str] @@ -461,6 +462,7 @@ class CacheSubmitRequest(BaseModel): "seedr", "pikpak", "torbox", + "easydebrid", ] info_hashes: list[str] diff --git a/streaming_providers/cache_helpers.py b/streaming_providers/cache_helpers.py index b5d825a..3c2a0ea 100644 --- a/streaming_providers/cache_helpers.py +++ b/streaming_providers/cache_helpers.py @@ -1,6 +1,7 @@ import logging from datetime import datetime, timedelta, timezone from typing import List, Dict +from urllib.parse import urljoin import dramatiq import httpx @@ -211,7 +212,7 @@ class MediaFusionCacheClient: """Client for interacting with MediaFusion cache service""" def __init__(self): - self.base_url = settings.mediafusion_url.rstrip("/") + self.base_url = settings.mediafusion_url self.timeout = httpx.Timeout(30.0) # 30 second timeout async def fetch_cache_status( @@ -233,7 +234,7 @@ class MediaFusionCacheClient: try: async with httpx.AsyncClient(timeout=self.timeout) as client: response = await client.post( - f"{self.base_url}/streaming_provider/cache/status", + urljoin(self.base_url, "/streaming_provider/cache/status"), json={ "service": provider.service, "info_hashes": info_hashes, @@ -276,7 +277,7 @@ class MediaFusionCacheClient: try: async with httpx.AsyncClient(timeout=self.timeout) as client: response = await client.post( - f"{self.base_url}/streaming_provider/cache/submit", + urljoin(self.base_url, "/streaming_provider/cache/submit"), json={ "service": provider.service, "info_hashes": info_hashes,