* add script graphics element * pass template data as json to stdin * update changelog
29 lines
955 B
C#
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);
|
|
}
|
|
}
|