diff --git a/.gitea/workflows/build-and-publish.yaml b/.gitea/workflows/build-and-publish.yaml index 77e8b9b..49309d9 100644 --- a/.gitea/workflows/build-and-publish.yaml +++ b/.gitea/workflows/build-and-publish.yaml @@ -56,7 +56,7 @@ jobs: - name: Install system runtime dependencies run: | sudo apt-get update - sudo apt-get install -y python3 python3-pip python3-venv ffmpeg + sudo apt-get install -y python3 python3-pip python3-venv ffmpeg mpv yt-dlp libmpv2 - name: Test install eendoe-repository run: | @@ -90,10 +90,19 @@ jobs: test -f /usr/local/share/ca-certificates/bnhmeijer/bnhmeijer-root-ca.crt echo "bnhmeijer-ca-certificates: OK" + - name: Test install jellyfin-kiosk + run: | + echo "=== Installing jellyfin-kiosk ===" + sudo apt-get install -y ./staging/jellyfin-kiosk-*.deb + dpkg -s jellyfin-kiosk | grep -q "Status: install ok installed" + test -x /usr/bin/jellyfin-kiosk + test -f /usr/lib/systemd/system/jellyfin-kiosk.service + echo "jellyfin-kiosk: OK" + - name: Test package uninstall and cleanup run: | echo "=== Testing package removal ===" - sudo apt-get remove -y eendoe-hyperdeck eendoe-srs eendoe-repository bnhmeijer-ca-certificates + sudo apt-get remove -y eendoe-hyperdeck eendoe-srs eendoe-repository bnhmeijer-ca-certificates jellyfin-kiosk echo "Package removal: OK" publish: diff --git a/sources/jellyfin_kiosk/bin/build.sh b/sources/jellyfin_kiosk/bin/build.sh new file mode 100755 index 0000000..82b3971 --- /dev/null +++ b/sources/jellyfin_kiosk/bin/build.sh @@ -0,0 +1,79 @@ +#!/bin/sh +set -e + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PKG_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" +CLUSTER_ROOT="$(cd "$PKG_ROOT/../../.." && pwd)" + +CONTROL_FILE=$(ls -1 "$PKG_ROOT"/*.control 2>/dev/null | head -n 1) + +if [ -z "$CONTROL_FILE" ]; then + echo "Fout: Geen .control bestand gevonden in $PKG_ROOT" >&2 + exit 1 +fi + +PACKAGE_NAME=$(awk '/^Package: /{print $NF}' "$CONTROL_FILE") +DETECTED_VERSION=$(awk '/^Version: /{print $NF}' "$CONTROL_FILE") + +# Version resolution: CLI arg > ENV var > .control version > default 0.1.0 +if [ -n "$1" ]; then + VERSION="$1" +elif [ -n "$PACKAGE_VERSION" ]; then + VERSION="$PACKAGE_VERSION" +elif [ -n "$VERSION" ]; then + VERSION="$VERSION" +elif [ "$DETECTED_VERSION" != "{VERSION}" ] && [ -n "$DETECTED_VERSION" ]; then + VERSION="$DETECTED_VERSION" +else + VERSION="0.1.0" +fi + +cd "$PKG_ROOT" + +TARGET_BIN="packaging/$PACKAGE_NAME/usr/bin/jellyfin-kiosk" +mkdir -p "packaging/$PACKAGE_NAME/usr/bin" +mkdir -p "packaging/$PACKAGE_NAME/etc/jellyfin-client" +mkdir -p "packaging/$PACKAGE_NAME/usr/lib/systemd/system" + +RELEASE_BIN="$CLUSTER_ROOT/jellyfin-client/jellyfin-kiosk-rs/target/release/jellyfin-kiosk-rs" +if [ -f "$RELEASE_BIN" ]; then + echo "Copying compiled binary from $RELEASE_BIN to $TARGET_BIN..." + cp -f "$RELEASE_BIN" "$TARGET_BIN" + strip -s "$TARGET_BIN" 2>/dev/null || true +elif [ ! -f "$TARGET_BIN" ]; then + echo "Error: Binary not found at $RELEASE_BIN or $TARGET_BIN" >&2 + exit 1 +fi + +# Copy config example if available +if [ -f "$CLUSTER_ROOT/jellyfin-client/config.yaml" ]; then + cp -f "$CLUSTER_ROOT/jellyfin-client/config.yaml" "packaging/$PACKAGE_NAME/etc/jellyfin-client/config.example.yaml" +elif [ -f "$CLUSTER_ROOT/jellyfin-client/config.example.yaml" ]; then + cp -f "$CLUSTER_ROOT/jellyfin-client/config.example.yaml" "packaging/$PACKAGE_NAME/etc/jellyfin-client/config.example.yaml" +fi + +mkdir -p "packaging/$PACKAGE_NAME/DEBIAN" +sed "s/{VERSION}/${VERSION}/" "$CONTROL_FILE" > "packaging/$PACKAGE_NAME/DEBIAN/control" + +ARCH=$(awk '/^Architecture: /{print $NF}' "packaging/$PACKAGE_NAME/DEBIAN/control") +ARCH="${ARCH:-amd64}" +DEB_FILENAME="${PACKAGE_NAME}-${VERSION}_${ARCH}.deb" + +echo "Building package: $PACKAGE_NAME ($VERSION) [$ARCH] -> $DEB_FILENAME" + +# Ensure correct Debian directory permissions +find "packaging/$PACKAGE_NAME" -type d -exec chmod 755 {} + +find "packaging/$PACKAGE_NAME" -type f -exec chmod 644 {} + +find "packaging/$PACKAGE_NAME/usr/bin" -type f -exec chmod 755 {} + 2>/dev/null || true +find "packaging/$PACKAGE_NAME/DEBIAN" -type f -exec chmod 755 {} + 2>/dev/null || true +chmod 644 "packaging/$PACKAGE_NAME/DEBIAN/control" 2>/dev/null || true +if [ -f "packaging/$PACKAGE_NAME/DEBIAN/conffiles" ]; then + chmod 644 "packaging/$PACKAGE_NAME/DEBIAN/conffiles" +fi + +# Build debian binary package +dpkg-deb --build "packaging/$PACKAGE_NAME" "$DEB_FILENAME" + +# Cleanup temporary control file +rm -f "packaging/$PACKAGE_NAME/DEBIAN/control" +echo "Succesvol gebouwd: $DEB_FILENAME" diff --git a/sources/jellyfin_kiosk/jellyfin-kiosk.control b/sources/jellyfin_kiosk/jellyfin-kiosk.control new file mode 100644 index 0000000..002cda9 --- /dev/null +++ b/sources/jellyfin_kiosk/jellyfin-kiosk.control @@ -0,0 +1,10 @@ +Package: jellyfin-kiosk +Version: 0.1.1 +Section: video +Maintainer: Bart Meijer +Architecture: amd64 +Depends: libmpv2, mpv, yt-dlp +Description: Native Jellyfin HTPC Kiosk client with Yatse and YouTube support + High-performance Rust GUI client for Jellyfin, featuring hardware-accelerated + MPV playback, Yatse Kodi JSON-RPC & EventServer emulation, YouTube sharing receiver, + and TV-friendly interface. diff --git a/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/DEBIAN/conffiles b/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/DEBIAN/conffiles new file mode 100644 index 0000000..0f79550 --- /dev/null +++ b/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/DEBIAN/conffiles @@ -0,0 +1 @@ +/etc/jellyfin-client/config.example.yaml diff --git a/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/DEBIAN/postinst b/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/DEBIAN/postinst new file mode 100755 index 0000000..4dafd5f --- /dev/null +++ b/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/DEBIAN/postinst @@ -0,0 +1,14 @@ +#!/bin/sh +set -e + +mkdir -p /etc/jellyfin-client +if [ ! -f /etc/jellyfin-client/config.yaml ] && [ -f /etc/jellyfin-client/config.example.yaml ]; then + cp /etc/jellyfin-client/config.example.yaml /etc/jellyfin-client/config.yaml + chmod 644 /etc/jellyfin-client/config.yaml 2>/dev/null || true +fi + +if [ -d /run/systemd/system ]; then + systemctl daemon-reload || true +fi + +exit 0 diff --git a/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/DEBIAN/postrm b/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/DEBIAN/postrm new file mode 100755 index 0000000..c526783 --- /dev/null +++ b/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/DEBIAN/postrm @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +if [ -d /run/systemd/system ]; then + systemctl daemon-reload || true +fi + +exit 0 diff --git a/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/etc/jellyfin-client/config.example.yaml b/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/etc/jellyfin-client/config.example.yaml new file mode 100644 index 0000000..573be1a --- /dev/null +++ b/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/etc/jellyfin-client/config.example.yaml @@ -0,0 +1,68 @@ +# Jellyfin HTPC Client Configuration + +jellyfin: + # Base URL of your Jellyfin server (can be internal IP or external domain with HTTPS) + server_url: "http://10.2.0.4:8096/jellyfin" + # Login credentials + + username: "bart" + password: "8x5yPgAa" + # Device identification + client_name: "Jellyfin HTPC Client" + device_name: "HTPC Living Room" + device_id: "htpc-living-room-01" + +player: + # Path to mpv binary + mpv_path: "mpv" + # MPV IPC socket location + ipc_socket: "/tmp/mpv-jellyfin.sock" + # Video output & hardware decoding + # Options for hwdec: auto, vaapi (Intel/AMD), nvdec (Nvidia), no + hwdec: "auto" + vo: "gpu" + fullscreen: false + # Audio device (use `mpv --audio-device=help` to list devices) + audio_device: "auto" + # Custom MPV arguments + extra_args: + - "--keep-open=yes" + - "--force-window=immediate" + - "--osd-font=sans-serif" + - "--osd-font-size=28" + +kodi_rpc: + # Emulated Kodi JSON-RPC interface for Yatse and other Kodi remotes + enabled: true + http_port: 8080 + ws_port: 9090 + +web_api: + # Direct REST API and web sharing page + enabled: true + host: "0.0.0.0" + port: 8097 + +youtube: + # Maximum resolution preference for YouTube streaming via yt-dlp + max_height: 1080 + # Automatically extract metadata (title, uploader) using yt-dlp before playback + fetch_metadata: true + # Google OAuth 2.0 Client ID (Google Cloud Console -> APIs -> Credentials, type: TVs and Limited Input / Desktop) + client_id: "612788493042-0070gm71evodaajv02tcl9kjtk9s76au.apps.googleusercontent.com" + client_secret: "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" + # Pad voor het opslaan van de ingelogde YouTube sessie + token_path: "youtube_token.json" + +mqtt: + # Enable MQTT client and Home Assistant auto-discovery + enabled: false + # MQTT broker host/IP + host: "10.2.0.4" + port: 1883 + username: "" + password: "" + # Home Assistant MQTT discovery prefix (default: homeassistant) + discovery_prefix: "homeassistant" + # Base topic prefix for state updates and commands + topic_prefix: "jellyfin-kiosk" diff --git a/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/usr/bin/jellyfin-kiosk b/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/usr/bin/jellyfin-kiosk new file mode 100755 index 0000000..cfc124e Binary files /dev/null and b/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/usr/bin/jellyfin-kiosk differ diff --git a/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/usr/lib/systemd/system/jellyfin-kiosk.service b/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/usr/lib/systemd/system/jellyfin-kiosk.service new file mode 100644 index 0000000..e06e1a9 --- /dev/null +++ b/sources/jellyfin_kiosk/packaging/jellyfin-kiosk/usr/lib/systemd/system/jellyfin-kiosk.service @@ -0,0 +1,18 @@ +[Unit] +Description=Jellyfin HTPC Kiosk & YouTube Receiver +After=network-online.target sound.target graphical-session.target +Wants=network-online.target + +[Service] +Type=simple +User=bart +Environment=DISPLAY=:0 +Environment=WAYLAND_DISPLAY=wayland-0 +ExecStart=/usr/bin/jellyfin-kiosk +WorkingDirectory=/home/bart +Restart=always +RestartSec=3s +LimitNOFILE=65536 + +[Install] +WantedBy=default.target diff --git a/staging/jellyfin-kiosk-0.1.1_amd64.deb b/staging/jellyfin-kiosk-0.1.1_amd64.deb new file mode 100644 index 0000000..733ac35 Binary files /dev/null and b/staging/jellyfin-kiosk-0.1.1_amd64.deb differ