# 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.
Running as part of an automated workflow:
I got the following error:
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.