Last active
January 24, 2024 08:58
-
-
Save jee-r/a4a7e30f199beb6dfd552be36b74b24a to your computer and use it in GitHub Desktop.
Wach Dir for betanin
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
version: '3' | |
services: | |
betanin: | |
image: ghcr.io/jee-r/beets:main | |
container_name: betanin | |
hostname: betanin | |
user: 1000:1000 | |
ports: | |
- 4030:4030 | |
environment: | |
- MODE=betanin | |
- BETANIN_HOST=0.0.0.0 | |
- BETANIN_PORT=4030 | |
- UMASK_SET=022 | |
- TZ=Europe/Paris | |
volumes: | |
- ./betanin/config/:/config | |
- /torrents:/torrents | |
- /Media/Music:/Media/Music | |
watcher: | |
container_name: beet_watcher | |
image: ghcr.io/jee-r/watcher:main | |
build: ./ | |
user: 1000:1000 | |
environment: | |
- UMASK_SET=022 | |
- TZ=Europe/Paris | |
- BETANIN_API_KEY=REDACTED | |
- BETANIN_API_URL=http://betanin:4030/api/torrents | |
- WATCH_DIR=/Media/Music/Unsorted/ | |
volumes: | |
- /Media/Music:/Media/Music | |
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
FROM alpine:3.19 | |
ENV WATCH_DIR \ | |
BETANIN_API_KEY \ | |
BETANIN_API_URL | |
RUN apk update ; \ | |
apk upgrade ; \ | |
apk add --no-cache \ | |
curl \ | |
inotify-tools ; \ | |
rm -rf /tmp/* /var/cache/apk/* | |
COPY ./entrypoint /usr/local/bin/entrypoint | |
CMD ["/usr/local/bin/entrypoint"] |
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
#!/bin/sh | |
inotifywait -m -e create,moved_to --format '%w%f' "$WATCH_DIR" | while IFS= read -r dir_path; do | |
sleep 20s | |
response=$(curl --silent --output /dev/null --request POST --data-urlencode "both=$dir_path" --header "Accept: application/json" --header "X-API-Key: $BETANIN_API_KEY" "$BETANIN_API_URL") | |
echo $response | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment