Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_all_albums(tmpdir):
# current number of tracks on spotify since as of 10/10/2018
# in US market only
expect_tracks = 49
global text_file
text_file = os.path.join(str(tmpdir), "test_ab.txt")
spotify_tools.write_all_albums_from_artist(ARTIST_URL, text_file)
with open(text_file, "r") as f:
tracks = len(f.readlines())
assert tracks == expect_tracks
def test_write_all_albums_from_artist(tmpdir):
expect_tracks = 282
text_file = os.path.join(str(tmpdir), "test_ab.txt")
spotify_tools.write_all_albums_from_artist(
"https://open.spotify.com/artist/4dpARuHxo51G3z768sgnrY", text_file
)
with open(text_file, "r") as f:
tracks = len(f.readlines())
assert tracks == expect_tracks
text_file=const.args.write_to)
else:
list_dl = downloader.ListDownloader(
tracks_file=const.args.list,
skip_file=const.args.skip,
write_successful_file=const.args.write_successful,
)
list_dl.download_list()
elif const.args.playlist:
spotify_tools.write_playlist(playlist_url=const.args.playlist,
text_file=const.args.write_to)
elif const.args.album:
spotify_tools.write_album(album_url=const.args.album,
text_file=const.args.write_to)
elif const.args.all_albums:
spotify_tools.write_all_albums_from_artist(artist_url=const.args.all_albums,
text_file=const.args.write_to)
elif const.args.username:
spotify_tools.write_user_playlist(username=const.args.username,
text_file=const.args.write_to)
elif const.args.list:
if const.args.write_m3u:
youtube_tools.generate_m3u(track_file=const.args.list)
else:
list_dl = downloader.ListDownloader(
tracks_file=const.args.list,
skip_file=const.args.skip,
write_successful_file=const.args.write_successful,
)
list_dl.download_list()
elif const.args.playlist:
spotify_tools.write_playlist(playlist_url=const.args.playlist)
elif const.args.album:
spotify_tools.write_album(album_url=const.args.album)
elif const.args.all_albums:
spotify_tools.write_all_albums_from_artist(artist_url=const.args.all_albums)
elif const.args.username:
spotify_tools.write_user_playlist(username=const.args.username)