Compare commits

...

2 Commits

Author SHA1 Message Date
1d1426f6ae downloader script 2025-09-13 17:16:19 +01:00
c15a183d1d up gitig 2025-09-10 11:31:34 +01:00
2 changed files with 54 additions and 1 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
audio
.venv

52
downloader.py Normal file
View File

@@ -0,0 +1,52 @@
import subprocess
import sys
url = "https://soundcloud.com/"
path = "musicbya/sets/13th-dec-crash-out"
command_link = url + path
dl_path = "/Users/azeem/repos/sc-audio-downloader/audio/13-DEC-CO-SC"
# run command scdl -l command_link --path dl_path in command line, log output constantly into python terminal
def run_scdl_with_output():
"""Run scdl command and stream output to terminal"""
command = ["scdl", "-l", command_link, "--path", dl_path, "--flac", "--name-format", "%(playlist_index)s - %(title)s.%(ext)s"]
print(f"Running command: {' '.join(command)}")
print("-" * 50)
try:
# Use subprocess.Popen to get real-time output
process = subprocess.Popen(
command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
bufsize=1
)
# Stream output line by line
for line in process.stdout:
print(line.rstrip())
sys.stdout.flush() # Ensure immediate output
# Wait for process to complete and get return code
return_code = process.wait()
if return_code == 0:
print("\n" + "=" * 50)
print("Download completed successfully!")
else:
print(f"\n" + "=" * 50)
print(f"Command failed with return code: {return_code}")
except FileNotFoundError:
print("Error: scdl command not found. Make sure it's installed and in your PATH.")
print("You can install it with: pip install scdl")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
run_scdl_with_output()