-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create Dockerfile Creating a basic Dockerfile so spotify_dl can be shipped as an image * Create bulk downloading script for Docker Creating a bash script for parallel bulk downloading of Spotify playlists. * Update GETTING_STARTED to include Docker instructions
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Use an official Python runtime as a base image | ||
FROM python:3.8-slim | ||
|
||
# Install any needed packages specified in requirements.txt | ||
RUN apt-get update | ||
RUN apt-get install -y ffmpeg | ||
RUN pip3 install spotify_dl --upgrade | ||
|
||
# Define environment variable | ||
ENV SPOTIPY_CLIENT_ID= | ||
ENV SPOTIPY_CLIENT_SECRET= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/sh | ||
|
||
# Information: The docker image has to be previously built and tagged with spotify_dl[:latest] | ||
# Use 'docker build -t spotify_dl .' inside the project directory to build the Docker container | ||
|
||
# Specify download location, use pwd for current directory | ||
location="`pwd`" | ||
|
||
# Declare list with playlists to download | ||
declare -a playlists=( \ | ||
"https://open.spotify.com/PLAYLIST_LINK" "Playlist Name" \ | ||
"https://open.spotify.com/PLAYLIST_LINK" "Playlist Name" \ | ||
) | ||
|
||
# Set client ID and secret | ||
client_id=sampleid123 | ||
client_secret=samplesecret123 | ||
|
||
arraylength=${#playlists[@]} | ||
|
||
for (( i=1; i<${arraylength}+1; i=i+2 )); | ||
do | ||
echo "Downloading playlist: ${playlists[$i-1]}" | ||
path="$location/${playlists[$i]}" | ||
echo "Creating dir: $path" | ||
mkdir -p "$path" | ||
echo "Starting container: " $(echo "spotify_dl-${playlists[$i]//[^[:alnum:]]/}" | sed 's/ä/ae/;s/ö/oe/;s/ü/ue/;s/ß/ss/g') | ||
docker run -d --rm --name $(echo "spotify_dl-${playlists[$i]//[^[:alnum:]]/}" | sed 's/ä/ae/;s/ö/oe/;s/ü/ue/;s/ß/ss/g') \ | ||
-e SPOTIPY_CLIENT_ID=$client_id \ | ||
-e SPOTIPY_CLIENT_SECRET=$client_secret \ | ||
-v "$location":/download \ | ||
spotify_dl \ | ||
spotify_dl -l "${playlists[$i-1]}" -o /download & | ||
done |