* 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
27 lines
1.1 KiB
C#
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);
|
|
}
|
|
}
|