#!/bin/bash echo "Building NFOGuard Emby Plugin..." # Check if we need to install .NET Framework support if ! command -v dotnet &> /dev/null; then echo "ERROR: .NET SDK not found. Installing..." echo "Run: sudo apt update && sudo apt install -y dotnet-sdk-6.0" exit 1 fi # Create EmbySDK directory if it doesn't exist if [ ! -d "../EmbySDK" ]; then echo "Creating EmbySDK directory..." mkdir -p ../EmbySDK echo "" echo "IMPORTANT: You need to copy Emby SDK DLLs to ../EmbySDK/" echo "Required files:" echo " - MediaBrowser.Common.dll" echo " - MediaBrowser.Controller.dll" echo " - MediaBrowser.Model.dll" echo "" echo "These can be found in your Emby Server installation directory." echo "Continue? (y/n)" read -r answer if [[ $answer != "y" ]]; then echo "Build cancelled. Please copy SDK files first." exit 1 fi fi # Clean previous builds rm -rf bin obj # Try building with dotnet first (requires SDK), fall back to msbuild if command -v dotnet &> /dev/null; then echo "Building with .NET CLI..." dotnet build NFOGuard.Emby.Plugin.csproj -c Release -f net48 elif command -v msbuild &> /dev/null; then echo "Building with MSBuild..." msbuild NFOGuard.Emby.Plugin.csproj /p:Configuration=Release /p:Platform="Any CPU" else echo "ERROR: No build tool found. Install .NET SDK or Mono with MSBuild." exit 1 fi if [ $? -eq 0 ]; then echo echo "Build successful!" echo "Plugin DLL location: bin/Release/net48/NFOGuard.Emby.Plugin.dll" echo # Create plugin-release directory in repo root and copy DLL PLUGIN_RELEASE_DIR="../plugin-release" mkdir -p "$PLUGIN_RELEASE_DIR" cp "bin/Release/net48/NFOGuard.Emby.Plugin.dll" "$PLUGIN_RELEASE_DIR/" echo "Plugin copied to: $PLUGIN_RELEASE_DIR/NFOGuard.Emby.Plugin.dll" echo echo "To install:" echo "1. Copy plugin-release/NFOGuard.Emby.Plugin.dll to your Emby plugins folder" echo "2. Restart Emby Server" echo else echo echo "Build failed! Check the output above for errors." echo fi