Compare commits

...

12 commits

4 changed files with 85 additions and 13 deletions

View file

@ -0,0 +1,18 @@
# Maintainer: Medvidek77 <medvidek77@tuta.io>
pkgname=tidler
pkgver=0.1
pkgrel=1
pkgdesc="Tidal music downloader based on the hifi-tui API"
arch=('any')
url="https://medvidek77.tech/Medvidek77/tidler"
license=('BSD3-Clause')
depends=('bash' 'curl' 'jq')
source=("git+$url.git#branch=stable")
sha256sums=('SKIP')
package() {
cd "$srcdir/$pkgname"
install -Dm755 src/tidler "$pkgdir/usr/bin/tidler"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

13
scripts/universal/install.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
if [ "$EUID" -ne 0 ]; then
echo "Please run script as root"
exit 1
else
if [ ! -f /bin/tidler ]; then
install -m 755 ../../src/tidler /bin/tidler
else
echo "TiDLer is already installed"
fi
fi

12
scripts/universal/update.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
if [ "$EUID" -ne 0 ]; then
echo "Please run script as root"
exit 1
else
if [ -f /bin/tidler ]; then
cd ../../
git pull
install -m 755 src/tidler /bin/tidler
fi
fi

55
src/tidler Normal file → Executable file
View file

@ -1,8 +1,13 @@
#!/bin/bash
downloadTrack() {
echo "Downloading track with ID: $1"
id="$1"
if [ "$#" -ge 1 ]; then
echo "Downloading track with 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")
track_name=$(echo "$json_data" | jq -r '.[0].title')
artist_name=$(echo "$json_data" | jq -r '.[0].artist.name')
@ -14,8 +19,12 @@ downloadTrack() {
}
searchTrack() {
echo "Enter track name:"
read -r track_name
if [ "$#" -ge 1 ]; then
track_name="$1"
else
echo "Enter track name:"
read -r track_name
fi
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)"')
@ -24,6 +33,11 @@ searchTrack() {
tracks_list+=("$list")
done <<< "$tracks"
if [ "${#tracks_list[@]}" -eq 1 ]; then
echo "No tracks found :("
exit 1
fi
PS3="Please select a track: "
select t in "${tracks_list[@]}"; do
if [ -n "$t" ]; then
@ -37,14 +51,29 @@ searchTrack() {
done
}
echo "Welcome to Tidal music downloader"
echo ""
echo "Choose: 1 = download ; 2 = search"
read option
if [ "$option" -eq 1 ]; then
downloadTrack
elif [ "$option" -eq 2 ]; then
searchTrack
echo "Welcome to TiDLer -> Tidal music downloader" && echo ""
if [ "$1" = "search" ]; then
if [ "$#" -ge 2 ]; then
shift
jsw="$*"
searchTrack "$jsw"
else
searchTrack
fi
elif [ "$1" = "download" ]; then
if [ "$#" -ge 2 ]; then
downloadTrack "$2"
else
downloadTrack
fi
else
echo "Choose 1 for download track or 2 for search track and download"
read option
if [ "$option" -eq 1 ]; then
downloadTrack
elif [ "$option" -eq 2 ]; then
searchTrack
fi
fi