diff options
| author | WizardOfYendor1 <WizardOfYendor1@users.noreply.github.com> | 2026-05-25 17:36:25 -0400 |
|---|---|---|
| committer | WizardOfYendor1 <WizardOfYendor1@users.noreply.github.com> | 2026-05-25 20:04:45 -0400 |
| commit | e1d63c0ea09f542f3e0432a641153591b579cb37 (patch) | |
| tree | 447d666b9d500b99c2ee760f323af1c658773616 /src | |
| parent | e1a16b4ec64b0facf28b4cad9d6bf0808339461b (diff) | |
Fixed issue etag info was not being set until the 3rd time though processing due to the "isNew" condition. Etag wouldn't be saved/persistent until the 3rd time through and onward.
Without this change it's self healing after the 3rd cycle.
It also appears there may be an issue with this etag "skip if hash hasn't changed" for schedules direct functionality.... like it never will work. But out of scope here.
Also fixed Sonar gripes about code formatting
Diffstat (limited to 'src')
| -rw-r--r-- | src/Jellyfin.LiveTv/Guide/GuideManager.cs | 19 | ||||
| -rw-r--r-- | src/Jellyfin.LiveTv/Listings/XmlTvProgramEtag.cs | 24 |
2 files changed, 22 insertions, 21 deletions
diff --git a/src/Jellyfin.LiveTv/Guide/GuideManager.cs b/src/Jellyfin.LiveTv/Guide/GuideManager.cs index d59eb9c18f..e0d9b323be 100644 --- a/src/Jellyfin.LiveTv/Guide/GuideManager.cs +++ b/src/Jellyfin.LiveTv/Guide/GuideManager.cs @@ -495,8 +495,6 @@ public class GuideManager : IGuideManager DateCreated = DateTime.UtcNow, DateModified = DateTime.UtcNow }; - - item.TrySetProviderId(EtagKey, info.Etag); } else if (XmlTvProgramEtag.MatchesStored(info.Etag, item.GetProviderId(EtagKey))) { @@ -629,13 +627,9 @@ public class GuideManager : IGuideManager forceUpdate |= UpdateImages(item, info); - if (isNew) - { - item.OnMetadataChanged(); - - return (item, true, false); - } - + // Restore the etag wiped by `item.ProviderIds = info.ProviderIds` above and + // persist it on new items so they join the fast path on the next refresh + // instead of taking an extra full processing cycle. var isUpdated = forceUpdate; var etag = info.Etag; if (string.IsNullOrWhiteSpace(etag)) @@ -648,6 +642,13 @@ public class GuideManager : IGuideManager isUpdated = true; } + if (isNew) + { + item.OnMetadataChanged(); + + return (item, true, false); + } + if (isUpdated) { item.OnMetadataChanged(); diff --git a/src/Jellyfin.LiveTv/Listings/XmlTvProgramEtag.cs b/src/Jellyfin.LiveTv/Listings/XmlTvProgramEtag.cs index b128b0ff9c..b5ddb1530f 100644 --- a/src/Jellyfin.LiveTv/Listings/XmlTvProgramEtag.cs +++ b/src/Jellyfin.LiveTv/Listings/XmlTvProgramEtag.cs @@ -128,6 +128,18 @@ namespace Jellyfin.LiveTv.Listings private static void AppendValue(StringBuilder builder, string name, DateTime? value) => AppendValue(builder, name, value.HasValue ? FormatDateTime(value.Value) : null); + private static void AppendValue(StringBuilder builder, string name, bool value) + => AppendValue(builder, name, value ? "true" : "false"); + + private static void AppendValue(StringBuilder builder, string name, bool? value) + => AppendValue(builder, name, value switch { true => "true", false => "false", null => null }); + + private static void AppendValue(StringBuilder builder, string name, int? value) + => AppendValue(builder, name, value?.ToString(CultureInfo.InvariantCulture)); + + private static void AppendValue(StringBuilder builder, string name, float? value) + => AppendValue(builder, name, value?.ToString("R", CultureInfo.InvariantCulture)); + // Treat Unspecified as UTC so the etag does not vary with the server's local timezone. private static string FormatDateTime(DateTime value) { @@ -141,18 +153,6 @@ namespace Jellyfin.LiveTv.Listings return utc.ToString("O", CultureInfo.InvariantCulture); } - private static void AppendValue(StringBuilder builder, string name, bool value) - => AppendValue(builder, name, value ? "true" : "false"); - - private static void AppendValue(StringBuilder builder, string name, bool? value) - => AppendValue(builder, name, value switch { true => "true", false => "false", null => null }); - - private static void AppendValue(StringBuilder builder, string name, int? value) - => AppendValue(builder, name, value?.ToString(CultureInfo.InvariantCulture)); - - private static void AppendValue(StringBuilder builder, string name, float? value) - => AppendValue(builder, name, value?.ToString("R", CultureInfo.InvariantCulture)); - private static void AppendList(StringBuilder builder, string name, IReadOnlyList<string> values) { AppendValue(builder, name + ".Count", values.Count.ToString(CultureInfo.InvariantCulture)); |
