obskyr / khinsider

A script for khinsider mass downloads. Get video game soundtracks quickly and easily! Also a Python interface.
632 stars 64 forks source link

An unexpected error occurred! #96

Open 2V3EvG4LMJFdRe opened 3 months ago

2V3EvG4LMJFdRe commented 3 months ago

Running as part of an automated workflow:

# Function to extract album name from KHInsider URL
extract_album_name() {
    local url="$1"
    if [[ "$url" =~ album/([^/]+) ]]; then
        echo "${BASH_REMATCH[1]}"
    else
        echo ""
    fi
}

# Function to call downloader
            album_name=$(extract_album_name "$1")
            download_dir=~/Downloads/KHInsider/"${album_name}"
            mkdir -p "${download_dir}"
            /Library/Frameworks/Python.framework/Versions/3.12/bin/khinsider.py "$1" "${download_dir}/"

I got the following error:

An unexpected error occurred! If it isn't too much to ask, please report to https://github.com/obskyr/khinsider/issues.
Attach the following error message:

Downloading to "/Users/redacted/Downloads/KHInsider/leaf-arrange-sound-track-wasshoy-lfcd-0010/".
Getting song list...
[<File: https://eta.vgmtreasurechest.com/soundtracks/leaf-arrange-sound-track-wasshoy-lfcd-0010/LFCD-0010_01.jpg>, <File: https://eta.vgmtreasurechest.com/soundtracks/leaf-arrange-sound-track-wasshoy-lfcd-0010/LFCD-0010_02.jpg>, <File: https://eta.vgmtreasurechest.com/soundtracks/leaf-arrange-sound-track-wasshoy-lfcd-0010/LFCD-0010_03.jpg>, <File: https://eta.vgmtreasurechest.com/soundtracks/leaf-arrange-sound-track-wasshoy-lfcd-0010/LFCD-0010_04.jpg>, <File: https://eta.vgmtreasurechest.com/soundtracks/leaf-arrange-sound-track-wasshoy-lfcd-0010/LFCD-0010_05.jpg>, <File: https://eta.vgmtreasurechest.com/soundtracks/leaf-arrange-sound-track-wasshoy-lfcd-0010/LFCD-0010_06.jpg>, <File: https://eta.vgmtreasurechest.com/soundtracks/leaf-arrange-sound-track-wasshoy-lfcd-0010/LFCD-0010_07.jpg>, <File: https://eta.vgmtreasurechest.com/soundtracks/leaf-arrange-sound-track-wasshoy-lfcd-0010/LFCD-0010_08.jpg>, <File: https://eta.vgmtreasurechest.com/soundtracks/leaf-arrange-sound-track-wasshoy-lfcd-0010/LFCD-0010_09.jpg>]
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/khinsider.py", line 681, in <module>
    sys.exit(doIt())
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/khinsider.py", line 628, in doIt
    success = download(soundtrack, outPath, formatOrder=formatOrder, verbose=True)
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/khinsider.py", line 457, in download
    return soundtrack.download(path, makeDirs, formatOrder, verbose)
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/khinsider.py", line 371, in download
    if not friendlyDownloadFile(file, path, fileNumber, totalFiles, verbose):
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/khinsider.py", line 220, in friendlyDownloadFile
    unicodePrint("Downloading {}: {}{}...".format(numberStr, filename, byTheWay))
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/khinsider.py", line 151, in unicodePrint
    print(*args, **kwargs)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 22-27: ordinal not in range(128)
2024-08-06 11:07:15 - Error during KHInsider download

The reason I have such a convoluted calling is because I'd like to specify a default download path for the script, but the function of specifying the path doesn't create a subfolder for the given album. Therefore, simply stating "~/Downloads/KHInsider/" as output path puts all the album's mp3 on that folder.