Test download archive and sync
This commit is contained in:
parent
7f22f4b4be
commit
f5801c36fc
|
|
@ -128,3 +128,39 @@ def test_strict_playlist(tmp_path: Path):
|
|||
assert r.returncode == 1
|
||||
assert_not_track(tmp_path / "test playlist", "1_testing - test track.mp3")
|
||||
assert_not_track(tmp_path / "test playlist", "2_test track 2.mp3")
|
||||
|
||||
|
||||
def test_sync(tmp_path: Path):
|
||||
os.chdir(tmp_path)
|
||||
os.makedirs("test playlist")
|
||||
r = call_scdl_with_auth(
|
||||
"-l",
|
||||
"https://soundcloud.com/7x11x13/wan-bushi-eurodance-vibes-part-123",
|
||||
"--onlymp3",
|
||||
"--name-format",
|
||||
"{title}",
|
||||
"--path",
|
||||
"test playlist",
|
||||
)
|
||||
assert r.returncode == 0
|
||||
assert_track(
|
||||
tmp_path / "test playlist",
|
||||
"Wan Bushi - Eurodance Vibes (part 1+2+3).mp3",
|
||||
check_metadata=False,
|
||||
)
|
||||
with open("archive.txt", "w", encoding="utf-8") as f:
|
||||
f.writelines(["1032303631"])
|
||||
r = call_scdl_with_auth(
|
||||
"-l",
|
||||
"https://soundcloud.com/one-thousand-and-one/sets/test-playlist/s-ZSLfNrbPoXR",
|
||||
"--playlist-name-format",
|
||||
"{title}",
|
||||
"--sync",
|
||||
"archive.txt",
|
||||
)
|
||||
assert r.returncode == 0
|
||||
assert_not_track(
|
||||
tmp_path / "test playlist", "Wan Bushi - Eurodance Vibes (part 1+2+3).mp3"
|
||||
)
|
||||
with open("archive.txt", "r") as f:
|
||||
assert f.read().split() == ["1855267053", "1855318536"]
|
||||
|
|
|
|||
|
|
@ -271,3 +271,28 @@ def test_remove(tmp_path: Path):
|
|||
assert r.returncode == 0
|
||||
assert_track(tmp_path, "track.wav", check_metadata=False)
|
||||
assert_not_track(tmp_path, "track.mp3")
|
||||
|
||||
|
||||
def test_download_archive(tmp_path: Path):
|
||||
os.chdir(tmp_path)
|
||||
r = call_scdl_with_auth(
|
||||
"-l",
|
||||
"https://soundcloud.com/one-thousand-and-one/test-track",
|
||||
"--name-format",
|
||||
"track",
|
||||
"--onlymp3",
|
||||
"--download-archive=archive.txt",
|
||||
)
|
||||
assert r.returncode == 0
|
||||
os.remove("track.mp3")
|
||||
assert not os.path.exists("track.mp3")
|
||||
r = call_scdl_with_auth(
|
||||
"-l",
|
||||
"https://soundcloud.com/one-thousand-and-one/test-track",
|
||||
"--name-format",
|
||||
"track",
|
||||
"--onlymp3",
|
||||
"--download-archive=archive.txt",
|
||||
)
|
||||
assert r.returncode == 1
|
||||
assert "already exists" in r.stderr
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user