Test user streams

This commit is contained in:
7x11x13 2024-06-23 21:03:17 -04:00
parent f5801c36fc
commit 8ea3721b14
3 changed files with 99 additions and 6 deletions

View File

@ -46,11 +46,10 @@ scdl me -f
--version Show version
-l [url] URL can be track/playlist/user
-n [maxtracks] Download the n last tracks of a playlist according to the creation date
-s Download the stream of a user (token needed)
-a Download all tracks of user (including reposts)
-t Download all uploads of a user (no reposts)
-f Download all favorites of a user
-C Download all commented by a user
-f Download all favorites (likes) of a user
-C Download all tracks commented on by a user
-p Download all playlists of a user
-r Download all reposts of user
-c Continue if a downloaded file already exists

View File

@ -22,11 +22,10 @@ Options:
--version Show version
-l [url] URL can be track/playlist/user
-n [maxtracks] Download the n last tracks of a playlist according to the creation date
-s Download the stream of a user (token needed)
-a Download all tracks of user (including reposts)
-t Download all uploads of a user (no reposts)
-f Download all favorites of a user
-C Download all commented by a user
-f Download all favorites (likes) of a user
-C Download all tracks commented on by a user
-p Download all playlists of a user
-r Download all reposts of user
-c Continue if a downloaded file already exists

95
tests/test_user.py Normal file
View File

@ -0,0 +1,95 @@
import os
from pathlib import Path
from tests.utils import assert_track, call_scdl_with_auth
def count_files(dir: Path):
return len(list(dir.rglob("*")))
def test_all(tmp_path: Path):
os.chdir(tmp_path)
r = call_scdl_with_auth(
"-l",
"https://soundcloud.com/one-thousand-and-one",
"-a",
"-o",
"3",
"--onlymp3",
)
assert r.returncode == 0
assert count_files(tmp_path) == 3
def test_tracks(tmp_path: Path):
os.chdir(tmp_path)
r = call_scdl_with_auth(
"-l",
"https://soundcloud.com/one-thousand-and-one",
"-t",
"--name-format=track",
"--onlymp3",
)
assert r.returncode == 0
assert_track(tmp_path, "track.mp3")
assert count_files(tmp_path) == 1
def test_likes(tmp_path: Path):
os.chdir(tmp_path)
r = call_scdl_with_auth(
"-l",
"https://soundcloud.com/one-thousand-and-one",
"-f",
"--onlymp3",
"--name-format={title}",
)
assert r.returncode == 0
assert_track(
tmp_path, "Wan Bushi - Eurodance Vibes (part 1+2+3).mp3", check_metadata=False
)
assert count_files(tmp_path) == 1
def test_commented(tmp_path: Path):
os.chdir(tmp_path)
r = call_scdl_with_auth(
"-l",
"https://soundcloud.com/one-thousand-and-one",
"-C",
"--onlymp3",
"--name-format={title}",
)
assert r.returncode == 0
assert_track(
tmp_path, "Wan Bushi - Eurodance Vibes (part 1+2+3).mp3", check_metadata=False
)
assert count_files(tmp_path) == 1
def test_playlists(tmp_path: Path):
os.chdir(tmp_path)
r = call_scdl_with_auth(
"-l",
"https://soundcloud.com/one-thousand-and-one",
"-p",
"--onlymp3",
)
assert r.returncode == 0
assert count_files(tmp_path) == 3
def test_reposts(tmp_path: Path):
os.chdir(tmp_path)
r = call_scdl_with_auth(
"-l",
"https://soundcloud.com/one-thousand-and-one",
"-r",
"--name-format={title}",
)
assert r.returncode == 0
assert_track(
tmp_path, "Wan Bushi - Eurodance Vibes (part 1+2+3).mp3", check_metadata=False
)
assert count_files(tmp_path) == 1