yt-dlf/start.sh

47 lines
2.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# yt-dlf startup script
#
# Environment variables:
# PORT Port to listen on (default: 3000)
# ORIGIN Public URL of this server, e.g. http://myserver:3000 (required in production)
# YTDLP_PATH Path to yt-dlp binary (default: yt-dlp, must be on PATH)
# FFMPEG_PATH Path to ffmpeg binary (default: ffmpeg, must be on PATH)
#
# DOWNLOAD_DIR Directory where downloaded files are stored (default: ~/YouTube)
#
# ZIP_AND_SEND Set to "true" to ZIP the downloaded files and offer them as a
# browser download instead of (only) saving them on the server.
# A random prefix is added to the directory name to avoid collisions
# when multiple users download the same video simultaneously.
# (default: false)
#
# DELETE_AFTER_SEND When ZIP_AND_SEND=true: delete the files from the server after
# the ZIP has been sent to the browser. (default: false)
#
# DELETE_DELAY Seconds to wait before deleting files after the ZIP has been sent.
# Only relevant when DELETE_AFTER_SEND=true. (default: 0)
#
# ZIP_EXTRA_DIR Optional directory whose files are added to every ZIP alongside
# the downloaded files. Subdirectory structure within ZIP_EXTRA_DIR
# is preserved. Only used when ZIP_AND_SEND=true. (default: none)
#
# USERS_FILE Path to the user database file. (default: users.txt next to start.sh)
# Manage users with: python3 scripts/add_user.py <username> <password>
#
# ADS_DIR Directory containing ads-left.html and ads-right.html.
# (default: same directory as start.sh)
export PORT="${PORT:-3000}"
export ORIGIN="${ORIGIN:-http://localhost:${PORT}}"
# Uncomment and adjust the lines below to configure:
# export DOWNLOAD_DIR="$HOME/YouTube"
# export ZIP_AND_SEND="false"
# export ZIP_EXTRA_DIR="/path/to/extra/files"
# export DELETE_AFTER_SEND="false"
# export DELETE_DELAY="0"
# export USERS_FILE="$(dirname "$0")/users.txt"
# export ADS_DIR="$(dirname "$0")"
exec node build/index.js