#!/usr/bin/env bash set -euo pipefail # Installer script for Jellyfin HTPC Client on Ubuntu/Debian INSTALL_DIR="/opt/jellyfin-client" CONFIG_DIR="/etc/jellyfin-client" SYSTEMD_SERVICE_FILE="/etc/systemd/system/jellyfin-client.service" echo "==========================================================" echo " Jellyfin HTPC Client & YouTube Receiver Installer " echo "==========================================================" if [ "$EUID" -ne 0 ]; then echo "[-] Please run as root (e.g. sudo ./install.sh)" exit 1 fi CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" echo "[*] Step 1: Installing system dependencies (mpv, yt-dlp, python3)..." apt-get update -qq apt-get install -y -qq mpv yt-dlp python3 python3-venv curl echo "[*] Step 2: Setting up installation directory at ${INSTALL_DIR}..." mkdir -p "${INSTALL_DIR}" cp -ru "${CURRENT_DIR}/src" "${INSTALL_DIR}/" cp -u "${CURRENT_DIR}/requirements.txt" "${INSTALL_DIR}/" cp -u "${CURRENT_DIR}/config.example.yaml" "${INSTALL_DIR}/" echo "[*] Step 3: Creating Python virtual environment..." python3 -m venv "${INSTALL_DIR}/.venv" "${INSTALL_DIR}/.venv/bin/pip" install --upgrade pip -q "${INSTALL_DIR}/.venv/bin/pip" install -r "${INSTALL_DIR}/requirements.txt" -q echo "[*] Step 4: Configuring /etc/jellyfin-client..." mkdir -p "${CONFIG_DIR}" if [ ! -f "${CONFIG_DIR}/config.yaml" ]; then cp "${CURRENT_DIR}/config.example.yaml" "${CONFIG_DIR}/config.yaml" echo "[+] Created default config at ${CONFIG_DIR}/config.yaml" else echo "[i] Existing configuration found at ${CONFIG_DIR}/config.yaml (preserving)" fi echo "[*] Step 5: Installing systemd service..." cp "${CURRENT_DIR}/systemd/jellyfin-client.service" "${SYSTEMD_SERVICE_FILE}" systemctl daemon-reload echo "" echo "==========================================================" echo " Installation Complete! " echo "==========================================================" echo "Next steps:" echo "1. Edit configuration in: ${CONFIG_DIR}/config.yaml" echo " (Set your Jellyfin URL, username, and password)" echo "" echo "2. Enable and start the service:" echo " sudo systemctl enable --now jellyfin-client" echo "" echo "3. Check logs:" echo " sudo journalctl -u jellyfin-client -f" echo "" echo "4. In Yatse:" echo " - Add Media Center -> Kodi -> Enter HTPC IP on port 8080 (for direct YouTube shares & remote)" echo " - Or add your Jellyfin server directly in Yatse and select '${CONFIG_DIR}' as remote player!" echo "=========================================================="