Compare commits
2 commits
e28ec85013
...
7ec9a84749
Author | SHA1 | Date | |
---|---|---|---|
7ec9a84749 | |||
af01ea56fd |
1 changed files with 37 additions and 12 deletions
39
src/tidler
39
src/tidler
|
@ -1,8 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
downloadTrack() {
|
downloadTrack() {
|
||||||
|
if [ "$#" -ge 1 ]; then
|
||||||
echo "Downloading track with ID: $1"
|
echo "Downloading track with ID: $1"
|
||||||
id="$1"
|
id="$1"
|
||||||
|
else
|
||||||
|
echo "Enter track ID:"
|
||||||
|
read -r id
|
||||||
|
fi
|
||||||
json_data=$(curl -s "https://tidal.401658.xyz/track/?id=$id&quality=LOSSLESS")
|
json_data=$(curl -s "https://tidal.401658.xyz/track/?id=$id&quality=LOSSLESS")
|
||||||
track_name=$(echo "$json_data" | jq -r '.[0].title')
|
track_name=$(echo "$json_data" | jq -r '.[0].title')
|
||||||
artist_name=$(echo "$json_data" | jq -r '.[0].artist.name')
|
artist_name=$(echo "$json_data" | jq -r '.[0].artist.name')
|
||||||
|
@ -14,8 +19,12 @@ downloadTrack() {
|
||||||
}
|
}
|
||||||
|
|
||||||
searchTrack() {
|
searchTrack() {
|
||||||
|
if [ "$#" -ge 1 ]; then
|
||||||
|
track_name="$1"
|
||||||
|
else
|
||||||
echo "Enter track name:"
|
echo "Enter track name:"
|
||||||
read -r track_name
|
read -r track_name
|
||||||
|
fi
|
||||||
track_name=$(echo "$track_name" | sed 's/ /%20/g')
|
track_name=$(echo "$track_name" | sed 's/ /%20/g')
|
||||||
tracks=$(curl -s "https://tidal.401658.xyz/search/?s=$track_name" | jq -r '.items[] | "\(.id) - \(.title) by \(.artist.name)"')
|
tracks=$(curl -s "https://tidal.401658.xyz/search/?s=$track_name" | jq -r '.items[] | "\(.id) - \(.title) by \(.artist.name)"')
|
||||||
|
|
||||||
|
@ -24,7 +33,7 @@ searchTrack() {
|
||||||
tracks_list+=("$list")
|
tracks_list+=("$list")
|
||||||
done <<< "$tracks"
|
done <<< "$tracks"
|
||||||
|
|
||||||
PS3="Please select a track: "
|
PS3="Please select a track:"
|
||||||
select t in "${tracks_list[@]}"; do
|
select t in "${tracks_list[@]}"; do
|
||||||
if [ -n "$t" ]; then
|
if [ -n "$t" ]; then
|
||||||
track_id=$(echo "$t" | awk -F ' - ' '{print $1}')
|
track_id=$(echo "$t" | awk -F ' - ' '{print $1}')
|
||||||
|
@ -39,12 +48,28 @@ searchTrack() {
|
||||||
|
|
||||||
echo "Welcome to Tidal music downloader"
|
echo "Welcome to Tidal music downloader"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Choose: 1 = download ; 2 = search"
|
|
||||||
read option
|
if [ "$1" = "search" ]; then
|
||||||
if [ "$option" -eq 1 ]; then
|
if [ "$#" -ge 2 ]; then
|
||||||
downloadTrack
|
shift
|
||||||
elif [ "$option" -eq 2 ]; then
|
jsw="$*"
|
||||||
|
searchTrack "$jsw"
|
||||||
|
else
|
||||||
searchTrack
|
searchTrack
|
||||||
|
fi
|
||||||
|
elif [ "$1" = "download" ]; then
|
||||||
|
if [ "$#" -ge 2 ]; then
|
||||||
|
downloadTrack "$2"
|
||||||
|
else
|
||||||
|
downloadTrack
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Choose: 1 = download ; 2 = search"
|
||||||
|
read option
|
||||||
|
if [ "$option" -eq 1 ]; then
|
||||||
|
downloadTrack
|
||||||
|
elif [ "$option" -eq 2 ]; then
|
||||||
|
searchTrack
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue