From a91de68a5cc1cde27ca113726e8d07e19efb9cd7 Mon Sep 17 00:00:00 2001 From: Lex Rivera Date: Wed, 18 Feb 2026 18:09:44 +0300 Subject: [PATCH] Add instance id support (#2828) * Add instance id support * actually use env variable for instance ID * Default to ersatztv.org for instance id * simplify * fix ordering * update changelog --------- Co-authored-by: Jason Dove <1695733+jasongdove@users.noreply.github.com> --- CHANGELOG.md | 2 ++ ErsatzTV.Core/Iptv/ChannelIdentifier.cs | 5 ++++- ErsatzTV.Core/SystemEnvironment.cs | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3172de29b..22dffa159 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - This controls how many (optional) seconds of black video and silent audio to insert between *every* playout item - This will drift playback from the wall clock as slugs are not scheduled in the playout, but are inserted dynamically during playback - If this feature turns out to be popular, methods to correct the drift may be investigated +- Add `ETV_INSTANCE_ID` environment variable to disambiguate EPG data from multiple ErsatzTV instances + - When set, the value will be used in channel identifiers before the final `.ersatztv.org` ### Changed - Move dark/light mode toggle to **Settings** > **UI** diff --git a/ErsatzTV.Core/Iptv/ChannelIdentifier.cs b/ErsatzTV.Core/Iptv/ChannelIdentifier.cs index caa2c733e..e2e672142 100644 --- a/ErsatzTV.Core/Iptv/ChannelIdentifier.cs +++ b/ErsatzTV.Core/Iptv/ChannelIdentifier.cs @@ -17,6 +17,9 @@ public static class ChannelIdentifier number /= 10; } - return $"C{channelNumber}.{id}.ersatztv.org"; + string instanceId = SystemEnvironment.InstanceId; + return !string.IsNullOrWhiteSpace(instanceId) + ? $"C{channelNumber}.{id}.{instanceId}.ersatztv.org" + : $"C{channelNumber}.{id}.ersatztv.org"; } } diff --git a/ErsatzTV.Core/SystemEnvironment.cs b/ErsatzTV.Core/SystemEnvironment.cs index f9eed6b53..f461b579e 100644 --- a/ErsatzTV.Core/SystemEnvironment.cs +++ b/ErsatzTV.Core/SystemEnvironment.cs @@ -10,6 +10,8 @@ public class SystemEnvironment TranscodeFolder = Environment.GetEnvironmentVariable("ETV_TRANSCODE_FOLDER"); + InstanceId = Environment.GetEnvironmentVariable("ETV_INSTANCE_ID"); + string uiPortVariable = Environment.GetEnvironmentVariable("ETV_UI_PORT"); if (!int.TryParse(uiPortVariable, out int uiPort)) { @@ -63,6 +65,7 @@ public class SystemEnvironment public static string BaseUrl { get; } public static string ConfigFolder { get; } public static string TranscodeFolder { get; } + public static string InstanceId { get; } public static int UiPort { get; } public static int StreamingPort { get; } public static bool AllowSharedPlexServers { get; }