misc
This commit is contained in:
@@ -19,8 +19,8 @@ from utils.sr_wrapper import SRUtil
|
||||
# ---------- Config ----------
|
||||
ROOT_DIR = Path("/storage/music2")
|
||||
MAX_RETRIES = 5
|
||||
THROTTLE_MIN = 1.7
|
||||
THROTTLE_MAX = 10.0
|
||||
THROTTLE_MIN = 1.0
|
||||
THROTTLE_MAX = 3.5
|
||||
|
||||
HEADERS = {
|
||||
"User-Agent": (
|
||||
@@ -259,7 +259,6 @@ def bulk_download(track_list: list, quality: str = "FLAC"):
|
||||
await asyncio.sleep(random.uniform(THROTTLE_MIN, THROTTLE_MAX))
|
||||
finally:
|
||||
try:
|
||||
await session.close()
|
||||
if tmp_file and tmp_file.exists():
|
||||
tmp_file.unlink()
|
||||
except Exception:
|
||||
@@ -304,8 +303,13 @@ def bulk_download(track_list: list, quality: str = "FLAC"):
|
||||
top_artist = "Unknown Artist"
|
||||
|
||||
combined_artist = sanitize_filename(top_artist)
|
||||
short_id = uuid.uuid4().hex[:8]
|
||||
staged_tarball = staging_root / f"{combined_artist}_{short_id}.tar.gz"
|
||||
staged_tarball = staging_root / f"{combined_artist}.tar.gz"
|
||||
# Ensure uniqueness (Windows-style padding) within the parent folder
|
||||
counter = 1
|
||||
base_name = staged_tarball.stem
|
||||
while staged_tarball.exists():
|
||||
counter += 1
|
||||
staged_tarball = staging_root / f"{base_name} ({counter}).tar.gz"
|
||||
|
||||
final_tarball = ROOT_DIR / "completed" / quality / staged_tarball.name
|
||||
final_tarball.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
Reference in New Issue
Block a user