Edit lib location; Add .env file wirh sourcing

This commit is contained in:
poka 2022-05-07 13:47:41 +02:00
parent 2702e818a2
commit b92d101a8c
5 changed files with 8 additions and 6 deletions

.env.template Normal file
View File

@ -0,0 +1,2 @@
format="{artist} - {track_name}.{ext}"

.gitignore vendored
View File

@ -1,2 +1,3 @@

View File

@ -4,6 +4,7 @@
This is not a youtube scrapper. This is a real Spotify music downloader, to mp3 320kb/s 44100 Hz, no DRM, with good tags.
**You will need a premium account to Spotify and set your ids in `.login.auth` file.**
You should also edit `.env` file to configure your tracks output format and location.
If you want to use keywords search, you will also need a developer token, set to the same file (TODO: bypass this token).
You can get this token here: https://developer.spotify.com/console/get-search-item/, but this one expire after one hour...

View File

@ -17,8 +17,8 @@ wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add - #add mopidy'
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
[[ ! -f .login.auth ]] && cp .login.auth.template .login.auth && chmod 600 .login.auth
[[ ! -f .env ]] && cp .env.template .env
git clone https://github.com/lavolp3/spotify-ripper.git lib/spotify-ripper && cd lib/spotify-ripper && python setup.py install
pyenv rehash

View File

@ -1,10 +1,8 @@
format="{artist} - {track_name}.{ext}"
[[ ! $1 ]] && echo "Please give a search" && exit 1
source .login.auth
source .env
track=$(echo "$@" | sed 's/ /%20/g ')
@ -15,4 +13,4 @@ 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')
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"
SPOTIPY_CLIENT_ID="" SPOTIPY_CLIENT_SECRET="" SPOTIPY_REDIRECT_URI="" python lib/spotify_ripper/spotify_ripper/main.py -k .spotify_appkey.key -u "$sp_id" -p "$sp_password" $link -f "$output/$format"