Files
ersatztv/ErsatzTV.Application/Graphics/Mapper.cs
T
Jason DoveandGitHub c524bc0d7d add script graphics element (#2681)
* add script graphics element

* pass template data as json to stdin

* update changelog
2025-11-30 14:20:18 -06:00

29 lines
955 B
C#

using ErsatzTV.Core.Domain;
namespace ErsatzTV.Application.Graphics;
public static class Mapper
{
public static GraphicsElementViewModel ProjectToViewModel(GraphicsElement graphicsElement)
{
string fileName = Path.GetFileName(graphicsElement.Path);
fileName = graphicsElement.Kind switch
{
GraphicsElementKind.Text => $"text/{fileName}",
GraphicsElementKind.Image => $"image/{fileName}",
GraphicsElementKind.Subtitle => $"subtitle/{fileName}",
GraphicsElementKind.Motion => $"motion/{fileName}",
GraphicsElementKind.Script => $"script/{fileName}",
_ => graphicsElement.Path
};
string name = fileName;
if (!string.IsNullOrWhiteSpace(graphicsElement.Name))
{
name = $"{graphicsElement.Name} ({fileName})";
}
return new GraphicsElementViewModel(graphicsElement.Id, name, fileName);
}
}