From a74feeb67e907d266cac2949f16a4ab93411f4bc Mon Sep 17 00:00:00 2001 From: SBCrumb Date: Mon, 22 Sep 2025 10:03:59 -0400 Subject: [PATCH] udpates to flow and nfo manager for TV --- .gitea/workflows/ci-dev.yml | 1 + .gitea/workflows/ci.yml | 1 + Dockerfile | 10 +++++++++- core/nfo_manager.py | 7 +++++++ 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci-dev.yml b/.gitea/workflows/ci-dev.yml index 718327f..fa44ee1 100644 --- a/.gitea/workflows/ci-dev.yml +++ b/.gitea/workflows/ci-dev.yml @@ -96,6 +96,7 @@ jobs: echo "Building DEV image with layer caching..." docker build \ $CACHE_ARGS \ + --build-arg GIT_BRANCH=dev \ --tag nfoguard:dev \ --tag nfoguard:dev-${{ github.sha }} \ --tag "$CACHE_IMAGE" \ diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 9398ee0..ae112d9 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -99,6 +99,7 @@ jobs: echo "Building with layer caching..." docker build \ $CACHE_ARGS \ + --build-arg GIT_BRANCH=main \ --tag nfoguard:latest \ --tag nfoguard:${{ github.sha }} \ --tag "$CACHE_IMAGE" \ diff --git a/Dockerfile b/Dockerfile index 573c48b..b48c511 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,13 @@ FROM python:3.11-slim +# Build argument for git branch +ARG GIT_BRANCH=main + # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ - PYTHONIOENCODING=utf-8 + PYTHONIOENCODING=utf-8 \ + GIT_BRANCH=${GIT_BRANCH} # Install system dependencies including PostgreSQL client libraries RUN apt-get update && apt-get install -y \ @@ -24,6 +28,10 @@ RUN pip install --no-cache-dir --upgrade pip && \ # Copy application code COPY . . +# Create git metadata for version detection based on build arg +RUN mkdir -p .git && \ + echo "ref: refs/heads/${GIT_BRANCH}" > .git/HEAD + # Copy DLL to a dedicated directory and create entrypoint script RUN mkdir -p /app/emby-plugin && \ cp /app/Emby-DLL/NFOGuard.Emby.Plugin.dll /app/emby-plugin/ && \ diff --git a/core/nfo_manager.py b/core/nfo_manager.py index faf8ba5..1fd370f 100644 --- a/core/nfo_manager.py +++ b/core/nfo_manager.py @@ -466,6 +466,13 @@ class NFOManager: # Important: DO NOT remove content fields like title, plot, runtime, premiered, etc. # These should be preserved from the long-named NFO files + + # Debug: Show what fields are preserved after removing NFOGuard fields + preserved_fields = [elem.tag for elem in episode] + if preserved_fields: + print(f" 🔍 Content preserved after cleanup: {', '.join(preserved_fields)}") + else: + print(f" ⚠️ No content fields found after cleanup!") except (ET.ParseError, ValueError) as e: print(f"⚠️ Corrupted episode NFO detected: {nfo_path} - {str(e)[:100]}...")