Fix single track download and fixed tidler.conf and edited text and added album search to interactive mode

This commit is contained in:
Medvidek77 2025-03-19 22:47:33 +01:00
parent f37362444e
commit 18b782a1f4
2 changed files with 28 additions and 5 deletions

View file

@ -51,7 +51,14 @@ downloadTrack() {
fi
json_data=$(curl -s "$proxy_url/track/?id=$id&quality=$quality")
if [ "$?" -gt 0 ]; then
echo "Error"
exit 1
fi
track_name=$(echo "$json_data" | jq -r '.[0].title')
artist_name=$(echo "$json_data" | jq -r '.[0].artist.name')
album_name=$(echo "$json_data" | jq -r '.[0].album.title')
url=$(echo "$json_data" | jq -r '.[-1].OriginalTrackUrl')
@ -68,8 +75,12 @@ downloadTrack() {
download_dir="$(pwd)"
fi
final_path="$download_dir/$album_dir"
if [ -z "$album_dir" ]; then
final_path="$download_dir"
else
final_path="$download_dir/$album_dir"
fi
mkdir -p "$final_path"
curl "$url" -o "$final_path/$filename"
@ -181,7 +192,7 @@ searchAlbum() {
}
echo "Welcome to TiDLer -> Tidal music downloader" && echo ""
echo "Welcome to TiDLer!" && echo ""
if [ "$1" = "search" ]; then
if [ "$#" -ge 2 ]; then
@ -200,6 +211,10 @@ elif [ "$1" = "download" ]; then
elif [ "$1" = "album" ]; then
searchAlbum
elif [ "$1" = "help" ]; then
echo "<MODE>"
echo ""
echo "If a valid parameter is provided, the corresponding function executes. Otherwise, TiDLer enters INTERACTIVE mode!"
echo ""
echo "<COMMANDS>"
echo ""
echo "search {text}-optional -> search any song"
@ -210,11 +225,19 @@ elif [ "$1" = "help" ]; then
echo ""
echo "help -> print this message and exit"
else
echo "Choose 1 for download track or 2 for search track and download"
echo "### Choose function! (Enter number) ###"
echo ""
echo "1. Download single track with ID"
echo ""
echo "2. Search single track with text"
echo ""
echo "3. Search and download whole album with text"
read option
if [ "$option" -eq 1 ]; then
downloadTrack
elif [ "$option" -eq 2 ]; then
searchTrack
elif [ "$option" -eq 3 ]; then
searchAlbum
fi
fi

View file

@ -1,5 +1,5 @@
# Default download directory
DOWNLOADS_DIR="~/Music"
DOWNLOADS_DIR="/home/$USER/Music"
# hifi-tui API server URL -> https://github.com/sachinsenal0x64/Hifi-Tui
# You can use "https://tidal.401658.xyz" with cache enabled