from ftplib import FTP

FTP_HOST = "ftp.djdownload.me"
FTP_USER = "ludovic.m.santos"
FTP_PASS = "3af32ssH"
FTP_PORT = 21

FTP_BASE = "/home/ftp.djdownload.me"

ftp = FTP(timeout=30)
ftp.connect(FTP_HOST, FTP_PORT)
ftp.login(FTP_USER, FTP_PASS)
ftp.set_pasv(True)
ftp.cwd(FTP_BASE)

print("\nROOT:")
print(ftp.nlst())

for year in ftp.nlst():
    print(f"\nYEAR → {year}")
    try:
        ftp.cwd(year)
    except Exception as e:
        print("  ❌ cannot enter year:", e)
        continue

    for item in ftp.nlst():
        print(f"  ├─ {item}")

    ftp.cwd("..")

ftp.quit()
