docker and youtube, docs

This commit is contained in:
Ondrej Zara 2019-10-29 08:49:04 +01:00
parent 3c0b41ab7f
commit 8add38bee4
6 changed files with 31 additions and 4 deletions

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
node_modules node_modules
_youtube _youtube/*
!_youtube/.empty
cyp.service cyp.service

View file

@ -1,6 +1,7 @@
FROM node:10 FROM node:10
RUN curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
RUN chmod a+rx /usr/local/bin/youtube-dl
WORKDIR /cyp WORKDIR /cyp
RUN ["mkdir", "_youtube"]
COPY package.json . COPY package.json .
RUN npm i RUN npm i
COPY index.js . COPY index.js .

View file

@ -27,4 +27,10 @@ watch: all
clean: clean:
rm -f $(SERVICE) $(CSS) rm -f $(SERVICE) $(CSS)
docker-image:
docker build -t cyp .
docker-run:
docker run --network=host -v "$$(pwd)"/_youtube:/cyp/_youtube cyp
.PHONY: all watch icons service clean .PHONY: all watch icons service clean

View file

@ -38,6 +38,25 @@ docker build -t cyp .
docker run --network=host cyp docker run --network=host cyp
``` ```
## Youtube-dl integration
You will need a working [youtube-dl](https://ytdl-org.github.io/youtube-dl/index.html) installation. Audio files are downloaded into the `_youtube` directory, so make sure it is available to your MPD library (use a symlink).
If you use Docker, you need to mount the `_youtube` directory into the image:
```sh
docker run --network=host -v "$(pwd)"/_youtube:/cyp/_youtube cyp
```
## Changing the port
...is done via the `PORT` environment variable. If you use Docker, the `-e` switch does the trick:
```sh
docker run --network=host -e PORT=12345 cyp
```
## Technology ## Technology
- Connected to MPD via WebSockets (using the [ws2mpd](https://github.com/ondras/ws2mpd/) bridge) - Connected to MPD via WebSockets (using the [ws2mpd](https://github.com/ondras/ws2mpd/) bridge)
@ -53,5 +72,5 @@ docker run --network=host cyp
## TODO ## TODO
- [ ] Bundling - [ ] Bundling
- [ ] Range styling - [X] Range styling
- [ ] Browser testing - [ ] Browser testing

0
_youtube/.empty Normal file
View file

View file

@ -1,6 +1,6 @@
const static = require("node-static"); const static = require("node-static");
const app = new static.Server("./app"); const app = new static.Server("./app");
const port = Number(process.argv[2]) || 8080; const port = Number(process.argv[2]) || process.env.PORT || 8080;
let tickets = []; let tickets = [];