Files
ersatztv/ErsatzTV.Application/Libraries/Mapper.cs
T
Jason DoveandGitHub 50529ee6ad add emby media source (#201)
* properly scope jellyfin disconnect

* add emby entities

* add emby media source page

* add emby media source editor

* sync emby libraries

* enable emby library sync toggle

* add emby path replacements editor

* add emby movie synchronization

* fix emby artwork

* sync emby television

* code cleanup

* add jellyfin/emby address placeholder

* tweak jellyfin/emby address form
2021-05-23 03:05:23 -05:00

27 lines
1.1 KiB
C#

using System;
using ErsatzTV.Application.Emby;
using ErsatzTV.Application.Jellyfin;
using ErsatzTV.Core.Domain;
namespace ErsatzTV.Application.Libraries
{
internal static class Mapper
{
public static LibraryViewModel ProjectToViewModel(Library library) =>
library switch
{
LocalLibrary l => ProjectToViewModel(l),
PlexLibrary p => new PlexLibraryViewModel(p.Id, p.Name, p.MediaKind),
JellyfinLibrary j => new JellyfinLibraryViewModel(j.Id, j.Name, j.MediaKind, j.ShouldSyncItems),
EmbyLibrary e => new EmbyLibraryViewModel(e.Id, e.Name, e.MediaKind, e.ShouldSyncItems),
_ => throw new ArgumentOutOfRangeException(nameof(library))
};
public static LocalLibraryViewModel ProjectToViewModel(LocalLibrary library) =>
new(library.Id, library.Name, library.MediaKind);
public static LocalLibraryPathViewModel ProjectToViewModel(LibraryPath libraryPath) =>
new(libraryPath.Id, libraryPath.LibraryId, libraryPath.Path);
}
}