Browse Source

fix smart_collection search crashes

pull/2579/head
Jason Dove 9 months ago
parent
commit
51449d2139
No known key found for this signature in database
  1. 1
      CHANGELOG.md
  2. 9
      ErsatzTV.Core/Scheduling/ChronologicalMediaCollectionEnumerator.cs
  3. 9
      ErsatzTV.Infrastructure/Search/SearchQueryParser.cs
  4. 2
      ErsatzTV/Pages/Playouts.razor

1
CHANGELOG.md

@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix remote stream scripts (parsing issue with spaces and quotes)
- Fix block history being removed when it is still needed for mirror channel
- This caused playout build errors like "Unable to locate history for playout item"
- Fix crashes due to invalid smart collection searches, e.g. `smart_collection:"this collection does not exist"`
## [25.8.0] - 2025-10-26
### Added

9
ErsatzTV.Core/Scheduling/ChronologicalMediaCollectionEnumerator.cs

@ -45,8 +45,13 @@ public sealed class ChronologicalMediaCollectionEnumerator : IMediaCollectionEnu @@ -45,8 +45,13 @@ public sealed class ChronologicalMediaCollectionEnumerator : IMediaCollectionEnu
public Option<MediaItem> Current => _sortedMediaItems.Count != 0 ? _sortedMediaItems[State.Index] : None;
public Option<bool> CurrentIncludeInProgramGuide { get; }
public void MoveNext(Option<DateTimeOffset> scheduledAt) =>
State.Index = (State.Index + 1) % _sortedMediaItems.Count;
public void MoveNext(Option<DateTimeOffset> scheduledAt)
{
if (_sortedMediaItems.Count > 0)
{
State.Index = (State.Index + 1) % _sortedMediaItems.Count;
}
}
public Option<TimeSpan> MinimumDuration => _lazyMinimumDuration.Value;

9
ErsatzTV.Infrastructure/Search/SearchQueryParser.cs

@ -77,7 +77,8 @@ public partial class SearchQueryParser(ISmartCollectionCache smartCollectionCach @@ -77,7 +77,8 @@ public partial class SearchQueryParser(ISmartCollectionCache smartCollectionCach
if (parsedQuery == replaceResult.Query)
{
logger.LogWarning(
"Failed to replace smart_collection in query; is the syntax correct? Quotes are required. Giving up...");
"Failed to replace smart_collection in query; is the syntax correct? Quotes are required. Giving up on collection {Name}...",
smartCollectionName);
break;
}
@ -125,6 +126,12 @@ public partial class SearchQueryParser(ISmartCollectionCache smartCollectionCach @@ -125,6 +126,12 @@ public partial class SearchQueryParser(ISmartCollectionCache smartCollectionCach
{
result = result.Replace(match.Value, $"({smartCollectionQuery})");
}
if (maybeQuery.IsNone)
{
//logger.LogError("Cannot find nested smart collection {Name}; removing from query.", smartCollectionName);
result = result.Replace(match.Value, "(type:bad_query)");
}
}
return new ReplaceResult(result, false);

2
ErsatzTV/Pages/Playouts.razor

@ -366,7 +366,7 @@ @@ -366,7 +366,7 @@
? playout.PlayoutId
: null;
_buildMessage = !playout.BuildStatus.Success && !string.IsNullOrWhiteSpace(playout.BuildStatus.Message)
_buildMessage = !(playout.BuildStatus?.Success ?? false) && !string.IsNullOrWhiteSpace(playout.BuildStatus?.Message)
? playout.BuildStatus.Message
: string.Empty;

Loading…
Cancel
Save