This commit is contained in:
2026-01-11 10:59:50 -08:00
parent 5f8f49c530
commit 234f7aca5c
9 changed files with 112 additions and 53 deletions

View File

@@ -292,10 +292,10 @@ class PodcastIndex(Provider):
try:
from SYS.config import resolve_output_dir
output_dir = resolve_output_dir(self.config or {})
except Exception:
output_dir = Path.home() / "Downloads"
import tempfile
output_dir = Path(tempfile.gettempdir())
try:
output_dir = Path(output_dir).expanduser()

View File

@@ -286,7 +286,7 @@ class Soulseek(Provider):
# NOTE: These defaults preserve existing behavior.
USERNAME = "asjhkjljhkjfdsd334"
PASSWORD = "khhhg"
DOWNLOAD_DIR = "./downloads"
DOWNLOAD_DIR = None
MAX_WAIT_TRANSFER = 1200
def __init__(self, config: Optional[Dict[str, Any]] = None):
@@ -325,13 +325,17 @@ class Soulseek(Provider):
)
return None
# Use tempfile directory as default if '.' or generic placeholder was passed
# by a caller that didn't know better.
target_dir = Path(output_dir)
if str(target_dir) == "." or str(target_dir) == "downloads":
# Use tempfile directory as default if generic path elements were passed or None.
if output_dir is None:
import tempfile
target_dir = Path(tempfile.gettempdir()) / "Medios" / "Soulseek"
target_dir.mkdir(parents=True, exist_ok=True)
else:
target_dir = Path(output_dir)
if str(target_dir) in (".", "downloads", "Downloads"):
import tempfile
target_dir = Path(tempfile.gettempdir()) / "Medios" / "Soulseek"
target_dir.mkdir(parents=True, exist_ok=True)
# This cmdlet stack is synchronous; use asyncio.run for clarity.
return asyncio.run(
@@ -348,12 +352,22 @@ class Soulseek(Provider):
# dedicated loop in this thread.
loop = asyncio.new_event_loop()
try:
# Re-resolve target_dir inside rescue block just in case
if output_dir is None:
import tempfile
target_dir = Path(tempfile.gettempdir()) / "Medios" / "Soulseek"
else:
target_dir = Path(output_dir)
if str(target_dir) in (".", "downloads", "Downloads"):
import tempfile
target_dir = Path(tempfile.gettempdir()) / "Medios" / "Soulseek"
asyncio.set_event_loop(loop)
return loop.run_until_complete(
download_soulseek_file(
username=username,
filename=filename,
output_dir=output_dir,
output_dir=target_dir,
timeout=self.MAX_WAIT_TRANSFER,
)
)
@@ -642,7 +656,7 @@ class Soulseek(Provider):
async def download_soulseek_file(
username: str,
filename: str,
output_dir: Path = Path("./downloads"),
output_dir: Optional[Path] = None,
timeout: int = 1200,
*,
client_username: Optional[str] = None,
@@ -656,6 +670,10 @@ async def download_soulseek_file(
from aioslsk.transfer.model import Transfer, TransferDirection
from aioslsk.transfer.state import TransferState
if output_dir is None:
import tempfile
output_dir = Path(tempfile.gettempdir()) / "Medios" / "Soulseek"
output_dir = Path(output_dir)
output_dir.mkdir(parents=True, exist_ok=True)