Browse Source

feat: add epg_entries support to image graphics elements

pull/2923/head
Jason Dove 2 months ago
parent
commit
a9d1bdeae0
No known key found for this signature in database
  1. 1
      CHANGELOG.md
  2. 3
      ErsatzTV.Core/Graphics/ImageGraphicsElement.cs
  3. 5
      ErsatzTV.Core/Interfaces/Streaming/GraphicsEngineContext.cs
  4. 17
      ErsatzTV.Infrastructure/Streaming/Graphics/GraphicsElementLoader.cs
  5. 2
      ErsatzTV.Infrastructure/Streaming/Graphics/GraphicsEngine.cs

1
CHANGELOG.md

@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- A config file named `default.json` will apply to all channels using the Next engine
- A config file named `{channel_number}.json` (e.g. `1.json`) will apply to the channel with that number
- Channel overlays will override values from the default overlay which will override values from the FFmpeg Profile
- Add `epg_entries` support to image graphics elements
### Fixed
- Fix HLS Direct playback when JWT auth is also used

3
ErsatzTV.Core/Graphics/ImageGraphicsElement.cs

@ -30,6 +30,9 @@ public class ImageGraphicsElement : BaseGraphicsElement @@ -30,6 +30,9 @@ public class ImageGraphicsElement : BaseGraphicsElement
[YamlMember(Alias = "z_index", ApplyNamingConventions = false)]
public int? ZIndex { get; set; }
[YamlMember(Alias = "epg_entries", ApplyNamingConventions = false)]
public int EpgEntries { get; set; }
public bool Scale { get; set; }
[YamlMember(Alias = "scale_width_percent", ApplyNamingConventions = false)]

5
ErsatzTV.Core/Interfaces/Streaming/GraphicsEngineContext.cs

@ -28,7 +28,10 @@ public record TextElementDataContext(TextGraphicsElement TextElement) : Graphics @@ -28,7 +28,10 @@ public record TextElementDataContext(TextGraphicsElement TextElement) : Graphics
public int EpgEntries => TextElement.EpgEntries;
}
public record ImageElementContext(ImageGraphicsElement ImageElement) : GraphicsElementContext;
public record ImageElementDataContext(ImageGraphicsElement ImageElement) : GraphicsElementContext, ITemplateDataContext
{
public int EpgEntries => ImageElement.EpgEntries;
}
public record MotionElementDataContext(MotionGraphicsElement MotionElement)
: GraphicsElementContext, ITemplateDataContext

17
ErsatzTV.Infrastructure/Streaming/Graphics/GraphicsElementLoader.cs

@ -76,7 +76,10 @@ public partial class GraphicsElementLoader( @@ -76,7 +76,10 @@ public partial class GraphicsElementLoader(
reference.GraphicsElement.Path);
}
context.Elements.AddRange(maybeElement.Select(element => new ImageElementContext(element)));
foreach (ImageGraphicsElement element in maybeElement)
{
context.Elements.Add(new ImageElementDataContext(element));
}
break;
}
@ -203,9 +206,11 @@ public partial class GraphicsElementLoader( @@ -203,9 +206,11 @@ public partial class GraphicsElementLoader(
IEnumerable<PlayoutItemGraphicsElement> elementsWithEpg = elements.Where(e =>
e.GraphicsElement.Kind is GraphicsElementKind.Text or GraphicsElementKind.Subtitle
or GraphicsElementKind.Motion or GraphicsElementKind.Script);
or GraphicsElementKind.Motion or GraphicsElementKind.Script or GraphicsElementKind.Image);
foreach (var reference in elementsWithEpg)
{
try
{
foreach (string line in await fileSystem.File.ReadAllLinesAsync(reference.GraphicsElement.Path))
{
@ -218,6 +223,14 @@ public partial class GraphicsElementLoader( @@ -218,6 +223,14 @@ public partial class GraphicsElementLoader(
epgEntries = Math.Max(epgEntries, value);
}
}
catch (Exception ex)
{
logger.LogWarning(
ex,
"Failed to read graphics element at {Path} for EPG entries",
reference.GraphicsElement.Path);
}
}
return epgEntries;
}

2
ErsatzTV.Infrastructure/Streaming/Graphics/GraphicsEngine.cs

@ -45,7 +45,7 @@ public class GraphicsEngine( @@ -45,7 +45,7 @@ public class GraphicsEngine(
break;
case ImageElementContext imageElementContext:
case ImageElementDataContext imageElementContext:
elements.Add(new ImageElement(imageElementContext.ImageElement, logger));
break;

Loading…
Cancel
Save