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
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user