Files
downloads-all-bot/bot/cache.py
2026-01-02 17:48:48 +07:00

9 lines
245 B
Python

import hashlib
import os
def cache_key(url, quality, audio=False):
raw = f"{url}:{quality}:{audio}"
return hashlib.sha256(raw.encode()).hexdigest()
def cache_path(cache_dir, key, ext):
return os.path.join(cache_dir, f"{key}.{ext}")