-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Silas Rosenkranz
committed
Mar 7, 2019
0 parents
commit a025451
Showing
138 changed files
with
17,911 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 @@ | ||
APP_PATH=/path/to/spotify-ripper-web/ |
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 @@ | ||
.env |
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,57 @@ | ||
FROM node:10.15.1-alpine AS base | ||
|
||
|
||
###### | ||
# spotify-ripper-docker | ||
###### | ||
|
||
FROM base AS srd | ||
|
||
WORKDIR /spotify-ripper-docker | ||
COPY ./spotify-ripper-docker ./ | ||
|
||
|
||
###### | ||
# spotify-ripper-web-frontend | ||
###### | ||
|
||
FROM base AS srwf | ||
|
||
WORKDIR /spotify-ripper-web-frontend | ||
|
||
COPY ./spotify-ripper-web-frontend/package.json ./ | ||
COPY ./spotify-ripper-web-frontend/yarn.lock ./ | ||
RUN yarn install | ||
|
||
COPY ./spotify-ripper-web-frontend . | ||
RUN yarn run build | ||
|
||
|
||
###### | ||
# spotify-ripper-web-backend | ||
###### | ||
|
||
FROM base AS srwb | ||
|
||
WORKDIR /spotify-ripper-web-backend | ||
|
||
COPY ./spotify-ripper-web-backend/package*.json ./ | ||
RUN npm install | ||
|
||
COPY ./spotify-ripper-web-backend ./ | ||
|
||
|
||
###### | ||
# composed | ||
###### | ||
|
||
FROM base AS release | ||
|
||
COPY --from=srd /spotify-ripper-docker /spotify-ripper-docker | ||
COPY --from=srwf /spotify-ripper-web-frontend /spotify-ripper-web-frontend | ||
COPY --from=srwb /spotify-ripper-web-backend /spotify-ripper-web-backend | ||
|
||
EXPOSE 3000 | ||
|
||
COPY ./entrypoint.sh /entrypoint.sh | ||
ENTRYPOINT [ "sh", "entrypoint.sh" ] |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 hedwiggggg | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,56 @@ | ||
# spotify-ripper-web | ||
## Introduction | ||
|
||
This repository aimed to create an easy-to-use web interface for the spotify-ripper. Archiving this goal I had the following point in the back of my head: | ||
|
||
- Parallel downloads of multiple users | ||
|
||
So I decided on the following project structure: | ||
|
||
spotify-ripper-docker: | ||
- This is just a dockerized version of the spotify-ripper, including some adjustments to better handle the standard data streams and bring them to the web interface. | ||
|
||
spotify-ripper-web-backend: | ||
- This is a node.js application which communicates with the frontend via websockets. | ||
- It creates and starts new containers and forwards the standard data streams to the UI via Websocket. | ||
|
||
spotify-ripper-web-frontend: | ||
- This is a vue.js spa, communicating with the node.js backend; Here you can also finally download the music. | ||
|
||
## Things that aren't so beautiful: | ||
|
||
- The project actually consists of three projects, which would probably have been much more intelligent to separate. | ||
- No TDD; not even the vue.js project | ||
- Implemented the spotify-ripper as a zip file; this would also be a separate project... | ||
- Not as much use of environment vars as I should have; there are some things hardcoded, like the websocket port | ||
- Not the worst and ugliest code; but alsonot the cleanest one.. | ||
|
||
## Installation | ||
|
||
The installation should be quite simple by dockerization. | ||
|
||
### Prequesites | ||
|
||
1. Installing docker and docker-compose | ||
2. rename `.env.example` to `.env` and change the path according tr environment. | ||
3. add your `spotify_appkey.key` to the `spotify-ripper-docker` folder | ||
4. (adjust `docker-compose.yml` to mount your docker.sock) | ||
|
||
### Run the application | ||
|
||
To do this you can simply run `docker-compose up --build` (Depending on how you configured Docker, sudo may be required) | ||
|
||
FYI: This whole repo is optimized and tested on Ubuntu 18.04. | ||
|
||
If all went well, it should look something like this: (remember that port 3000 is in the container and mapped outside by your adjustments in the `docker-compose.yml`) | ||
|
||
![Console](/screenshots/screenshot_1.png "Console") | ||
|
||
Then you should be able to access it by `http://localhost:<your_port>/web/` | ||
|
||
## Screenshots | ||
|
||
![spotify-ripper web-ui](/screenshots/screenshot_2.png "spotify-ripper web-ui") | ||
![spotify-ripper web-ui](/screenshots/screenshot_3.png "spotify-ripper web-ui") | ||
![spotify-ripper web-ui](/screenshots/screenshot_4.png "spotify-ripper web-ui") | ||
![spotify-ripper web-ui](/screenshots/screenshot_5.png "spotify-ripper web-ui") |
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,18 @@ | ||
version: "3.7" | ||
|
||
services: | ||
spotify-ripper-web: | ||
build: ./ | ||
|
||
restart: unless-stopped | ||
|
||
ports: | ||
- "80:3000" | ||
- "81:3300" | ||
|
||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- ./ripped_music:/ripped_music | ||
|
||
environment: | ||
APP_PATH: ${APP_PATH} |
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,23 @@ | ||
#!/bin/sh | ||
|
||
pid_node=0 | ||
|
||
term_handler() { | ||
if [ $pid_node -ne 0 ]; then | ||
kill -SIGTERM "$pid_node" | ||
wait "$pid_node" | ||
fi | ||
|
||
exit 130; | ||
} | ||
|
||
trap term_handler INT TERM | ||
|
||
node ./spotify-ripper-web-backend/app.js & | ||
pid_node="$!" | ||
|
||
while true | ||
do | ||
sleep 1 | ||
|
||
done |
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,2 @@ | ||
* | ||
!.gitignore |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
README.md |
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 @@ | ||
spotify_appkey.key |
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,43 @@ | ||
FROM debian:stretch-slim | ||
|
||
ENV LANG C.UTF-8 | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# Install packages | ||
RUN apt-get update -qy && apt-get upgrade -qy | ||
RUN apt-get install nano wget lame build-essential libffi-dev python-pip python-dev python3-dev python3-pip libffi-dev -y | ||
|
||
WORKDIR /dependencies | ||
|
||
# Download libspotify & compile it | ||
COPY ./dependencies/libspotify-12.1.51-Linux-x86_64-release.tar.gz ./libspotify-12.1.51-Linux-x86_64-release.tar.gz | ||
RUN tar xvf libspotify-12.1.51-Linux-x86_64-release.tar.gz && \ | ||
rm -f libspotify-12.1.51-Linux-x86_64-release.tar.gz && \ | ||
cd libspotify-12.1.51-Linux-x86_64-release && \ | ||
make install prefix=/usr/local | ||
|
||
# Install required tools for support for AAC (M4A container) | ||
COPY ./dependencies/libfdk-aac-dev_0.1.4-2+b1_amd64.deb ./libfdk-aac-dev_0.1.4-2+b1_amd64.deb | ||
COPY ./dependencies/libfdk-aac1_0.1.4-2+b1_amd64.deb ./libfdk-aac1_0.1.4-2+b1_amd64.deb | ||
RUN apt-get install pkg-config automake autoconf -y && \ | ||
dpkg -i libfdk-aac1_0.1.4-2+b1_amd64.deb && dpkg -i libfdk-aac-dev_0.1.4-2+b1_amd64.deb | ||
|
||
# Compile libfdk-aac encoder | ||
COPY ./dependencies/v0.6.2.tar.gz ./v0.6.2.tar.gz | ||
RUN tar xvf v0.6.2.tar.gz && \ | ||
rm -f v0.6.2.tar.gz && cd fdkaac-0.6.2 && \ | ||
autoreconf -i && ./configure && make install | ||
|
||
# Install a fork of spotify-ripper | ||
COPY ./dependencies/spotify-ripper-morgaroth-2.9.6.tar.gz ./spotify-ripper-morgaroth-2.9.6.tar.gz | ||
RUN pip3 install spotify-ripper-morgaroth-2.9.6.tar.gz | ||
|
||
WORKDIR / | ||
|
||
# Link our download location to /data in the container | ||
VOLUME ["/ripped_music"] | ||
|
||
# Copy needed files for spotify-ripper | ||
COPY ./spotify_appkey.key /root/.spotify-ripper/spotify_appkey.key | ||
COPY ./config.ini /root/.spotify-ripper/config.ini |
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,30 @@ | ||
> A Debian Stretch (slim) image with python, pip, libspotify and spotify-ripper | ||
## Prereqs | ||
1. Install Docker and make sure the Docker daemon is running. | ||
2. Place your libspotify appkey in the directory you're going to build from | ||
3. Modify the config if needed | ||
|
||
## Installation | ||
1. `git clone https://github.com/thibmaek/spotify-ripper-docker` | ||
2. Add username & password in the `config.ini` file in this repo | ||
3. `docker build -t spotify-ripper .` | ||
4. `docker run -itd -v /home/user/download:/data --name spotify-ripper spotify-ripper` | ||
|
||
## Ripping | ||
Default config will use the liblamemp3 encoder to rip to a MP3 container at 320kbps. | ||
You can also rip to M4A (AAC) using the libfdk-aac encoder which is compiled into this image. | ||
The spotify-ripper-morgaroth pip package embedded in this image will however 'monkey-patch' an M4A bug which makes it really incompatible with iTunes and causes iTunes to hang or crash when adding new files to the library. Use with caution! | ||
|
||
Once the container is running, use docker exec to start ripping: | ||
|
||
```bash | ||
# You can add --remove-offline-cache to remove the libspotify offline cache and save disk space | ||
# and avoid Docker storage conflicts. | ||
|
||
# Running this will run the output in the current terminal window | ||
docker exec spotify-ripper spotify-ripper spotify:album:… --remove-offline-cache | ||
|
||
# Running this will run it detached in the background so you don't need to keep a terminal open | ||
docker exec -d spotify-ripper spotify-ripper spotify:album:… | ||
``` |
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,10 @@ | ||
[main] | ||
bitrate = 320 | ||
cbr = True | ||
cover_file_and_embed = album_cover.jpg | ||
directory = /ripped_music | ||
format = {album}/{disc_num}{track_num:2} - {artist} - {track_name}.{ext} | ||
grouping = {label} | ||
normalize = True | ||
quality = 320 | ||
partial_check = strict |
Binary file added
BIN
+39.4 KB
spotify-ripper-docker/dependencies/libfdk-aac-dev_0.1.4-2+b1_amd64.deb
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.5 MB
spotify-ripper-docker/dependencies/libspotify-12.1.51-Linux-x86_64-release.tar.gz
Binary file not shown.
Binary file added
BIN
+47.8 KB
spotify-ripper-docker/dependencies/spotify-ripper-morgaroth-2.9.6.tar.gz
Binary file not shown.
Binary file not shown.
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 @@ | ||
node_modules |
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 @@ | ||
node_modules |
Oops, something went wrong.