commit
b071f74a7f
@ -0,0 +1,2 @@
|
||||
lib/*
|
||||
.login.auth
|
@ -0,0 +1,3 @@
|
||||
sp_id=""
|
||||
sp_password=""
|
||||
sp_token=""
|
Binary file not shown.
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ ! $(which python) ]]; then
|
||||
if [[ ! $(which pyenv) ]]; then
|
||||
echo "pyenv installation..."
|
||||
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
|
||||
echo "Restat terminal and relaunch this install script"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
pyenv install 3.9.6
|
||||
pyenv global 3.9.6
|
||||
fi
|
||||
|
||||
sudo apt install lame build-essential libffi-dev
|
||||
wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add - #add mopidy's libspotify repository
|
||||
sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/stretch.list #valid for Debian Stretch.
|
||||
sudo apt update && sudo apt install libspotify12 libspotify-dev python-spotify #install libspotify from mopidy's repository
|
||||
mkdir -p lib
|
||||
cp .login.auth.template .login.auth
|
||||
chmod 600 .login.auth
|
||||
|
||||
git clone https://github.com/lavolp3/spotify-ripper.git lib/spotify-ripper && cd lib/spotify-ripper && python setup.py install
|
||||
pyenv rehash
|
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
|
||||
output="/mnt/e/Musique"
|
||||
format="{artist} - {track_name}.{ext}"
|
||||
|
||||
[[ ! $1 ]] && echo "Please give a search" && exit 1
|
||||
source .login.auth
|
||||
|
||||
track=$(echo "$@" | sed 's/ /%20/g ')
|
||||
|
||||
if [[ $(echo "$track" | grep "open.spotify.com") ]]; then
|
||||
link="$track"
|
||||
[[ $(echo "$link" | grep "open.spotify.com/album") ]] && format="{artist} - {album}/{track_name}.{ext}"
|
||||
else
|
||||
link=$(curl -sX "GET" "https://api.spotify.com/v1/search?q=$track&type=track" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer $sp_token" | jq -r '.[].items[0].external_urls.spotify')
|
||||
fi
|
||||
|
||||
SPOTIPY_CLIENT_ID="" SPOTIPY_CLIENT_SECRET="" SPOTIPY_REDIRECT_URI="" python lib/spotify_ripper/main.py -k .spotify_appkey.key -u "$sp_id" -p "$sp_password" $link -f "$output/$format"
|
Loading…
Reference in new issue