Installed this package and I'm trying to create a python script that will automate updating my music library by just running it. The problem is that even though I can collect the artist IDs and everything is going ok , after it tries to grab the download link I get the following error:
` File "C:\Users\b03ch\PycharmProjects\pythonProject\artist_updater.py", line 55, in
artist["download"](download_dir, quality=track_formats.FLAC)
KeyError: 'download'`
which indicates that the download portion of this command is not being generated, even though everything else is correct (also tried with individual artists same problem persists)
(Full code is:
`# Import Dependencies
import os
import shutil
from typing import List
from pydeezer.ProgressHandler import BaseProgressHandler
from tqdm import tqdm
import pydeezer
# Specify the path to the directory
directory_path = 'E:\Music\ArtistToUpdate'
# Use list comprehension to get all folder names in the directory
artist_list: list[str] = []
for folder in os.listdir(directory_path):
if os.path.isdir(os.path.join(directory_path, folder)):
artist_list.append(folder)
print(artist_list)
# Check if download directory is full, if full remove all
download_directory = "F:\Musica\ArtistUpdates"
def is_directory_empty(download_directory):
# Check if the directory is empty
return any(os.listdir(download_directory))
if is_directory_empty(download_directory):
print("Deleting folders within download directory: ")
shutil.rmtree(download_directory)
os.mkdir(download_directory)
# Import ARL
from pydeezer import Deezer
arl = "e3395f1f08a74b6de24223fdfaaaa9728fddc65b06d4dd834d25435aef52e3b258810229de775454f79c1785b552e81b46dc6a695b4f9cee1d06054f28697c54ef1bdae352bd0d79d42df7f6622cfe000cd83b856da81d8aa81beef7b9ec8f3e"
deezer = Deezer(arl=arl)
user_info = deezer.user
# Start Downloader
from pydeezer import Downloader
from pydeezer.constants import track_formats
download_dir = "F:\Musica\ArtistUpdates"
print("Download directory is " + download_dir)
artists: str
for artists in artist_list:
artist_search_results = deezer.search_artists(artists, limit=1)
id = artist_search_results[0]['id']
print(id)
new_directory = os.mkdir("F:\\Musica\\ArtistUpdates\\{0}".format(artists))
artist = deezer.get_artist(id)
artist["download"](download_dir, quality=track_formats.FLAC)`
Installed this package and I'm trying to create a python script that will automate updating my music library by just running it. The problem is that even though I can collect the artist IDs and everything is going ok , after it tries to grab the download link I get the following error: ` File "C:\Users\b03ch\PycharmProjects\pythonProject\artist_updater.py", line 55, in
artist["download"](download_dir, quality=track_formats.FLAC)