Add advice and finish size filter
This commit is contained in:
@@ -8,7 +8,6 @@ ALLDEBRID_API_KEY = os.getenv("ALLDEBRID_API_KEY")
|
||||
NTFY_TOPIC_URL = os.getenv("NTFY_TOPIC_URL")
|
||||
NTFY_TOKEN = os.getenv("NTFY_TOKEN")
|
||||
|
||||
MAX_SIZE_BYTES = 5*1024**3
|
||||
NB_PAGES = 2
|
||||
|
||||
def check_alldebrid_status():
|
||||
@@ -71,11 +70,11 @@ def search_torrents(query: str, category_id: str | None = None) -> list[dict]:
|
||||
|
||||
return results
|
||||
|
||||
def filter_and_format_torrents(torrents: list[dict]) -> list[dict]:
|
||||
def filter_and_format_torrents(torrents: list[dict], max_size: int, season: int | None = None, episode: int | None = None) -> list[dict]:
|
||||
"""Filtre les torrents trop gros et formate la taille et l'âge."""
|
||||
filtered = []
|
||||
for t in torrents:
|
||||
if t['size'] <= MAX_SIZE_BYTES:
|
||||
if t['size'] <= max_size*1024**3:
|
||||
t['size'] = format_size(t['size'])
|
||||
days, human = calculate_age(t['uploaded_at'])
|
||||
t['age_days'] = days
|
||||
|
||||
Reference in New Issue
Block a user