diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 81cfd0365..5ad79b540 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "jetbrains.resharper.globaltools": { - "version": "2021.2.2", + "version": "2022.1.0", "commands": [ "jb" ] diff --git a/ErsatzTV.Application/Artists/ArtistViewModel.cs b/ErsatzTV.Application/Artists/ArtistViewModel.cs index 5b1bb8b4c..4b79bbc6f 100644 --- a/ErsatzTV.Application/Artists/ArtistViewModel.cs +++ b/ErsatzTV.Application/Artists/ArtistViewModel.cs @@ -11,4 +11,4 @@ public record ArtistViewModel( List Genres, List Styles, List Moods, - List Languages); \ No newline at end of file + List Languages); diff --git a/ErsatzTV.Application/Artists/Mapper.cs b/ErsatzTV.Application/Artists/Mapper.cs index 34fc5d5c9..005c07d87 100644 --- a/ErsatzTV.Application/Artists/Mapper.cs +++ b/ErsatzTV.Application/Artists/Mapper.cs @@ -37,4 +37,4 @@ internal static class Mapper .Flatten() .ToList(); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Artists/Queries/GetAllArtists.cs b/ErsatzTV.Application/Artists/Queries/GetAllArtists.cs index a63d932de..93f01f23d 100644 --- a/ErsatzTV.Application/Artists/Queries/GetAllArtists.cs +++ b/ErsatzTV.Application/Artists/Queries/GetAllArtists.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Artists; -public record GetAllArtists : IRequest>; \ No newline at end of file +public record GetAllArtists : IRequest>; diff --git a/ErsatzTV.Application/Artists/Queries/GetAllArtistsHandler.cs b/ErsatzTV.Application/Artists/Queries/GetAllArtistsHandler.cs index 39a0150be..6fcc7d9da 100644 --- a/ErsatzTV.Application/Artists/Queries/GetAllArtistsHandler.cs +++ b/ErsatzTV.Application/Artists/Queries/GetAllArtistsHandler.cs @@ -19,4 +19,4 @@ public class GetAllArtistsHandler : IRequestHandler !string.IsNullOrWhiteSpace( a.ArtistMetadata.HeadOrNone().Match(am => am.Title, () => string.Empty)))) .Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Artists/Queries/GetArtistById.cs b/ErsatzTV.Application/Artists/Queries/GetArtistById.cs index 54c8e3642..fac2fb78a 100644 --- a/ErsatzTV.Application/Artists/Queries/GetArtistById.cs +++ b/ErsatzTV.Application/Artists/Queries/GetArtistById.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Artists; -public record GetArtistById(int ArtistId) : IRequest>; \ No newline at end of file +public record GetArtistById(int ArtistId) : IRequest>; diff --git a/ErsatzTV.Application/Artists/Queries/GetArtistByIdHandler.cs b/ErsatzTV.Application/Artists/Queries/GetArtistByIdHandler.cs index e4e8304c6..9850542bc 100644 --- a/ErsatzTV.Application/Artists/Queries/GetArtistByIdHandler.cs +++ b/ErsatzTV.Application/Artists/Queries/GetArtistByIdHandler.cs @@ -29,4 +29,4 @@ public class GetArtistByIdHandler : IRequestHandler Task.FromResult(Option.None)); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Channels/ChannelViewModel.cs b/ErsatzTV.Application/Channels/ChannelViewModel.cs index 4cb768fd7..d10145e69 100644 --- a/ErsatzTV.Application/Channels/ChannelViewModel.cs +++ b/ErsatzTV.Application/Channels/ChannelViewModel.cs @@ -16,4 +16,4 @@ public record ChannelViewModel( int? FallbackFillerId, int PlayoutCount, string PreferredSubtitleLanguageCode, - ChannelSubtitleMode SubtitleMode); \ No newline at end of file + ChannelSubtitleMode SubtitleMode); diff --git a/ErsatzTV.Application/Channels/Commands/CreateChannel.cs b/ErsatzTV.Application/Channels/Commands/CreateChannel.cs index cb848cfe9..be455d23d 100644 --- a/ErsatzTV.Application/Channels/Commands/CreateChannel.cs +++ b/ErsatzTV.Application/Channels/Commands/CreateChannel.cs @@ -16,4 +16,4 @@ public record CreateChannel int? WatermarkId, int? FallbackFillerId, string PreferredSubtitleLanguageCode, - ChannelSubtitleMode SubtitleMode) : IRequest>; \ No newline at end of file + ChannelSubtitleMode SubtitleMode) : IRequest>; diff --git a/ErsatzTV.Application/Channels/Commands/CreateChannelHandler.cs b/ErsatzTV.Application/Channels/Commands/CreateChannelHandler.cs index 700b218fe..c838d7f0e 100644 --- a/ErsatzTV.Application/Channels/Commands/CreateChannelHandler.cs +++ b/ErsatzTV.Application/Channels/Commands/CreateChannelHandler.cs @@ -21,7 +21,7 @@ public class CreateChannelHandler : IRequestHandler validation = await Validate(dbContext, request); - return await validation.Apply(c => PersistChannel(dbContext, c)); + return await LanguageExtensions.Apply(validation, c => PersistChannel(dbContext, c)); } private static async Task PersistChannel(TvContext dbContext, Channel channel) @@ -106,7 +106,9 @@ public class CreateChannelHandler : IRequestHandler string.Equals(ci.ThreeLetterISOLanguageName, lc, StringComparison.OrdinalIgnoreCase))) .ToValidation("Preferred subtitle language code is invalid"); - private static async Task> ValidateNumber(TvContext dbContext, CreateChannel createChannel) + private static async Task> ValidateNumber( + TvContext dbContext, + CreateChannel createChannel) { Option maybeExistingChannel = await dbContext.Channels .SelectOneAsync(c => c.Number, c => c.Number == createChannel.Number); @@ -169,4 +171,4 @@ public class CreateChannelHandler : IRequestHandler o.ToValidation( $"Fallback filler {createChannel.FallbackFillerId} does not exist.")); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Channels/Commands/CreateChannelResult.cs b/ErsatzTV.Application/Channels/Commands/CreateChannelResult.cs index af9178516..908640ae1 100644 --- a/ErsatzTV.Application/Channels/Commands/CreateChannelResult.cs +++ b/ErsatzTV.Application/Channels/Commands/CreateChannelResult.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Channels; -public record CreateChannelResult(int ChannelId) : EntityIdResult(ChannelId); \ No newline at end of file +public record CreateChannelResult(int ChannelId) : EntityIdResult(ChannelId); diff --git a/ErsatzTV.Application/Channels/Commands/DeleteChannel.cs b/ErsatzTV.Application/Channels/Commands/DeleteChannel.cs index 14f6365b6..f97ec6576 100644 --- a/ErsatzTV.Application/Channels/Commands/DeleteChannel.cs +++ b/ErsatzTV.Application/Channels/Commands/DeleteChannel.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Channels; -public record DeleteChannel(int ChannelId) : IRequest>; \ No newline at end of file +public record DeleteChannel(int ChannelId) : IRequest>; diff --git a/ErsatzTV.Application/Channels/Commands/DeleteChannelHandler.cs b/ErsatzTV.Application/Channels/Commands/DeleteChannelHandler.cs index b6534cf27..9a3dbc7e9 100644 --- a/ErsatzTV.Application/Channels/Commands/DeleteChannelHandler.cs +++ b/ErsatzTV.Application/Channels/Commands/DeleteChannelHandler.cs @@ -20,4 +20,4 @@ public class DeleteChannelHandler : IRequestHandler($"Channel {deleteChannel.ChannelId} does not exist.") .Map(c => c.Id); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Channels/Commands/UpdateChannel.cs b/ErsatzTV.Application/Channels/Commands/UpdateChannel.cs index 3034fc592..414eb536a 100644 --- a/ErsatzTV.Application/Channels/Commands/UpdateChannel.cs +++ b/ErsatzTV.Application/Channels/Commands/UpdateChannel.cs @@ -17,4 +17,4 @@ public record UpdateChannel int? WatermarkId, int? FallbackFillerId, string PreferredSubtitleLanguageCode, - ChannelSubtitleMode SubtitleMode) : IRequest>; \ No newline at end of file + ChannelSubtitleMode SubtitleMode) : IRequest>; diff --git a/ErsatzTV.Application/Channels/Commands/UpdateChannelHandler.cs b/ErsatzTV.Application/Channels/Commands/UpdateChannelHandler.cs index d105f2c6f..bb0ef63ca 100644 --- a/ErsatzTV.Application/Channels/Commands/UpdateChannelHandler.cs +++ b/ErsatzTV.Application/Channels/Commands/UpdateChannelHandler.cs @@ -14,8 +14,8 @@ namespace ErsatzTV.Application.Channels; public class UpdateChannelHandler : IRequestHandler> { - private readonly ChannelWriter _ffmpegWorkerChannel; private readonly IDbContextFactory _dbContextFactory; + private readonly ChannelWriter _ffmpegWorkerChannel; public UpdateChannelHandler( ChannelWriter ffmpegWorkerChannel, @@ -69,7 +69,7 @@ public class UpdateChannelHandler : IRequestHandler string.IsNullOrWhiteSpace(lc) || CultureInfo.GetCultures(CultureTypes.NeutralCultures).Any( ci => string.Equals(ci.ThreeLetterISOLanguageName, lc, StringComparison.OrdinalIgnoreCase))) .ToValidation("Preferred audio language code is invalid"); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Channels/Mapper.cs b/ErsatzTV.Application/Channels/Mapper.cs index bdca3f130..b84b4fcdb 100644 --- a/ErsatzTV.Application/Channels/Mapper.cs +++ b/ErsatzTV.Application/Channels/Mapper.cs @@ -44,4 +44,4 @@ internal static class Mapper StreamingMode.HttpLiveStreamingSegmenter => "HLS Segmenter", _ => throw new ArgumentOutOfRangeException() }; -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Channels/Queries/GetAllChannels.cs b/ErsatzTV.Application/Channels/Queries/GetAllChannels.cs index 4c05e0f68..5cdd67d45 100644 --- a/ErsatzTV.Application/Channels/Queries/GetAllChannels.cs +++ b/ErsatzTV.Application/Channels/Queries/GetAllChannels.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Channels; -public record GetAllChannels : IRequest>; \ No newline at end of file +public record GetAllChannels : IRequest>; diff --git a/ErsatzTV.Application/Channels/Queries/GetAllChannelsForApiHandler.cs b/ErsatzTV.Application/Channels/Queries/GetAllChannelsForApiHandler.cs index c85b30dc4..f2c094876 100644 --- a/ErsatzTV.Application/Channels/Queries/GetAllChannelsForApiHandler.cs +++ b/ErsatzTV.Application/Channels/Queries/GetAllChannelsForApiHandler.cs @@ -18,4 +18,4 @@ public class GetAllChannelsForApiHandler : IRequestHandler channels = Optional(await _channelRepository.GetAll()).Flatten(); return channels.Map(ProjectToResponseModel).ToList(); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Channels/Queries/GetAllChannelsHandler.cs b/ErsatzTV.Application/Channels/Queries/GetAllChannelsHandler.cs index 87e891013..9c1d28563 100644 --- a/ErsatzTV.Application/Channels/Queries/GetAllChannelsHandler.cs +++ b/ErsatzTV.Application/Channels/Queries/GetAllChannelsHandler.cs @@ -11,4 +11,4 @@ public class GetAllChannelsHandler : IRequestHandler> Handle(GetAllChannels request, CancellationToken cancellationToken) => Optional(await _channelRepository.GetAll()).Flatten().Map(ProjectToViewModel).ToList(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Channels/Queries/GetChannelById.cs b/ErsatzTV.Application/Channels/Queries/GetChannelById.cs index af490209a..8a14e347d 100644 --- a/ErsatzTV.Application/Channels/Queries/GetChannelById.cs +++ b/ErsatzTV.Application/Channels/Queries/GetChannelById.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Channels; -public record GetChannelById(int Id) : IRequest>; \ No newline at end of file +public record GetChannelById(int Id) : IRequest>; diff --git a/ErsatzTV.Application/Channels/Queries/GetChannelByIdHandler.cs b/ErsatzTV.Application/Channels/Queries/GetChannelByIdHandler.cs index 07638286a..dedf57f12 100644 --- a/ErsatzTV.Application/Channels/Queries/GetChannelByIdHandler.cs +++ b/ErsatzTV.Application/Channels/Queries/GetChannelByIdHandler.cs @@ -12,4 +12,4 @@ public class GetChannelByIdHandler : IRequestHandler> Handle(GetChannelById request, CancellationToken cancellationToken) => _channelRepository.Get(request.Id) .MapT(ProjectToViewModel); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Channels/Queries/GetChannelByNumberHandler.cs b/ErsatzTV.Application/Channels/Queries/GetChannelByNumberHandler.cs index cfd044476..18bab8578 100644 --- a/ErsatzTV.Application/Channels/Queries/GetChannelByNumberHandler.cs +++ b/ErsatzTV.Application/Channels/Queries/GetChannelByNumberHandler.cs @@ -11,4 +11,4 @@ public class GetChannelByNumberHandler : IRequestHandler> Handle(GetChannelByNumber request, CancellationToken cancellationToken) => _channelRepository.GetByNumber(request.ChannelNumber).MapT(ProjectToViewModel); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Channels/Queries/GetChannelGuide.cs b/ErsatzTV.Application/Channels/Queries/GetChannelGuide.cs index 5b097262e..fd5695d3c 100644 --- a/ErsatzTV.Application/Channels/Queries/GetChannelGuide.cs +++ b/ErsatzTV.Application/Channels/Queries/GetChannelGuide.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Channels; -public record GetChannelGuide(string Scheme, string Host) : IRequest; \ No newline at end of file +public record GetChannelGuide(string Scheme, string Host) : IRequest; diff --git a/ErsatzTV.Application/Channels/Queries/GetChannelGuideHandler.cs b/ErsatzTV.Application/Channels/Queries/GetChannelGuideHandler.cs index 378599358..29d000b0b 100644 --- a/ErsatzTV.Application/Channels/Queries/GetChannelGuideHandler.cs +++ b/ErsatzTV.Application/Channels/Queries/GetChannelGuideHandler.cs @@ -12,4 +12,4 @@ public class GetChannelGuideHandler : IRequestHandler Handle(GetChannelGuide request, CancellationToken cancellationToken) => _channelRepository.GetAllForGuide() .Map(channels => new ChannelGuide(request.Scheme, request.Host, channels)); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Channels/Queries/GetChannelLineup.cs b/ErsatzTV.Application/Channels/Queries/GetChannelLineup.cs index 6201557ca..c7721ff34 100644 --- a/ErsatzTV.Application/Channels/Queries/GetChannelLineup.cs +++ b/ErsatzTV.Application/Channels/Queries/GetChannelLineup.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Channels; -public record GetChannelLineup(string Scheme, string Host) : IRequest>; \ No newline at end of file +public record GetChannelLineup(string Scheme, string Host) : IRequest>; diff --git a/ErsatzTV.Application/Channels/Queries/GetChannelLineupHandler.cs b/ErsatzTV.Application/Channels/Queries/GetChannelLineupHandler.cs index 214f1c243..9c9081225 100644 --- a/ErsatzTV.Application/Channels/Queries/GetChannelLineupHandler.cs +++ b/ErsatzTV.Application/Channels/Queries/GetChannelLineupHandler.cs @@ -12,4 +12,4 @@ public class GetChannelLineupHandler : IRequestHandler> Handle(GetChannelLineup request, CancellationToken cancellationToken) => _channelRepository.GetAll() .Map(channels => channels.Map(c => new LineupItem(request.Scheme, request.Host, c)).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Channels/Queries/GetChannelPlaylist.cs b/ErsatzTV.Application/Channels/Queries/GetChannelPlaylist.cs index ab4667909..9ef4c26e4 100644 --- a/ErsatzTV.Application/Channels/Queries/GetChannelPlaylist.cs +++ b/ErsatzTV.Application/Channels/Queries/GetChannelPlaylist.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Channels; -public record GetChannelPlaylist(string Scheme, string Host, string Mode) : IRequest; \ No newline at end of file +public record GetChannelPlaylist(string Scheme, string Host, string Mode) : IRequest; diff --git a/ErsatzTV.Application/Channels/Queries/GetChannelPlaylistHandler.cs b/ErsatzTV.Application/Channels/Queries/GetChannelPlaylistHandler.cs index 66a6576f1..9df0c42d9 100644 --- a/ErsatzTV.Application/Channels/Queries/GetChannelPlaylistHandler.cs +++ b/ErsatzTV.Application/Channels/Queries/GetChannelPlaylistHandler.cs @@ -47,4 +47,4 @@ public class GetChannelPlaylistHandler : IRequestHandler; \ No newline at end of file +public record SaveConfigElementByKey(ConfigElementKey Key, string Value) : IRequest; diff --git a/ErsatzTV.Application/Configuration/Commands/SaveConfigElementByKeyHandler.cs b/ErsatzTV.Application/Configuration/Commands/SaveConfigElementByKeyHandler.cs index 091d197d7..3d73942a9 100644 --- a/ErsatzTV.Application/Configuration/Commands/SaveConfigElementByKeyHandler.cs +++ b/ErsatzTV.Application/Configuration/Commands/SaveConfigElementByKeyHandler.cs @@ -2,7 +2,7 @@ namespace ErsatzTV.Application.Configuration; -public class SaveConfigElementByKeyHandler : MediatR.IRequestHandler +public class SaveConfigElementByKeyHandler : IRequestHandler { private readonly IConfigElementRepository _configElementRepository; @@ -14,4 +14,4 @@ public class SaveConfigElementByKeyHandler : MediatR.IRequestHandler>; \ No newline at end of file +public record UpdateLibraryRefreshInterval(int LibraryRefreshInterval) : IRequest>; diff --git a/ErsatzTV.Application/Configuration/Commands/UpdateLibraryRefreshIntervalHandler.cs b/ErsatzTV.Application/Configuration/Commands/UpdateLibraryRefreshIntervalHandler.cs index 66236301d..b2f503f71 100644 --- a/ErsatzTV.Application/Configuration/Commands/UpdateLibraryRefreshIntervalHandler.cs +++ b/ErsatzTV.Application/Configuration/Commands/UpdateLibraryRefreshIntervalHandler.cs @@ -5,7 +5,7 @@ using ErsatzTV.Core.Interfaces.Repositories; namespace ErsatzTV.Application.Configuration; public class UpdateLibraryRefreshIntervalHandler : - MediatR.IRequestHandler> + IRequestHandler> { private readonly IConfigElementRepository _configElementRepository; @@ -16,7 +16,10 @@ public class UpdateLibraryRefreshIntervalHandler : UpdateLibraryRefreshInterval request, CancellationToken cancellationToken) => Validate(request) - .MapT(_ => _configElementRepository.Upsert(ConfigElementKey.LibraryRefreshInterval, request.LibraryRefreshInterval)) + .MapT( + _ => _configElementRepository.Upsert( + ConfigElementKey.LibraryRefreshInterval, + request.LibraryRefreshInterval)) .Bind(v => v.ToEitherAsync()); private static Task> Validate(UpdateLibraryRefreshInterval request) => @@ -25,4 +28,4 @@ public class UpdateLibraryRefreshIntervalHandler : .Map(_ => Unit.Default) .ToValidation("Tuner count must be greater than zero") .AsTask(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Configuration/Commands/UpdatePlayoutDaysToBuild.cs b/ErsatzTV.Application/Configuration/Commands/UpdatePlayoutDaysToBuild.cs index 1c2fe661d..9fb50ef83 100644 --- a/ErsatzTV.Application/Configuration/Commands/UpdatePlayoutDaysToBuild.cs +++ b/ErsatzTV.Application/Configuration/Commands/UpdatePlayoutDaysToBuild.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Configuration; -public record UpdatePlayoutDaysToBuild(int DaysToBuild) : MediatR.IRequest>; \ No newline at end of file +public record UpdatePlayoutDaysToBuild(int DaysToBuild) : IRequest>; diff --git a/ErsatzTV.Application/Configuration/Commands/UpdatePlayoutDaysToBuildHandler.cs b/ErsatzTV.Application/Configuration/Commands/UpdatePlayoutDaysToBuildHandler.cs index c6a3119b6..a5c78beb7 100644 --- a/ErsatzTV.Application/Configuration/Commands/UpdatePlayoutDaysToBuildHandler.cs +++ b/ErsatzTV.Application/Configuration/Commands/UpdatePlayoutDaysToBuildHandler.cs @@ -56,4 +56,4 @@ public class UpdatePlayoutDaysToBuildHandler : IRequestHandler Unit.Default) .ToValidation("Days to build must be greater than zero") .AsTask(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Configuration/ConfigElementViewModel.cs b/ErsatzTV.Application/Configuration/ConfigElementViewModel.cs index 6cd251466..e5ca2e648 100644 --- a/ErsatzTV.Application/Configuration/ConfigElementViewModel.cs +++ b/ErsatzTV.Application/Configuration/ConfigElementViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Configuration; -public record ConfigElementViewModel(string Key, string Value); \ No newline at end of file +public record ConfigElementViewModel(string Key, string Value); diff --git a/ErsatzTV.Application/Configuration/Mapper.cs b/ErsatzTV.Application/Configuration/Mapper.cs index 9731588d8..9bc1ce09f 100644 --- a/ErsatzTV.Application/Configuration/Mapper.cs +++ b/ErsatzTV.Application/Configuration/Mapper.cs @@ -6,4 +6,4 @@ internal static class Mapper { internal static ConfigElementViewModel ProjectToViewModel(ConfigElement element) => new(element.Key, element.Value); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Configuration/Queries/GetConfigElementByKey.cs b/ErsatzTV.Application/Configuration/Queries/GetConfigElementByKey.cs index 5f62f1922..d1f10bdda 100644 --- a/ErsatzTV.Application/Configuration/Queries/GetConfigElementByKey.cs +++ b/ErsatzTV.Application/Configuration/Queries/GetConfigElementByKey.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Configuration; -public record GetConfigElementByKey(ConfigElementKey Key) : IRequest>; \ No newline at end of file +public record GetConfigElementByKey(ConfigElementKey Key) : IRequest>; diff --git a/ErsatzTV.Application/Configuration/Queries/GetConfigElementByKeyHandler.cs b/ErsatzTV.Application/Configuration/Queries/GetConfigElementByKeyHandler.cs index c99996f96..cd26164d1 100644 --- a/ErsatzTV.Application/Configuration/Queries/GetConfigElementByKeyHandler.cs +++ b/ErsatzTV.Application/Configuration/Queries/GetConfigElementByKeyHandler.cs @@ -14,4 +14,4 @@ public class GetConfigElementByKeyHandler : IRequestHandler _configElementRepository.Get(request.Key).MapT(ProjectToViewModel); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Configuration/Queries/GetLibraryRefreshInterval.cs b/ErsatzTV.Application/Configuration/Queries/GetLibraryRefreshInterval.cs index bf727dc55..49483977b 100644 --- a/ErsatzTV.Application/Configuration/Queries/GetLibraryRefreshInterval.cs +++ b/ErsatzTV.Application/Configuration/Queries/GetLibraryRefreshInterval.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Configuration; -public record GetLibraryRefreshInterval : IRequest; \ No newline at end of file +public record GetLibraryRefreshInterval : IRequest; diff --git a/ErsatzTV.Application/Configuration/Queries/GetLibraryRefreshIntervalHandler.cs b/ErsatzTV.Application/Configuration/Queries/GetLibraryRefreshIntervalHandler.cs index ad737c3fc..289d12eeb 100644 --- a/ErsatzTV.Application/Configuration/Queries/GetLibraryRefreshIntervalHandler.cs +++ b/ErsatzTV.Application/Configuration/Queries/GetLibraryRefreshIntervalHandler.cs @@ -13,4 +13,4 @@ public class GetLibraryRefreshIntervalHandler : IRequestHandler Handle(GetLibraryRefreshInterval request, CancellationToken cancellationToken) => _configElementRepository.GetValue(ConfigElementKey.LibraryRefreshInterval) .Map(result => result.IfNone(6)); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Configuration/Queries/GetPlayoutDaysToBuild.cs b/ErsatzTV.Application/Configuration/Queries/GetPlayoutDaysToBuild.cs index 190bb5208..b9653768c 100644 --- a/ErsatzTV.Application/Configuration/Queries/GetPlayoutDaysToBuild.cs +++ b/ErsatzTV.Application/Configuration/Queries/GetPlayoutDaysToBuild.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Configuration; -public record GetPlayoutDaysToBuild : IRequest; \ No newline at end of file +public record GetPlayoutDaysToBuild : IRequest; diff --git a/ErsatzTV.Application/Configuration/Queries/GetPlayoutDaysToBuildHandler.cs b/ErsatzTV.Application/Configuration/Queries/GetPlayoutDaysToBuildHandler.cs index 036f0ea0f..5a78ebd8c 100644 --- a/ErsatzTV.Application/Configuration/Queries/GetPlayoutDaysToBuildHandler.cs +++ b/ErsatzTV.Application/Configuration/Queries/GetPlayoutDaysToBuildHandler.cs @@ -13,4 +13,4 @@ public class GetPlayoutDaysToBuildHandler : IRequestHandler Handle(GetPlayoutDaysToBuild request, CancellationToken cancellationToken) => _configElementRepository.GetValue(ConfigElementKey.PlayoutDaysToBuild) .Map(result => result.IfNone(2)); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Emby/Commands/DisconnectEmby.cs b/ErsatzTV.Application/Emby/Commands/DisconnectEmby.cs index d6a530dac..f19b0a9b9 100644 --- a/ErsatzTV.Application/Emby/Commands/DisconnectEmby.cs +++ b/ErsatzTV.Application/Emby/Commands/DisconnectEmby.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Emby; -public record DisconnectEmby : MediatR.IRequest>; \ No newline at end of file +public record DisconnectEmby : IRequest>; diff --git a/ErsatzTV.Application/Emby/Commands/DisconnectEmbyHandler.cs b/ErsatzTV.Application/Emby/Commands/DisconnectEmbyHandler.cs index 7d72ea1b6..9f75026c6 100644 --- a/ErsatzTV.Application/Emby/Commands/DisconnectEmbyHandler.cs +++ b/ErsatzTV.Application/Emby/Commands/DisconnectEmbyHandler.cs @@ -7,7 +7,7 @@ using ErsatzTV.Core.Interfaces.Search; namespace ErsatzTV.Application.Emby; -public class DisconnectEmbyHandler : MediatR.IRequestHandler> +public class DisconnectEmbyHandler : IRequestHandler> { private readonly IEmbySecretStore _embySecretStore; private readonly IEntityLocker _entityLocker; @@ -38,4 +38,4 @@ public class DisconnectEmbyHandler : MediatR.IRequestHandler>; \ No newline at end of file +public record SaveEmbySecrets(EmbySecrets Secrets) : IRequest>; diff --git a/ErsatzTV.Application/Emby/Commands/SaveEmbySecretsHandler.cs b/ErsatzTV.Application/Emby/Commands/SaveEmbySecretsHandler.cs index 87909125f..5ae9b9115 100644 --- a/ErsatzTV.Application/Emby/Commands/SaveEmbySecretsHandler.cs +++ b/ErsatzTV.Application/Emby/Commands/SaveEmbySecretsHandler.cs @@ -6,7 +6,7 @@ using ErsatzTV.Core.Interfaces.Repositories; namespace ErsatzTV.Application.Emby; -public class SaveEmbySecretsHandler : MediatR.IRequestHandler> +public class SaveEmbySecretsHandler : IRequestHandler> { private readonly ChannelWriter _channel; private readonly IEmbyApiClient _embyApiClient; @@ -53,4 +53,4 @@ public class SaveEmbySecretsHandler : MediatR.IRequestHandler>, - IEmbyBackgroundServiceRequest; \ No newline at end of file +public record SynchronizeEmbyLibraries(int EmbyMediaSourceId) : IRequest>, + IEmbyBackgroundServiceRequest; diff --git a/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyLibrariesHandler.cs b/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyLibrariesHandler.cs index 4ac5ca56a..575f1a7c3 100644 --- a/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyLibrariesHandler.cs +++ b/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyLibrariesHandler.cs @@ -9,7 +9,7 @@ using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Emby; public class - SynchronizeEmbyLibrariesHandler : MediatR.IRequestHandler> + SynchronizeEmbyLibrariesHandler : IRequestHandler> { private readonly IEmbyApiClient _embyApiClient; private readonly IEmbySecretStore _embySecretStore; @@ -108,4 +108,4 @@ public class { public string ApiKey { get; set; } } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyLibraryById.cs b/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyLibraryById.cs index 1901e0b45..c61cfb454 100644 --- a/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyLibraryById.cs +++ b/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyLibraryById.cs @@ -17,4 +17,4 @@ public record SynchronizeEmbyLibraryByIdIfNeeded(int EmbyLibraryId) : ISynchroni public record ForceSynchronizeEmbyLibraryById(int EmbyLibraryId) : ISynchronizeEmbyLibraryById { public bool ForceScan => true; -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyLibraryByIdHandler.cs b/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyLibraryByIdHandler.cs index 70fd9ae3d..45a8799ab 100644 --- a/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyLibraryByIdHandler.cs +++ b/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyLibraryByIdHandler.cs @@ -181,4 +181,4 @@ public class SynchronizeEmbyLibraryByIdHandler : { public string ApiKey { get; set; } } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyMediaSources.cs b/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyMediaSources.cs index 0f162f168..b9df7be1d 100644 --- a/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyMediaSources.cs +++ b/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyMediaSources.cs @@ -4,4 +4,4 @@ using ErsatzTV.Core.Domain; namespace ErsatzTV.Application.Emby; public record SynchronizeEmbyMediaSources : IRequest>>, - IEmbyBackgroundServiceRequest; \ No newline at end of file + IEmbyBackgroundServiceRequest; diff --git a/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyMediaSourcesHandler.cs b/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyMediaSourcesHandler.cs index 7750c6e05..ad1deac08 100644 --- a/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyMediaSourcesHandler.cs +++ b/ErsatzTV.Application/Emby/Commands/SynchronizeEmbyMediaSourcesHandler.cs @@ -32,4 +32,4 @@ public class SynchronizeEmbyMediaSourcesHandler : IRequestHandler Preferences) : MediatR.IRequest>; + (List Preferences) : IRequest>; -public record EmbyLibraryPreference(int Id, bool ShouldSyncItems); \ No newline at end of file +public record EmbyLibraryPreference(int Id, bool ShouldSyncItems); diff --git a/ErsatzTV.Application/Emby/Commands/UpdateEmbyLibraryPreferencesHandler.cs b/ErsatzTV.Application/Emby/Commands/UpdateEmbyLibraryPreferencesHandler.cs index 556f5d3c9..ade791d88 100644 --- a/ErsatzTV.Application/Emby/Commands/UpdateEmbyLibraryPreferencesHandler.cs +++ b/ErsatzTV.Application/Emby/Commands/UpdateEmbyLibraryPreferencesHandler.cs @@ -5,7 +5,7 @@ using ErsatzTV.Core.Interfaces.Search; namespace ErsatzTV.Application.Emby; public class - UpdateEmbyLibraryPreferencesHandler : MediatR.IRequestHandler> { private readonly IMediaSourceRepository _mediaSourceRepository; @@ -33,4 +33,4 @@ public class return Unit.Default; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Emby/Commands/UpdateEmbyPathReplacements.cs b/ErsatzTV.Application/Emby/Commands/UpdateEmbyPathReplacements.cs index 90bdf1ed4..c54b7d8e7 100644 --- a/ErsatzTV.Application/Emby/Commands/UpdateEmbyPathReplacements.cs +++ b/ErsatzTV.Application/Emby/Commands/UpdateEmbyPathReplacements.cs @@ -4,6 +4,6 @@ namespace ErsatzTV.Application.Emby; public record UpdateEmbyPathReplacements( int EmbyMediaSourceId, - List PathReplacements) : MediatR.IRequest>; + List PathReplacements) : IRequest>; -public record EmbyPathReplacementItem(int Id, string EmbyPath, string LocalPath); \ No newline at end of file +public record EmbyPathReplacementItem(int Id, string EmbyPath, string LocalPath); diff --git a/ErsatzTV.Application/Emby/Commands/UpdateEmbyPathReplacementsHandler.cs b/ErsatzTV.Application/Emby/Commands/UpdateEmbyPathReplacementsHandler.cs index 212b2ae72..4d40c9076 100644 --- a/ErsatzTV.Application/Emby/Commands/UpdateEmbyPathReplacementsHandler.cs +++ b/ErsatzTV.Application/Emby/Commands/UpdateEmbyPathReplacementsHandler.cs @@ -4,7 +4,7 @@ using ErsatzTV.Core.Interfaces.Repositories; namespace ErsatzTV.Application.Emby; -public class UpdateEmbyPathReplacementsHandler : MediatR.IRequestHandler> { private readonly IMediaSourceRepository _mediaSourceRepository; @@ -46,4 +46,4 @@ public class UpdateEmbyPathReplacementsHandler : MediatR.IRequestHandler v.ToValidation( $"Emby media source {request.EmbyMediaSourceId} does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Emby/EmbyConnectionParametersViewModel.cs b/ErsatzTV.Application/Emby/EmbyConnectionParametersViewModel.cs index 73649b6d8..c0beb3e4e 100644 --- a/ErsatzTV.Application/Emby/EmbyConnectionParametersViewModel.cs +++ b/ErsatzTV.Application/Emby/EmbyConnectionParametersViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Emby; -public record EmbyConnectionParametersViewModel(string Address); \ No newline at end of file +public record EmbyConnectionParametersViewModel(string Address); diff --git a/ErsatzTV.Application/Emby/EmbyLibraryViewModel.cs b/ErsatzTV.Application/Emby/EmbyLibraryViewModel.cs index af6e703ed..710096283 100644 --- a/ErsatzTV.Application/Emby/EmbyLibraryViewModel.cs +++ b/ErsatzTV.Application/Emby/EmbyLibraryViewModel.cs @@ -4,4 +4,4 @@ using ErsatzTV.Core.Domain; namespace ErsatzTV.Application.Emby; public record EmbyLibraryViewModel(int Id, string Name, LibraryMediaKind MediaKind, bool ShouldSyncItems) - : LibraryViewModel("Emby", Id, Name, MediaKind); \ No newline at end of file + : LibraryViewModel("Emby", Id, Name, MediaKind); diff --git a/ErsatzTV.Application/Emby/EmbyMediaSourceViewModel.cs b/ErsatzTV.Application/Emby/EmbyMediaSourceViewModel.cs index 434530b4d..d207fd152 100644 --- a/ErsatzTV.Application/Emby/EmbyMediaSourceViewModel.cs +++ b/ErsatzTV.Application/Emby/EmbyMediaSourceViewModel.cs @@ -5,4 +5,4 @@ namespace ErsatzTV.Application.Emby; public record EmbyMediaSourceViewModel(int Id, string Name, string Address) : RemoteMediaSourceViewModel( Id, Name, - Address); \ No newline at end of file + Address); diff --git a/ErsatzTV.Application/Emby/EmbyPathReplacementViewModel.cs b/ErsatzTV.Application/Emby/EmbyPathReplacementViewModel.cs index da490cb7a..1d0ee1bc8 100644 --- a/ErsatzTV.Application/Emby/EmbyPathReplacementViewModel.cs +++ b/ErsatzTV.Application/Emby/EmbyPathReplacementViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Emby; -public record EmbyPathReplacementViewModel(int Id, string EmbyPath, string LocalPath); \ No newline at end of file +public record EmbyPathReplacementViewModel(int Id, string EmbyPath, string LocalPath); diff --git a/ErsatzTV.Application/Emby/Mapper.cs b/ErsatzTV.Application/Emby/Mapper.cs index 528f7bbb4..38f3fd5f4 100644 --- a/ErsatzTV.Application/Emby/Mapper.cs +++ b/ErsatzTV.Application/Emby/Mapper.cs @@ -15,4 +15,4 @@ internal static class Mapper internal static EmbyPathReplacementViewModel ProjectToViewModel(EmbyPathReplacement pathReplacement) => new(pathReplacement.Id, pathReplacement.EmbyPath, pathReplacement.LocalPath); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Emby/Queries/GetAllEmbyMediaSources.cs b/ErsatzTV.Application/Emby/Queries/GetAllEmbyMediaSources.cs index 1334ac37f..a302f6aa7 100644 --- a/ErsatzTV.Application/Emby/Queries/GetAllEmbyMediaSources.cs +++ b/ErsatzTV.Application/Emby/Queries/GetAllEmbyMediaSources.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Emby; -public record GetAllEmbyMediaSources : IRequest>; \ No newline at end of file +public record GetAllEmbyMediaSources : IRequest>; diff --git a/ErsatzTV.Application/Emby/Queries/GetAllEmbyMediaSourcesHandler.cs b/ErsatzTV.Application/Emby/Queries/GetAllEmbyMediaSourcesHandler.cs index d735fff24..c17c48220 100644 --- a/ErsatzTV.Application/Emby/Queries/GetAllEmbyMediaSourcesHandler.cs +++ b/ErsatzTV.Application/Emby/Queries/GetAllEmbyMediaSourcesHandler.cs @@ -14,4 +14,4 @@ public class GetAllEmbyMediaSourcesHandler : IRequestHandler _mediaSourceRepository.GetAllEmby().Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Emby/Queries/GetEmbyConnectionParameters.cs b/ErsatzTV.Application/Emby/Queries/GetEmbyConnectionParameters.cs index 653d9cacc..0c6ea2bc6 100644 --- a/ErsatzTV.Application/Emby/Queries/GetEmbyConnectionParameters.cs +++ b/ErsatzTV.Application/Emby/Queries/GetEmbyConnectionParameters.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Emby; -public record GetEmbyConnectionParameters : IRequest>; \ No newline at end of file +public record GetEmbyConnectionParameters : IRequest>; diff --git a/ErsatzTV.Application/Emby/Queries/GetEmbyConnectionParametersHandler.cs b/ErsatzTV.Application/Emby/Queries/GetEmbyConnectionParametersHandler.cs index c85eca763..336de1803 100644 --- a/ErsatzTV.Application/Emby/Queries/GetEmbyConnectionParametersHandler.cs +++ b/ErsatzTV.Application/Emby/Queries/GetEmbyConnectionParametersHandler.cs @@ -63,4 +63,4 @@ public class GetEmbyConnectionParametersHandler : IRequestHandler>; \ No newline at end of file +public record GetEmbyLibrariesBySourceId(int EmbyMediaSourceId) : IRequest>; diff --git a/ErsatzTV.Application/Emby/Queries/GetEmbyLibrariesBySourceIdHandler.cs b/ErsatzTV.Application/Emby/Queries/GetEmbyLibrariesBySourceIdHandler.cs index dda6a3896..c5dd08493 100644 --- a/ErsatzTV.Application/Emby/Queries/GetEmbyLibrariesBySourceIdHandler.cs +++ b/ErsatzTV.Application/Emby/Queries/GetEmbyLibrariesBySourceIdHandler.cs @@ -16,4 +16,4 @@ public class CancellationToken cancellationToken) => _mediaSourceRepository.GetEmbyLibraries(request.EmbyMediaSourceId) .Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Emby/Queries/GetEmbyMediaSourceById.cs b/ErsatzTV.Application/Emby/Queries/GetEmbyMediaSourceById.cs index 3410201bc..0381452d6 100644 --- a/ErsatzTV.Application/Emby/Queries/GetEmbyMediaSourceById.cs +++ b/ErsatzTV.Application/Emby/Queries/GetEmbyMediaSourceById.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Emby; -public record GetEmbyMediaSourceById(int EmbyMediaSourceId) : IRequest>; \ No newline at end of file +public record GetEmbyMediaSourceById(int EmbyMediaSourceId) : IRequest>; diff --git a/ErsatzTV.Application/Emby/Queries/GetEmbyMediaSourceByIdHandler.cs b/ErsatzTV.Application/Emby/Queries/GetEmbyMediaSourceByIdHandler.cs index 24e8da6ec..ba2bfe4d8 100644 --- a/ErsatzTV.Application/Emby/Queries/GetEmbyMediaSourceByIdHandler.cs +++ b/ErsatzTV.Application/Emby/Queries/GetEmbyMediaSourceByIdHandler.cs @@ -15,4 +15,4 @@ public class GetEmbyMediaSourceById request, CancellationToken cancellationToken) => _mediaSourceRepository.GetEmby(request.EmbyMediaSourceId).MapT(ProjectToViewModel); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Emby/Queries/GetEmbyPathReplacementsBySourceId.cs b/ErsatzTV.Application/Emby/Queries/GetEmbyPathReplacementsBySourceId.cs index 678d31e91..81e41b35c 100644 --- a/ErsatzTV.Application/Emby/Queries/GetEmbyPathReplacementsBySourceId.cs +++ b/ErsatzTV.Application/Emby/Queries/GetEmbyPathReplacementsBySourceId.cs @@ -1,4 +1,4 @@ namespace ErsatzTV.Application.Emby; public record GetEmbyPathReplacementsBySourceId - (int EmbyMediaSourceId) : IRequest>; \ No newline at end of file + (int EmbyMediaSourceId) : IRequest>; diff --git a/ErsatzTV.Application/Emby/Queries/GetEmbyPathReplacementsBySourceIdHandler.cs b/ErsatzTV.Application/Emby/Queries/GetEmbyPathReplacementsBySourceIdHandler.cs index db1dcbf96..e1261b69f 100644 --- a/ErsatzTV.Application/Emby/Queries/GetEmbyPathReplacementsBySourceIdHandler.cs +++ b/ErsatzTV.Application/Emby/Queries/GetEmbyPathReplacementsBySourceIdHandler.cs @@ -16,4 +16,4 @@ public class GetEmbyPathReplacementsBySourceIdHandler : IRequestHandler _mediaSourceRepository.GetEmbyPathReplacements(request.EmbyMediaSourceId) .Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Emby/Queries/GetEmbySecrets.cs b/ErsatzTV.Application/Emby/Queries/GetEmbySecrets.cs index c15302ea7..6c8f25ceb 100644 --- a/ErsatzTV.Application/Emby/Queries/GetEmbySecrets.cs +++ b/ErsatzTV.Application/Emby/Queries/GetEmbySecrets.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Emby; -public record GetEmbySecrets : IRequest; \ No newline at end of file +public record GetEmbySecrets : IRequest; diff --git a/ErsatzTV.Application/Emby/Queries/GetEmbySecretsHandler.cs b/ErsatzTV.Application/Emby/Queries/GetEmbySecretsHandler.cs index 9de15a250..df47191e2 100644 --- a/ErsatzTV.Application/Emby/Queries/GetEmbySecretsHandler.cs +++ b/ErsatzTV.Application/Emby/Queries/GetEmbySecretsHandler.cs @@ -12,4 +12,4 @@ public class GetEmbySecretsHandler : IRequestHandler Handle(GetEmbySecrets request, CancellationToken cancellationToken) => _embySecretStore.ReadSecrets(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/EntityIdResult.cs b/ErsatzTV.Application/EntityIdResult.cs index feb3d4fb9..fc5ddb559 100644 --- a/ErsatzTV.Application/EntityIdResult.cs +++ b/ErsatzTV.Application/EntityIdResult.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application; -public record EntityIdResult(int Id); \ No newline at end of file +public record EntityIdResult(int Id); diff --git a/ErsatzTV.Application/ErsatzTV.Application.csproj b/ErsatzTV.Application/ErsatzTV.Application.csproj index 73813cb3e..026e7303a 100644 --- a/ErsatzTV.Application/ErsatzTV.Application.csproj +++ b/ErsatzTV.Application/ErsatzTV.Application.csproj @@ -8,7 +8,7 @@ - + diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/CopyFFmpegProfile.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/CopyFFmpegProfile.cs index 539d9b1b5..bb4515b6b 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/CopyFFmpegProfile.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/CopyFFmpegProfile.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.FFmpegProfiles; public record CopyFFmpegProfile - (int FFmpegProfileId, string Name) : IRequest>; \ No newline at end of file + (int FFmpegProfileId, string Name) : IRequest>; diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/CopyFFmpegProfileHandler.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/CopyFFmpegProfileHandler.cs index 1a4a4830e..971680813 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/CopyFFmpegProfileHandler.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/CopyFFmpegProfileHandler.cs @@ -29,4 +29,4 @@ public class private Validation ValidateName(CopyFFmpegProfile request) => request.NotEmpty(x => x.Name) .Bind(_ => request.NotLongerThan(50)(x => x.Name)); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/CreateFFmpegProfile.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/CreateFFmpegProfile.cs index 4ac02fbe3..a1a5988ab 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/CreateFFmpegProfile.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/CreateFFmpegProfile.cs @@ -21,4 +21,4 @@ public record CreateFFmpegProfile( int AudioChannels, int AudioSampleRate, bool NormalizeFramerate, - bool DeinterlaceVideo) : IRequest>; \ No newline at end of file + bool DeinterlaceVideo) : IRequest>; diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/CreateFFmpegProfileHandler.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/CreateFFmpegProfileHandler.cs index b3e57a1ef..eefd03e2e 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/CreateFFmpegProfileHandler.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/CreateFFmpegProfileHandler.cs @@ -20,7 +20,7 @@ public class CreateFFmpegProfileHandler : { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(profile => PersistFFmpegProfile(dbContext, profile)); + return await LanguageExtensions.Apply(validation, profile => PersistFFmpegProfile(dbContext, profile)); } private static async Task PersistFFmpegProfile( @@ -32,7 +32,9 @@ public class CreateFFmpegProfileHandler : return new CreateFFmpegProfileResult(ffmpegProfile.Id); } - private async Task> Validate(TvContext dbContext, CreateFFmpegProfile request) => + private async Task> Validate( + TvContext dbContext, + CreateFFmpegProfile request) => (ValidateName(request), ValidateThreadCount(request), await ResolutionMustExist(dbContext, request)) .Apply( (name, threadCount, resolutionId) => new FFmpegProfile @@ -70,4 +72,4 @@ public class CreateFFmpegProfileHandler : .SelectOneAsync(r => r.Id, r => r.Id == createFFmpegProfile.ResolutionId) .MapT(r => r.Id) .Map(o => o.ToValidation($"[Resolution] {createFFmpegProfile.ResolutionId} does not exist")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/CreateFFmpegProfileResult.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/CreateFFmpegProfileResult.cs index f2a29e103..30aa9d243 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/CreateFFmpegProfileResult.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/CreateFFmpegProfileResult.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.FFmpegProfiles; -public record CreateFFmpegProfileResult(int FFmpegProfileId) : EntityIdResult(FFmpegProfileId); \ No newline at end of file +public record CreateFFmpegProfileResult(int FFmpegProfileId) : EntityIdResult(FFmpegProfileId); diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/DeleteFFmpegProfile.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/DeleteFFmpegProfile.cs index 6f630f9c6..f2de7ded5 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/DeleteFFmpegProfile.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/DeleteFFmpegProfile.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.FFmpegProfiles; -public record DeleteFFmpegProfile(int FFmpegProfileId) : MediatR.IRequest>; \ No newline at end of file +public record DeleteFFmpegProfile(int FFmpegProfileId) : IRequest>; diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/DeleteFFmpegProfileHandler.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/DeleteFFmpegProfileHandler.cs index b8041e3c6..035e46ef9 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/DeleteFFmpegProfileHandler.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/DeleteFFmpegProfileHandler.cs @@ -6,14 +6,14 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.FFmpegProfiles; -public class DeleteFFmpegProfileHandler : IRequestHandler> +public class DeleteFFmpegProfileHandler : IRequestHandler> { private readonly IDbContextFactory _dbContextFactory; public DeleteFFmpegProfileHandler(IDbContextFactory dbContextFactory) => _dbContextFactory = dbContextFactory; - public async Task> Handle( + public async Task> Handle( DeleteFFmpegProfile request, CancellationToken cancellationToken) { @@ -22,11 +22,11 @@ public class DeleteFFmpegProfileHandler : IRequestHandler DoDeletion(dbContext, p)); } - private static async Task DoDeletion(TvContext dbContext, FFmpegProfile ffmpegProfile) + private static async Task DoDeletion(TvContext dbContext, FFmpegProfile ffmpegProfile) { dbContext.FFmpegProfiles.Remove(ffmpegProfile); await dbContext.SaveChangesAsync(); - return LanguageExt.Unit.Default; + return Unit.Default; } private static Task> FFmpegProfileMustExist( @@ -35,4 +35,4 @@ public class DeleteFFmpegProfileHandler : IRequestHandler p.Id, p => p.Id == request.FFmpegProfileId) .Map(o => o.ToValidation($"FFmpegProfile {request.FFmpegProfileId} does not exist")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/NewFFmpegProfile.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/NewFFmpegProfile.cs index f14242fdb..bf164f86d 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/NewFFmpegProfile.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/NewFFmpegProfile.cs @@ -4,4 +4,4 @@ /// Requests a new ffmpeg profile (view model) that contains /// appropriate default values. /// -public record NewFFmpegProfile : IRequest; \ No newline at end of file +public record NewFFmpegProfile : IRequest; diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/NewFFmpegProfileHandler.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/NewFFmpegProfileHandler.cs index 77fbe4fa4..4743e93fc 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/NewFFmpegProfileHandler.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/NewFFmpegProfileHandler.cs @@ -29,4 +29,4 @@ public class NewFFmpegProfileHandler : IRequestHandler>; \ No newline at end of file + bool DeinterlaceVideo) : IRequest>; diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegProfileHandler.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegProfileHandler.cs index b2afd3200..eab9ddd57 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegProfileHandler.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegProfileHandler.cs @@ -20,7 +20,7 @@ public class { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(p => ApplyUpdateRequest(dbContext, p, request)); + return await LanguageExtensions.Apply(validation, p => ApplyUpdateRequest(dbContext, p, request)); } private async Task ApplyUpdateRequest( @@ -77,4 +77,4 @@ public class .SelectOneAsync(r => r.Id, r => r.Id == updateFFmpegProfile.ResolutionId) .MapT(r => r.Id) .Map(o => o.ToValidation($"[Resolution] {updateFFmpegProfile.ResolutionId} does not exist")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegProfileResult.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegProfileResult.cs index 9fa704174..b473d73a0 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegProfileResult.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegProfileResult.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.FFmpegProfiles; -public record UpdateFFmpegProfileResult(int FFmpegProfileId) : EntityIdResult(FFmpegProfileId); \ No newline at end of file +public record UpdateFFmpegProfileResult(int FFmpegProfileId) : EntityIdResult(FFmpegProfileId); diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegSettings.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegSettings.cs index 383e0739b..d24d5e842 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegSettings.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegSettings.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.FFmpegProfiles; -public record UpdateFFmpegSettings(FFmpegSettingsViewModel Settings) : MediatR.IRequest>; \ No newline at end of file +public record UpdateFFmpegSettings(FFmpegSettingsViewModel Settings) : IRequest>; diff --git a/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegSettingsHandler.cs b/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegSettingsHandler.cs index 20dcec21b..8d9c70525 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegSettingsHandler.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Commands/UpdateFFmpegSettingsHandler.cs @@ -121,4 +121,4 @@ public class UpdateFFmpegSettingsHandler : IRequestHandler new(resolution.Id, resolution.Name, resolution.Width, resolution.Height); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/FFmpegProfiles/Queries/GetAllFFmpegProfiles.cs b/ErsatzTV.Application/FFmpegProfiles/Queries/GetAllFFmpegProfiles.cs index 7c6e39c3e..ef7f09d7d 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Queries/GetAllFFmpegProfiles.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Queries/GetAllFFmpegProfiles.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.FFmpegProfiles; -public record GetAllFFmpegProfiles : IRequest>; \ No newline at end of file +public record GetAllFFmpegProfiles : IRequest>; diff --git a/ErsatzTV.Application/FFmpegProfiles/Queries/GetAllFFmpegProfilesHandler.cs b/ErsatzTV.Application/FFmpegProfiles/Queries/GetAllFFmpegProfilesHandler.cs index c0ad5478f..d4c5cdb0c 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Queries/GetAllFFmpegProfilesHandler.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Queries/GetAllFFmpegProfilesHandler.cs @@ -21,4 +21,4 @@ public class GetAllFFmpegProfilesHandler : IRequestHandler list.Map(ProjectToViewModel).ToList()); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegProfileById.cs b/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegProfileById.cs index 6a5404a73..be23be3d4 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegProfileById.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegProfileById.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.FFmpegProfiles; -public record GetFFmpegProfileById(int Id) : IRequest>; \ No newline at end of file +public record GetFFmpegProfileById(int Id) : IRequest>; diff --git a/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegProfileByIdHandler.cs b/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegProfileByIdHandler.cs index 263bc5b5d..ea1ccc6f4 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegProfileByIdHandler.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegProfileByIdHandler.cs @@ -22,4 +22,4 @@ public class GetFFmpegProfileByIdHandler : IRequestHandler p.Id, p => p.Id == request.Id) .MapT(ProjectToViewModel); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegSettings.cs b/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegSettings.cs index db95f2a8e..78dac0fd7 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegSettings.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegSettings.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.FFmpegProfiles; -public record GetFFmpegSettings : IRequest; \ No newline at end of file +public record GetFFmpegSettings : IRequest; diff --git a/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegSettingsHandler.cs b/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegSettingsHandler.cs index ea96907fd..aa9936d19 100644 --- a/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegSettingsHandler.cs +++ b/ErsatzTV.Application/FFmpegProfiles/Queries/GetFFmpegSettingsHandler.cs @@ -42,7 +42,7 @@ public class GetFFmpegSettingsHandler : IRequestHandler>; \ No newline at end of file +) : IRequest>; diff --git a/ErsatzTV.Application/Filler/Commands/CreateFillerPresetHandler.cs b/ErsatzTV.Application/Filler/Commands/CreateFillerPresetHandler.cs index 1ed9835ba..e12f99af1 100644 --- a/ErsatzTV.Application/Filler/Commands/CreateFillerPresetHandler.cs +++ b/ErsatzTV.Application/Filler/Commands/CreateFillerPresetHandler.cs @@ -49,4 +49,4 @@ public class CreateFillerPresetHandler : IRequestHandler>; \ No newline at end of file +public record DeleteFillerPreset(int FillerPresetId) : IRequest>; diff --git a/ErsatzTV.Application/Filler/Commands/DeleteFillerPresetHandler.cs b/ErsatzTV.Application/Filler/Commands/DeleteFillerPresetHandler.cs index 0f030bc86..ac134e127 100644 --- a/ErsatzTV.Application/Filler/Commands/DeleteFillerPresetHandler.cs +++ b/ErsatzTV.Application/Filler/Commands/DeleteFillerPresetHandler.cs @@ -34,4 +34,4 @@ public class DeleteFillerPresetHandler : IRequestHandler fp.Id, ps => ps.Id == request.FillerPresetId) .Map(o => o.ToValidation($"FillerPreset {request.FillerPresetId} does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Filler/Commands/UpdateFillerPreset.cs b/ErsatzTV.Application/Filler/Commands/UpdateFillerPreset.cs index 01169c5fd..d6b1582ec 100644 --- a/ErsatzTV.Application/Filler/Commands/UpdateFillerPreset.cs +++ b/ErsatzTV.Application/Filler/Commands/UpdateFillerPreset.cs @@ -17,4 +17,4 @@ public record UpdateFillerPreset( int? MediaItemId, int? MultiCollectionId, int? SmartCollectionId -) : IRequest>; \ No newline at end of file +) : IRequest>; diff --git a/ErsatzTV.Application/Filler/Commands/UpdateFillerPresetHandler.cs b/ErsatzTV.Application/Filler/Commands/UpdateFillerPresetHandler.cs index 30b73f828..feb39da17 100644 --- a/ErsatzTV.Application/Filler/Commands/UpdateFillerPresetHandler.cs +++ b/ErsatzTV.Application/Filler/Commands/UpdateFillerPresetHandler.cs @@ -10,10 +10,8 @@ public class UpdateFillerPresetHandler : IRequestHandler _dbContextFactory; - public UpdateFillerPresetHandler(IDbContextFactory dbContextFactory) - { + public UpdateFillerPresetHandler(IDbContextFactory dbContextFactory) => _dbContextFactory = dbContextFactory; - } public async Task> Handle(UpdateFillerPreset request, CancellationToken cancellationToken) { @@ -51,4 +49,4 @@ public class UpdateFillerPresetHandler : IRequestHandler ps.Id, ps => ps.Id == request.Id) .Map(o => o.ToValidation("FillerPreset does not exist")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Filler/FillerPresetViewModel.cs b/ErsatzTV.Application/Filler/FillerPresetViewModel.cs index 383fcade3..af65ceeed 100644 --- a/ErsatzTV.Application/Filler/FillerPresetViewModel.cs +++ b/ErsatzTV.Application/Filler/FillerPresetViewModel.cs @@ -15,4 +15,4 @@ public record FillerPresetViewModel( int? CollectionId, int? MediaItemId, int? MultiCollectionId, - int? SmartCollectionId); \ No newline at end of file + int? SmartCollectionId); diff --git a/ErsatzTV.Application/Filler/Mapper.cs b/ErsatzTV.Application/Filler/Mapper.cs index f7ddb8fcf..910917f10 100644 --- a/ErsatzTV.Application/Filler/Mapper.cs +++ b/ErsatzTV.Application/Filler/Mapper.cs @@ -18,4 +18,4 @@ internal static class Mapper fillerPreset.MediaItemId, fillerPreset.MultiCollectionId, fillerPreset.SmartCollectionId); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Filler/PagedFillerPresetsViewModel.cs b/ErsatzTV.Application/Filler/PagedFillerPresetsViewModel.cs index fcec726e3..534282dcf 100644 --- a/ErsatzTV.Application/Filler/PagedFillerPresetsViewModel.cs +++ b/ErsatzTV.Application/Filler/PagedFillerPresetsViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Filler; -public record PagedFillerPresetsViewModel(int TotalCount, List Page); \ No newline at end of file +public record PagedFillerPresetsViewModel(int TotalCount, List Page); diff --git a/ErsatzTV.Application/Filler/Queries/GetAllFillerPresets.cs b/ErsatzTV.Application/Filler/Queries/GetAllFillerPresets.cs index 2b252f984..95e304957 100644 --- a/ErsatzTV.Application/Filler/Queries/GetAllFillerPresets.cs +++ b/ErsatzTV.Application/Filler/Queries/GetAllFillerPresets.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Filler; -public record GetAllFillerPresets : IRequest>; \ No newline at end of file +public record GetAllFillerPresets : IRequest>; diff --git a/ErsatzTV.Application/Filler/Queries/GetAllFillerPresetsHandler.cs b/ErsatzTV.Application/Filler/Queries/GetAllFillerPresetsHandler.cs index de9252b85..74529ed85 100644 --- a/ErsatzTV.Application/Filler/Queries/GetAllFillerPresetsHandler.cs +++ b/ErsatzTV.Application/Filler/Queries/GetAllFillerPresetsHandler.cs @@ -19,4 +19,4 @@ public class GetAllFillerPresetsHandler : IRequestHandler presets.Map(ProjectToViewModel).ToList()); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Filler/Queries/GetFillerPresetById.cs b/ErsatzTV.Application/Filler/Queries/GetFillerPresetById.cs index 2ff167f60..163a30ed9 100644 --- a/ErsatzTV.Application/Filler/Queries/GetFillerPresetById.cs +++ b/ErsatzTV.Application/Filler/Queries/GetFillerPresetById.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Filler; -public record GetFillerPresetById(int Id) : IRequest>; \ No newline at end of file +public record GetFillerPresetById(int Id) : IRequest>; diff --git a/ErsatzTV.Application/Filler/Queries/GetFillerPresetByIdHandler.cs b/ErsatzTV.Application/Filler/Queries/GetFillerPresetByIdHandler.cs index 769779e03..42bd6f640 100644 --- a/ErsatzTV.Application/Filler/Queries/GetFillerPresetByIdHandler.cs +++ b/ErsatzTV.Application/Filler/Queries/GetFillerPresetByIdHandler.cs @@ -21,4 +21,4 @@ public class GetFillerPresetByIdHandler : IRequestHandler c.Id, c => c.Id == request.Id) .MapT(ProjectToViewModel); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Filler/Queries/GetPagedFillerPresets.cs b/ErsatzTV.Application/Filler/Queries/GetPagedFillerPresets.cs index c3938857a..1845b1148 100644 --- a/ErsatzTV.Application/Filler/Queries/GetPagedFillerPresets.cs +++ b/ErsatzTV.Application/Filler/Queries/GetPagedFillerPresets.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Filler; -public record GetPagedFillerPresets(int PageNum, int PageSize) : IRequest; \ No newline at end of file +public record GetPagedFillerPresets(int PageNum, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/Filler/Queries/GetPagedFillerPresetsHandler.cs b/ErsatzTV.Application/Filler/Queries/GetPagedFillerPresetsHandler.cs index 15eae643d..f2de8e187 100644 --- a/ErsatzTV.Application/Filler/Queries/GetPagedFillerPresetsHandler.cs +++ b/ErsatzTV.Application/Filler/Queries/GetPagedFillerPresetsHandler.cs @@ -9,10 +9,8 @@ public class GetPagedFillerPresetsHandler : IRequestHandler _dbContextFactory; - public GetPagedFillerPresetsHandler(IDbContextFactory dbContextFactory) - { + public GetPagedFillerPresetsHandler(IDbContextFactory dbContextFactory) => _dbContextFactory = dbContextFactory; - } public async Task Handle( GetPagedFillerPresets request, @@ -32,4 +30,4 @@ public class GetPagedFillerPresetsHandler : IRequestHandler>; \ No newline at end of file +public record UpdateHDHRTunerCount(int TunerCount) : IRequest>; diff --git a/ErsatzTV.Application/HDHR/Commands/UpdateHDHRTunerCountHandler.cs b/ErsatzTV.Application/HDHR/Commands/UpdateHDHRTunerCountHandler.cs index 1b62bfb9a..ba7c67109 100644 --- a/ErsatzTV.Application/HDHR/Commands/UpdateHDHRTunerCountHandler.cs +++ b/ErsatzTV.Application/HDHR/Commands/UpdateHDHRTunerCountHandler.cs @@ -4,7 +4,7 @@ using ErsatzTV.Core.Interfaces.Repositories; namespace ErsatzTV.Application.HDHR; -public class UpdateHDHRTunerCountHandler : MediatR.IRequestHandler> +public class UpdateHDHRTunerCountHandler : IRequestHandler> { private readonly IConfigElementRepository _configElementRepository; @@ -24,4 +24,4 @@ public class UpdateHDHRTunerCountHandler : MediatR.IRequestHandler Unit.Default) .ToValidation("Tuner count must be greater than zero") .AsTask(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/HDHR/Queries/GetHDHRTunerCount.cs b/ErsatzTV.Application/HDHR/Queries/GetHDHRTunerCount.cs index 79f03b216..0f4f2c3c3 100644 --- a/ErsatzTV.Application/HDHR/Queries/GetHDHRTunerCount.cs +++ b/ErsatzTV.Application/HDHR/Queries/GetHDHRTunerCount.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.HDHR; -public record GetHDHRTunerCount : IRequest; \ No newline at end of file +public record GetHDHRTunerCount : IRequest; diff --git a/ErsatzTV.Application/HDHR/Queries/GetHDHRTunerCountHandler.cs b/ErsatzTV.Application/HDHR/Queries/GetHDHRTunerCountHandler.cs index ef5f4f236..fd67f683b 100644 --- a/ErsatzTV.Application/HDHR/Queries/GetHDHRTunerCountHandler.cs +++ b/ErsatzTV.Application/HDHR/Queries/GetHDHRTunerCountHandler.cs @@ -13,4 +13,4 @@ public class GetHDHRTunerCountHandler : IRequestHandler public Task Handle(GetHDHRTunerCount request, CancellationToken cancellationToken) => _configElementRepository.GetValue(ConfigElementKey.HDHRTunerCount) .Map(result => result.IfNone(2)); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Health/Queries/GetAllHealthCheckResults.cs b/ErsatzTV.Application/Health/Queries/GetAllHealthCheckResults.cs index 269f46489..dd51aa2a1 100644 --- a/ErsatzTV.Application/Health/Queries/GetAllHealthCheckResults.cs +++ b/ErsatzTV.Application/Health/Queries/GetAllHealthCheckResults.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Health; -public record GetAllHealthCheckResults : IRequest>; \ No newline at end of file +public record GetAllHealthCheckResults : IRequest>; diff --git a/ErsatzTV.Application/Health/Queries/GetAllHealthCheckResultsHandler.cs b/ErsatzTV.Application/Health/Queries/GetAllHealthCheckResultsHandler.cs index 511c1d6b3..d78615550 100644 --- a/ErsatzTV.Application/Health/Queries/GetAllHealthCheckResultsHandler.cs +++ b/ErsatzTV.Application/Health/Queries/GetAllHealthCheckResultsHandler.cs @@ -16,4 +16,4 @@ public class GetAllHealthCheckResultsHandler : IRequestHandler results = await _healthCheckService.PerformHealthChecks(cancellationToken); return results.Filter(r => r.Status != HealthCheckStatus.NotApplicable).ToList(); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/IBackgroundServiceRequest.cs b/ErsatzTV.Application/IBackgroundServiceRequest.cs index d86df59a6..cd701a41a 100644 --- a/ErsatzTV.Application/IBackgroundServiceRequest.cs +++ b/ErsatzTV.Application/IBackgroundServiceRequest.cs @@ -2,4 +2,4 @@ public interface IBackgroundServiceRequest { -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/IEmbyBackgroundServiceRequest.cs b/ErsatzTV.Application/IEmbyBackgroundServiceRequest.cs index 766521731..f5f1374ee 100644 --- a/ErsatzTV.Application/IEmbyBackgroundServiceRequest.cs +++ b/ErsatzTV.Application/IEmbyBackgroundServiceRequest.cs @@ -2,4 +2,4 @@ public interface IEmbyBackgroundServiceRequest { -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/IFFmpegWorkerRequest.cs b/ErsatzTV.Application/IFFmpegWorkerRequest.cs index a95ac18d8..7b3180cdf 100644 --- a/ErsatzTV.Application/IFFmpegWorkerRequest.cs +++ b/ErsatzTV.Application/IFFmpegWorkerRequest.cs @@ -2,4 +2,4 @@ public interface IFFmpegWorkerRequest { -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/IJellyfinBackgroundServiceRequest.cs b/ErsatzTV.Application/IJellyfinBackgroundServiceRequest.cs index b6e844585..0b4dc143d 100644 --- a/ErsatzTV.Application/IJellyfinBackgroundServiceRequest.cs +++ b/ErsatzTV.Application/IJellyfinBackgroundServiceRequest.cs @@ -2,4 +2,4 @@ public interface IJellyfinBackgroundServiceRequest { -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/IPlexBackgroundServiceRequest.cs b/ErsatzTV.Application/IPlexBackgroundServiceRequest.cs index 467bf9bfc..472764090 100644 --- a/ErsatzTV.Application/IPlexBackgroundServiceRequest.cs +++ b/ErsatzTV.Application/IPlexBackgroundServiceRequest.cs @@ -2,4 +2,4 @@ public interface IPlexBackgroundServiceRequest { -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ISubtitleWorkerRequest.cs b/ErsatzTV.Application/ISubtitleWorkerRequest.cs index eba74b5b5..46d3bacd3 100644 --- a/ErsatzTV.Application/ISubtitleWorkerRequest.cs +++ b/ErsatzTV.Application/ISubtitleWorkerRequest.cs @@ -2,4 +2,4 @@ public interface ISubtitleWorkerRequest { -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Images/CachedImagePathViewModel.cs b/ErsatzTV.Application/Images/CachedImagePathViewModel.cs index 0a1f9a1e4..b629d8c18 100644 --- a/ErsatzTV.Application/Images/CachedImagePathViewModel.cs +++ b/ErsatzTV.Application/Images/CachedImagePathViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Images; -public record CachedImagePathViewModel(string FileName, string MimeType); \ No newline at end of file +public record CachedImagePathViewModel(string FileName, string MimeType); diff --git a/ErsatzTV.Application/Images/Commands/SaveArtworkToDisk.cs b/ErsatzTV.Application/Images/Commands/SaveArtworkToDisk.cs index 3a4b34b92..bfa9629a0 100644 --- a/ErsatzTV.Application/Images/Commands/SaveArtworkToDisk.cs +++ b/ErsatzTV.Application/Images/Commands/SaveArtworkToDisk.cs @@ -4,4 +4,4 @@ using ErsatzTV.Core.Domain; namespace ErsatzTV.Application.Images; // ReSharper disable once SuggestBaseTypeForParameter -public record SaveArtworkToDisk(Stream Stream, ArtworkKind ArtworkKind) : IRequest>; \ No newline at end of file +public record SaveArtworkToDisk(Stream Stream, ArtworkKind ArtworkKind) : IRequest>; diff --git a/ErsatzTV.Application/Images/Commands/SaveArtworkToDiskHandler.cs b/ErsatzTV.Application/Images/Commands/SaveArtworkToDiskHandler.cs index d4d458957..c3d199816 100644 --- a/ErsatzTV.Application/Images/Commands/SaveArtworkToDiskHandler.cs +++ b/ErsatzTV.Application/Images/Commands/SaveArtworkToDiskHandler.cs @@ -11,4 +11,4 @@ public class SaveArtworkToDiskHandler : IRequestHandler> Handle(SaveArtworkToDisk request, CancellationToken cancellationToken) => _imageCache.SaveArtworkToCache(request.Stream, request.ArtworkKind); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Images/Queries/GetCachedImagePath.cs b/ErsatzTV.Application/Images/Queries/GetCachedImagePath.cs index ea7d98e20..8688ce21d 100644 --- a/ErsatzTV.Application/Images/Queries/GetCachedImagePath.cs +++ b/ErsatzTV.Application/Images/Queries/GetCachedImagePath.cs @@ -5,4 +5,4 @@ namespace ErsatzTV.Application.Images; public record GetCachedImagePath (string FileName, ArtworkKind ArtworkKind, int? MaxHeight = null) : IRequest< - Either>; \ No newline at end of file + Either>; diff --git a/ErsatzTV.Application/Images/Queries/GetCachedImagePathHandler.cs b/ErsatzTV.Application/Images/Queries/GetCachedImagePathHandler.cs index 58855c467..2f366990e 100644 --- a/ErsatzTV.Application/Images/Queries/GetCachedImagePathHandler.cs +++ b/ErsatzTV.Application/Images/Queries/GetCachedImagePathHandler.cs @@ -12,9 +12,9 @@ public class GetCachedImagePathHandler : IRequestHandler> { private static readonly MimeTypes MimeTypes = new(); - private readonly IImageCache _imageCache; - private readonly IFFmpegProcessService _ffmpegProcessService; private readonly IConfigElementRepository _configElementRepository; + private readonly IFFmpegProcessService _ffmpegProcessService; + private readonly IImageCache _imageCache; public GetCachedImagePathHandler( IImageCache imageCache, @@ -106,9 +106,9 @@ public class private async Task> Validate() => await ValidateFFmpegPath(); - + private Task> ValidateFFmpegPath() => _configElementRepository.GetValue(ConfigElementKey.FFmpegPath) .FilterT(File.Exists) .Map(ffmpegPath => ffmpegPath.ToValidation("FFmpeg path does not exist on the file system")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Jellyfin/Commands/DisconnectJellyfin.cs b/ErsatzTV.Application/Jellyfin/Commands/DisconnectJellyfin.cs index dd651ff51..8bc63f280 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/DisconnectJellyfin.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/DisconnectJellyfin.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Jellyfin; -public record DisconnectJellyfin : MediatR.IRequest>; \ No newline at end of file +public record DisconnectJellyfin : IRequest>; diff --git a/ErsatzTV.Application/Jellyfin/Commands/DisconnectJellyfinHandler.cs b/ErsatzTV.Application/Jellyfin/Commands/DisconnectJellyfinHandler.cs index bb286ac83..babacadcc 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/DisconnectJellyfinHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/DisconnectJellyfinHandler.cs @@ -7,7 +7,7 @@ using ErsatzTV.Core.Interfaces.Search; namespace ErsatzTV.Application.Jellyfin; -public class DisconnectJellyfinHandler : MediatR.IRequestHandler> +public class DisconnectJellyfinHandler : IRequestHandler> { private readonly IEntityLocker _entityLocker; private readonly IJellyfinSecretStore _jellyfinSecretStore; @@ -38,4 +38,4 @@ public class DisconnectJellyfinHandler : MediatR.IRequestHandler>; \ No newline at end of file +public record SaveJellyfinSecrets(JellyfinSecrets Secrets) : IRequest>; diff --git a/ErsatzTV.Application/Jellyfin/Commands/SaveJellyfinSecretsHandler.cs b/ErsatzTV.Application/Jellyfin/Commands/SaveJellyfinSecretsHandler.cs index 3d6f0226b..3cc84d776 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/SaveJellyfinSecretsHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/SaveJellyfinSecretsHandler.cs @@ -6,7 +6,7 @@ using ErsatzTV.Core.Jellyfin; namespace ErsatzTV.Application.Jellyfin; -public class SaveJellyfinSecretsHandler : MediatR.IRequestHandler> +public class SaveJellyfinSecretsHandler : IRequestHandler> { private readonly ChannelWriter _channel; private readonly IJellyfinApiClient _jellyfinApiClient; @@ -53,4 +53,4 @@ public class SaveJellyfinSecretsHandler : MediatR.IRequestHandler>, - IJellyfinBackgroundServiceRequest; \ No newline at end of file +public record SynchronizeJellyfinAdminUserId(int JellyfinMediaSourceId) : IRequest>, + IJellyfinBackgroundServiceRequest; diff --git a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinAdminUserIdHandler.cs b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinAdminUserIdHandler.cs index c5d542647..ce53088e2 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinAdminUserIdHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinAdminUserIdHandler.cs @@ -9,7 +9,7 @@ using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Jellyfin; public class - SynchronizeJellyfinAdminUserIdHandler : MediatR.IRequestHandler> { private readonly IJellyfinApiClient _jellyfinApiClient; @@ -104,4 +104,4 @@ public class { public string ApiKey { get; set; } } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibraries.cs b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibraries.cs index de711cd93..01459ed63 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibraries.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibraries.cs @@ -2,5 +2,5 @@ namespace ErsatzTV.Application.Jellyfin; -public record SynchronizeJellyfinLibraries(int JellyfinMediaSourceId) : MediatR.IRequest>, - IJellyfinBackgroundServiceRequest; \ No newline at end of file +public record SynchronizeJellyfinLibraries(int JellyfinMediaSourceId) : IRequest>, + IJellyfinBackgroundServiceRequest; diff --git a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibrariesHandler.cs b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibrariesHandler.cs index cf8488879..e70bd3471 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibrariesHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibrariesHandler.cs @@ -9,7 +9,7 @@ using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Jellyfin; public class - SynchronizeJellyfinLibrariesHandler : MediatR.IRequestHandler> { @@ -110,4 +110,4 @@ public class { public string ApiKey { get; set; } } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibraryById.cs b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibraryById.cs index 926d25733..71f3f5496 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibraryById.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibraryById.cs @@ -17,4 +17,4 @@ public record SynchronizeJellyfinLibraryByIdIfNeeded(int JellyfinLibraryId) : IS public record ForceSynchronizeJellyfinLibraryById(int JellyfinLibraryId) : ISynchronizeJellyfinLibraryById { public bool ForceScan => true; -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibraryByIdHandler.cs b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibraryByIdHandler.cs index 56d864275..0b94f602f 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibraryByIdHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinLibraryByIdHandler.cs @@ -181,4 +181,4 @@ public class SynchronizeJellyfinLibraryByIdHandler : { public string ApiKey { get; set; } } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinMediaSources.cs b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinMediaSources.cs index 9ae409b00..930ecf9bc 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinMediaSources.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinMediaSources.cs @@ -4,4 +4,4 @@ using ErsatzTV.Core.Domain; namespace ErsatzTV.Application.Jellyfin; public record SynchronizeJellyfinMediaSources : IRequest>>, - IJellyfinBackgroundServiceRequest; \ No newline at end of file + IJellyfinBackgroundServiceRequest; diff --git a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinMediaSourcesHandler.cs b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinMediaSourcesHandler.cs index 4171335ed..4c1845bf8 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinMediaSourcesHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/SynchronizeJellyfinMediaSourcesHandler.cs @@ -32,4 +32,4 @@ public class SynchronizeJellyfinMediaSourcesHandler : IRequestHandler Preferences) : MediatR.IRequest>; + (List Preferences) : IRequest>; -public record JellyfinLibraryPreference(int Id, bool ShouldSyncItems); \ No newline at end of file +public record JellyfinLibraryPreference(int Id, bool ShouldSyncItems); diff --git a/ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinLibraryPreferencesHandler.cs b/ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinLibraryPreferencesHandler.cs index 0748af034..856a26159 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinLibraryPreferencesHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinLibraryPreferencesHandler.cs @@ -5,7 +5,7 @@ using ErsatzTV.Core.Interfaces.Search; namespace ErsatzTV.Application.Jellyfin; public class - UpdateJellyfinLibraryPreferencesHandler : MediatR.IRequestHandler> { private readonly IMediaSourceRepository _mediaSourceRepository; @@ -33,4 +33,4 @@ public class return Unit.Default; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinPathReplacements.cs b/ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinPathReplacements.cs index b17b3aa2a..a1608d284 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinPathReplacements.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinPathReplacements.cs @@ -4,6 +4,6 @@ namespace ErsatzTV.Application.Jellyfin; public record UpdateJellyfinPathReplacements( int JellyfinMediaSourceId, - List PathReplacements) : MediatR.IRequest>; + List PathReplacements) : IRequest>; -public record JellyfinPathReplacementItem(int Id, string JellyfinPath, string LocalPath); \ No newline at end of file +public record JellyfinPathReplacementItem(int Id, string JellyfinPath, string LocalPath); diff --git a/ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinPathReplacementsHandler.cs b/ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinPathReplacementsHandler.cs index dbf45f68b..0f4dd76de 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinPathReplacementsHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/UpdateJellyfinPathReplacementsHandler.cs @@ -4,7 +4,7 @@ using ErsatzTV.Core.Interfaces.Repositories; namespace ErsatzTV.Application.Jellyfin; -public class UpdateJellyfinPathReplacementsHandler : MediatR.IRequestHandler> { private readonly IMediaSourceRepository _mediaSourceRepository; @@ -46,4 +46,4 @@ public class UpdateJellyfinPathReplacementsHandler : MediatR.IRequestHandler v.ToValidation( $"Jellyfin media source {request.JellyfinMediaSourceId} does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Jellyfin/JellyfinConnectionParametersViewModel.cs b/ErsatzTV.Application/Jellyfin/JellyfinConnectionParametersViewModel.cs index 50592c61a..d29231876 100644 --- a/ErsatzTV.Application/Jellyfin/JellyfinConnectionParametersViewModel.cs +++ b/ErsatzTV.Application/Jellyfin/JellyfinConnectionParametersViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Jellyfin; -public record JellyfinConnectionParametersViewModel(string Address); \ No newline at end of file +public record JellyfinConnectionParametersViewModel(string Address); diff --git a/ErsatzTV.Application/Jellyfin/JellyfinLibraryViewModel.cs b/ErsatzTV.Application/Jellyfin/JellyfinLibraryViewModel.cs index 24e661db4..dcb933299 100644 --- a/ErsatzTV.Application/Jellyfin/JellyfinLibraryViewModel.cs +++ b/ErsatzTV.Application/Jellyfin/JellyfinLibraryViewModel.cs @@ -4,4 +4,4 @@ using ErsatzTV.Core.Domain; namespace ErsatzTV.Application.Jellyfin; public record JellyfinLibraryViewModel(int Id, string Name, LibraryMediaKind MediaKind, bool ShouldSyncItems) - : LibraryViewModel("Jellyfin", Id, Name, MediaKind); \ No newline at end of file + : LibraryViewModel("Jellyfin", Id, Name, MediaKind); diff --git a/ErsatzTV.Application/Jellyfin/JellyfinMediaSourceViewModel.cs b/ErsatzTV.Application/Jellyfin/JellyfinMediaSourceViewModel.cs index b5db08944..96a32e142 100644 --- a/ErsatzTV.Application/Jellyfin/JellyfinMediaSourceViewModel.cs +++ b/ErsatzTV.Application/Jellyfin/JellyfinMediaSourceViewModel.cs @@ -5,4 +5,4 @@ namespace ErsatzTV.Application.Jellyfin; public record JellyfinMediaSourceViewModel(int Id, string Name, string Address) : RemoteMediaSourceViewModel( Id, Name, - Address); \ No newline at end of file + Address); diff --git a/ErsatzTV.Application/Jellyfin/JellyfinPathReplacementViewModel.cs b/ErsatzTV.Application/Jellyfin/JellyfinPathReplacementViewModel.cs index fa80a7297..f9e50489b 100644 --- a/ErsatzTV.Application/Jellyfin/JellyfinPathReplacementViewModel.cs +++ b/ErsatzTV.Application/Jellyfin/JellyfinPathReplacementViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Jellyfin; -public record JellyfinPathReplacementViewModel(int Id, string JellyfinPath, string LocalPath); \ No newline at end of file +public record JellyfinPathReplacementViewModel(int Id, string JellyfinPath, string LocalPath); diff --git a/ErsatzTV.Application/Jellyfin/Mapper.cs b/ErsatzTV.Application/Jellyfin/Mapper.cs index f696ff259..457025fff 100644 --- a/ErsatzTV.Application/Jellyfin/Mapper.cs +++ b/ErsatzTV.Application/Jellyfin/Mapper.cs @@ -15,4 +15,4 @@ internal static class Mapper internal static JellyfinPathReplacementViewModel ProjectToViewModel(JellyfinPathReplacement pathReplacement) => new(pathReplacement.Id, pathReplacement.JellyfinPath, pathReplacement.LocalPath); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Jellyfin/Queries/GetAllJellyfinMediaSources.cs b/ErsatzTV.Application/Jellyfin/Queries/GetAllJellyfinMediaSources.cs index 032f4c828..ba1334bf8 100644 --- a/ErsatzTV.Application/Jellyfin/Queries/GetAllJellyfinMediaSources.cs +++ b/ErsatzTV.Application/Jellyfin/Queries/GetAllJellyfinMediaSources.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Jellyfin; -public record GetAllJellyfinMediaSources : IRequest>; \ No newline at end of file +public record GetAllJellyfinMediaSources : IRequest>; diff --git a/ErsatzTV.Application/Jellyfin/Queries/GetAllJellyfinMediaSourcesHandler.cs b/ErsatzTV.Application/Jellyfin/Queries/GetAllJellyfinMediaSourcesHandler.cs index 330797299..aa65fac16 100644 --- a/ErsatzTV.Application/Jellyfin/Queries/GetAllJellyfinMediaSourcesHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Queries/GetAllJellyfinMediaSourcesHandler.cs @@ -16,4 +16,4 @@ public class GetAllJellyfinMediaSources request, CancellationToken cancellationToken) => _mediaSourceRepository.GetAllJellyfin().Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinConnectionParameters.cs b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinConnectionParameters.cs index f007ee670..1d7cbf76b 100644 --- a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinConnectionParameters.cs +++ b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinConnectionParameters.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Jellyfin; -public record GetJellyfinConnectionParameters : IRequest>; \ No newline at end of file +public record GetJellyfinConnectionParameters : IRequest>; diff --git a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinConnectionParametersHandler.cs b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinConnectionParametersHandler.cs index 07fdfc781..af15ba254 100644 --- a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinConnectionParametersHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinConnectionParametersHandler.cs @@ -63,4 +63,4 @@ public class GetJellyfinConnectionParametersHandler : IRequestHandler>; \ No newline at end of file +public record GetJellyfinLibrariesBySourceId(int JellyfinMediaSourceId) : IRequest>; diff --git a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinLibrariesBySourceIdHandler.cs b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinLibrariesBySourceIdHandler.cs index b1232a4bd..9491118d8 100644 --- a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinLibrariesBySourceIdHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinLibrariesBySourceIdHandler.cs @@ -17,4 +17,4 @@ public class CancellationToken cancellationToken) => _mediaSourceRepository.GetJellyfinLibraries(request.JellyfinMediaSourceId) .Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinMediaSourceById.cs b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinMediaSourceById.cs index b6808d9ae..f730e26f9 100644 --- a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinMediaSourceById.cs +++ b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinMediaSourceById.cs @@ -1,4 +1,4 @@ namespace ErsatzTV.Application.Jellyfin; public record GetJellyfinMediaSourceById - (int JellyfinMediaSourceId) : IRequest>; \ No newline at end of file + (int JellyfinMediaSourceId) : IRequest>; diff --git a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinMediaSourceByIdHandler.cs b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinMediaSourceByIdHandler.cs index 9c9f7e454..70b8b8f1c 100644 --- a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinMediaSourceByIdHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinMediaSourceByIdHandler.cs @@ -16,4 +16,4 @@ public class GetJellyfinMediaSourceById request, CancellationToken cancellationToken) => _mediaSourceRepository.GetJellyfin(request.JellyfinMediaSourceId).MapT(ProjectToViewModel); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinPathReplacementsBySourceId.cs b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinPathReplacementsBySourceId.cs index 83eadc9e6..2f920b3d5 100644 --- a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinPathReplacementsBySourceId.cs +++ b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinPathReplacementsBySourceId.cs @@ -1,4 +1,4 @@ namespace ErsatzTV.Application.Jellyfin; public record GetJellyfinPathReplacementsBySourceId - (int JellyfinMediaSourceId) : IRequest>; \ No newline at end of file + (int JellyfinMediaSourceId) : IRequest>; diff --git a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinPathReplacementsBySourceIdHandler.cs b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinPathReplacementsBySourceIdHandler.cs index b84654063..f125a59a8 100644 --- a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinPathReplacementsBySourceIdHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinPathReplacementsBySourceIdHandler.cs @@ -16,4 +16,4 @@ public class GetJellyfinPathReplacementsBySourceIdHandler : IRequestHandler _mediaSourceRepository.GetJellyfinPathReplacements(request.JellyfinMediaSourceId) .Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinSecrets.cs b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinSecrets.cs index b67748306..a655655fb 100644 --- a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinSecrets.cs +++ b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinSecrets.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Jellyfin; -public record GetJellyfinSecrets : IRequest; \ No newline at end of file +public record GetJellyfinSecrets : IRequest; diff --git a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinSecretsHandler.cs b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinSecretsHandler.cs index 3f93735b7..6878c9759 100644 --- a/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinSecretsHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Queries/GetJellyfinSecretsHandler.cs @@ -12,4 +12,4 @@ public class GetJellyfinSecretsHandler : IRequestHandler Handle(GetJellyfinSecrets request, CancellationToken cancellationToken) => _jellyfinSecretStore.ReadSecrets(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Libraries/Commands/CreateLocalLibrary.cs b/ErsatzTV.Application/Libraries/Commands/CreateLocalLibrary.cs index b31e02118..c958aa12a 100644 --- a/ErsatzTV.Application/Libraries/Commands/CreateLocalLibrary.cs +++ b/ErsatzTV.Application/Libraries/Commands/CreateLocalLibrary.cs @@ -4,4 +4,4 @@ using ErsatzTV.Core.Domain; namespace ErsatzTV.Application.Libraries; public record CreateLocalLibrary(string Name, LibraryMediaKind MediaKind, List Paths) - : ILocalLibraryRequest, IRequest>; \ No newline at end of file + : ILocalLibraryRequest, IRequest>; diff --git a/ErsatzTV.Application/Libraries/Commands/CreateLocalLibraryHandler.cs b/ErsatzTV.Application/Libraries/Commands/CreateLocalLibraryHandler.cs index 83ed4eac8..66814dc15 100644 --- a/ErsatzTV.Application/Libraries/Commands/CreateLocalLibraryHandler.cs +++ b/ErsatzTV.Application/Libraries/Commands/CreateLocalLibraryHandler.cs @@ -12,9 +12,9 @@ namespace ErsatzTV.Application.Libraries; public class CreateLocalLibraryHandler : LocalLibraryHandlerBase, IRequestHandler> { - private readonly ChannelWriter _workerChannel; - private readonly IEntityLocker _entityLocker; private readonly IDbContextFactory _dbContextFactory; + private readonly IEntityLocker _entityLocker; + private readonly ChannelWriter _workerChannel; public CreateLocalLibraryHandler( ChannelWriter workerChannel, @@ -41,7 +41,7 @@ public class CreateLocalLibraryHandler : LocalLibraryHandlerBase, { await dbContext.LocalLibraries.AddAsync(localLibrary); await dbContext.SaveChangesAsync(); - + if (_entityLocker.LockLibrary(localLibrary.Id)) { await _workerChannel.WriteAsync(new ForceScanLocalLibrary(localLibrary.Id)); @@ -73,4 +73,4 @@ public class CreateLocalLibraryHandler : LocalLibraryHandlerBase, MediaSourceId = lms.Id }) .Map(o => o.ToValidation("LocalMediaSource does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Libraries/Commands/CreateLocalLibraryPath.cs b/ErsatzTV.Application/Libraries/Commands/CreateLocalLibraryPath.cs index d53b74971..29c6289ea 100644 --- a/ErsatzTV.Application/Libraries/Commands/CreateLocalLibraryPath.cs +++ b/ErsatzTV.Application/Libraries/Commands/CreateLocalLibraryPath.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Libraries; public record CreateLocalLibraryPath - (int LibraryId, string Path) : IRequest>; \ No newline at end of file + (int LibraryId, string Path) : IRequest>; diff --git a/ErsatzTV.Application/Libraries/Commands/CreateLocalLibraryPathHandler.cs b/ErsatzTV.Application/Libraries/Commands/CreateLocalLibraryPathHandler.cs index 72470d58e..53f198c36 100644 --- a/ErsatzTV.Application/Libraries/Commands/CreateLocalLibraryPathHandler.cs +++ b/ErsatzTV.Application/Libraries/Commands/CreateLocalLibraryPathHandler.cs @@ -48,4 +48,4 @@ public class CreateLocalLibraryPathHandler : IRequestHandler>; \ No newline at end of file +public record DeleteLocalLibrary(int LocalLibraryId) : IRequest>; diff --git a/ErsatzTV.Application/Libraries/Commands/DeleteLocalLibraryHandler.cs b/ErsatzTV.Application/Libraries/Commands/DeleteLocalLibraryHandler.cs index 7da9fc664..6e75f6733 100644 --- a/ErsatzTV.Application/Libraries/Commands/DeleteLocalLibraryHandler.cs +++ b/ErsatzTV.Application/Libraries/Commands/DeleteLocalLibraryHandler.cs @@ -27,8 +27,8 @@ public class DeleteLocalLibraryHandler : LocalLibraryHandlerBase, CancellationToken cancellationToken) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); - Validation validation = await LocalLibraryMustExist(dbContext, request); - return await validation.Apply(localLibrary => DoDeletion(dbContext, localLibrary)); + Validation validation = await LocalLibraryMustExist(dbContext, request); + return await LanguageExtensions.Apply(validation, localLibrary => DoDeletion(dbContext, localLibrary)); } private async Task DoDeletion(TvContext dbContext, LocalLibrary localLibrary) @@ -55,4 +55,4 @@ public class DeleteLocalLibraryHandler : LocalLibraryHandlerBase, dbContext.LocalLibraries .SelectOneAsync(ll => ll.Id, ll => ll.Id == request.LocalLibraryId) .Map(o => o.ToValidation($"Local library {request.LocalLibraryId} does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Libraries/Commands/ILocalLibraryRequest.cs b/ErsatzTV.Application/Libraries/Commands/ILocalLibraryRequest.cs index 0eba13106..698f643d4 100644 --- a/ErsatzTV.Application/Libraries/Commands/ILocalLibraryRequest.cs +++ b/ErsatzTV.Application/Libraries/Commands/ILocalLibraryRequest.cs @@ -3,4 +3,4 @@ public interface ILocalLibraryRequest { public string Name { get; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Libraries/Commands/LocalLibraryHandlerBase.cs b/ErsatzTV.Application/Libraries/Commands/LocalLibraryHandlerBase.cs index 17688ce65..15ea6617d 100644 --- a/ErsatzTV.Application/Libraries/Commands/LocalLibraryHandlerBase.cs +++ b/ErsatzTV.Application/Libraries/Commands/LocalLibraryHandlerBase.cs @@ -30,7 +30,7 @@ public abstract class LocalLibraryHandlerBase .Map(_ => localLibrary) .ToValidation("Path must not belong to another library path"); } - + private static bool AreSubPaths(string path1, string path2) { string one = path1 + Path.DirectorySeparatorChar; @@ -38,4 +38,4 @@ public abstract class LocalLibraryHandlerBase return one == two || one.StartsWith(two, StringComparison.OrdinalIgnoreCase) || two.StartsWith(one, StringComparison.OrdinalIgnoreCase); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Libraries/Commands/MoveLocalLibraryPath.cs b/ErsatzTV.Application/Libraries/Commands/MoveLocalLibraryPath.cs index ecf9d52b9..9cbbb5c5a 100644 --- a/ErsatzTV.Application/Libraries/Commands/MoveLocalLibraryPath.cs +++ b/ErsatzTV.Application/Libraries/Commands/MoveLocalLibraryPath.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Libraries; -public record MoveLocalLibraryPath(int LibraryPathId, int TargetLibraryId) : IRequest>; \ No newline at end of file +public record MoveLocalLibraryPath(int LibraryPathId, int TargetLibraryId) : IRequest>; diff --git a/ErsatzTV.Application/Libraries/Commands/MoveLocalLibraryPathHandler.cs b/ErsatzTV.Application/Libraries/Commands/MoveLocalLibraryPathHandler.cs index ffe1b0a39..14f86f6b3 100644 --- a/ErsatzTV.Application/Libraries/Commands/MoveLocalLibraryPathHandler.cs +++ b/ErsatzTV.Application/Libraries/Commands/MoveLocalLibraryPathHandler.cs @@ -12,10 +12,10 @@ namespace ErsatzTV.Application.Libraries; public class MoveLocalLibraryPathHandler : IRequestHandler> { - private readonly ISearchIndex _searchIndex; - private readonly ISearchRepository _searchRepository; private readonly IDbContextFactory _dbContextFactory; private readonly ILogger _logger; + private readonly ISearchIndex _searchIndex; + private readonly ISearchRepository _searchRepository; public MoveLocalLibraryPathHandler( ISearchIndex searchIndex, @@ -35,7 +35,7 @@ public class MoveLocalLibraryPathHandler : IRequestHandler validation = await Validate(dbContext, request); - return await validation.Apply(parameters => MovePath(dbContext, parameters)); + return await LanguageExtensions.Apply(validation, parameters => MovePath(dbContext, parameters)); } private async Task MovePath(TvContext dbContext, Parameters parameters) @@ -109,4 +109,4 @@ public class MoveLocalLibraryPathHandler : IRequestHandler Paths) : ILocalLibraryRequest, - IRequest>; \ No newline at end of file + IRequest>; diff --git a/ErsatzTV.Application/Libraries/Commands/UpdateLocalLibraryHandler.cs b/ErsatzTV.Application/Libraries/Commands/UpdateLocalLibraryHandler.cs index 3aa29fbf1..30d524e63 100644 --- a/ErsatzTV.Application/Libraries/Commands/UpdateLocalLibraryHandler.cs +++ b/ErsatzTV.Application/Libraries/Commands/UpdateLocalLibraryHandler.cs @@ -14,10 +14,10 @@ namespace ErsatzTV.Application.Libraries; public class UpdateLocalLibraryHandler : LocalLibraryHandlerBase, IRequestHandler> { - private readonly ChannelWriter _workerChannel; + private readonly IDbContextFactory _dbContextFactory; private readonly IEntityLocker _entityLocker; private readonly ISearchIndex _searchIndex; - private readonly IDbContextFactory _dbContextFactory; + private readonly ChannelWriter _workerChannel; public UpdateLocalLibraryHandler( ChannelWriter workerChannel, @@ -44,7 +44,7 @@ public class UpdateLocalLibraryHandler : LocalLibraryHandlerBase, { (LocalLibrary existing, LocalLibrary incoming) = parameters; existing.Name = incoming.Name; - + var toAdd = incoming.Paths .Filter(p => existing.Paths.All(ep => NormalizePath(ep.Path) != NormalizePath(p.Path))) .ToList(); @@ -58,7 +58,7 @@ public class UpdateLocalLibraryHandler : LocalLibraryHandlerBase, .Filter(mi => toRemoveIds.Contains(mi.LibraryPathId)) .Map(mi => mi.Id) .ToListAsync(); - + existing.Paths.RemoveAll(toRemove.Contains); existing.Paths.AddRange(toAdd); @@ -105,12 +105,10 @@ public class UpdateLocalLibraryHandler : LocalLibraryHandlerBase, }) .Map(o => o.ToValidation("LocalLibrary does not exist.")); - private record Parameters(LocalLibrary Existing, LocalLibrary Incoming); - - private static string NormalizePath(string path) - { - return Path.GetFullPath(new Uri(path).LocalPath) + private static string NormalizePath(string path) => + Path.GetFullPath(new Uri(path).LocalPath) .TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) .ToUpperInvariant(); - } -} \ No newline at end of file + + private record Parameters(LocalLibrary Existing, LocalLibrary Incoming); +} diff --git a/ErsatzTV.Application/Libraries/LibraryViewModel.cs b/ErsatzTV.Application/Libraries/LibraryViewModel.cs index cb3b52149..77155c4f4 100644 --- a/ErsatzTV.Application/Libraries/LibraryViewModel.cs +++ b/ErsatzTV.Application/Libraries/LibraryViewModel.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Libraries; -public record LibraryViewModel(string LibraryKind, int Id, string Name, LibraryMediaKind MediaKind); \ No newline at end of file +public record LibraryViewModel(string LibraryKind, int Id, string Name, LibraryMediaKind MediaKind); diff --git a/ErsatzTV.Application/Libraries/LocalLibraryPathViewModel.cs b/ErsatzTV.Application/Libraries/LocalLibraryPathViewModel.cs index 54778c8f0..331263f29 100644 --- a/ErsatzTV.Application/Libraries/LocalLibraryPathViewModel.cs +++ b/ErsatzTV.Application/Libraries/LocalLibraryPathViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Libraries; -public record LocalLibraryPathViewModel(int Id, int LibraryId, string Path); \ No newline at end of file +public record LocalLibraryPathViewModel(int Id, int LibraryId, string Path); diff --git a/ErsatzTV.Application/Libraries/LocalLibraryViewModel.cs b/ErsatzTV.Application/Libraries/LocalLibraryViewModel.cs index 64acf4140..b855ea3c2 100644 --- a/ErsatzTV.Application/Libraries/LocalLibraryViewModel.cs +++ b/ErsatzTV.Application/Libraries/LocalLibraryViewModel.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Libraries; public record LocalLibraryViewModel(int Id, string Name, LibraryMediaKind MediaKind) - : LibraryViewModel("Local", Id, Name, MediaKind); \ No newline at end of file + : LibraryViewModel("Local", Id, Name, MediaKind); diff --git a/ErsatzTV.Application/Libraries/Mapper.cs b/ErsatzTV.Application/Libraries/Mapper.cs index 76e56856f..ae872681e 100644 --- a/ErsatzTV.Application/Libraries/Mapper.cs +++ b/ErsatzTV.Application/Libraries/Mapper.cs @@ -21,4 +21,4 @@ internal static class Mapper public static LocalLibraryPathViewModel ProjectToViewModel(LibraryPath libraryPath) => new(libraryPath.Id, libraryPath.LibraryId, libraryPath.Path); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Libraries/PlexLibraryViewModel.cs b/ErsatzTV.Application/Libraries/PlexLibraryViewModel.cs index eabc26bb3..e19c19844 100644 --- a/ErsatzTV.Application/Libraries/PlexLibraryViewModel.cs +++ b/ErsatzTV.Application/Libraries/PlexLibraryViewModel.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Libraries; public record PlexLibraryViewModel(int Id, string Name, LibraryMediaKind MediaKind) - : LibraryViewModel("Plex", Id, Name, MediaKind); \ No newline at end of file + : LibraryViewModel("Plex", Id, Name, MediaKind); diff --git a/ErsatzTV.Application/Libraries/Queries/CountMediaItemsByLibrary.cs b/ErsatzTV.Application/Libraries/Queries/CountMediaItemsByLibrary.cs index f7353132e..98bb0bfc0 100644 --- a/ErsatzTV.Application/Libraries/Queries/CountMediaItemsByLibrary.cs +++ b/ErsatzTV.Application/Libraries/Queries/CountMediaItemsByLibrary.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Libraries; -public record CountMediaItemsByLibrary(int LibraryId) : IRequest; \ No newline at end of file +public record CountMediaItemsByLibrary(int LibraryId) : IRequest; diff --git a/ErsatzTV.Application/Libraries/Queries/CountMediaItemsByLibraryHandler.cs b/ErsatzTV.Application/Libraries/Queries/CountMediaItemsByLibraryHandler.cs index a6e50255d..031d9d15e 100644 --- a/ErsatzTV.Application/Libraries/Queries/CountMediaItemsByLibraryHandler.cs +++ b/ErsatzTV.Application/Libraries/Queries/CountMediaItemsByLibraryHandler.cs @@ -8,10 +8,8 @@ public class CountMediaItemsByLibraryHandler : IRequestHandler _dbContextFactory; - public CountMediaItemsByLibraryHandler(IDbContextFactory dbContextFactory) - { + public CountMediaItemsByLibraryHandler(IDbContextFactory dbContextFactory) => _dbContextFactory = dbContextFactory; - } public async Task Handle(CountMediaItemsByLibrary request, CancellationToken cancellationToken) { @@ -22,4 +20,4 @@ public class CountMediaItemsByLibraryHandler : IRequestHandler; \ No newline at end of file +public record CountMediaItemsByLibraryPath(int LibraryPathId) : IRequest; diff --git a/ErsatzTV.Application/Libraries/Queries/CountMediaItemsByLibraryPathHandler.cs b/ErsatzTV.Application/Libraries/Queries/CountMediaItemsByLibraryPathHandler.cs index 398bc79bc..b80a22c12 100644 --- a/ErsatzTV.Application/Libraries/Queries/CountMediaItemsByLibraryPathHandler.cs +++ b/ErsatzTV.Application/Libraries/Queries/CountMediaItemsByLibraryPathHandler.cs @@ -11,4 +11,4 @@ public class CountMediaItemsByLibraryPathHandler : IRequestHandler Handle(CountMediaItemsByLibraryPath request, CancellationToken cancellationToken) => _libraryRepository.CountMediaItemsByPath(request.LibraryPathId); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Libraries/Queries/GetAllLocalLibraries.cs b/ErsatzTV.Application/Libraries/Queries/GetAllLocalLibraries.cs index 28d3ff1ed..d80c73946 100644 --- a/ErsatzTV.Application/Libraries/Queries/GetAllLocalLibraries.cs +++ b/ErsatzTV.Application/Libraries/Queries/GetAllLocalLibraries.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Libraries; -public record GetAllLocalLibraries : IRequest>; \ No newline at end of file +public record GetAllLocalLibraries : IRequest>; diff --git a/ErsatzTV.Application/Libraries/Queries/GetAllLocalLibrariesHandler.cs b/ErsatzTV.Application/Libraries/Queries/GetAllLocalLibrariesHandler.cs index b0b18efec..78116098f 100644 --- a/ErsatzTV.Application/Libraries/Queries/GetAllLocalLibrariesHandler.cs +++ b/ErsatzTV.Application/Libraries/Queries/GetAllLocalLibrariesHandler.cs @@ -20,4 +20,4 @@ public class GetAllLocalLibrariesHandler : IRequestHandler l.MediaKind) .Map(ProjectToViewModel) .ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Libraries/Queries/GetConfiguredLibraries.cs b/ErsatzTV.Application/Libraries/Queries/GetConfiguredLibraries.cs index 42e2779b5..2acf1047c 100644 --- a/ErsatzTV.Application/Libraries/Queries/GetConfiguredLibraries.cs +++ b/ErsatzTV.Application/Libraries/Queries/GetConfiguredLibraries.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Libraries; -public record GetConfiguredLibraries : IRequest>; \ No newline at end of file +public record GetConfiguredLibraries : IRequest>; diff --git a/ErsatzTV.Application/Libraries/Queries/GetConfiguredLibrariesHandler.cs b/ErsatzTV.Application/Libraries/Queries/GetConfiguredLibrariesHandler.cs index 2187e1945..554ef80a2 100644 --- a/ErsatzTV.Application/Libraries/Queries/GetConfiguredLibrariesHandler.cs +++ b/ErsatzTV.Application/Libraries/Queries/GetConfiguredLibrariesHandler.cs @@ -31,4 +31,4 @@ public class GetConfiguredLibrariesHandler : IRequestHandler emby.ShouldSyncItems, _ => false }; -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryById.cs b/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryById.cs index 229c46999..f6f498618 100644 --- a/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryById.cs +++ b/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryById.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Libraries; -public record GetLocalLibraryById(int LibraryId) : IRequest>; \ No newline at end of file +public record GetLocalLibraryById(int LibraryId) : IRequest>; diff --git a/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryByIdHandler.cs b/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryByIdHandler.cs index de85e1b7b..5502307ba 100644 --- a/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryByIdHandler.cs +++ b/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryByIdHandler.cs @@ -14,4 +14,4 @@ public class GetLocalLibraryByIdHandler : IRequestHandler _libraryRepository.GetLocal(request.LibraryId).MapT(ProjectToViewModel); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryPaths.cs b/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryPaths.cs index 46077f1f1..5fae4c33f 100644 --- a/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryPaths.cs +++ b/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryPaths.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Libraries; -public record GetLocalLibraryPaths(int LocalLibraryId) : IRequest>; \ No newline at end of file +public record GetLocalLibraryPaths(int LocalLibraryId) : IRequest>; diff --git a/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryPathsHandler.cs b/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryPathsHandler.cs index c0f596ffb..765aa89d7 100644 --- a/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryPathsHandler.cs +++ b/ErsatzTV.Application/Libraries/Queries/GetLocalLibraryPathsHandler.cs @@ -15,4 +15,4 @@ public class GetLocalLibraryPathsHandler : IRequestHandler _libraryRepository.GetLocalPaths(request.LocalLibraryId) .Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Logs/LogEntryViewModel.cs b/ErsatzTV.Application/Logs/LogEntryViewModel.cs index 140d5a51d..98b14d83b 100644 --- a/ErsatzTV.Application/Logs/LogEntryViewModel.cs +++ b/ErsatzTV.Application/Logs/LogEntryViewModel.cs @@ -7,4 +7,4 @@ public record LogEntryViewModel( DateTime Timestamp, LogEventLevel Level, string Exception, - string Message); \ No newline at end of file + string Message); diff --git a/ErsatzTV.Application/Logs/Mapper.cs b/ErsatzTV.Application/Logs/Mapper.cs index 3d55a3820..37eecf048 100644 --- a/ErsatzTV.Application/Logs/Mapper.cs +++ b/ErsatzTV.Application/Logs/Mapper.cs @@ -39,4 +39,4 @@ internal static class Mapper logEntry.Exception, message); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Logs/PagedLogEntriesViewModel.cs b/ErsatzTV.Application/Logs/PagedLogEntriesViewModel.cs index 6a343d644..6260b3971 100644 --- a/ErsatzTV.Application/Logs/PagedLogEntriesViewModel.cs +++ b/ErsatzTV.Application/Logs/PagedLogEntriesViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Logs; -public record PagedLogEntriesViewModel(int TotalCount, List Page); \ No newline at end of file +public record PagedLogEntriesViewModel(int TotalCount, List Page); diff --git a/ErsatzTV.Application/Logs/Queries/GetRecentLogEntries.cs b/ErsatzTV.Application/Logs/Queries/GetRecentLogEntries.cs index 5344085df..02dd57acd 100644 --- a/ErsatzTV.Application/Logs/Queries/GetRecentLogEntries.cs +++ b/ErsatzTV.Application/Logs/Queries/GetRecentLogEntries.cs @@ -7,4 +7,4 @@ public record GetRecentLogEntries(int PageNum, int PageSize) : IRequest> SortExpression { get; set; } public Option SortDescending { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Logs/Queries/GetRecentLogEntriesHandler.cs b/ErsatzTV.Application/Logs/Queries/GetRecentLogEntriesHandler.cs index bf7881f10..2ef4a8ca2 100644 --- a/ErsatzTV.Application/Logs/Queries/GetRecentLogEntriesHandler.cs +++ b/ErsatzTV.Application/Logs/Queries/GetRecentLogEntriesHandler.cs @@ -37,4 +37,4 @@ public class GetRecentLogEntriesHandler : IRequestHandler> + DeleteItemsFromDatabaseHandler : IRequestHandler> { private readonly IMediaItemRepository _mediaItemRepository; private readonly ISearchIndex _searchIndex; @@ -31,4 +31,4 @@ public class return deleteResult; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Maintenance/Commands/DeleteOrphanedArtwork.cs b/ErsatzTV.Application/Maintenance/Commands/DeleteOrphanedArtwork.cs index 9ab46be81..c6d625e0c 100644 --- a/ErsatzTV.Application/Maintenance/Commands/DeleteOrphanedArtwork.cs +++ b/ErsatzTV.Application/Maintenance/Commands/DeleteOrphanedArtwork.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Maintenance; -public record DeleteOrphanedArtwork : MediatR.IRequest>, IBackgroundServiceRequest; \ No newline at end of file +public record DeleteOrphanedArtwork : IRequest>, IBackgroundServiceRequest; diff --git a/ErsatzTV.Application/Maintenance/Commands/DeleteOrphanedArtworkHandler.cs b/ErsatzTV.Application/Maintenance/Commands/DeleteOrphanedArtworkHandler.cs index 41222782e..2b6bc3e2b 100644 --- a/ErsatzTV.Application/Maintenance/Commands/DeleteOrphanedArtworkHandler.cs +++ b/ErsatzTV.Application/Maintenance/Commands/DeleteOrphanedArtworkHandler.cs @@ -3,7 +3,7 @@ using ErsatzTV.Core.Interfaces.Repositories; namespace ErsatzTV.Application.Maintenance; -public class DeleteOrphanedArtworkHandler : MediatR.IRequestHandler> +public class DeleteOrphanedArtworkHandler : IRequestHandler> { private readonly IArtworkRepository _artworkRepository; @@ -15,4 +15,4 @@ public class DeleteOrphanedArtworkHandler : MediatR.IRequestHandler Right(Unit.Default)); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Maintenance/Commands/EmptyTrashHandler.cs b/ErsatzTV.Application/Maintenance/Commands/EmptyTrashHandler.cs index d604b5153..f7077f7b9 100644 --- a/ErsatzTV.Application/Maintenance/Commands/EmptyTrashHandler.cs +++ b/ErsatzTV.Application/Maintenance/Commands/EmptyTrashHandler.cs @@ -52,4 +52,4 @@ public class EmptyTrashHandler : IRequestHandler Cards, - Option PageMap); \ No newline at end of file + Option PageMap); diff --git a/ErsatzTV.Application/MediaCards/ArtistCardViewModel.cs b/ErsatzTV.Application/MediaCards/ArtistCardViewModel.cs index 74cc8b99f..e1183d0f9 100644 --- a/ErsatzTV.Application/MediaCards/ArtistCardViewModel.cs +++ b/ErsatzTV.Application/MediaCards/ArtistCardViewModel.cs @@ -15,4 +15,4 @@ public record ArtistCardViewModel Subtitle, SortTitle, Poster, - State); \ No newline at end of file + State); diff --git a/ErsatzTV.Application/MediaCards/CollectionCardResultsViewModel.cs b/ErsatzTV.Application/MediaCards/CollectionCardResultsViewModel.cs index ac9737603..a1125872b 100644 --- a/ErsatzTV.Application/MediaCards/CollectionCardResultsViewModel.cs +++ b/ErsatzTV.Application/MediaCards/CollectionCardResultsViewModel.cs @@ -12,4 +12,4 @@ public record CollectionCardResultsViewModel( List SongCards) { public bool UseCustomPlaybackOrder { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCards/Mapper.cs b/ErsatzTV.Application/MediaCards/Mapper.cs index 1f4f262c4..20a47e9aa 100644 --- a/ErsatzTV.Application/MediaCards/Mapper.cs +++ b/ErsatzTV.Application/MediaCards/Mapper.cs @@ -19,7 +19,7 @@ internal static class Mapper showMetadata.SortTitle, GetPoster(showMetadata, maybeJellyfin, maybeEmby), showMetadata.Show.State); - + internal static TelevisionSeasonCardViewModel ProjectToViewModel( Season season, Option maybeJellyfin, @@ -256,4 +256,4 @@ internal static class Mapper return thumb; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCards/MediaCardViewModel.cs b/ErsatzTV.Application/MediaCards/MediaCardViewModel.cs index db68dd45b..0db9f192a 100644 --- a/ErsatzTV.Application/MediaCards/MediaCardViewModel.cs +++ b/ErsatzTV.Application/MediaCards/MediaCardViewModel.cs @@ -8,4 +8,4 @@ public record MediaCardViewModel( string Subtitle, string SortTitle, string Poster, - MediaItemState State); \ No newline at end of file + MediaItemState State); diff --git a/ErsatzTV.Application/MediaCards/MovieCardResultsViewModel.cs b/ErsatzTV.Application/MediaCards/MovieCardResultsViewModel.cs index e2906452c..488c50023 100644 --- a/ErsatzTV.Application/MediaCards/MovieCardResultsViewModel.cs +++ b/ErsatzTV.Application/MediaCards/MovieCardResultsViewModel.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaCards; -public record MovieCardResultsViewModel(int Count, List Cards, Option PageMap); \ No newline at end of file +public record MovieCardResultsViewModel(int Count, List Cards, Option PageMap); diff --git a/ErsatzTV.Application/MediaCards/MovieCardViewModel.cs b/ErsatzTV.Application/MediaCards/MovieCardViewModel.cs index 71e4e9690..5b14bd786 100644 --- a/ErsatzTV.Application/MediaCards/MovieCardViewModel.cs +++ b/ErsatzTV.Application/MediaCards/MovieCardViewModel.cs @@ -18,4 +18,4 @@ public record MovieCardViewModel State) { public int CustomIndex { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCards/MusicVideoCardResultsViewModel.cs b/ErsatzTV.Application/MediaCards/MusicVideoCardResultsViewModel.cs index 4d11cfac8..510db7aad 100644 --- a/ErsatzTV.Application/MediaCards/MusicVideoCardResultsViewModel.cs +++ b/ErsatzTV.Application/MediaCards/MusicVideoCardResultsViewModel.cs @@ -5,4 +5,4 @@ namespace ErsatzTV.Application.MediaCards; public record MusicVideoCardResultsViewModel( int Count, List Cards, - Option PageMap); \ No newline at end of file + Option PageMap); diff --git a/ErsatzTV.Application/MediaCards/MusicVideoCardViewModel.cs b/ErsatzTV.Application/MediaCards/MusicVideoCardViewModel.cs index ebe4824fa..85d8bad3e 100644 --- a/ErsatzTV.Application/MediaCards/MusicVideoCardViewModel.cs +++ b/ErsatzTV.Application/MediaCards/MusicVideoCardViewModel.cs @@ -21,4 +21,4 @@ public record MusicVideoCardViewModel State) { public int CustomIndex { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCards/OtherVideoCardResultsViewModel.cs b/ErsatzTV.Application/MediaCards/OtherVideoCardResultsViewModel.cs index 45b9585ef..dfd2712ec 100644 --- a/ErsatzTV.Application/MediaCards/OtherVideoCardResultsViewModel.cs +++ b/ErsatzTV.Application/MediaCards/OtherVideoCardResultsViewModel.cs @@ -5,4 +5,4 @@ namespace ErsatzTV.Application.MediaCards; public record OtherVideoCardResultsViewModel( int Count, List Cards, - Option PageMap); \ No newline at end of file + Option PageMap); diff --git a/ErsatzTV.Application/MediaCards/OtherVideoCardViewModel.cs b/ErsatzTV.Application/MediaCards/OtherVideoCardViewModel.cs index a4092658e..f06476a02 100644 --- a/ErsatzTV.Application/MediaCards/OtherVideoCardViewModel.cs +++ b/ErsatzTV.Application/MediaCards/OtherVideoCardViewModel.cs @@ -17,4 +17,4 @@ public record OtherVideoCardViewModel State) { public int CustomIndex { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCards/Queries/GetCollectionCards.cs b/ErsatzTV.Application/MediaCards/Queries/GetCollectionCards.cs index bf3b80d58..ec416aa44 100644 --- a/ErsatzTV.Application/MediaCards/Queries/GetCollectionCards.cs +++ b/ErsatzTV.Application/MediaCards/Queries/GetCollectionCards.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaCards; -public record GetCollectionCards(int Id) : IRequest>; \ No newline at end of file +public record GetCollectionCards(int Id) : IRequest>; diff --git a/ErsatzTV.Application/MediaCards/Queries/GetCollectionCardsHandler.cs b/ErsatzTV.Application/MediaCards/Queries/GetCollectionCardsHandler.cs index 215212a4a..e913b8589 100644 --- a/ErsatzTV.Application/MediaCards/Queries/GetCollectionCardsHandler.cs +++ b/ErsatzTV.Application/MediaCards/Queries/GetCollectionCardsHandler.cs @@ -101,4 +101,4 @@ public class GetCollectionCardsHandler : .Map(c => c.ToEither(BaseError.New("Unable to load collection"))) .MapT(c => ProjectToViewModel(c, maybeJellyfin, maybeEmby)); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCards/Queries/GetMusicVideoCards.cs b/ErsatzTV.Application/MediaCards/Queries/GetMusicVideoCards.cs index 2399f57a9..99cac8aab 100644 --- a/ErsatzTV.Application/MediaCards/Queries/GetMusicVideoCards.cs +++ b/ErsatzTV.Application/MediaCards/Queries/GetMusicVideoCards.cs @@ -1,4 +1,4 @@ namespace ErsatzTV.Application.MediaCards; public record GetMusicVideoCards - (int ArtistId, int PageNumber, int PageSize) : IRequest; \ No newline at end of file + (int ArtistId, int PageNumber, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/MediaCards/Queries/GetMusicVideoCardsHandler.cs b/ErsatzTV.Application/MediaCards/Queries/GetMusicVideoCardsHandler.cs index 6ff72922b..514b3d65f 100644 --- a/ErsatzTV.Application/MediaCards/Queries/GetMusicVideoCardsHandler.cs +++ b/ErsatzTV.Application/MediaCards/Queries/GetMusicVideoCardsHandler.cs @@ -22,4 +22,4 @@ public class GetMusicVideoCardsHandler : IRequestHandler; \ No newline at end of file + (int TelevisionSeasonId, int PageNumber, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/MediaCards/Queries/GetTelevisionEpisodeCardsHandler.cs b/ErsatzTV.Application/MediaCards/Queries/GetTelevisionEpisodeCardsHandler.cs index 3863ca021..0f2b7949d 100644 --- a/ErsatzTV.Application/MediaCards/Queries/GetTelevisionEpisodeCardsHandler.cs +++ b/ErsatzTV.Application/MediaCards/Queries/GetTelevisionEpisodeCardsHandler.cs @@ -38,4 +38,4 @@ public class return new TelevisionEpisodeCardResultsViewModel(count, results, Option.None); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCards/Queries/GetTelevisionSeasonCards.cs b/ErsatzTV.Application/MediaCards/Queries/GetTelevisionSeasonCards.cs index 20cfeabd2..40a30fa97 100644 --- a/ErsatzTV.Application/MediaCards/Queries/GetTelevisionSeasonCards.cs +++ b/ErsatzTV.Application/MediaCards/Queries/GetTelevisionSeasonCards.cs @@ -1,4 +1,4 @@ namespace ErsatzTV.Application.MediaCards; public record GetTelevisionSeasonCards - (int TelevisionShowId, int PageNumber, int PageSize) : IRequest; \ No newline at end of file + (int TelevisionShowId, int PageNumber, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/MediaCards/Queries/GetTelevisionSeasonCardsHandler.cs b/ErsatzTV.Application/MediaCards/Queries/GetTelevisionSeasonCardsHandler.cs index 61d3b5a54..e8d428e65 100644 --- a/ErsatzTV.Application/MediaCards/Queries/GetTelevisionSeasonCardsHandler.cs +++ b/ErsatzTV.Application/MediaCards/Queries/GetTelevisionSeasonCardsHandler.cs @@ -37,4 +37,4 @@ public class return new TelevisionSeasonCardResultsViewModel(count, results, None); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCards/SearchCardResultsViewModel.cs b/ErsatzTV.Application/MediaCards/SearchCardResultsViewModel.cs index 88be2d8a6..4961f8905 100644 --- a/ErsatzTV.Application/MediaCards/SearchCardResultsViewModel.cs +++ b/ErsatzTV.Application/MediaCards/SearchCardResultsViewModel.cs @@ -2,4 +2,4 @@ public record SearchCardResultsViewModel( List MovieCards, - List ShowCards); \ No newline at end of file + List ShowCards); diff --git a/ErsatzTV.Application/MediaCards/SongCardResultsViewModel.cs b/ErsatzTV.Application/MediaCards/SongCardResultsViewModel.cs index eca3dc2cb..7022ae5a0 100644 --- a/ErsatzTV.Application/MediaCards/SongCardResultsViewModel.cs +++ b/ErsatzTV.Application/MediaCards/SongCardResultsViewModel.cs @@ -5,4 +5,4 @@ namespace ErsatzTV.Application.MediaCards; public record SongCardResultsViewModel( int Count, List Cards, - Option PageMap); \ No newline at end of file + Option PageMap); diff --git a/ErsatzTV.Application/MediaCards/SongCardViewModel.cs b/ErsatzTV.Application/MediaCards/SongCardViewModel.cs index b1a02141a..35668fd15 100644 --- a/ErsatzTV.Application/MediaCards/SongCardViewModel.cs +++ b/ErsatzTV.Application/MediaCards/SongCardViewModel.cs @@ -18,4 +18,4 @@ public record SongCardViewModel State) { public int CustomIndex { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCards/TelevisionEpisodeCardResultsViewModel.cs b/ErsatzTV.Application/MediaCards/TelevisionEpisodeCardResultsViewModel.cs index af3c11ccd..a47daaf16 100644 --- a/ErsatzTV.Application/MediaCards/TelevisionEpisodeCardResultsViewModel.cs +++ b/ErsatzTV.Application/MediaCards/TelevisionEpisodeCardResultsViewModel.cs @@ -5,4 +5,4 @@ namespace ErsatzTV.Application.MediaCards; public record TelevisionEpisodeCardResultsViewModel( int Count, List Cards, - Option PageMap); \ No newline at end of file + Option PageMap); diff --git a/ErsatzTV.Application/MediaCards/TelevisionEpisodeCardViewModel.cs b/ErsatzTV.Application/MediaCards/TelevisionEpisodeCardViewModel.cs index 5d47f6c2e..78f5a9595 100644 --- a/ErsatzTV.Application/MediaCards/TelevisionEpisodeCardViewModel.cs +++ b/ErsatzTV.Application/MediaCards/TelevisionEpisodeCardViewModel.cs @@ -24,4 +24,4 @@ public record TelevisionEpisodeCardViewModel $"Episode {Episode}", SortTitle, Poster, - State); \ No newline at end of file + State); diff --git a/ErsatzTV.Application/MediaCards/TelevisionSeasonCardResultsViewModel.cs b/ErsatzTV.Application/MediaCards/TelevisionSeasonCardResultsViewModel.cs index c3a2d2057..ffed17b5c 100644 --- a/ErsatzTV.Application/MediaCards/TelevisionSeasonCardResultsViewModel.cs +++ b/ErsatzTV.Application/MediaCards/TelevisionSeasonCardResultsViewModel.cs @@ -5,4 +5,4 @@ namespace ErsatzTV.Application.MediaCards; public record TelevisionSeasonCardResultsViewModel( int Count, List Cards, - Option PageMap); \ No newline at end of file + Option PageMap); diff --git a/ErsatzTV.Application/MediaCards/TelevisionSeasonCardViewModel.cs b/ErsatzTV.Application/MediaCards/TelevisionSeasonCardViewModel.cs index d2f42db14..ab5ab474f 100644 --- a/ErsatzTV.Application/MediaCards/TelevisionSeasonCardViewModel.cs +++ b/ErsatzTV.Application/MediaCards/TelevisionSeasonCardViewModel.cs @@ -18,4 +18,4 @@ public record TelevisionSeasonCardViewModel Subtitle, SortTitle, Poster, - State); \ No newline at end of file + State); diff --git a/ErsatzTV.Application/MediaCards/TelevisionShowCardResultsViewModel.cs b/ErsatzTV.Application/MediaCards/TelevisionShowCardResultsViewModel.cs index 3e1264369..4f410e39d 100644 --- a/ErsatzTV.Application/MediaCards/TelevisionShowCardResultsViewModel.cs +++ b/ErsatzTV.Application/MediaCards/TelevisionShowCardResultsViewModel.cs @@ -5,4 +5,4 @@ namespace ErsatzTV.Application.MediaCards; public record TelevisionShowCardResultsViewModel( int Count, List Cards, - Option PageMap); \ No newline at end of file + Option PageMap); diff --git a/ErsatzTV.Application/MediaCards/TelevisionShowCardViewModel.cs b/ErsatzTV.Application/MediaCards/TelevisionShowCardViewModel.cs index 3aee93167..addd38881 100644 --- a/ErsatzTV.Application/MediaCards/TelevisionShowCardViewModel.cs +++ b/ErsatzTV.Application/MediaCards/TelevisionShowCardViewModel.cs @@ -15,4 +15,4 @@ public record TelevisionShowCardViewModel Subtitle, SortTitle, Poster, - State); \ No newline at end of file + State); diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddArtistToCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/AddArtistToCollection.cs index c2711031b..63bbee49f 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddArtistToCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddArtistToCollection.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.MediaCollections; public record AddArtistToCollection - (int CollectionId, int ArtistId) : MediatR.IRequest>; \ No newline at end of file + (int CollectionId, int ArtistId) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddArtistToCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/AddArtistToCollectionHandler.cs index 8af663b2a..bbfcbc1e3 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddArtistToCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddArtistToCollectionHandler.cs @@ -33,7 +33,7 @@ public class AddArtistToCollectionHandler : { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(parameters => ApplyAddArtistRequest(dbContext, parameters)); + return await LanguageExtensions.Apply(validation, parameters => ApplyAddArtistRequest(dbContext, parameters)); } private async Task ApplyAddArtistRequest(TvContext dbContext, Parameters parameters) @@ -43,7 +43,7 @@ public class AddArtistToCollectionHandler : { // refresh all playouts that use this collection foreach (int playoutId in await _mediaCollectionRepository - .PlayoutIdsUsingCollection(parameters.Collection.Id)) + .PlayoutIdsUsingCollection(parameters.Collection.Id)) { await _channel.WriteAsync(new BuildPlayout(playoutId, PlayoutBuildMode.Refresh)); } @@ -74,4 +74,4 @@ public class AddArtistToCollectionHandler : .Map(o => o.ToValidation("Artist does not exist")); private record Parameters(Collection Collection, Artist Artist); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddEpisodeToCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/AddEpisodeToCollection.cs index 79ce6509f..35f467008 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddEpisodeToCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddEpisodeToCollection.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaCollections; -public record AddEpisodeToCollection(int CollectionId, int EpisodeId) : MediatR.IRequest>; \ No newline at end of file +public record AddEpisodeToCollection(int CollectionId, int EpisodeId) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddEpisodeToCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/AddEpisodeToCollectionHandler.cs index 125cbd5e3..6777e3866 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddEpisodeToCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddEpisodeToCollectionHandler.cs @@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.MediaCollections; public class AddEpisodeToCollectionHandler : - MediatR.IRequestHandler> + IRequestHandler> { private readonly ChannelWriter _channel; private readonly IDbContextFactory _dbContextFactory; @@ -33,7 +33,9 @@ public class AddEpisodeToCollectionHandler : { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(parameters => ApplyAddTelevisionEpisodeRequest(dbContext, parameters)); + return await LanguageExtensions.Apply( + validation, + parameters => ApplyAddTelevisionEpisodeRequest(dbContext, parameters)); } private async Task ApplyAddTelevisionEpisodeRequest(TvContext dbContext, Parameters parameters) @@ -43,7 +45,7 @@ public class AddEpisodeToCollectionHandler : { // refresh all playouts that use this collection foreach (int playoutId in await _mediaCollectionRepository - .PlayoutIdsUsingCollection(parameters.Collection.Id)) + .PlayoutIdsUsingCollection(parameters.Collection.Id)) { await _channel.WriteAsync(new BuildPlayout(playoutId, PlayoutBuildMode.Refresh)); } @@ -74,4 +76,4 @@ public class AddEpisodeToCollectionHandler : .Map(o => o.ToValidation("Episode does not exist")); private record Parameters(Collection Collection, Episode Episode); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddItemsToCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/AddItemsToCollection.cs index aada16a44..fddd89e7a 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddItemsToCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddItemsToCollection.cs @@ -12,4 +12,4 @@ public record AddItemsToCollection List ArtistIds, List MusicVideoIds, List OtherVideoIds, - List SongIds) : MediatR.IRequest>; \ No newline at end of file + List SongIds) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddItemsToCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/AddItemsToCollectionHandler.cs index d8fa5f9d5..4bc62ebb4 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddItemsToCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddItemsToCollectionHandler.cs @@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.MediaCollections; public class AddItemsToCollectionHandler : - MediatR.IRequestHandler> + IRequestHandler> { private readonly ChannelWriter _channel; private readonly IDbContextFactory _dbContextFactory; @@ -39,10 +39,13 @@ public class AddItemsToCollectionHandler : { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(c => ApplyAddItemsRequest(dbContext, c, request)); + return await LanguageExtensions.Apply(validation, c => ApplyAddItemsRequest(dbContext, c, request)); } - private async Task ApplyAddItemsRequest(TvContext dbContext, Collection collection, AddItemsToCollection request) + private async Task ApplyAddItemsRequest( + TvContext dbContext, + Collection collection, + AddItemsToCollection request) { var allItems = request.MovieIds .Append(request.ShowIds) @@ -65,7 +68,7 @@ public class AddItemsToCollectionHandler : { // refresh all playouts that use this collection foreach (int playoutId in await _mediaCollectionRepository - .PlayoutIdsUsingCollection(request.CollectionId)) + .PlayoutIdsUsingCollection(request.CollectionId)) { await _channel.WriteAsync(new BuildPlayout(playoutId, PlayoutBuildMode.Refresh)); } @@ -119,4 +122,4 @@ public class AddItemsToCollectionHandler : .Filter(v => v == true) .MapT(_ => Unit.Default) .Map(v => v.ToValidation("Episode does not exist")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddMovieCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/AddMovieCollection.cs index 2ee69d58d..e07fb98c0 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddMovieCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddMovieCollection.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaCollections; -public record AddMovieToCollection(int CollectionId, int MovieId) : MediatR.IRequest>; \ No newline at end of file +public record AddMovieToCollection(int CollectionId, int MovieId) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddMovieToCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/AddMovieToCollectionHandler.cs index 8f27288e4..ee4f5dfd7 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddMovieToCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddMovieToCollectionHandler.cs @@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.MediaCollections; public class AddMovieToCollectionHandler : - MediatR.IRequestHandler> + IRequestHandler> { private readonly ChannelWriter _channel; private readonly IDbContextFactory _dbContextFactory; @@ -33,7 +33,7 @@ public class AddMovieToCollectionHandler : { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(parameters => ApplyAddMovieRequest(dbContext, parameters)); + return await LanguageExtensions.Apply(validation, parameters => ApplyAddMovieRequest(dbContext, parameters)); } private async Task ApplyAddMovieRequest(TvContext dbContext, Parameters parameters) @@ -43,7 +43,7 @@ public class AddMovieToCollectionHandler : { // refresh all playouts that use this collection foreach (int playoutId in await _mediaCollectionRepository - .PlayoutIdsUsingCollection(parameters.Collection.Id)) + .PlayoutIdsUsingCollection(parameters.Collection.Id)) { await _channel.WriteAsync(new BuildPlayout(playoutId, PlayoutBuildMode.Refresh)); } @@ -74,4 +74,4 @@ public class AddMovieToCollectionHandler : .Map(o => o.ToValidation("Movie does not exist")); private record Parameters(Collection Collection, Movie Movie); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddMusicVideoToCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/AddMusicVideoToCollection.cs index 279206f58..97570ed91 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddMusicVideoToCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddMusicVideoToCollection.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.MediaCollections; public record AddMusicVideoToCollection - (int CollectionId, int MusicVideoId) : MediatR.IRequest>; \ No newline at end of file + (int CollectionId, int MusicVideoId) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddMusicVideoToCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/AddMusicVideoToCollectionHandler.cs index 8e77bf4cf..3e576c34c 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddMusicVideoToCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddMusicVideoToCollectionHandler.cs @@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.MediaCollections; public class AddMusicVideoToCollectionHandler : - MediatR.IRequestHandler> + IRequestHandler> { private readonly ChannelWriter _channel; private readonly IDbContextFactory _dbContextFactory; @@ -33,7 +33,9 @@ public class AddMusicVideoToCollectionHandler : { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(parameters => ApplyAddMusicVideoRequest(dbContext, parameters)); + return await LanguageExtensions.Apply( + validation, + parameters => ApplyAddMusicVideoRequest(dbContext, parameters)); } private async Task ApplyAddMusicVideoRequest(TvContext dbContext, Parameters parameters) @@ -43,7 +45,7 @@ public class AddMusicVideoToCollectionHandler : { // refresh all playouts that use this collection foreach (int playoutId in await _mediaCollectionRepository - .PlayoutIdsUsingCollection(parameters.Collection.Id)) + .PlayoutIdsUsingCollection(parameters.Collection.Id)) { await _channel.WriteAsync(new BuildPlayout(playoutId, PlayoutBuildMode.Refresh)); } @@ -74,4 +76,4 @@ public class AddMusicVideoToCollectionHandler : .Map(o => o.ToValidation("MusicVideo does not exist")); private record Parameters(Collection Collection, MusicVideo MusicVideo); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddOtherVideoToCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/AddOtherVideoToCollection.cs index c44310190..ccf799d02 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddOtherVideoToCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddOtherVideoToCollection.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.MediaCollections; public record AddOtherVideoToCollection - (int CollectionId, int OtherVideoId) : MediatR.IRequest>; \ No newline at end of file + (int CollectionId, int OtherVideoId) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddOtherVideoToCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/AddOtherVideoToCollectionHandler.cs index cf1f3fc82..c3715f15e 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddOtherVideoToCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddOtherVideoToCollectionHandler.cs @@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.MediaCollections; public class AddOtherVideoToCollectionHandler : - MediatR.IRequestHandler> + IRequestHandler> { private readonly ChannelWriter _channel; private readonly IDbContextFactory _dbContextFactory; @@ -33,7 +33,9 @@ public class AddOtherVideoToCollectionHandler : { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(parameters => ApplyAddOtherVideoRequest(dbContext, parameters)); + return await LanguageExtensions.Apply( + validation, + parameters => ApplyAddOtherVideoRequest(dbContext, parameters)); } private async Task ApplyAddOtherVideoRequest(TvContext dbContext, Parameters parameters) @@ -43,7 +45,7 @@ public class AddOtherVideoToCollectionHandler : { // refresh all playouts that use this collection foreach (int playoutId in await _mediaCollectionRepository - .PlayoutIdsUsingCollection(parameters.Collection.Id)) + .PlayoutIdsUsingCollection(parameters.Collection.Id)) { await _channel.WriteAsync(new BuildPlayout(playoutId, PlayoutBuildMode.Refresh)); } @@ -74,4 +76,4 @@ public class AddOtherVideoToCollectionHandler : .Map(o => o.ToValidation("OtherVideo does not exist")); private record Parameters(Collection Collection, OtherVideo OtherVideo); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddSeasonToCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/AddSeasonToCollection.cs index 57d43c27f..3a4800d53 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddSeasonToCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddSeasonToCollection.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaCollections; -public record AddSeasonToCollection(int CollectionId, int SeasonId) : MediatR.IRequest>; \ No newline at end of file +public record AddSeasonToCollection(int CollectionId, int SeasonId) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddSeasonToCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/AddSeasonToCollectionHandler.cs index 89e4b32c3..513c7d146 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddSeasonToCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddSeasonToCollectionHandler.cs @@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.MediaCollections; public class AddSeasonToCollectionHandler : - MediatR.IRequestHandler> + IRequestHandler> { private readonly ChannelWriter _channel; private readonly IDbContextFactory _dbContextFactory; @@ -33,7 +33,7 @@ public class AddSeasonToCollectionHandler : { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(parameters => ApplyAddSeasonRequest(dbContext, parameters)); + return await LanguageExtensions.Apply(validation, parameters => ApplyAddSeasonRequest(dbContext, parameters)); } private async Task ApplyAddSeasonRequest(TvContext dbContext, Parameters parameters) @@ -43,7 +43,7 @@ public class AddSeasonToCollectionHandler : { // refresh all playouts that use this collection foreach (int playoutId in await _mediaCollectionRepository - .PlayoutIdsUsingCollection(parameters.Collection.Id)) + .PlayoutIdsUsingCollection(parameters.Collection.Id)) { await _channel.WriteAsync(new BuildPlayout(playoutId, PlayoutBuildMode.Refresh)); } @@ -74,4 +74,4 @@ public class AddSeasonToCollectionHandler : .Map(o => o.ToValidation("Season does not exist")); private record Parameters(Collection Collection, Season Season); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddShowToCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/AddShowToCollection.cs index 476e29123..caf51fdf5 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddShowToCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddShowToCollection.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaCollections; -public record AddShowToCollection(int CollectionId, int ShowId) : MediatR.IRequest>; \ No newline at end of file +public record AddShowToCollection(int CollectionId, int ShowId) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddShowToCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/AddShowToCollectionHandler.cs index 1ca2ff698..c408217d5 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddShowToCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddShowToCollectionHandler.cs @@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.MediaCollections; public class AddShowToCollectionHandler : - MediatR.IRequestHandler> + IRequestHandler> { private readonly ChannelWriter _channel; private readonly IDbContextFactory _dbContextFactory; @@ -33,7 +33,7 @@ public class AddShowToCollectionHandler : { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(parameters => ApplyAddShowRequest(dbContext, parameters)); + return await LanguageExtensions.Apply(validation, parameters => ApplyAddShowRequest(dbContext, parameters)); } private async Task ApplyAddShowRequest(TvContext dbContext, Parameters parameters) @@ -43,7 +43,7 @@ public class AddShowToCollectionHandler : { // refresh all playouts that use this collection foreach (int playoutId in await _mediaCollectionRepository - .PlayoutIdsUsingCollection(parameters.Collection.Id)) + .PlayoutIdsUsingCollection(parameters.Collection.Id)) { await _channel.WriteAsync(new BuildPlayout(playoutId, PlayoutBuildMode.Refresh)); } @@ -74,4 +74,4 @@ public class AddShowToCollectionHandler : .Map(o => o.ToValidation("Show does not exist")); private record Parameters(Collection Collection, Show Show); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddSongToCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/AddSongToCollection.cs index 5bd9c0edf..5125246b3 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddSongToCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddSongToCollection.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.MediaCollections; public record AddSongToCollection - (int CollectionId, int SongId) : MediatR.IRequest>; \ No newline at end of file + (int CollectionId, int SongId) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddSongToCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/AddSongToCollectionHandler.cs index fb55067c0..b5be0ff1b 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddSongToCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddSongToCollectionHandler.cs @@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.MediaCollections; public class AddSongToCollectionHandler : - MediatR.IRequestHandler> + IRequestHandler> { private readonly ChannelWriter _channel; private readonly IDbContextFactory _dbContextFactory; @@ -43,7 +43,7 @@ public class AddSongToCollectionHandler : { // refresh all playouts that use this collection foreach (int playoutId in await _mediaCollectionRepository - .PlayoutIdsUsingCollection(parameters.Collection.Id)) + .PlayoutIdsUsingCollection(parameters.Collection.Id)) { await _channel.WriteAsync(new BuildPlayout(playoutId, PlayoutBuildMode.Refresh)); } @@ -74,4 +74,4 @@ public class AddSongToCollectionHandler : .Map(o => o.ToValidation("Song does not exist")); private record Parameters(Collection Collection, Song Song); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddTraktList.cs b/ErsatzTV.Application/MediaCollections/Commands/AddTraktList.cs index 9568409fe..e9d22f8d7 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddTraktList.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddTraktList.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaCollections; -public record AddTraktList(string TraktListUrl) : IRequest>, IBackgroundServiceRequest; \ No newline at end of file +public record AddTraktList(string TraktListUrl) : IRequest>, IBackgroundServiceRequest; diff --git a/ErsatzTV.Application/MediaCollections/Commands/AddTraktListHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/AddTraktListHandler.cs index dfdbef63b..9f5083e97 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/AddTraktListHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/AddTraktListHandler.cs @@ -42,7 +42,7 @@ public class AddTraktListHandler : TraktCommandBase, IRequestHandler ValidateUrl(AddTraktList request) { const string PATTERN = @"(?:https:\/\/trakt\.tv\/users\/)?([\w\-_]+)\/(?:lists\/)?([\w\-_]+)"; @@ -60,15 +60,15 @@ public class AddTraktListHandler : TraktCommandBase, IRequestHandler> DoAdd(Parameters parameters) { await using TvContext dbContext = _dbContextFactory.CreateDbContext(); - + return await TraktApiClient.GetUserList(parameters.User, parameters.List) .BindT(list => SaveList(dbContext, list)) .BindT(list => SaveListItems(dbContext, list)) .BindT(list => MatchListItems(dbContext, list)) .MapT(_ => Unit.Default); - + // match list items (and update in search index) } private record Parameters(string User, string List); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/CreateCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/CreateCollection.cs index 2fdbd8807..1a1614029 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/CreateCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/CreateCollection.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaCollections; -public record CreateCollection(string Name) : IRequest>; \ No newline at end of file +public record CreateCollection(string Name) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/CreateCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/CreateCollectionHandler.cs index 6ec7d3070..49fd05311 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/CreateCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/CreateCollectionHandler.cs @@ -59,4 +59,4 @@ public class CreateCollectionHandler : return (result1, result2).Apply((_, _) => createCollection.Name); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/CreateMultiCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/CreateMultiCollection.cs index aa094dcff..bdf6cd1a1 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/CreateMultiCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/CreateMultiCollection.cs @@ -3,7 +3,11 @@ using ErsatzTV.Core.Domain; namespace ErsatzTV.Application.MediaCollections; -public record CreateMultiCollectionItem(int? CollectionId, int? SmartCollectionId, bool ScheduleAsGroup, PlaybackOrder PlaybackOrder); +public record CreateMultiCollectionItem( + int? CollectionId, + int? SmartCollectionId, + bool ScheduleAsGroup, + PlaybackOrder PlaybackOrder); public record CreateMultiCollection - (string Name, List Items) : IRequest>; \ No newline at end of file + (string Name, List Items) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/CreateMultiCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/CreateMultiCollectionHandler.cs index 054c381b3..69ffcfdbd 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/CreateMultiCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/CreateMultiCollectionHandler.cs @@ -102,4 +102,4 @@ public class CreateMultiCollectionHandler : return (result1, result2).Apply((_, _) => createMultiCollection.Name); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/CreateSmartCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/CreateSmartCollection.cs index 2a4977bcf..d033ddd88 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/CreateSmartCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/CreateSmartCollection.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.MediaCollections; public record CreateSmartCollection - (string Query, string Name) : IRequest>; \ No newline at end of file + (string Query, string Name) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/CreateSmartCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/CreateSmartCollectionHandler.cs index 255bc5e65..93e2340a9 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/CreateSmartCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/CreateSmartCollectionHandler.cs @@ -59,4 +59,4 @@ public class CreateSmartCollectionHandler : return (result1, result2).Apply((_, _) => createSmartCollection.Name); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/DeleteCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/DeleteCollection.cs index 55ddc1ab4..5b9d7f985 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/DeleteCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/DeleteCollection.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaCollections; -public record DeleteCollection(int CollectionId) : IRequest>; \ No newline at end of file +public record DeleteCollection(int CollectionId) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/DeleteCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/DeleteCollectionHandler.cs index 530fd0746..cd08f42b2 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/DeleteCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/DeleteCollectionHandler.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.MediaCollections; -public class DeleteCollectionHandler : MediatR.IRequestHandler> +public class DeleteCollectionHandler : IRequestHandler> { private readonly IDbContextFactory _dbContextFactory; @@ -35,4 +35,4 @@ public class DeleteCollectionHandler : MediatR.IRequestHandler c.Id, c => c.Id == request.CollectionId) .Map(o => o.ToValidation($"Collection {request.CollectionId} does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/DeleteMultiCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/DeleteMultiCollection.cs index 886da8b45..ac997a111 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/DeleteMultiCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/DeleteMultiCollection.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaCollections; -public record DeleteMultiCollection(int MultiCollectionId) : MediatR.IRequest>; \ No newline at end of file +public record DeleteMultiCollection(int MultiCollectionId) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/DeleteMultiCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/DeleteMultiCollectionHandler.cs index 5f37670a7..42d5036c0 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/DeleteMultiCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/DeleteMultiCollectionHandler.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.MediaCollections; -public class DeleteMultiCollectionHandler : MediatR.IRequestHandler> +public class DeleteMultiCollectionHandler : IRequestHandler> { private readonly IDbContextFactory _dbContextFactory; @@ -35,4 +35,4 @@ public class DeleteMultiCollectionHandler : MediatR.IRequestHandler c.Id, c => c.Id == request.MultiCollectionId) .Map(o => o.ToValidation($"MultiCollection {request.MultiCollectionId} does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/DeleteSmartCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/DeleteSmartCollection.cs index 02d9e3277..3f77a526c 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/DeleteSmartCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/DeleteSmartCollection.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaCollections; -public record DeleteSmartCollection(int SmartCollectionId) : MediatR.IRequest>; \ No newline at end of file +public record DeleteSmartCollection(int SmartCollectionId) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/DeleteSmartCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/DeleteSmartCollectionHandler.cs index 216517728..3ba6f0d5b 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/DeleteSmartCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/DeleteSmartCollectionHandler.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.MediaCollections; -public class DeleteSmartCollectionHandler : MediatR.IRequestHandler> +public class DeleteSmartCollectionHandler : IRequestHandler> { private readonly IDbContextFactory _dbContextFactory; @@ -35,4 +35,4 @@ public class DeleteSmartCollectionHandler : MediatR.IRequestHandler c.Id, c => c.Id == request.SmartCollectionId) .Map(o => o.ToValidation($"SmartCollection {request.SmartCollectionId} does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/DeleteTraktList.cs b/ErsatzTV.Application/MediaCollections/Commands/DeleteTraktList.cs index 47f38ec81..5562d3ce2 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/DeleteTraktList.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/DeleteTraktList.cs @@ -2,5 +2,5 @@ namespace ErsatzTV.Application.MediaCollections; -public record DeleteTraktList(int TraktListId) : IRequest>, - IBackgroundServiceRequest; \ No newline at end of file +public record DeleteTraktList(int TraktListId) : IRequest>, + IBackgroundServiceRequest; diff --git a/ErsatzTV.Application/MediaCollections/Commands/DeleteTraktListHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/DeleteTraktListHandler.cs index 4f66001e2..f623ad40f 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/DeleteTraktListHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/DeleteTraktListHandler.cs @@ -10,12 +10,12 @@ using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.MediaCollections; -public class DeleteTraktListHandler : TraktCommandBase, MediatR.IRequestHandler> +public class DeleteTraktListHandler : TraktCommandBase, IRequestHandler> { - private readonly ISearchRepository _searchRepository; - private readonly ISearchIndex _searchIndex; private readonly IDbContextFactory _dbContextFactory; private readonly IEntityLocker _entityLocker; + private readonly ISearchIndex _searchIndex; + private readonly ISearchRepository _searchRepository; public DeleteTraktListHandler( ITraktApiClient traktApiClient, @@ -69,4 +69,4 @@ public class DeleteTraktListHandler : TraktCommandBase, MediatR.IRequestHandler< return Unit.Default; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/MatchTraktListItems.cs b/ErsatzTV.Application/MediaCollections/Commands/MatchTraktListItems.cs index e651129b4..6e441365b 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/MatchTraktListItems.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/MatchTraktListItems.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.MediaCollections; public record MatchTraktListItems(int TraktListId, bool Unlock = true) : IRequest>, - IBackgroundServiceRequest; \ No newline at end of file + IBackgroundServiceRequest; diff --git a/ErsatzTV.Application/MediaCollections/Commands/MatchTraktListItemsHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/MatchTraktListItemsHandler.cs index cb0fb2d32..ef5355efb 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/MatchTraktListItemsHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/MatchTraktListItemsHandler.cs @@ -49,4 +49,4 @@ public class MatchTraktListItemsHandler : TraktCommandBase, } } } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/RemoveItemsFromCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/RemoveItemsFromCollection.cs index 1f949b695..2f86e1db5 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/RemoveItemsFromCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/RemoveItemsFromCollection.cs @@ -2,7 +2,7 @@ namespace ErsatzTV.Application.MediaCollections; -public record RemoveItemsFromCollection(int MediaCollectionId) : MediatR.IRequest> +public record RemoveItemsFromCollection(int MediaCollectionId) : IRequest> { public List MediaItemIds { get; set; } = new(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/RemoveItemsFromCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/RemoveItemsFromCollectionHandler.cs index 4afc7c2ef..978c3626d 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/RemoveItemsFromCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/RemoveItemsFromCollectionHandler.cs @@ -32,7 +32,7 @@ public class RemoveItemsFromCollectionHandler : IRequestHandler validation = await Validate(dbContext, request); - return await validation.Apply(c => ApplyRemoveItemsRequest(dbContext, request, c)); + return await LanguageExtensions.Apply(validation, c => ApplyRemoveItemsRequest(dbContext, request, c)); } private async Task ApplyRemoveItemsRequest( @@ -70,4 +70,4 @@ public class RemoveItemsFromCollectionHandler : IRequestHandler c.MediaItems) .SelectOneAsync(c => c.Id, c => c.Id == request.MediaCollectionId) .Map(o => o.ToValidation("Collection does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/TraktCommandBase.cs b/ErsatzTV.Application/MediaCollections/Commands/TraktCommandBase.cs index e535851e3..9ccaa8e88 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/TraktCommandBase.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/TraktCommandBase.cs @@ -13,9 +13,9 @@ namespace ErsatzTV.Application.MediaCollections; public abstract class TraktCommandBase { - private readonly ISearchRepository _searchRepository; - private readonly ISearchIndex _searchIndex; private readonly ILogger _logger; + private readonly ISearchIndex _searchIndex; + private readonly ISearchRepository _searchRepository; protected TraktCommandBase( ITraktApiClient traktApiClient, @@ -77,7 +77,7 @@ public abstract class TraktCommandBase var toAdd = items.Filter(i => list.Items.All(i2 => i2.TraktId != i.TraktId)).ToList(); var toRemove = list.Items.Filter(i => items.All(i2 => i2.TraktId != i.TraktId)).ToList(); var toUpdate = list.Items.Filter(i => !toRemove.Contains(i)).ToList(); - + list.Items.RemoveAll(toRemove.Contains); list.Items.AddRange(toAdd.Map(a => ProjectItem(list, a))); @@ -189,18 +189,18 @@ public abstract class TraktCommandBase Title = item.Title, Year = item.Year, Season = item.Season, - Episode = item.Episode, + Episode = item.Episode }; result.Guids = item.Guids.Map(g => new TraktListItemGuid { Guid = g, TraktListItem = result }).ToList(); return result; } - + private async Task> IdentifyMovie(TvContext dbContext, TraktListItem item) { var guids = item.Guids.Map(g => g.Guid).ToList(); - + Option maybeMovieByGuid = await dbContext.MovieMetadata .AsNoTracking() .Filter(mm => mm.Guids.Any(g => guids.Contains(g.Guid))) @@ -266,7 +266,7 @@ public abstract class TraktCommandBase return None; } - + private async Task> IdentifySeason(TvContext dbContext, TraktListItem item) { var guids = item.Guids.Map(g => g.Guid).ToList(); @@ -302,7 +302,7 @@ public abstract class TraktCommandBase return None; } - + private async Task> IdentifyEpisode(TvContext dbContext, TraktListItem item) { var guids = item.Guids.Map(g => g.Guid).ToList(); @@ -339,4 +339,4 @@ public abstract class TraktCommandBase return None; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/UpdateCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/UpdateCollection.cs index 887211a79..ed4b425c1 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/UpdateCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/UpdateCollection.cs @@ -3,7 +3,7 @@ namespace ErsatzTV.Application.MediaCollections; public record UpdateCollection - (int CollectionId, string Name) : MediatR.IRequest> + (int CollectionId, string Name) : IRequest> { public Option UseCustomPlaybackOrder { get; set; } = None; -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/UpdateCollectionCustomOrder.cs b/ErsatzTV.Application/MediaCollections/Commands/UpdateCollectionCustomOrder.cs index b8b565112..48fe22f92 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/UpdateCollectionCustomOrder.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/UpdateCollectionCustomOrder.cs @@ -5,6 +5,6 @@ namespace ErsatzTV.Application.MediaCollections; public record UpdateCollectionCustomOrder ( int CollectionId, - List MediaItemCustomOrders) : MediatR.IRequest>; + List MediaItemCustomOrders) : IRequest>; -public record MediaItemCustomOrder(int MediaItemId, int CustomIndex); \ No newline at end of file +public record MediaItemCustomOrder(int MediaItemId, int CustomIndex); diff --git a/ErsatzTV.Application/MediaCollections/Commands/UpdateCollectionCustomOrderHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/UpdateCollectionCustomOrderHandler.cs index b269d0eeb..54231aca9 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/UpdateCollectionCustomOrderHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/UpdateCollectionCustomOrderHandler.cs @@ -32,7 +32,7 @@ public class UpdateCollectionCustomOrderHandler : IRequestHandler validation = await Validate(dbContext, request); - return await validation.Apply(c => ApplyUpdateRequest(dbContext, c, request)); + return await LanguageExtensions.Apply(validation, c => ApplyUpdateRequest(dbContext, c, request)); } private async Task ApplyUpdateRequest( @@ -76,4 +76,4 @@ public class UpdateCollectionCustomOrderHandler : IRequestHandler c.CollectionItems) .SelectOneAsync(c => c.Id, c => c.Id == request.CollectionId) .Map(o => o.ToValidation("Collection does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/UpdateCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/UpdateCollectionHandler.cs index 735e824d2..023241d73 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/UpdateCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/UpdateCollectionHandler.cs @@ -32,7 +32,7 @@ public class UpdateCollectionHandler : IRequestHandler validation = await Validate(dbContext, request); - return await validation.Apply(c => ApplyUpdateRequest(dbContext, c, request)); + return await LanguageExtensions.Apply(validation, c => ApplyUpdateRequest(dbContext, c, request)); } private async Task ApplyUpdateRequest(TvContext dbContext, Collection c, UpdateCollection request) @@ -72,4 +72,4 @@ public class UpdateCollectionHandler : IRequestHandler ValidateName(UpdateCollection updateSimpleMediaCollection) => updateSimpleMediaCollection.NotEmpty(c => c.Name) .Bind(_ => updateSimpleMediaCollection.NotLongerThan(50)(c => c.Name)); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/UpdateMultiCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/UpdateMultiCollection.cs index 017afe549..6b0685f4a 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/UpdateMultiCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/UpdateMultiCollection.cs @@ -3,10 +3,14 @@ using ErsatzTV.Core.Domain; namespace ErsatzTV.Application.MediaCollections; -public record UpdateMultiCollectionItem(int? CollectionId, int? SmartCollectionId, bool ScheduleAsGroup, PlaybackOrder PlaybackOrder); +public record UpdateMultiCollectionItem( + int? CollectionId, + int? SmartCollectionId, + bool ScheduleAsGroup, + PlaybackOrder PlaybackOrder); public record UpdateMultiCollection ( int MultiCollectionId, string Name, - List Items) : MediatR.IRequest>; \ No newline at end of file + List Items) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/UpdateMultiCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/UpdateMultiCollectionHandler.cs index ef8516df8..19144cc04 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/UpdateMultiCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/UpdateMultiCollectionHandler.cs @@ -32,7 +32,7 @@ public class UpdateMultiCollectionHandler : IRequestHandler validation = await Validate(dbContext, request); - return await validation.Apply(c => ApplyUpdateRequest(dbContext, c, request)); + return await LanguageExtensions.Apply(validation, c => ApplyUpdateRequest(dbContext, c, request)); } private async Task ApplyUpdateRequest(TvContext dbContext, MultiCollection c, UpdateMultiCollection request) @@ -159,4 +159,4 @@ public class UpdateMultiCollectionHandler : IRequestHandler updateMultiCollection.Name); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Commands/UpdateSmartCollection.cs b/ErsatzTV.Application/MediaCollections/Commands/UpdateSmartCollection.cs index bbb1d115a..40db0287d 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/UpdateSmartCollection.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/UpdateSmartCollection.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaCollections; -public record UpdateSmartCollection(int Id, string Query) : IRequest>; \ No newline at end of file +public record UpdateSmartCollection(int Id, string Query) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Commands/UpdateSmartCollectionHandler.cs b/ErsatzTV.Application/MediaCollections/Commands/UpdateSmartCollectionHandler.cs index f2c460bf1..b3a4d987e 100644 --- a/ErsatzTV.Application/MediaCollections/Commands/UpdateSmartCollectionHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Commands/UpdateSmartCollectionHandler.cs @@ -32,7 +32,7 @@ public class UpdateSmartCollectionHandler : IRequestHandler validation = await Validate(dbContext, request); - return await validation.Apply(c => ApplyUpdateRequest(dbContext, c, request)); + return await LanguageExtensions.Apply(validation, c => ApplyUpdateRequest(dbContext, c, request)); } private async Task ApplyUpdateRequest(TvContext dbContext, SmartCollection c, UpdateSmartCollection request) @@ -62,4 +62,4 @@ public class UpdateSmartCollectionHandler : IRequestHandler c.Id, c => c.Id == updateCollection.Id) .Map(o => o.ToValidation("SmartCollection does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Mapper.cs b/ErsatzTV.Application/MediaCollections/Mapper.cs index 688a4b144..964bdd821 100644 --- a/ErsatzTV.Application/MediaCollections/Mapper.cs +++ b/ErsatzTV.Application/MediaCollections/Mapper.cs @@ -33,10 +33,11 @@ internal static class Mapper multiCollectionItem.ScheduleAsGroup, multiCollectionItem.PlaybackOrder); - private static MultiCollectionSmartItemViewModel ProjectToViewModel(MultiCollectionSmartItem multiCollectionSmartItem) => + private static MultiCollectionSmartItemViewModel ProjectToViewModel( + MultiCollectionSmartItem multiCollectionSmartItem) => new( multiCollectionSmartItem.MultiCollectionId, ProjectToViewModel(multiCollectionSmartItem.SmartCollection), multiCollectionSmartItem.ScheduleAsGroup, multiCollectionSmartItem.PlaybackOrder); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/MediaCollectionSummaryViewModel.cs b/ErsatzTV.Application/MediaCollections/MediaCollectionSummaryViewModel.cs index 3aacaa275..0e40866e4 100644 --- a/ErsatzTV.Application/MediaCollections/MediaCollectionSummaryViewModel.cs +++ b/ErsatzTV.Application/MediaCollections/MediaCollectionSummaryViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.MediaCollections; -public record MediaCollectionSummaryViewModel(int Id, string Name, int ItemCount, bool IsSimple); \ No newline at end of file +public record MediaCollectionSummaryViewModel(int Id, string Name, int ItemCount, bool IsSimple); diff --git a/ErsatzTV.Application/MediaCollections/MediaCollectionViewModel.cs b/ErsatzTV.Application/MediaCollections/MediaCollectionViewModel.cs index 81c768352..b91c34f08 100644 --- a/ErsatzTV.Application/MediaCollections/MediaCollectionViewModel.cs +++ b/ErsatzTV.Application/MediaCollections/MediaCollectionViewModel.cs @@ -13,4 +13,4 @@ public record MediaCollectionViewModel( string.Empty, Name, string.Empty, - State); \ No newline at end of file + State); diff --git a/ErsatzTV.Application/MediaCollections/MultiCollectionItemViewModel.cs b/ErsatzTV.Application/MediaCollections/MultiCollectionItemViewModel.cs index 38d71eb4a..146c581da 100644 --- a/ErsatzTV.Application/MediaCollections/MultiCollectionItemViewModel.cs +++ b/ErsatzTV.Application/MediaCollections/MultiCollectionItemViewModel.cs @@ -6,4 +6,4 @@ public record MultiCollectionItemViewModel( int MultiCollectionId, MediaCollectionViewModel Collection, bool ScheduleAsGroup, - PlaybackOrder PlaybackOrder); \ No newline at end of file + PlaybackOrder PlaybackOrder); diff --git a/ErsatzTV.Application/MediaCollections/MultiCollectionSmartItemViewModel.cs b/ErsatzTV.Application/MediaCollections/MultiCollectionSmartItemViewModel.cs index 46adfa4a8..4f733de0b 100644 --- a/ErsatzTV.Application/MediaCollections/MultiCollectionSmartItemViewModel.cs +++ b/ErsatzTV.Application/MediaCollections/MultiCollectionSmartItemViewModel.cs @@ -6,4 +6,4 @@ public record MultiCollectionSmartItemViewModel( int MultiCollectionId, SmartCollectionViewModel SmartCollection, bool ScheduleAsGroup, - PlaybackOrder PlaybackOrder); \ No newline at end of file + PlaybackOrder PlaybackOrder); diff --git a/ErsatzTV.Application/MediaCollections/MultiCollectionViewModel.cs b/ErsatzTV.Application/MediaCollections/MultiCollectionViewModel.cs index 5cc6bfdd8..507826fd7 100644 --- a/ErsatzTV.Application/MediaCollections/MultiCollectionViewModel.cs +++ b/ErsatzTV.Application/MediaCollections/MultiCollectionViewModel.cs @@ -4,4 +4,4 @@ public record MultiCollectionViewModel( int Id, string Name, List Items, - List SmartItems); \ No newline at end of file + List SmartItems); diff --git a/ErsatzTV.Application/MediaCollections/PagedMediaCollectionsViewModel.cs b/ErsatzTV.Application/MediaCollections/PagedMediaCollectionsViewModel.cs index dfef499c3..92497885b 100644 --- a/ErsatzTV.Application/MediaCollections/PagedMediaCollectionsViewModel.cs +++ b/ErsatzTV.Application/MediaCollections/PagedMediaCollectionsViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.MediaCollections; -public record PagedMediaCollectionsViewModel(int TotalCount, List Page); \ No newline at end of file +public record PagedMediaCollectionsViewModel(int TotalCount, List Page); diff --git a/ErsatzTV.Application/MediaCollections/PagedMultiCollectionsViewModel.cs b/ErsatzTV.Application/MediaCollections/PagedMultiCollectionsViewModel.cs index e03dbe56d..91cdfe71b 100644 --- a/ErsatzTV.Application/MediaCollections/PagedMultiCollectionsViewModel.cs +++ b/ErsatzTV.Application/MediaCollections/PagedMultiCollectionsViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.MediaCollections; -public record PagedMultiCollectionsViewModel(int TotalCount, List Page); \ No newline at end of file +public record PagedMultiCollectionsViewModel(int TotalCount, List Page); diff --git a/ErsatzTV.Application/MediaCollections/PagedSmartCollectionsViewModel.cs b/ErsatzTV.Application/MediaCollections/PagedSmartCollectionsViewModel.cs index 5bf17cb0a..5b81dbb26 100644 --- a/ErsatzTV.Application/MediaCollections/PagedSmartCollectionsViewModel.cs +++ b/ErsatzTV.Application/MediaCollections/PagedSmartCollectionsViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.MediaCollections; -public record PagedSmartCollectionsViewModel(int TotalCount, List Page); \ No newline at end of file +public record PagedSmartCollectionsViewModel(int TotalCount, List Page); diff --git a/ErsatzTV.Application/MediaCollections/PagedTraktListsViewModel.cs b/ErsatzTV.Application/MediaCollections/PagedTraktListsViewModel.cs index 1ec2c7466..583476d87 100644 --- a/ErsatzTV.Application/MediaCollections/PagedTraktListsViewModel.cs +++ b/ErsatzTV.Application/MediaCollections/PagedTraktListsViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.MediaCollections; -public record PagedTraktListsViewModel(int TotalCount, List Page); \ No newline at end of file +public record PagedTraktListsViewModel(int TotalCount, List Page); diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetAllCollections.cs b/ErsatzTV.Application/MediaCollections/Queries/GetAllCollections.cs index a3e0c132f..638e0b7da 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetAllCollections.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetAllCollections.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.MediaCollections; -public record GetAllCollections : IRequest>; \ No newline at end of file +public record GetAllCollections : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetAllCollectionsHandler.cs b/ErsatzTV.Application/MediaCollections/Queries/GetAllCollectionsHandler.cs index 31f586fe4..aa19a2cc7 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetAllCollectionsHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetAllCollectionsHandler.cs @@ -20,4 +20,4 @@ public class GetAllCollectionsHandler : IRequestHandler list.Map(ProjectToViewModel).ToList()); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetAllMultiCollections.cs b/ErsatzTV.Application/MediaCollections/Queries/GetAllMultiCollections.cs index ef22f393f..6edf40fdf 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetAllMultiCollections.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetAllMultiCollections.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.MediaCollections; -public record GetAllMultiCollections : IRequest>; \ No newline at end of file +public record GetAllMultiCollections : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetAllMultiCollectionsHandler.cs b/ErsatzTV.Application/MediaCollections/Queries/GetAllMultiCollectionsHandler.cs index cf1982f66..2bf10f135 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetAllMultiCollectionsHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetAllMultiCollectionsHandler.cs @@ -20,4 +20,4 @@ public class GetAllMultiCollectionsHandler : IRequestHandler list.Map(ProjectToViewModel).ToList()); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetAllSmartCollections.cs b/ErsatzTV.Application/MediaCollections/Queries/GetAllSmartCollections.cs index 147327ee3..7f04a9753 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetAllSmartCollections.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetAllSmartCollections.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.MediaCollections; -public record GetAllSmartCollections : IRequest>; \ No newline at end of file +public record GetAllSmartCollections : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetAllSmartCollectionsHandler.cs b/ErsatzTV.Application/MediaCollections/Queries/GetAllSmartCollectionsHandler.cs index 2f3648b47..7872d1da8 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetAllSmartCollectionsHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetAllSmartCollectionsHandler.cs @@ -20,4 +20,4 @@ public class GetAllSmartCollectionsHandler : IRequestHandler list.Map(ProjectToViewModel).ToList()); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetCollectionById.cs b/ErsatzTV.Application/MediaCollections/Queries/GetCollectionById.cs index 71370776b..5667278a1 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetCollectionById.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetCollectionById.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.MediaCollections; -public record GetCollectionById(int Id) : IRequest>; \ No newline at end of file +public record GetCollectionById(int Id) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetCollectionByIdHandler.cs b/ErsatzTV.Application/MediaCollections/Queries/GetCollectionByIdHandler.cs index 567841b94..78689c61e 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetCollectionByIdHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetCollectionByIdHandler.cs @@ -22,4 +22,4 @@ public class GetCollectionByIdHandler : .SelectOneAsync(c => c.Id, c => c.Id == request.Id) .MapT(ProjectToViewModel); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetMultiCollectionById.cs b/ErsatzTV.Application/MediaCollections/Queries/GetMultiCollectionById.cs index a98200ae5..40d0bb5a6 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetMultiCollectionById.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetMultiCollectionById.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.MediaCollections; -public record GetMultiCollectionById(int Id) : IRequest>; \ No newline at end of file +public record GetMultiCollectionById(int Id) : IRequest>; diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetMultiCollectionByIdHandler.cs b/ErsatzTV.Application/MediaCollections/Queries/GetMultiCollectionByIdHandler.cs index 6aed14b61..4bc51d82d 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetMultiCollectionByIdHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetMultiCollectionByIdHandler.cs @@ -25,4 +25,4 @@ public class GetMultiCollectionByIdHandler : IRequestHandler c.Id, c => c.Id == request.Id) .MapT(ProjectToViewModel); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetPagedCollections.cs b/ErsatzTV.Application/MediaCollections/Queries/GetPagedCollections.cs index f90fdf714..1b2dde5fc 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetPagedCollections.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetPagedCollections.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.MediaCollections; -public record GetPagedCollections(int PageNum, int PageSize) : IRequest; \ No newline at end of file +public record GetPagedCollections(int PageNum, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetPagedCollectionsHandler.cs b/ErsatzTV.Application/MediaCollections/Queries/GetPagedCollectionsHandler.cs index 904680b00..e64d50f7f 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetPagedCollectionsHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetPagedCollectionsHandler.cs @@ -9,10 +9,8 @@ public class GetPagedCollectionsHandler : IRequestHandler _dbContextFactory; - public GetPagedCollectionsHandler(IDbContextFactory dbContextFactory) - { + public GetPagedCollectionsHandler(IDbContextFactory dbContextFactory) => _dbContextFactory = dbContextFactory; - } public async Task Handle( GetPagedCollections request, @@ -32,4 +30,4 @@ public class GetPagedCollectionsHandler : IRequestHandler; \ No newline at end of file +public record GetPagedMultiCollections(int PageNum, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetPagedMultiCollectionsHandler.cs b/ErsatzTV.Application/MediaCollections/Queries/GetPagedMultiCollectionsHandler.cs index 6348ea0b8..0db29b6c7 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetPagedMultiCollectionsHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetPagedMultiCollectionsHandler.cs @@ -9,10 +9,8 @@ public class GetPagedMultiCollectionsHandler : IRequestHandler _dbContextFactory; - public GetPagedMultiCollectionsHandler(IDbContextFactory dbContextFactory) - { + public GetPagedMultiCollectionsHandler(IDbContextFactory dbContextFactory) => _dbContextFactory = dbContextFactory; - } public async Task Handle( GetPagedMultiCollections request, @@ -34,4 +32,4 @@ public class GetPagedMultiCollectionsHandler : IRequestHandler; \ No newline at end of file +public record GetPagedSmartCollections(int PageNum, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetPagedSmartCollectionsHandler.cs b/ErsatzTV.Application/MediaCollections/Queries/GetPagedSmartCollectionsHandler.cs index 1d9a30f03..812085889 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetPagedSmartCollectionsHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetPagedSmartCollectionsHandler.cs @@ -9,10 +9,8 @@ public class GetPagedSmartCollectionsHandler : IRequestHandler _dbContextFactory; - public GetPagedSmartCollectionsHandler(IDbContextFactory dbContextFactory) - { + public GetPagedSmartCollectionsHandler(IDbContextFactory dbContextFactory) => _dbContextFactory = dbContextFactory; - } public async Task Handle( GetPagedSmartCollections request, @@ -32,4 +30,4 @@ public class GetPagedSmartCollectionsHandler : IRequestHandler; \ No newline at end of file +public record GetPagedTraktLists(int PageNum, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/MediaCollections/Queries/GetPagedTraktListsHandler.cs b/ErsatzTV.Application/MediaCollections/Queries/GetPagedTraktListsHandler.cs index aabc7208d..0014421a9 100644 --- a/ErsatzTV.Application/MediaCollections/Queries/GetPagedTraktListsHandler.cs +++ b/ErsatzTV.Application/MediaCollections/Queries/GetPagedTraktListsHandler.cs @@ -9,10 +9,8 @@ public class GetPagedTraktListsHandler : IRequestHandler _dbContextFactory; - public GetPagedTraktListsHandler(IDbContextFactory dbContextFactory) - { + public GetPagedTraktListsHandler(IDbContextFactory dbContextFactory) => _dbContextFactory = dbContextFactory; - } public async Task Handle( GetPagedTraktLists request, @@ -33,4 +31,4 @@ public class GetPagedTraktListsHandler : IRequestHandler season.SeasonNumber == 0 ? "Specials" : $"Season {season.SeasonNumber}"; -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaItems/NamedMediaItemViewModel.cs b/ErsatzTV.Application/MediaItems/NamedMediaItemViewModel.cs index af889ae8a..14e48a838 100644 --- a/ErsatzTV.Application/MediaItems/NamedMediaItemViewModel.cs +++ b/ErsatzTV.Application/MediaItems/NamedMediaItemViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.MediaItems; -public record NamedMediaItemViewModel(int MediaItemId, string Name); \ No newline at end of file +public record NamedMediaItemViewModel(int MediaItemId, string Name); diff --git a/ErsatzTV.Application/MediaItems/Queries/GetAllLanguageCodes.cs b/ErsatzTV.Application/MediaItems/Queries/GetAllLanguageCodes.cs index f0edf0e64..ca0abfebe 100644 --- a/ErsatzTV.Application/MediaItems/Queries/GetAllLanguageCodes.cs +++ b/ErsatzTV.Application/MediaItems/Queries/GetAllLanguageCodes.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.MediaItems; -public record GetAllLanguageCodes : IRequest>; \ No newline at end of file +public record GetAllLanguageCodes : IRequest>; diff --git a/ErsatzTV.Application/MediaItems/Queries/GetAllLanguageCodesHandler.cs b/ErsatzTV.Application/MediaItems/Queries/GetAllLanguageCodesHandler.cs index ea37fdd1e..f27f93759 100644 --- a/ErsatzTV.Application/MediaItems/Queries/GetAllLanguageCodesHandler.cs +++ b/ErsatzTV.Application/MediaItems/Queries/GetAllLanguageCodesHandler.cs @@ -22,7 +22,7 @@ public class GetAllLanguageCodesHandler : IRequestHandler> Handle(GetAllLanguageCodes request, CancellationToken cancellationToken) { await using TvContext dbContext = _dbContextFactory.CreateDbContext(); - + var result = new System.Collections.Generic.HashSet(); CultureInfo[] allCultures = CultureInfo.GetCultures(CultureTypes.NeutralCultures); @@ -42,4 +42,4 @@ public class GetAllLanguageCodesHandler : IRequestHandler true; -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/MediaSources/Commands/ScanLocalLibraryHandler.cs b/ErsatzTV.Application/MediaSources/Commands/ScanLocalLibraryHandler.cs index 1cf96e5a5..c53c2fb65 100644 --- a/ErsatzTV.Application/MediaSources/Commands/ScanLocalLibraryHandler.cs +++ b/ErsatzTV.Application/MediaSources/Commands/ScanLocalLibraryHandler.cs @@ -74,8 +74,8 @@ public class ScanLocalLibraryHandler : IRequestHandler>; \ No newline at end of file +public record GetMovieById(int Id) : IRequest>; diff --git a/ErsatzTV.Application/Movies/Queries/GetMovieByIdHandler.cs b/ErsatzTV.Application/Movies/Queries/GetMovieByIdHandler.cs index 07589f58b..4b2a41ee6 100644 --- a/ErsatzTV.Application/Movies/Queries/GetMovieByIdHandler.cs +++ b/ErsatzTV.Application/Movies/Queries/GetMovieByIdHandler.cs @@ -9,8 +9,8 @@ namespace ErsatzTV.Application.Movies; public class GetMovieByIdHandler : IRequestHandler> { - private readonly IMediaSourceRepository _mediaSourceRepository; private readonly IDbContextFactory _dbContextFactory; + private readonly IMediaSourceRepository _mediaSourceRepository; private readonly IMovieRepository _movieRepository; public GetMovieByIdHandler( @@ -28,7 +28,7 @@ public class GetMovieByIdHandler : IRequestHandler maybeJellyfin = await _mediaSourceRepository.GetAllJellyfin() .Map(list => list.HeadOrNone()); @@ -51,4 +51,4 @@ public class GetMovieByIdHandler : IRequestHandler ProjectToViewModel(m, languageCodes, maybeJellyfin, maybeEmby)); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Playouts/Commands/BuildPlayout.cs b/ErsatzTV.Application/Playouts/Commands/BuildPlayout.cs index 15c7881c6..2159b907a 100644 --- a/ErsatzTV.Application/Playouts/Commands/BuildPlayout.cs +++ b/ErsatzTV.Application/Playouts/Commands/BuildPlayout.cs @@ -4,4 +4,4 @@ using ErsatzTV.Core.Scheduling; namespace ErsatzTV.Application.Playouts; public record BuildPlayout(int PlayoutId, PlayoutBuildMode Mode) : IRequest>, - IBackgroundServiceRequest; \ No newline at end of file + IBackgroundServiceRequest; diff --git a/ErsatzTV.Application/Playouts/Commands/BuildPlayoutHandler.cs b/ErsatzTV.Application/Playouts/Commands/BuildPlayoutHandler.cs index 415191982..57fdea6b1 100644 --- a/ErsatzTV.Application/Playouts/Commands/BuildPlayoutHandler.cs +++ b/ErsatzTV.Application/Playouts/Commands/BuildPlayoutHandler.cs @@ -15,9 +15,9 @@ public class BuildPlayoutHandler : IRequestHandler _dbContextFactory; - private readonly IPlayoutBuilder _playoutBuilder; private readonly IFFmpegSegmenterService _ffmpegSegmenterService; private readonly ChannelWriter _ffmpegWorkerChannel; + private readonly IPlayoutBuilder _playoutBuilder; public BuildPlayoutHandler( IClient client, @@ -37,7 +37,7 @@ public class BuildPlayoutHandler : IRequestHandler validation = await Validate(dbContext, request); - return await validation.Apply(playout => ApplyUpdateRequest(dbContext, request, playout)); + return await LanguageExtensions.Apply(validation, playout => ApplyUpdateRequest(dbContext, request, playout)); } private async Task ApplyUpdateRequest(TvContext dbContext, BuildPlayout request, Playout playout) @@ -49,6 +49,7 @@ public class BuildPlayoutHandler : IRequestHandler> Validate(TvContext dbContext, BuildPlayout request) => PlayoutMustExist(dbContext, request); @@ -92,4 +94,4 @@ public class BuildPlayoutHandler : IRequestHandler psi.FallbackFiller) .SelectOneAsync(p => p.Id, p => p.Id == buildPlayout.PlayoutId) .Map(o => o.ToValidation("Playout does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Playouts/Commands/CreatePlayout.cs b/ErsatzTV.Application/Playouts/Commands/CreatePlayout.cs index 29ec84f26..07a2bb031 100644 --- a/ErsatzTV.Application/Playouts/Commands/CreatePlayout.cs +++ b/ErsatzTV.Application/Playouts/Commands/CreatePlayout.cs @@ -6,4 +6,4 @@ namespace ErsatzTV.Application.Playouts; public record CreatePlayout( int ChannelId, int ProgramScheduleId, - ProgramSchedulePlayoutType ProgramSchedulePlayoutType) : IRequest>; \ No newline at end of file + ProgramSchedulePlayoutType ProgramSchedulePlayoutType) : IRequest>; diff --git a/ErsatzTV.Application/Playouts/Commands/CreatePlayoutHandler.cs b/ErsatzTV.Application/Playouts/Commands/CreatePlayoutHandler.cs index 0fb1403ba..646817ea0 100644 --- a/ErsatzTV.Application/Playouts/Commands/CreatePlayoutHandler.cs +++ b/ErsatzTV.Application/Playouts/Commands/CreatePlayoutHandler.cs @@ -28,7 +28,7 @@ public class CreatePlayoutHandler : IRequestHandler validation = await Validate(dbContext, request); - return await validation.Apply(playout => PersistPlayout(dbContext, playout)); + return await LanguageExtensions.Apply(validation, playout => PersistPlayout(dbContext, playout)); } private async Task PersistPlayout(TvContext dbContext, Playout playout) @@ -85,4 +85,4 @@ public class CreatePlayoutHandler : IRequestHandler playoutType != ProgramSchedulePlayoutType.None) .ToValidation("[ProgramSchedulePlayoutType] must not be None"); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Playouts/Commands/CreatePlayoutResponse.cs b/ErsatzTV.Application/Playouts/Commands/CreatePlayoutResponse.cs index fb4d596b6..db96e7248 100644 --- a/ErsatzTV.Application/Playouts/Commands/CreatePlayoutResponse.cs +++ b/ErsatzTV.Application/Playouts/Commands/CreatePlayoutResponse.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Playouts; -public record CreatePlayoutResponse(int PlayoutId); \ No newline at end of file +public record CreatePlayoutResponse(int PlayoutId); diff --git a/ErsatzTV.Application/Playouts/Commands/DeletePlayout.cs b/ErsatzTV.Application/Playouts/Commands/DeletePlayout.cs index 6ccc3dd74..4e81b073c 100644 --- a/ErsatzTV.Application/Playouts/Commands/DeletePlayout.cs +++ b/ErsatzTV.Application/Playouts/Commands/DeletePlayout.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Playouts; -public record DeletePlayout(int PlayoutId) : IRequest>; \ No newline at end of file +public record DeletePlayout(int PlayoutId) : IRequest>; diff --git a/ErsatzTV.Application/Playouts/Commands/DeletePlayoutHandler.cs b/ErsatzTV.Application/Playouts/Commands/DeletePlayoutHandler.cs index 6e26187e0..62d42c2c5 100644 --- a/ErsatzTV.Application/Playouts/Commands/DeletePlayoutHandler.cs +++ b/ErsatzTV.Application/Playouts/Commands/DeletePlayoutHandler.cs @@ -32,4 +32,4 @@ public class DeletePlayoutHandler : IRequestHandler Unit.Default) .ToEither(BaseError.New($"Playout {request.PlayoutId} does not exist.")); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Playouts/Commands/UpdatePlayout.cs b/ErsatzTV.Application/Playouts/Commands/UpdatePlayout.cs index 1668286bb..7a04d5f9b 100644 --- a/ErsatzTV.Application/Playouts/Commands/UpdatePlayout.cs +++ b/ErsatzTV.Application/Playouts/Commands/UpdatePlayout.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Playouts; public record UpdatePlayout - (int PlayoutId, Option DailyRebuildTime) : IRequest>; \ No newline at end of file + (int PlayoutId, Option DailyRebuildTime) : IRequest>; diff --git a/ErsatzTV.Application/Playouts/Commands/UpdatePlayoutHandler.cs b/ErsatzTV.Application/Playouts/Commands/UpdatePlayoutHandler.cs index 9bf853ea6..95e56cd4c 100644 --- a/ErsatzTV.Application/Playouts/Commands/UpdatePlayoutHandler.cs +++ b/ErsatzTV.Application/Playouts/Commands/UpdatePlayoutHandler.cs @@ -55,4 +55,4 @@ public class UpdatePlayoutHandler : IRequestHandler p.ProgramSchedule) .SelectOneAsync(p => p.Id, p => p.Id == updatePlayout.PlayoutId) .Map(o => o.ToValidation("Playout does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Playouts/Mapper.cs b/ErsatzTV.Application/Playouts/Mapper.cs index b4e1ed56d..27917bb4d 100644 --- a/ErsatzTV.Application/Playouts/Mapper.cs +++ b/ErsatzTV.Application/Playouts/Mapper.cs @@ -39,12 +39,18 @@ internal static class Mapper .Map(am => $"{am.Title} - ").IfNone(string.Empty); return mv.MusicVideoMetadata.HeadOrNone() .Map(mvm => $"{artistName}{mvm.Title}") - .Map(s => string.IsNullOrWhiteSpace(playoutItem.ChapterTitle) ? s : $"{s} ({playoutItem.ChapterTitle})") + .Map( + s => string.IsNullOrWhiteSpace(playoutItem.ChapterTitle) + ? s + : $"{s} ({playoutItem.ChapterTitle})") .IfNone("[unknown music video]"); case OtherVideo ov: return ov.OtherVideoMetadata.HeadOrNone() .Map(ovm => ovm.Title ?? string.Empty) - .Map(s => string.IsNullOrWhiteSpace(playoutItem.ChapterTitle) ? s : $"{s} ({playoutItem.ChapterTitle})") + .Map( + s => string.IsNullOrWhiteSpace(playoutItem.ChapterTitle) + ? s + : $"{s} ({playoutItem.ChapterTitle})") .IfNone("[unknown video]"); case Song s: string songArtist = s.SongMetadata.HeadOrNone() @@ -52,7 +58,10 @@ internal static class Mapper .IfNone(string.Empty); return s.SongMetadata.HeadOrNone() .Map(sm => $"{songArtist}{sm.Title ?? string.Empty}") - .Map(t => string.IsNullOrWhiteSpace(playoutItem.ChapterTitle) ? t : $"{s} ({playoutItem.ChapterTitle})") + .Map( + t => string.IsNullOrWhiteSpace(playoutItem.ChapterTitle) + ? t + : $"{s} ({playoutItem.ChapterTitle})") .IfNone("[unknown song]"); default: return string.Empty; @@ -63,4 +72,4 @@ internal static class Mapper string.Format( duration.TotalHours >= 1 ? @"{0:h\:mm\:ss}" : @"{0:mm\:ss}", duration); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Playouts/PagedPlayoutItemsViewModel.cs b/ErsatzTV.Application/Playouts/PagedPlayoutItemsViewModel.cs index 0e6568dc5..698faf2fd 100644 --- a/ErsatzTV.Application/Playouts/PagedPlayoutItemsViewModel.cs +++ b/ErsatzTV.Application/Playouts/PagedPlayoutItemsViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Playouts; -public record PagedPlayoutItemsViewModel(int TotalCount, List Page); \ No newline at end of file +public record PagedPlayoutItemsViewModel(int TotalCount, List Page); diff --git a/ErsatzTV.Application/Playouts/PlayoutChannelViewModel.cs b/ErsatzTV.Application/Playouts/PlayoutChannelViewModel.cs index 3968e90a2..39ce526bd 100644 --- a/ErsatzTV.Application/Playouts/PlayoutChannelViewModel.cs +++ b/ErsatzTV.Application/Playouts/PlayoutChannelViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Playouts; -public record PlayoutChannelViewModel(int Id, string Number, string Name); \ No newline at end of file +public record PlayoutChannelViewModel(int Id, string Number, string Name); diff --git a/ErsatzTV.Application/Playouts/PlayoutItemViewModel.cs b/ErsatzTV.Application/Playouts/PlayoutItemViewModel.cs index 118ba6536..52d1b8b18 100644 --- a/ErsatzTV.Application/Playouts/PlayoutItemViewModel.cs +++ b/ErsatzTV.Application/Playouts/PlayoutItemViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Playouts; -public record PlayoutItemViewModel(string Title, DateTimeOffset Start, string Duration); \ No newline at end of file +public record PlayoutItemViewModel(string Title, DateTimeOffset Start, string Duration); diff --git a/ErsatzTV.Application/Playouts/PlayoutNameViewModel.cs b/ErsatzTV.Application/Playouts/PlayoutNameViewModel.cs index 9aeaeb386..85ec0f757 100644 --- a/ErsatzTV.Application/Playouts/PlayoutNameViewModel.cs +++ b/ErsatzTV.Application/Playouts/PlayoutNameViewModel.cs @@ -5,4 +5,4 @@ public record PlayoutNameViewModel( string ChannelName, string ChannelNumber, string ScheduleName, - Option DailyRebuildTime); \ No newline at end of file + Option DailyRebuildTime); diff --git a/ErsatzTV.Application/Playouts/PlayoutProgramScheduleViewModel.cs b/ErsatzTV.Application/Playouts/PlayoutProgramScheduleViewModel.cs index e4e3e9824..34618db0d 100644 --- a/ErsatzTV.Application/Playouts/PlayoutProgramScheduleViewModel.cs +++ b/ErsatzTV.Application/Playouts/PlayoutProgramScheduleViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Playouts; -public record PlayoutProgramScheduleViewModel(int Id, string Name); \ No newline at end of file +public record PlayoutProgramScheduleViewModel(int Id, string Name); diff --git a/ErsatzTV.Application/Playouts/PlayoutViewModel.cs b/ErsatzTV.Application/Playouts/PlayoutViewModel.cs index 55bf72ea7..4dda2a99d 100644 --- a/ErsatzTV.Application/Playouts/PlayoutViewModel.cs +++ b/ErsatzTV.Application/Playouts/PlayoutViewModel.cs @@ -6,4 +6,4 @@ public record PlayoutViewModel( int Id, PlayoutChannelViewModel Channel, PlayoutProgramScheduleViewModel ProgramSchedule, - ProgramSchedulePlayoutType ProgramSchedulePlayoutType); \ No newline at end of file + ProgramSchedulePlayoutType ProgramSchedulePlayoutType); diff --git a/ErsatzTV.Application/Playouts/Queries/GetAllPlayouts.cs b/ErsatzTV.Application/Playouts/Queries/GetAllPlayouts.cs index 429eb6f43..3e2160245 100644 --- a/ErsatzTV.Application/Playouts/Queries/GetAllPlayouts.cs +++ b/ErsatzTV.Application/Playouts/Queries/GetAllPlayouts.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Playouts; -public record GetAllPlayouts : IRequest>; \ No newline at end of file +public record GetAllPlayouts : IRequest>; diff --git a/ErsatzTV.Application/Playouts/Queries/GetAllPlayoutsHandler.cs b/ErsatzTV.Application/Playouts/Queries/GetAllPlayoutsHandler.cs index f26922620..1da32fd3c 100644 --- a/ErsatzTV.Application/Playouts/Queries/GetAllPlayoutsHandler.cs +++ b/ErsatzTV.Application/Playouts/Queries/GetAllPlayoutsHandler.cs @@ -26,4 +26,4 @@ public class GetAllPlayoutsHandler : IRequestHandler; \ No newline at end of file +public record GetFuturePlayoutItemsById + (int PlayoutId, bool ShowFiller, int PageNum, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/Playouts/Queries/GetFuturePlayoutItemsByIdHandler.cs b/ErsatzTV.Application/Playouts/Queries/GetFuturePlayoutItemsByIdHandler.cs index 1e87870c0..49037819c 100644 --- a/ErsatzTV.Application/Playouts/Queries/GetFuturePlayoutItemsByIdHandler.cs +++ b/ErsatzTV.Application/Playouts/Queries/GetFuturePlayoutItemsByIdHandler.cs @@ -22,8 +22,11 @@ public class GetFuturePlayoutItemsByIdHandler : IRequestHandler i.Finish >= now && i.PlayoutId == request.PlayoutId && (request.ShowFiller || i.FillerKind == FillerKind.None), cancellationToken); - + .CountAsync( + i => i.Finish >= now && i.PlayoutId == request.PlayoutId && + (request.ShowFiller || i.FillerKind == FillerKind.None), + cancellationToken); + List page = await dbContext.PlayoutItems .Include(i => i.MediaItem) .ThenInclude(mi => (mi as Movie).MovieMetadata) @@ -65,4 +68,4 @@ public class GetFuturePlayoutItemsByIdHandler : IRequestHandler>; \ No newline at end of file +public record SignOutOfPlex : IRequest>; diff --git a/ErsatzTV.Application/Plex/Commands/SignOutOfPlexHandler.cs b/ErsatzTV.Application/Plex/Commands/SignOutOfPlexHandler.cs index 076d3dfb4..c20d4231c 100644 --- a/ErsatzTV.Application/Plex/Commands/SignOutOfPlexHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/SignOutOfPlexHandler.cs @@ -6,7 +6,7 @@ using ErsatzTV.Core.Interfaces.Search; namespace ErsatzTV.Application.Plex; -public class SignOutOfPlexHandler : MediatR.IRequestHandler> +public class SignOutOfPlexHandler : IRequestHandler> { private readonly IEntityLocker _entityLocker; private readonly IMediaSourceRepository _mediaSourceRepository; @@ -35,4 +35,4 @@ public class SignOutOfPlexHandler : MediatR.IRequestHandler>; \ No newline at end of file +public record StartPlexPinFlow : IRequest>; diff --git a/ErsatzTV.Application/Plex/Commands/StartPlexPinFlowHandler.cs b/ErsatzTV.Application/Plex/Commands/StartPlexPinFlowHandler.cs index 4c417b83b..b6c2225a2 100644 --- a/ErsatzTV.Application/Plex/Commands/StartPlexPinFlowHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/StartPlexPinFlowHandler.cs @@ -29,4 +29,4 @@ public class StartPlexPinFlowHandler : IRequestHandler(pin.Url); }) ); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibraries.cs b/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibraries.cs index 4f23bcab6..1683fda85 100644 --- a/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibraries.cs +++ b/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibraries.cs @@ -2,5 +2,5 @@ namespace ErsatzTV.Application.Plex; -public record SynchronizePlexLibraries(int PlexMediaSourceId) : MediatR.IRequest>, - IPlexBackgroundServiceRequest; \ No newline at end of file +public record SynchronizePlexLibraries(int PlexMediaSourceId) : IRequest>, + IPlexBackgroundServiceRequest; diff --git a/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibrariesHandler.cs b/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibrariesHandler.cs index 76ca7f64c..1e77c610f 100644 --- a/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibrariesHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibrariesHandler.cs @@ -9,7 +9,7 @@ using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Plex; public class - SynchronizePlexLibrariesHandler : MediatR.IRequestHandler> + SynchronizePlexLibrariesHandler : IRequestHandler> { private readonly ILogger _logger; private readonly IMediaSourceRepository _mediaSourceRepository; @@ -106,4 +106,4 @@ public class { public PlexServerAuthToken PlexServerAuthToken { get; set; } } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibraryById.cs b/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibraryById.cs index 1192f8d50..081d13013 100644 --- a/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibraryById.cs +++ b/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibraryById.cs @@ -18,4 +18,4 @@ public record ForceSynchronizePlexLibraryById (int PlexLibraryId) : ISynchronizePlexLibraryById { public bool ForceScan => true; -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibraryByIdHandler.cs b/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibraryByIdHandler.cs index e5ac6b380..fa730a188 100644 --- a/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibraryByIdHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/SynchronizePlexLibraryByIdHandler.cs @@ -149,7 +149,7 @@ public class _configElementRepository.GetValue(ConfigElementKey.LibraryRefreshInterval) .FilterT(lri => lri > 0) .Map(lri => lri.ToValidation("Library refresh interval is invalid")); - + private Task> ValidateFFmpegPath() => _configElementRepository.GetValue(ConfigElementKey.FFmpegPath) .FilterT(File.Exists) @@ -176,4 +176,4 @@ public class { public PlexServerAuthToken PlexServerAuthToken { get; set; } } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Plex/Commands/SynchronizePlexMediaSources.cs b/ErsatzTV.Application/Plex/Commands/SynchronizePlexMediaSources.cs index 83da2a37a..a9a6eedcf 100644 --- a/ErsatzTV.Application/Plex/Commands/SynchronizePlexMediaSources.cs +++ b/ErsatzTV.Application/Plex/Commands/SynchronizePlexMediaSources.cs @@ -4,4 +4,4 @@ using ErsatzTV.Core.Domain; namespace ErsatzTV.Application.Plex; public record - SynchronizePlexMediaSources : IRequest>>, IPlexBackgroundServiceRequest; \ No newline at end of file + SynchronizePlexMediaSources : IRequest>>, IPlexBackgroundServiceRequest; diff --git a/ErsatzTV.Application/Plex/Commands/SynchronizePlexMediaSourcesHandler.cs b/ErsatzTV.Application/Plex/Commands/SynchronizePlexMediaSourcesHandler.cs index 952e3a060..d40e9b93a 100644 --- a/ErsatzTV.Application/Plex/Commands/SynchronizePlexMediaSourcesHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/SynchronizePlexMediaSourcesHandler.cs @@ -18,9 +18,9 @@ public class SynchronizePlexMediaSourcesHandler : IRequestHandler _logger; private readonly IMediaSourceRepository _mediaSourceRepository; - private readonly IPlexTvApiClient _plexTvApiClient; - private readonly IPlexServerApiClient _plexServerApiClient; private readonly IPlexSecretStore _plexSecretStore; + private readonly IPlexServerApiClient _plexServerApiClient; + private readonly IPlexTvApiClient _plexTvApiClient; public SynchronizePlexMediaSourcesHandler( IMediaSourceRepository mediaSourceRepository, @@ -158,4 +158,4 @@ public class SynchronizePlexMediaSourcesHandler : IRequestHandler(), new List()); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Plex/Commands/TryCompletePlexPinFlow.cs b/ErsatzTV.Application/Plex/Commands/TryCompletePlexPinFlow.cs index 00d3fa4d0..61ef42d0f 100644 --- a/ErsatzTV.Application/Plex/Commands/TryCompletePlexPinFlow.cs +++ b/ErsatzTV.Application/Plex/Commands/TryCompletePlexPinFlow.cs @@ -4,4 +4,4 @@ using ErsatzTV.Core.Plex; namespace ErsatzTV.Application.Plex; public record TryCompletePlexPinFlow(PlexAuthPin AuthPin) : IRequest>, - IPlexBackgroundServiceRequest; \ No newline at end of file + IPlexBackgroundServiceRequest; diff --git a/ErsatzTV.Application/Plex/Commands/TryCompletePlexPinFlowHandler.cs b/ErsatzTV.Application/Plex/Commands/TryCompletePlexPinFlowHandler.cs index b283695e1..3373fbe22 100644 --- a/ErsatzTV.Application/Plex/Commands/TryCompletePlexPinFlowHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/TryCompletePlexPinFlowHandler.cs @@ -36,4 +36,4 @@ public class TryCompletePlexPinFlowHandler : IRequestHandler Preferences) : MediatR.IRequest>; + (List Preferences) : IRequest>; -public record PlexLibraryPreference(int Id, bool ShouldSyncItems); \ No newline at end of file +public record PlexLibraryPreference(int Id, bool ShouldSyncItems); diff --git a/ErsatzTV.Application/Plex/Commands/UpdatePlexLibraryPreferencesHandler.cs b/ErsatzTV.Application/Plex/Commands/UpdatePlexLibraryPreferencesHandler.cs index ddc24f837..4a3db7f5b 100644 --- a/ErsatzTV.Application/Plex/Commands/UpdatePlexLibraryPreferencesHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/UpdatePlexLibraryPreferencesHandler.cs @@ -5,7 +5,7 @@ using ErsatzTV.Core.Interfaces.Search; namespace ErsatzTV.Application.Plex; public class - UpdatePlexLibraryPreferencesHandler : MediatR.IRequestHandler> { private readonly IMediaSourceRepository _mediaSourceRepository; @@ -33,4 +33,4 @@ public class return Unit.Default; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Plex/Commands/UpdatePlexPathReplacements.cs b/ErsatzTV.Application/Plex/Commands/UpdatePlexPathReplacements.cs index 54e5306f7..372917b73 100644 --- a/ErsatzTV.Application/Plex/Commands/UpdatePlexPathReplacements.cs +++ b/ErsatzTV.Application/Plex/Commands/UpdatePlexPathReplacements.cs @@ -5,6 +5,6 @@ namespace ErsatzTV.Application.Plex; public record UpdatePlexPathReplacements ( int PlexMediaSourceId, - List PathReplacements) : MediatR.IRequest>; + List PathReplacements) : IRequest>; -public record PlexPathReplacementItem(int Id, string PlexPath, string LocalPath); \ No newline at end of file +public record PlexPathReplacementItem(int Id, string PlexPath, string LocalPath); diff --git a/ErsatzTV.Application/Plex/Commands/UpdatePlexPathReplacementsHandler.cs b/ErsatzTV.Application/Plex/Commands/UpdatePlexPathReplacementsHandler.cs index 3c7036384..6bd9e5f68 100644 --- a/ErsatzTV.Application/Plex/Commands/UpdatePlexPathReplacementsHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/UpdatePlexPathReplacementsHandler.cs @@ -5,7 +5,7 @@ using ErsatzTV.Core.Interfaces.Repositories; namespace ErsatzTV.Application.Plex; public class - UpdatePlexPathReplacementsHandler : MediatR.IRequestHandler> + UpdatePlexPathReplacementsHandler : IRequestHandler> { private readonly IMediaSourceRepository _mediaSourceRepository; @@ -42,4 +42,4 @@ public class UpdatePlexPathReplacements request) => _mediaSourceRepository.GetPlex(request.PlexMediaSourceId) .Map(v => v.ToValidation($"Plex media source {request.PlexMediaSourceId} does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Plex/Mapper.cs b/ErsatzTV.Application/Plex/Mapper.cs index 55f23ed17..974cc0f75 100644 --- a/ErsatzTV.Application/Plex/Mapper.cs +++ b/ErsatzTV.Application/Plex/Mapper.cs @@ -15,4 +15,4 @@ internal static class Mapper internal static PlexPathReplacementViewModel ProjectToViewModel(PlexPathReplacement pathReplacement) => new(pathReplacement.Id, pathReplacement.PlexPath, pathReplacement.LocalPath); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Plex/PlexConnectionParametersViewModel.cs b/ErsatzTV.Application/Plex/PlexConnectionParametersViewModel.cs index eefa84c87..d11e0f2cc 100644 --- a/ErsatzTV.Application/Plex/PlexConnectionParametersViewModel.cs +++ b/ErsatzTV.Application/Plex/PlexConnectionParametersViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Plex; -public record PlexConnectionParametersViewModel(Uri Uri, string AuthToken); \ No newline at end of file +public record PlexConnectionParametersViewModel(Uri Uri, string AuthToken); diff --git a/ErsatzTV.Application/Plex/PlexLibraryViewModel.cs b/ErsatzTV.Application/Plex/PlexLibraryViewModel.cs index f09ea9bb6..e66851ad8 100644 --- a/ErsatzTV.Application/Plex/PlexLibraryViewModel.cs +++ b/ErsatzTV.Application/Plex/PlexLibraryViewModel.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Plex; -public record PlexLibraryViewModel(int Id, string Name, LibraryMediaKind MediaKind, bool ShouldSyncItems); \ No newline at end of file +public record PlexLibraryViewModel(int Id, string Name, LibraryMediaKind MediaKind, bool ShouldSyncItems); diff --git a/ErsatzTV.Application/Plex/PlexMediaSourceViewModel.cs b/ErsatzTV.Application/Plex/PlexMediaSourceViewModel.cs index df86da4dd..899464a01 100644 --- a/ErsatzTV.Application/Plex/PlexMediaSourceViewModel.cs +++ b/ErsatzTV.Application/Plex/PlexMediaSourceViewModel.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Plex; -public record PlexMediaSourceViewModel(int Id, string Name, string Address) : MediaSourceViewModel(Id, Name); \ No newline at end of file +public record PlexMediaSourceViewModel(int Id, string Name, string Address) : MediaSourceViewModel(Id, Name); diff --git a/ErsatzTV.Application/Plex/PlexPathReplacementViewModel.cs b/ErsatzTV.Application/Plex/PlexPathReplacementViewModel.cs index 266d60c2a..234d014eb 100644 --- a/ErsatzTV.Application/Plex/PlexPathReplacementViewModel.cs +++ b/ErsatzTV.Application/Plex/PlexPathReplacementViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Plex; -public record PlexPathReplacementViewModel(int Id, string PlexPath, string LocalPath); \ No newline at end of file +public record PlexPathReplacementViewModel(int Id, string PlexPath, string LocalPath); diff --git a/ErsatzTV.Application/Plex/Queries/GetAllPlexMediaSources.cs b/ErsatzTV.Application/Plex/Queries/GetAllPlexMediaSources.cs index 81d0bd7c7..de6c34801 100644 --- a/ErsatzTV.Application/Plex/Queries/GetAllPlexMediaSources.cs +++ b/ErsatzTV.Application/Plex/Queries/GetAllPlexMediaSources.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Plex; -public record GetAllPlexMediaSources : IRequest>; \ No newline at end of file +public record GetAllPlexMediaSources : IRequest>; diff --git a/ErsatzTV.Application/Plex/Queries/GetAllPlexMediaSourcesHandler.cs b/ErsatzTV.Application/Plex/Queries/GetAllPlexMediaSourcesHandler.cs index 7bc40d26b..7b526c0f0 100644 --- a/ErsatzTV.Application/Plex/Queries/GetAllPlexMediaSourcesHandler.cs +++ b/ErsatzTV.Application/Plex/Queries/GetAllPlexMediaSourcesHandler.cs @@ -14,4 +14,4 @@ public class GetAllPlexMediaSourcesHandler : IRequestHandler _mediaSourceRepository.GetAllPlex().Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Plex/Queries/GetPlexConnectionParameters.cs b/ErsatzTV.Application/Plex/Queries/GetPlexConnectionParameters.cs index 23cb87aa4..dd176a3ea 100644 --- a/ErsatzTV.Application/Plex/Queries/GetPlexConnectionParameters.cs +++ b/ErsatzTV.Application/Plex/Queries/GetPlexConnectionParameters.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Plex; public record GetPlexConnectionParameters - (int PlexMediaSourceId) : IRequest>; \ No newline at end of file + (int PlexMediaSourceId) : IRequest>; diff --git a/ErsatzTV.Application/Plex/Queries/GetPlexConnectionParametersHandler.cs b/ErsatzTV.Application/Plex/Queries/GetPlexConnectionParametersHandler.cs index 53f26f948..79a3fa4a5 100644 --- a/ErsatzTV.Application/Plex/Queries/GetPlexConnectionParametersHandler.cs +++ b/ErsatzTV.Application/Plex/Queries/GetPlexConnectionParametersHandler.cs @@ -84,4 +84,4 @@ public class GetPlexConnectionParametersHandler : IRequestHandler>; \ No newline at end of file +public record GetPlexLibrariesBySourceId(int PlexMediaSourceId) : IRequest>; diff --git a/ErsatzTV.Application/Plex/Queries/GetPlexLibrariesBySourceIdHandler.cs b/ErsatzTV.Application/Plex/Queries/GetPlexLibrariesBySourceIdHandler.cs index 9bfc86ea7..102ee2bf6 100644 --- a/ErsatzTV.Application/Plex/Queries/GetPlexLibrariesBySourceIdHandler.cs +++ b/ErsatzTV.Application/Plex/Queries/GetPlexLibrariesBySourceIdHandler.cs @@ -17,4 +17,4 @@ public class CancellationToken cancellationToken) => _mediaSourceRepository.GetPlexLibraries(request.PlexMediaSourceId) .Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Plex/Queries/GetPlexMediaSourceById.cs b/ErsatzTV.Application/Plex/Queries/GetPlexMediaSourceById.cs index 8e89fc273..79638de5a 100644 --- a/ErsatzTV.Application/Plex/Queries/GetPlexMediaSourceById.cs +++ b/ErsatzTV.Application/Plex/Queries/GetPlexMediaSourceById.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Plex; -public record GetPlexMediaSourceById(int PlexMediaSourceId) : IRequest>; \ No newline at end of file +public record GetPlexMediaSourceById(int PlexMediaSourceId) : IRequest>; diff --git a/ErsatzTV.Application/Plex/Queries/GetPlexMediaSourceByIdHandler.cs b/ErsatzTV.Application/Plex/Queries/GetPlexMediaSourceByIdHandler.cs index 46337c903..7550fd53a 100644 --- a/ErsatzTV.Application/Plex/Queries/GetPlexMediaSourceByIdHandler.cs +++ b/ErsatzTV.Application/Plex/Queries/GetPlexMediaSourceByIdHandler.cs @@ -15,4 +15,4 @@ public class GetPlexMediaSourceById request, CancellationToken cancellationToken) => _mediaSourceRepository.GetPlex(request.PlexMediaSourceId).MapT(ProjectToViewModel); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Plex/Queries/GetPlexPathReplacementsBySourceId.cs b/ErsatzTV.Application/Plex/Queries/GetPlexPathReplacementsBySourceId.cs index b153ef3e7..b8825b40e 100644 --- a/ErsatzTV.Application/Plex/Queries/GetPlexPathReplacementsBySourceId.cs +++ b/ErsatzTV.Application/Plex/Queries/GetPlexPathReplacementsBySourceId.cs @@ -1,4 +1,4 @@ namespace ErsatzTV.Application.Plex; public record GetPlexPathReplacementsBySourceId - (int PlexMediaSourceId) : IRequest>; \ No newline at end of file + (int PlexMediaSourceId) : IRequest>; diff --git a/ErsatzTV.Application/Plex/Queries/GetPlexPathReplacementsBySourceIdHandler.cs b/ErsatzTV.Application/Plex/Queries/GetPlexPathReplacementsBySourceIdHandler.cs index 45913a458..cf40f05c7 100644 --- a/ErsatzTV.Application/Plex/Queries/GetPlexPathReplacementsBySourceIdHandler.cs +++ b/ErsatzTV.Application/Plex/Queries/GetPlexPathReplacementsBySourceIdHandler.cs @@ -16,4 +16,4 @@ public class GetPlexPathReplacementsBySourceIdHandler : IRequestHandler _mediaSourceRepository.GetPlexPathReplacements(request.PlexMediaSourceId) .Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/AddProgramScheduleItem.cs b/ErsatzTV.Application/ProgramSchedules/Commands/AddProgramScheduleItem.cs index 19310e05c..591de7c37 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/AddProgramScheduleItem.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/AddProgramScheduleItem.cs @@ -24,4 +24,4 @@ public record AddProgramScheduleItem( int? PostRollFillerId, int? TailFillerId, int? FallbackFillerId, - int? WatermarkId) : IRequest>, IProgramScheduleItemRequest; \ No newline at end of file + int? WatermarkId) : IRequest>, IProgramScheduleItemRequest; diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/AddProgramScheduleItemHandler.cs b/ErsatzTV.Application/ProgramSchedules/Commands/AddProgramScheduleItemHandler.cs index 2eaf769bb..d5b941a59 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/AddProgramScheduleItemHandler.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/AddProgramScheduleItemHandler.cs @@ -29,7 +29,7 @@ public class AddProgramScheduleItemHandler : ProgramScheduleItemCommandBase, { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(ps => PersistItem(dbContext, request, ps)); + return await LanguageExtensions.Apply(validation, ps => PersistItem(dbContext, request, ps)); } private async Task PersistItem( @@ -58,4 +58,4 @@ public class AddProgramScheduleItemHandler : ProgramScheduleItemCommandBase, AddProgramScheduleItem request) => ProgramScheduleMustExist(dbContext, request.ProgramScheduleId) .BindT(programSchedule => PlayoutModeMustBeValid(request, programSchedule)); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/CreateProgramSchedule.cs b/ErsatzTV.Application/ProgramSchedules/Commands/CreateProgramSchedule.cs index ff210024f..4e2ee6ce7 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/CreateProgramSchedule.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/CreateProgramSchedule.cs @@ -6,4 +6,4 @@ public record CreateProgramSchedule( string Name, bool KeepMultiPartEpisodesTogether, bool TreatCollectionsAsShows, - bool ShuffleScheduleItems) : IRequest>; \ No newline at end of file + bool ShuffleScheduleItems) : IRequest>; diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/CreateProgramScheduleHandler.cs b/ErsatzTV.Application/ProgramSchedules/Commands/CreateProgramScheduleHandler.cs index 03ec417d2..95f1c7ed1 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/CreateProgramScheduleHandler.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/CreateProgramScheduleHandler.cs @@ -35,8 +35,7 @@ public class CreateProgramScheduleHandler : private static Task> Validate( TvContext dbContext, CreateProgramSchedule request) => - ValidationT_AsyncSync_Extensions.MapT( - ValidateName(dbContext, request), + ValidateName(dbContext, request).MapT( name => { bool keepMultiPartEpisodesTogether = request.KeepMultiPartEpisodesTogether; @@ -65,4 +64,4 @@ public class CreateProgramScheduleHandler : return (result1, result2).Apply((_, _) => createProgramSchedule.Name); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/CreateProgramScheduleResult.cs b/ErsatzTV.Application/ProgramSchedules/Commands/CreateProgramScheduleResult.cs index f22b989f9..b342f7369 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/CreateProgramScheduleResult.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/CreateProgramScheduleResult.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.ProgramSchedules; -public record CreateProgramScheduleResult(int ProgramScheduleId) : EntityIdResult(ProgramScheduleId); \ No newline at end of file +public record CreateProgramScheduleResult(int ProgramScheduleId) : EntityIdResult(ProgramScheduleId); diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/DeleteProgramSchedule.cs b/ErsatzTV.Application/ProgramSchedules/Commands/DeleteProgramSchedule.cs index 3e6ce0b57..89d16c302 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/DeleteProgramSchedule.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/DeleteProgramSchedule.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.ProgramSchedules; -public record DeleteProgramSchedule(int ProgramScheduleId) : IRequest>; \ No newline at end of file +public record DeleteProgramSchedule(int ProgramScheduleId) : IRequest>; diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/DeleteProgramScheduleHandler.cs b/ErsatzTV.Application/ProgramSchedules/Commands/DeleteProgramScheduleHandler.cs index 46631a508..cddbcd2b2 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/DeleteProgramScheduleHandler.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/DeleteProgramScheduleHandler.cs @@ -34,4 +34,4 @@ public class DeleteProgramScheduleHandler : IRequestHandler ps.Id, ps => ps.Id == request.ProgramScheduleId) .Map(o => o.ToValidation($"ProgramSchedule {request.ProgramScheduleId} does not exist.")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/IProgramScheduleItemRequest.cs b/ErsatzTV.Application/ProgramSchedules/Commands/IProgramScheduleItemRequest.cs index fcec59ba7..234efa092 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/IProgramScheduleItemRequest.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/IProgramScheduleItemRequest.cs @@ -23,4 +23,4 @@ public interface IProgramScheduleItemRequest int? TailFillerId { get; } int? FallbackFillerId { get; } int? WatermarkId { get; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/ProgramScheduleItemCommandBase.cs b/ErsatzTV.Application/ProgramSchedules/Commands/ProgramScheduleItemCommandBase.cs index aec11c560..d62e787ce 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/ProgramScheduleItemCommandBase.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/ProgramScheduleItemCommandBase.cs @@ -31,7 +31,7 @@ public abstract class ProgramScheduleItemCommandBase List allFiller = await dbContext.FillerPresets .Filter(fp => allFillerIds.Contains(fp.Id)) .ToListAsync(); - + if (allFiller.Count(f => f.PadToNearestMinute.HasValue) > 1) { return BaseError.New("Schedule may only contain one filler preset that is configured to pad"); @@ -70,7 +70,8 @@ public abstract class ProgramScheduleItemCommandBase case PlayoutMode.Multiple: if (item.MultipleCount.GetValueOrDefault() < 0) { - return BaseError.New("[MultipleCount] must be greater than or equal to 0 for playout mode 'multiple'"); + return BaseError.New( + "[MultipleCount] must be greater than or equal to 0 for playout mode 'multiple'"); } break; @@ -252,4 +253,4 @@ public abstract class ProgramScheduleItemCommandBase startTime.HasValue && startTime.Value >= TimeSpan.FromDays(1) ? startTime.Value.Subtract(TimeSpan.FromDays(1)) : startTime; -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/ReplaceProgramScheduleItems.cs b/ErsatzTV.Application/ProgramSchedules/Commands/ReplaceProgramScheduleItems.cs index 8b561e125..e2b62cac6 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/ReplaceProgramScheduleItems.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/ReplaceProgramScheduleItems.cs @@ -28,4 +28,4 @@ public record ReplaceProgramScheduleItem( public record ReplaceProgramScheduleItems (int ProgramScheduleId, List Items) : IRequest< - Either>>; \ No newline at end of file + Either>>; diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/ReplaceProgramScheduleItemsHandler.cs b/ErsatzTV.Application/ProgramSchedules/Commands/ReplaceProgramScheduleItemsHandler.cs index f3084b9cb..1fed7d638 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/ReplaceProgramScheduleItemsHandler.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/ReplaceProgramScheduleItemsHandler.cs @@ -12,8 +12,8 @@ namespace ErsatzTV.Application.ProgramSchedules; public class ReplaceProgramScheduleItemsHandler : ProgramScheduleItemCommandBase, IRequestHandler>> { - private readonly IDbContextFactory _dbContextFactory; private readonly ChannelWriter _channel; + private readonly IDbContextFactory _dbContextFactory; public ReplaceProgramScheduleItemsHandler( IDbContextFactory dbContextFactory, @@ -29,7 +29,7 @@ public class ReplaceProgramScheduleItemsHandler : ProgramScheduleItemCommandBase { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(ps => PersistItems(dbContext, request, ps)); + return await LanguageExtensions.Apply(validation, ps => PersistItems(dbContext, request, ps)); } private async Task> PersistItems( @@ -129,4 +129,4 @@ public class ReplaceProgramScheduleItemsHandler : ProgramScheduleItemCommandBase int? MediaItemId, int? MultiCollectionId, int? SmartCollectionId); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/UpdateProgramSchedule.cs b/ErsatzTV.Application/ProgramSchedules/Commands/UpdateProgramSchedule.cs index c2c8a1143..a8039fa97 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/UpdateProgramSchedule.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/UpdateProgramSchedule.cs @@ -8,4 +8,4 @@ public record UpdateProgramSchedule string Name, bool KeepMultiPartEpisodesTogether, bool TreatCollectionsAsShows, - bool ShuffleScheduleItems) : IRequest>; \ No newline at end of file + bool ShuffleScheduleItems) : IRequest>; diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/UpdateProgramScheduleHandler.cs b/ErsatzTV.Application/ProgramSchedules/Commands/UpdateProgramScheduleHandler.cs index 3540ef9ff..8d83f117e 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/UpdateProgramScheduleHandler.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/UpdateProgramScheduleHandler.cs @@ -29,7 +29,7 @@ public class UpdateProgramScheduleHandler : { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); Validation validation = await Validate(dbContext, request); - return await validation.Apply(ps => ApplyUpdateRequest(dbContext, ps, request)); + return await LanguageExtensions.Apply(validation, ps => ApplyUpdateRequest(dbContext, ps, request)); } private async Task ApplyUpdateRequest( @@ -83,4 +83,4 @@ public class UpdateProgramScheduleHandler : private static Validation ValidateName(UpdateProgramSchedule request) => request.NotEmpty(c => c.Name) .Bind(_ => request.NotLongerThan(50)(c => c.Name)); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/Commands/UpdateProgramScheduleResult.cs b/ErsatzTV.Application/ProgramSchedules/Commands/UpdateProgramScheduleResult.cs index f79a12350..72cf2f497 100644 --- a/ErsatzTV.Application/ProgramSchedules/Commands/UpdateProgramScheduleResult.cs +++ b/ErsatzTV.Application/ProgramSchedules/Commands/UpdateProgramScheduleResult.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.ProgramSchedules; -public record UpdateProgramScheduleResult(int ProgramScheduleId) : EntityIdResult(ProgramScheduleId); \ No newline at end of file +public record UpdateProgramScheduleResult(int ProgramScheduleId) : EntityIdResult(ProgramScheduleId); diff --git a/ErsatzTV.Application/ProgramSchedules/Mapper.cs b/ErsatzTV.Application/ProgramSchedules/Mapper.cs index 02da7dcf6..4bdd2e8ff 100644 --- a/ErsatzTV.Application/ProgramSchedules/Mapper.cs +++ b/ErsatzTV.Application/ProgramSchedules/Mapper.cs @@ -197,4 +197,4 @@ internal static class Mapper _ => throw new NotSupportedException( $"Unsupported program schedule item type {programScheduleItem.GetType().Name}") }; -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemDurationViewModel.cs b/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemDurationViewModel.cs index 42e723b70..2158f482d 100644 --- a/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemDurationViewModel.cs +++ b/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemDurationViewModel.cs @@ -55,4 +55,4 @@ public record ProgramScheduleItemDurationViewModel : ProgramScheduleItemViewMode public TimeSpan PlayoutDuration { get; } public TailMode TailMode { get; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemFloodViewModel.cs b/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemFloodViewModel.cs index 4c3403532..0e0ade5f5 100644 --- a/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemFloodViewModel.cs +++ b/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemFloodViewModel.cs @@ -48,4 +48,4 @@ public record ProgramScheduleItemFloodViewModel : ProgramScheduleItemViewModel watermark) { } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemMultipleViewModel.cs b/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemMultipleViewModel.cs index 86f2df10d..3a3227799 100644 --- a/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemMultipleViewModel.cs +++ b/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemMultipleViewModel.cs @@ -50,4 +50,4 @@ public record ProgramScheduleItemMultipleViewModel : ProgramScheduleItemViewMode Count = count; public int Count { get; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemOneViewModel.cs b/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemOneViewModel.cs index 33c6b9b05..30dfd4184 100644 --- a/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemOneViewModel.cs +++ b/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemOneViewModel.cs @@ -48,4 +48,4 @@ public record ProgramScheduleItemOneViewModel : ProgramScheduleItemViewModel watermark) { } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemViewModel.cs b/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemViewModel.cs index 1655aac5e..2fa2168b9 100644 --- a/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemViewModel.cs +++ b/ErsatzTV.Application/ProgramSchedules/ProgramScheduleItemViewModel.cs @@ -42,4 +42,4 @@ public abstract record ProgramScheduleItemViewModel( SmartCollection?.Name, _ => string.Empty }; -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/ProgramScheduleViewModel.cs b/ErsatzTV.Application/ProgramSchedules/ProgramScheduleViewModel.cs index 0202e221e..578f28150 100644 --- a/ErsatzTV.Application/ProgramSchedules/ProgramScheduleViewModel.cs +++ b/ErsatzTV.Application/ProgramSchedules/ProgramScheduleViewModel.cs @@ -5,4 +5,4 @@ public record ProgramScheduleViewModel( string Name, bool KeepMultiPartEpisodesTogether, bool TreatCollectionsAsShows, - bool ShuffleScheduleItems); \ No newline at end of file + bool ShuffleScheduleItems); diff --git a/ErsatzTV.Application/ProgramSchedules/Queries/GetAllProgramSchedules.cs b/ErsatzTV.Application/ProgramSchedules/Queries/GetAllProgramSchedules.cs index ce8d78131..e824564a4 100644 --- a/ErsatzTV.Application/ProgramSchedules/Queries/GetAllProgramSchedules.cs +++ b/ErsatzTV.Application/ProgramSchedules/Queries/GetAllProgramSchedules.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.ProgramSchedules; -public record GetAllProgramSchedules : IRequest>; \ No newline at end of file +public record GetAllProgramSchedules : IRequest>; diff --git a/ErsatzTV.Application/ProgramSchedules/Queries/GetAllProgramSchedulesHandler.cs b/ErsatzTV.Application/ProgramSchedules/Queries/GetAllProgramSchedulesHandler.cs index d2879f0ea..d78c611e5 100644 --- a/ErsatzTV.Application/ProgramSchedules/Queries/GetAllProgramSchedulesHandler.cs +++ b/ErsatzTV.Application/ProgramSchedules/Queries/GetAllProgramSchedulesHandler.cs @@ -25,4 +25,4 @@ public class GetAllProgramSchedulesHandler : IRequestHandler>; \ No newline at end of file +public record GetProgramScheduleById(int Id) : IRequest>; diff --git a/ErsatzTV.Application/ProgramSchedules/Queries/GetProgramScheduleByIdHandler.cs b/ErsatzTV.Application/ProgramSchedules/Queries/GetProgramScheduleByIdHandler.cs index ff08a51b5..47a5bff9b 100644 --- a/ErsatzTV.Application/ProgramSchedules/Queries/GetProgramScheduleByIdHandler.cs +++ b/ErsatzTV.Application/ProgramSchedules/Queries/GetProgramScheduleByIdHandler.cs @@ -22,4 +22,4 @@ public class GetProgramScheduleByIdHandler : .SelectOneAsync(ps => ps.Id, ps => ps.Id == request.Id) .MapT(ProjectToViewModel); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/ProgramSchedules/Queries/GetProgramScheduleItems.cs b/ErsatzTV.Application/ProgramSchedules/Queries/GetProgramScheduleItems.cs index 9cadcb96e..e1cd5c6ef 100644 --- a/ErsatzTV.Application/ProgramSchedules/Queries/GetProgramScheduleItems.cs +++ b/ErsatzTV.Application/ProgramSchedules/Queries/GetProgramScheduleItems.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.ProgramSchedules; -public record GetProgramScheduleItems(int Id) : IRequest>; \ No newline at end of file +public record GetProgramScheduleItems(int Id) : IRequest>; diff --git a/ErsatzTV.Application/ProgramSchedules/Queries/GetProgramScheduleItemsHandler.cs b/ErsatzTV.Application/ProgramSchedules/Queries/GetProgramScheduleItemsHandler.cs index 28e1562ac..eab1237b3 100644 --- a/ErsatzTV.Application/ProgramSchedules/Queries/GetProgramScheduleItemsHandler.cs +++ b/ErsatzTV.Application/ProgramSchedules/Queries/GetProgramScheduleItemsHandler.cs @@ -75,4 +75,4 @@ public class GetProgramScheduleItemsHandler : return item; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Resolutions/FFmpegProfileResolutionViewModel.cs b/ErsatzTV.Application/Resolutions/FFmpegProfileResolutionViewModel.cs index 84eb02f97..3cfabf46e 100644 --- a/ErsatzTV.Application/Resolutions/FFmpegProfileResolutionViewModel.cs +++ b/ErsatzTV.Application/Resolutions/FFmpegProfileResolutionViewModel.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Resolutions; -public record ResolutionViewModel(int Id, string Name, int Width, int Height); \ No newline at end of file +public record ResolutionViewModel(int Id, string Name, int Width, int Height); diff --git a/ErsatzTV.Application/Resolutions/Mapper.cs b/ErsatzTV.Application/Resolutions/Mapper.cs index 175d2b645..7bba76128 100644 --- a/ErsatzTV.Application/Resolutions/Mapper.cs +++ b/ErsatzTV.Application/Resolutions/Mapper.cs @@ -6,4 +6,4 @@ internal static class Mapper { internal static ResolutionViewModel ProjectToViewModel(Resolution resolution) => new(resolution.Id, resolution.Name, resolution.Width, resolution.Height); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Resolutions/Queries/GetAllResolutions.cs b/ErsatzTV.Application/Resolutions/Queries/GetAllResolutions.cs index 95350905b..a9560eb92 100644 --- a/ErsatzTV.Application/Resolutions/Queries/GetAllResolutions.cs +++ b/ErsatzTV.Application/Resolutions/Queries/GetAllResolutions.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Resolutions; -public record GetAllResolutions : IRequest>; \ No newline at end of file +public record GetAllResolutions : IRequest>; diff --git a/ErsatzTV.Application/Resolutions/Queries/GetAllResolutionsHandler.cs b/ErsatzTV.Application/Resolutions/Queries/GetAllResolutionsHandler.cs index 8780c8895..7eabf4fc6 100644 --- a/ErsatzTV.Application/Resolutions/Queries/GetAllResolutionsHandler.cs +++ b/ErsatzTV.Application/Resolutions/Queries/GetAllResolutionsHandler.cs @@ -20,4 +20,4 @@ public class GetAllResolutionsHandler : IRequestHandler list.Map(ProjectToViewModel).ToList()); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Search/Commands/RebuildSearchIndex.cs b/ErsatzTV.Application/Search/Commands/RebuildSearchIndex.cs index c74fb1185..22bcef898 100644 --- a/ErsatzTV.Application/Search/Commands/RebuildSearchIndex.cs +++ b/ErsatzTV.Application/Search/Commands/RebuildSearchIndex.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Search; -public record RebuildSearchIndex : MediatR.IRequest, IBackgroundServiceRequest; \ No newline at end of file +public record RebuildSearchIndex : IRequest, IBackgroundServiceRequest; diff --git a/ErsatzTV.Application/Search/Commands/RebuildSearchIndexHandler.cs b/ErsatzTV.Application/Search/Commands/RebuildSearchIndexHandler.cs index 195acc2ce..880e72507 100644 --- a/ErsatzTV.Application/Search/Commands/RebuildSearchIndexHandler.cs +++ b/ErsatzTV.Application/Search/Commands/RebuildSearchIndexHandler.cs @@ -7,7 +7,7 @@ using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Search; -public class RebuildSearchIndexHandler : MediatR.IRequestHandler +public class RebuildSearchIndexHandler : IRequestHandler { private readonly IConfigElementRepository _configElementRepository; private readonly ILocalFileSystem _localFileSystem; @@ -55,4 +55,4 @@ public class RebuildSearchIndexHandler : MediatR.IRequestHandler; \ No newline at end of file +public record QuerySearchIndexAllItems(string Query) : IRequest; diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexAllItemsHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexAllItemsHandler.cs index d025948b8..8349dd784 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexAllItemsHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexAllItemsHandler.cs @@ -26,4 +26,4 @@ public class private Task> GetIds(string type, string query) => _searchIndex.Search($"type:{type} AND ({query})", 0, 0) .Map(result => result.Items.Map(i => i.Id).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexArtists.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexArtists.cs index 10aafce28..ee37543ee 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexArtists.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexArtists.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Search; public record QuerySearchIndexArtists - (string Query, int PageNumber, int PageSize) : IRequest; \ No newline at end of file + (string Query, int PageNumber, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexArtistsHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexArtistsHandler.cs index d4c3d0373..cd18255ec 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexArtistsHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexArtistsHandler.cs @@ -34,4 +34,4 @@ public class return new ArtistCardResultsViewModel(searchResult.TotalCount, items, searchResult.PageMap); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexEpisodes.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexEpisodes.cs index e733f1887..2dfaff476 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexEpisodes.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexEpisodes.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Search; public record QuerySearchIndexEpisodes - (string Query, int PageNumber, int PageSize) : IRequest; \ No newline at end of file + (string Query, int PageNumber, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexEpisodesHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexEpisodesHandler.cs index 49f64a3d8..f4f3d0c58 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexEpisodesHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexEpisodesHandler.cs @@ -46,4 +46,4 @@ public class return new TelevisionEpisodeCardResultsViewModel(searchResult.TotalCount, items, searchResult.PageMap); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexMovies.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexMovies.cs index 0e60cf7ef..f90f981a8 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexMovies.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexMovies.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Search; public record QuerySearchIndexMovies - (string Query, int PageNumber, int PageSize) : IRequest; \ No newline at end of file + (string Query, int PageNumber, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexMoviesHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexMoviesHandler.cs index e0468afb2..6d8be69e0 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexMoviesHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexMoviesHandler.cs @@ -44,4 +44,4 @@ public class QuerySearchIndexMoviesHandler : IRequestHandler; \ No newline at end of file + (string Query, int PageNumber, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexMusicVideosHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexMusicVideosHandler.cs index 4bfe5dfed..181d1c2ee 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexMusicVideosHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexMusicVideosHandler.cs @@ -34,4 +34,4 @@ public class return new MusicVideoCardResultsViewModel(searchResult.TotalCount, items, searchResult.PageMap); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexOtherVideos.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexOtherVideos.cs index 5c3071051..6890ace9e 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexOtherVideos.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexOtherVideos.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Search; public record QuerySearchIndexOtherVideos - (string Query, int PageNumber, int PageSize) : IRequest; \ No newline at end of file + (string Query, int PageNumber, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexOtherVideosHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexOtherVideosHandler.cs index c8ddcfd2f..de3c4c9d4 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexOtherVideosHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexOtherVideosHandler.cs @@ -34,4 +34,4 @@ public class return new OtherVideoCardResultsViewModel(searchResult.TotalCount, items, searchResult.PageMap); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexSeasons.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexSeasons.cs index 8b1494a30..c04e5ea55 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexSeasons.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexSeasons.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Search; public record QuerySearchIndexSeasons - (string Query, int PageNumber, int PageSize) : IRequest; \ No newline at end of file + (string Query, int PageNumber, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexSeasonsHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexSeasonsHandler.cs index dab5115db..744348463 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexSeasonsHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexSeasonsHandler.cs @@ -45,4 +45,4 @@ public class return new TelevisionSeasonCardResultsViewModel(searchResult.TotalCount, items, searchResult.PageMap); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexShows.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexShows.cs index a9e66cc47..9e0ce37d8 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexShows.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexShows.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Search; public record QuerySearchIndexShows - (string Query, int PageNumber, int PageSize) : IRequest; \ No newline at end of file + (string Query, int PageNumber, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexShowsHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexShowsHandler.cs index 4369fdf55..b0324200c 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexShowsHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexShowsHandler.cs @@ -45,4 +45,4 @@ public class return new TelevisionShowCardResultsViewModel(searchResult.TotalCount, items, searchResult.PageMap); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexSongs.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexSongs.cs index 0331495b6..199ad7921 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexSongs.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexSongs.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Search; public record QuerySearchIndexSongs - (string Query, int PageNumber, int PageSize) : IRequest; \ No newline at end of file + (string Query, int PageNumber, int PageSize) : IRequest; diff --git a/ErsatzTV.Application/Search/Queries/QuerySearchIndexSongsHandler.cs b/ErsatzTV.Application/Search/Queries/QuerySearchIndexSongsHandler.cs index 50f4be1b5..1038d18b3 100644 --- a/ErsatzTV.Application/Search/Queries/QuerySearchIndexSongsHandler.cs +++ b/ErsatzTV.Application/Search/Queries/QuerySearchIndexSongsHandler.cs @@ -10,8 +10,8 @@ public class QuerySearchIndexSongsHandler : IRequestHandler { - private readonly ISongRepository _songRepository; private readonly ISearchIndex _searchIndex; + private readonly ISongRepository _songRepository; public QuerySearchIndexSongsHandler(ISearchIndex searchIndex, ISongRepository songRepository) { @@ -34,4 +34,4 @@ public class return new SongCardResultsViewModel(searchResult.TotalCount, items, searchResult.PageMap); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Search/SearchResultAllItemsViewModel.cs b/ErsatzTV.Application/Search/SearchResultAllItemsViewModel.cs index 87b2e544c..18fbc17e9 100644 --- a/ErsatzTV.Application/Search/SearchResultAllItemsViewModel.cs +++ b/ErsatzTV.Application/Search/SearchResultAllItemsViewModel.cs @@ -8,4 +8,4 @@ public record SearchResultAllItemsViewModel( List ArtistIds, List MusicVideoIds, List OtherVideoIds, - List SongIds); \ No newline at end of file + List SongIds); diff --git a/ErsatzTV.Application/Search/SearchResultViewModel.cs b/ErsatzTV.Application/Search/SearchResultViewModel.cs index 22ca86360..55bfb4e40 100644 --- a/ErsatzTV.Application/Search/SearchResultViewModel.cs +++ b/ErsatzTV.Application/Search/SearchResultViewModel.cs @@ -4,4 +4,4 @@ public class SearchResultViewModel { public int TotalCount { get; set; } public List Items { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Streaming/Commands/StartFFmpegSession.cs b/ErsatzTV.Application/Streaming/Commands/StartFFmpegSession.cs index 60892b0fe..4cfef21ea 100644 --- a/ErsatzTV.Application/Streaming/Commands/StartFFmpegSession.cs +++ b/ErsatzTV.Application/Streaming/Commands/StartFFmpegSession.cs @@ -3,5 +3,5 @@ namespace ErsatzTV.Application.Streaming; public record StartFFmpegSession(string ChannelNumber, bool StartAtZero) : - MediatR.IRequest>, - IFFmpegWorkerRequest; \ No newline at end of file + IRequest>, + IFFmpegWorkerRequest; diff --git a/ErsatzTV.Application/Streaming/Commands/StartFFmpegSessionHandler.cs b/ErsatzTV.Application/Streaming/Commands/StartFFmpegSessionHandler.cs index bbc5f2db8..33f04a589 100644 --- a/ErsatzTV.Application/Streaming/Commands/StartFFmpegSessionHandler.cs +++ b/ErsatzTV.Application/Streaming/Commands/StartFFmpegSessionHandler.cs @@ -12,11 +12,11 @@ namespace ErsatzTV.Application.Streaming; public class StartFFmpegSessionHandler : IRequestHandler> { + private readonly IConfigElementRepository _configElementRepository; + private readonly IFFmpegSegmenterService _ffmpegSegmenterService; + private readonly ILocalFileSystem _localFileSystem; private readonly ILogger _logger; private readonly IServiceScopeFactory _serviceScopeFactory; - private readonly IFFmpegSegmenterService _ffmpegSegmenterService; - private readonly IConfigElementRepository _configElementRepository; - private readonly ILocalFileSystem _localFileSystem; public StartFFmpegSessionHandler( ILocalFileSystem localFileSystem, @@ -128,4 +128,4 @@ public class StartFFmpegSessionHandler : IRequestHandler>(Unit.Default); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Streaming/Commands/TouchFFmpegSession.cs b/ErsatzTV.Application/Streaming/Commands/TouchFFmpegSession.cs index 02888f5ee..383522369 100644 --- a/ErsatzTV.Application/Streaming/Commands/TouchFFmpegSession.cs +++ b/ErsatzTV.Application/Streaming/Commands/TouchFFmpegSession.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Streaming; -public record TouchFFmpegSession(string Path) : IRequest>, IFFmpegWorkerRequest; \ No newline at end of file +public record TouchFFmpegSession(string Path) : IRequest>, IFFmpegWorkerRequest; diff --git a/ErsatzTV.Application/Streaming/HlsSessionWorker.cs b/ErsatzTV.Application/Streaming/HlsSessionWorker.cs index d1b3f1553..6b5812819 100644 --- a/ErsatzTV.Application/Streaming/HlsSessionWorker.cs +++ b/ErsatzTV.Application/Streaming/HlsSessionWorker.cs @@ -21,16 +21,15 @@ public class HlsSessionWorker : IHlsSessionWorker private static readonly SemaphoreSlim Slim = new(1, 1); private static int _workAheadCount; private readonly IHlsPlaylistFilter _hlsPlaylistFilter; - private readonly IServiceScopeFactory _serviceScopeFactory; private readonly ILogger _logger; - private DateTimeOffset _lastAccess; - private DateTimeOffset _transcodedUntil; - private Timer _timer; + private readonly IServiceScopeFactory _serviceScopeFactory; private readonly object _sync = new(); - private DateTimeOffset _playlistStart; - private Option _targetFramerate; private string _channelNumber; private bool _firstProcess; + private DateTimeOffset _lastAccess; + private Option _targetFramerate; + private Timer _timer; + private DateTimeOffset _transcodedUntil; public HlsSessionWorker( IHlsPlaylistFilter hlsPlaylistFilter, @@ -42,7 +41,7 @@ public class HlsSessionWorker : IHlsSessionWorker _logger = logger; } - public DateTimeOffset PlaylistStart => _playlistStart; + public DateTimeOffset PlaylistStart { get; private set; } public void Touch() { @@ -76,7 +75,11 @@ public class HlsSessionWorker : IHlsSessionWorker public async Task Run(string channelNumber, TimeSpan idleTimeout, CancellationToken incomingCancellationToken) { var cts = CancellationTokenSource.CreateLinkedTokenSource(incomingCancellationToken); - void Cancel(object o, ElapsedEventArgs e) => cts.Cancel(); + + void Cancel(object o, ElapsedEventArgs e) + { + cts.Cancel(); + } try { @@ -106,7 +109,7 @@ public class HlsSessionWorker : IHlsSessionWorker Touch(); _transcodedUntil = DateTimeOffset.Now; - _playlistStart = _transcodedUntil; + PlaylistStart = _transcodedUntil; _firstProcess = true; @@ -309,13 +312,12 @@ public class HlsSessionWorker : IHlsSessionWorker await Slim.WaitAsync(cancellationToken); try { - Option maybeLines = await ReadPlaylistLines(cancellationToken); foreach (string[] lines in maybeLines) { // trim playlist and insert discontinuity before appending with new ffmpeg process TrimPlaylistResult trimResult = _hlsPlaylistFilter.TrimPlaylistWithDiscontinuity( - _playlistStart, + PlaylistStart, DateTimeOffset.Now.AddMinutes(-1), lines); await WritePlaylist(trimResult.Playlist, cancellationToken); @@ -348,7 +350,7 @@ public class HlsSessionWorker : IHlsSessionWorker File.Delete(segment.File); } - _playlistStart = trimResult.PlaylistStart; + PlaylistStart = trimResult.PlaylistStart; } } finally @@ -415,4 +417,4 @@ public class HlsSessionWorker : IHlsSessionWorker "live.m3u8"); private record Segment(string File, int SequenceNumber); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Streaming/PtsAndDuration.cs b/ErsatzTV.Application/Streaming/PtsAndDuration.cs index de65697c5..78ec0c2e4 100644 --- a/ErsatzTV.Application/Streaming/PtsAndDuration.cs +++ b/ErsatzTV.Application/Streaming/PtsAndDuration.cs @@ -11,6 +11,7 @@ public record PtsAndDuration(long Pts, long Duration) // some durations are N/A, so we have to guess at something right = 10_000; } + return new PtsAndDuration(left, right); } } diff --git a/ErsatzTV.Application/Streaming/Queries/FFmpegProcessHandler.cs b/ErsatzTV.Application/Streaming/Queries/FFmpegProcessHandler.cs index db986616b..b824c763a 100644 --- a/ErsatzTV.Application/Streaming/Queries/FFmpegProcessHandler.cs +++ b/ErsatzTV.Application/Streaming/Queries/FFmpegProcessHandler.cs @@ -70,4 +70,4 @@ public abstract class FFmpegProcessHandler : IRequestHandler(ConfigElementKey.FFprobePath) .FilterT(File.Exists) .Map(maybePath => maybePath.ToValidation("FFprobe path does not exist on filesystem")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Streaming/Queries/FFmpegProcessRequest.cs b/ErsatzTV.Application/Streaming/Queries/FFmpegProcessRequest.cs index 6ec1dc363..bc2f3ed4a 100644 --- a/ErsatzTV.Application/Streaming/Queries/FFmpegProcessRequest.cs +++ b/ErsatzTV.Application/Streaming/Queries/FFmpegProcessRequest.cs @@ -9,4 +9,4 @@ public record FFmpegProcessRequest DateTimeOffset Now, bool StartAtZero, bool HlsRealtime, - long PtsOffset) : IRequest>; \ No newline at end of file + long PtsOffset) : IRequest>; diff --git a/ErsatzTV.Application/Streaming/Queries/GetConcatPlaylistByChannelNumber.cs b/ErsatzTV.Application/Streaming/Queries/GetConcatPlaylistByChannelNumber.cs index e2944ca24..a5aeb780e 100644 --- a/ErsatzTV.Application/Streaming/Queries/GetConcatPlaylistByChannelNumber.cs +++ b/ErsatzTV.Application/Streaming/Queries/GetConcatPlaylistByChannelNumber.cs @@ -4,4 +4,4 @@ using ErsatzTV.Core.FFmpeg; namespace ErsatzTV.Application.Streaming; public record GetConcatPlaylistByChannelNumber - (string Scheme, string Host, string ChannelNumber) : IRequest>; \ No newline at end of file + (string Scheme, string Host, string ChannelNumber) : IRequest>; diff --git a/ErsatzTV.Application/Streaming/Queries/GetConcatPlaylistByChannelNumberHandler.cs b/ErsatzTV.Application/Streaming/Queries/GetConcatPlaylistByChannelNumberHandler.cs index 2c1b90f77..de83ae703 100644 --- a/ErsatzTV.Application/Streaming/Queries/GetConcatPlaylistByChannelNumberHandler.cs +++ b/ErsatzTV.Application/Streaming/Queries/GetConcatPlaylistByChannelNumberHandler.cs @@ -27,4 +27,4 @@ public class private async Task> ChannelMustExist(GetConcatPlaylistByChannelNumber request) => (await _channelRepository.GetByNumber(request.ChannelNumber)) .ToValidation($"Channel number {request.ChannelNumber} does not exist."); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Streaming/Queries/GetConcatProcessByChannelNumber.cs b/ErsatzTV.Application/Streaming/Queries/GetConcatProcessByChannelNumber.cs index 99e38057f..9260852b3 100644 --- a/ErsatzTV.Application/Streaming/Queries/GetConcatProcessByChannelNumber.cs +++ b/ErsatzTV.Application/Streaming/Queries/GetConcatProcessByChannelNumber.cs @@ -16,4 +16,4 @@ public record GetConcatProcessByChannelNumber : FFmpegProcessRequest public string Scheme { get; } public string Host { get; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Streaming/Queries/GetConcatProcessByChannelNumberHandler.cs b/ErsatzTV.Application/Streaming/Queries/GetConcatProcessByChannelNumberHandler.cs index 70ea1ce73..7399bcff5 100644 --- a/ErsatzTV.Application/Streaming/Queries/GetConcatProcessByChannelNumberHandler.cs +++ b/ErsatzTV.Application/Streaming/Queries/GetConcatProcessByChannelNumberHandler.cs @@ -15,10 +15,8 @@ public class GetConcatProcessByChannelNumberHandler : FFmpegProcessHandler dbContextFactory, IFFmpegProcessService ffmpegProcessService) - : base(dbContextFactory) - { + : base(dbContextFactory) => _ffmpegProcessService = ffmpegProcessService; - } protected override async Task> GetProcess( TvContext dbContext, @@ -41,4 +39,4 @@ public class GetConcatProcessByChannelNumberHandler : FFmpegProcessHandler.None, DateTimeOffset.MaxValue); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Streaming/Queries/GetErrorProcessHandler.cs b/ErsatzTV.Application/Streaming/Queries/GetErrorProcessHandler.cs index 33f893361..7445a0db9 100644 --- a/ErsatzTV.Application/Streaming/Queries/GetErrorProcessHandler.cs +++ b/ErsatzTV.Application/Streaming/Queries/GetErrorProcessHandler.cs @@ -14,10 +14,8 @@ public class GetErrorProcessHandler : FFmpegProcessHandler public GetErrorProcessHandler( IDbContextFactory dbContextFactory, IFFmpegProcessService ffmpegProcessService) - : base(dbContextFactory) - { + : base(dbContextFactory) => _ffmpegProcessService = ffmpegProcessService; - } protected override async Task> GetProcess( TvContext dbContext, @@ -37,4 +35,4 @@ public class GetErrorProcessHandler : FFmpegProcessHandler return new PlayoutItemProcessModel(process, request.MaybeDuration, request.Until); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Streaming/Queries/GetHlsPlaylistByChannelNumber.cs b/ErsatzTV.Application/Streaming/Queries/GetHlsPlaylistByChannelNumber.cs index 253491afc..da2fb236b 100644 --- a/ErsatzTV.Application/Streaming/Queries/GetHlsPlaylistByChannelNumber.cs +++ b/ErsatzTV.Application/Streaming/Queries/GetHlsPlaylistByChannelNumber.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Streaming; public record GetHlsPlaylistByChannelNumber - (string Scheme, string Host, string ChannelNumber, string Mode) : IRequest>; \ No newline at end of file + (string Scheme, string Host, string ChannelNumber, string Mode) : IRequest>; diff --git a/ErsatzTV.Application/Streaming/Queries/GetHlsPlaylistByChannelNumberHandler.cs b/ErsatzTV.Application/Streaming/Queries/GetHlsPlaylistByChannelNumberHandler.cs index c7583cde0..1923620a4 100644 --- a/ErsatzTV.Application/Streaming/Queries/GetHlsPlaylistByChannelNumberHandler.cs +++ b/ErsatzTV.Application/Streaming/Queries/GetHlsPlaylistByChannelNumberHandler.cs @@ -28,7 +28,9 @@ public class GetHlsPlaylistByChannelNumberHandler : await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); DateTimeOffset now = DateTimeOffset.Now; Validation validation = await Validate(dbContext, request, now); - return await validation.Apply(parameters => GetPlaylist(dbContext, request, parameters, now)); + return await LanguageExtensions.Apply( + validation, + parameters => GetPlaylist(dbContext, request, parameters, now)); } private Task GetPlaylist( @@ -108,4 +110,4 @@ public class GetHlsPlaylistByChannelNumberHandler : private record ChannelIndexRecord(long StartTicks, long Index); private record Parameters(Channel Channel, PlayoutItem PlayoutItem); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Streaming/Queries/GetLastPtsDurationHandler.cs b/ErsatzTV.Application/Streaming/Queries/GetLastPtsDurationHandler.cs index 326002729..cd2a6627f 100644 --- a/ErsatzTV.Application/Streaming/Queries/GetLastPtsDurationHandler.cs +++ b/ErsatzTV.Application/Streaming/Queries/GetLastPtsDurationHandler.cs @@ -1,7 +1,6 @@ using System.Text; using Bugsnag; using CliWrap; -using CliWrap.Buffered; using ErsatzTV.Core; using ErsatzTV.Core.Domain; using ErsatzTV.Core.FFmpeg; @@ -16,10 +15,10 @@ namespace ErsatzTV.Application.Streaming; public class GetLastPtsDurationHandler : IRequestHandler> { private readonly IClient _client; - private readonly ILocalFileSystem _localFileSystem; - private readonly ITempFilePool _tempFilePool; private readonly IConfigElementRepository _configElementRepository; + private readonly ILocalFileSystem _localFileSystem; private readonly ILogger _logger; + private readonly ITempFilePool _tempFilePool; public GetLastPtsDurationHandler( IClient client, @@ -104,7 +103,7 @@ public class GetLastPtsDurationHandler : IRequestHandler f.Name).FirstOrDefault()); } - + private Task> ValidateFFprobePath() => _configElementRepository.GetValue(ConfigElementKey.FFprobePath) .FilterT(File.Exists) @@ -142,9 +141,6 @@ public class GetLastPtsDurationHandler : IRequestHandler Files, string Playlist, string ProbeOutput) { - private record FileData(string FileName, long Bytes, DateTime LastWriteTimeUtc); - private record InternalData(List Files, string EncodedPlaylist, string EncodedProbeOutput); - public string Serialize() { var data = new InternalData( @@ -154,5 +150,9 @@ public class GetLastPtsDurationHandler : IRequestHandler Files, string EncodedPlaylist, string EncodedProbeOutput); } } diff --git a/ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumber.cs b/ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumber.cs index fbb644843..5a1223296 100644 --- a/ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumber.cs +++ b/ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumber.cs @@ -1,14 +1,16 @@ namespace ErsatzTV.Application.Streaming; -public record GetPlayoutItemProcessByChannelNumber(string ChannelNumber, +public record GetPlayoutItemProcessByChannelNumber( + string ChannelNumber, string Mode, DateTimeOffset Now, bool StartAtZero, bool HlsRealtime, long PtsOffset, - Option TargetFramerate) : FFmpegProcessRequest(ChannelNumber, + Option TargetFramerate) : FFmpegProcessRequest( + ChannelNumber, Mode, Now, StartAtZero, HlsRealtime, - PtsOffset); \ No newline at end of file + PtsOffset); diff --git a/ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumberHandler.cs b/ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumberHandler.cs index e40a07c40..cd8b7910f 100644 --- a/ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumberHandler.cs +++ b/ErsatzTV.Application/Streaming/Queries/GetPlayoutItemProcessByChannelNumberHandler.cs @@ -19,15 +19,15 @@ namespace ErsatzTV.Application.Streaming; public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler { - private readonly IEmbyPathReplacementService _embyPathReplacementService; - private readonly IMediaCollectionRepository _mediaCollectionRepository; - private readonly ITelevisionRepository _televisionRepository; private readonly IArtistRepository _artistRepository; - private readonly IJellyfinPathReplacementService _jellyfinPathReplacementService; + private readonly IEmbyPathReplacementService _embyPathReplacementService; private readonly IFFmpegProcessService _ffmpegProcessService; + private readonly IJellyfinPathReplacementService _jellyfinPathReplacementService; private readonly ILocalFileSystem _localFileSystem; + private readonly IMediaCollectionRepository _mediaCollectionRepository; private readonly IPlexPathReplacementService _plexPathReplacementService; private readonly ISongVideoGenerator _songVideoGenerator; + private readonly ITelevisionRepository _televisionRepository; public GetPlayoutItemProcessByChannelNumberHandler( IDbContextFactory dbContextFactory, @@ -179,7 +179,8 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< var result = new PlayoutItemProcessModel( process, - playoutItemWithPath.PlayoutItem.FinishOffset - (request.StartAtZero ? playoutItemWithPath.PlayoutItem.StartOffset : now), + playoutItemWithPath.PlayoutItem.FinishOffset - + (request.StartAtZero ? playoutItemWithPath.PlayoutItem.StartOffset : now), playoutItemWithPath.PlayoutItem.FinishOffset); return Right(result); @@ -188,12 +189,12 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< foreach (BaseError error in maybePlayoutItem.LeftToSeq()) { Option maybeDuration = await dbContext.PlayoutItems - .Filter(pi => pi.Playout.ChannelId == channel.Id) - .Filter(pi => pi.Start > now.UtcDateTime) - .OrderBy(pi => pi.Start) - .FirstOrDefaultAsync(cancellationToken) - .Map(Optional) - .MapT(pi => pi.StartOffset - now); + .Filter(pi => pi.Playout.ChannelId == channel.Id) + .Filter(pi => pi.Start > now.UtcDateTime) + .OrderBy(pi => pi.Start) + .FirstOrDefaultAsync(cancellationToken) + .Map(Optional) + .MapT(pi => pi.StartOffset - now); DateTimeOffset finish = maybeDuration.Match(d => now.Add(d), () => now); @@ -283,14 +284,14 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< // TODO: shuffle? does it really matter since we loop anyway MediaItem item = items[new Random().Next(items.Count)]; - + Option maybeDuration = await dbContext.PlayoutItems - .Filter(pi => pi.Playout.ChannelId == channel.Id) - .Filter(pi => pi.Start > now.UtcDateTime) - .OrderBy(pi => pi.Start) - .FirstOrDefaultAsync() - .Map(Optional) - .MapT(pi => pi.StartOffset - now); + .Filter(pi => pi.Playout.ChannelId == channel.Id) + .Filter(pi => pi.Start > now.UtcDateTime) + .OrderBy(pi => pi.Start) + .FirstOrDefaultAsync() + .Map(Optional) + .MapT(pi => pi.StartOffset - now); MediaVersion version = item.GetHeadVersion(); @@ -324,7 +325,7 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< InPoint = TimeSpan.Zero, OutPoint = version.Duration }; - + return await ValidatePlayoutItemPath(playoutItem); } @@ -374,4 +375,4 @@ public class GetPlayoutItemProcessByChannelNumberHandler : FFmpegProcessHandler< } private record PlayoutItemWithPath(PlayoutItem PlayoutItem, string Path); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Streaming/Queries/GetWrappedProcessByChannelNumber.cs b/ErsatzTV.Application/Streaming/Queries/GetWrappedProcessByChannelNumber.cs index 6f3db9bba..765151d88 100644 --- a/ErsatzTV.Application/Streaming/Queries/GetWrappedProcessByChannelNumber.cs +++ b/ErsatzTV.Application/Streaming/Queries/GetWrappedProcessByChannelNumber.cs @@ -16,4 +16,4 @@ public record GetWrappedProcessByChannelNumber : FFmpegProcessRequest public string Scheme { get; } public string Host { get; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Streaming/Queries/GetWrappedProcessByChannelNumberHandler.cs b/ErsatzTV.Application/Streaming/Queries/GetWrappedProcessByChannelNumberHandler.cs index 2942d3edb..51052b1d5 100644 --- a/ErsatzTV.Application/Streaming/Queries/GetWrappedProcessByChannelNumberHandler.cs +++ b/ErsatzTV.Application/Streaming/Queries/GetWrappedProcessByChannelNumberHandler.cs @@ -15,10 +15,8 @@ public class GetWrappedProcessByChannelNumberHandler : FFmpegProcessHandler dbContextFactory, IFFmpegProcessService ffmpegProcessService) - : base(dbContextFactory) - { + : base(dbContextFactory) => _ffmpegProcessService = ffmpegProcessService; - } protected override async Task> GetProcess( TvContext dbContext, @@ -41,4 +39,4 @@ public class GetWrappedProcessByChannelNumberHandler : FFmpegProcessHandler.None, DateTimeOffset.MaxValue); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Subtitles/Commands/ExtractEmbeddedSubtitlesHandler.cs b/ErsatzTV.Application/Subtitles/Commands/ExtractEmbeddedSubtitlesHandler.cs index 4750f1338..184d30d8a 100644 --- a/ErsatzTV.Application/Subtitles/Commands/ExtractEmbeddedSubtitlesHandler.cs +++ b/ErsatzTV.Application/Subtitles/Commands/ExtractEmbeddedSubtitlesHandler.cs @@ -58,7 +58,7 @@ public class ExtractEmbeddedSubtitlesHandler : IRequestHandler requestedPlayout = await dbContext.Playouts .Filter(p => p.Channel.SubtitleMode != ChannelSubtitleMode.None) .SelectOneAsync(p => p.Id, p => p.Id == request.PlayoutId.IfNone(-1)); - + playoutIdsToCheck.AddRange(requestedPlayout.Map(p => p.Id)); // check all playouts (that have subtitles enabled) if none were passed @@ -151,7 +151,7 @@ public class ExtractEmbeddedSubtitlesHandler : IRequestHandler(); - + try { List episodeIds = await dbContext.EpisodeMetadata @@ -183,7 +183,7 @@ public class ExtractEmbeddedSubtitlesHandler : IRequestHandler mm.MusicVideoId) .ToListAsync(cancellationToken); result.AddRange(musicVideoIds); - + List otherVideoIds = await dbContext.OtherVideoMetadata .Filter(ovm => mediaItemIds.Contains(ovm.OtherVideoId)) .Filter( @@ -256,7 +256,7 @@ public class ExtractEmbeddedSubtitlesHandler : IRequestHandler $"{name}.vtt", _ => string.Empty }; - + if (string.IsNullOrWhiteSpace(nameWithExtension)) { return None; @@ -378,7 +379,7 @@ public class ExtractEmbeddedSubtitlesHandler : IRequestHandler>; \ No newline at end of file +public record GetAllTelevisionSeasons : IRequest>; diff --git a/ErsatzTV.Application/Television/Queries/GetAllTelevisionSeasonsHandler.cs b/ErsatzTV.Application/Television/Queries/GetAllTelevisionSeasonsHandler.cs index 3ab340fb4..62aac52c9 100644 --- a/ErsatzTV.Application/Television/Queries/GetAllTelevisionSeasonsHandler.cs +++ b/ErsatzTV.Application/Television/Queries/GetAllTelevisionSeasonsHandler.cs @@ -16,4 +16,4 @@ public class GetAllTelevisionSeasons request, CancellationToken cancellationToken) => _televisionRepository.GetAllSeasons().Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Television/Queries/GetAllTelevisionShows.cs b/ErsatzTV.Application/Television/Queries/GetAllTelevisionShows.cs index d0df92d3a..209779219 100644 --- a/ErsatzTV.Application/Television/Queries/GetAllTelevisionShows.cs +++ b/ErsatzTV.Application/Television/Queries/GetAllTelevisionShows.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Television; -public record GetAllTelevisionShows : IRequest>; \ No newline at end of file +public record GetAllTelevisionShows : IRequest>; diff --git a/ErsatzTV.Application/Television/Queries/GetAllTelevisionShowsHandler.cs b/ErsatzTV.Application/Television/Queries/GetAllTelevisionShowsHandler.cs index 7d673d5eb..f43cb57e5 100644 --- a/ErsatzTV.Application/Television/Queries/GetAllTelevisionShowsHandler.cs +++ b/ErsatzTV.Application/Television/Queries/GetAllTelevisionShowsHandler.cs @@ -15,4 +15,4 @@ public class GetAllTelevisionShowsHandler : IRequestHandler _televisionRepository.GetAllShows().Map(list => list.Map(ProjectToViewModel).ToList()); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Television/Queries/GetTelevisionSeasonById.cs b/ErsatzTV.Application/Television/Queries/GetTelevisionSeasonById.cs index c0177958f..3699a8ef4 100644 --- a/ErsatzTV.Application/Television/Queries/GetTelevisionSeasonById.cs +++ b/ErsatzTV.Application/Television/Queries/GetTelevisionSeasonById.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Television; -public record GetTelevisionSeasonById(int SeasonId) : IRequest>; \ No newline at end of file +public record GetTelevisionSeasonById(int SeasonId) : IRequest>; diff --git a/ErsatzTV.Application/Television/Queries/GetTelevisionSeasonByIdHandler.cs b/ErsatzTV.Application/Television/Queries/GetTelevisionSeasonByIdHandler.cs index de2ce9e43..1357ae33f 100644 --- a/ErsatzTV.Application/Television/Queries/GetTelevisionSeasonByIdHandler.cs +++ b/ErsatzTV.Application/Television/Queries/GetTelevisionSeasonByIdHandler.cs @@ -31,4 +31,4 @@ public class return await _televisionRepository.GetSeason(request.SeasonId) .MapT(s => ProjectToViewModel(s, maybeJellyfin, maybeEmby)); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Television/Queries/GetTelevisionShowById.cs b/ErsatzTV.Application/Television/Queries/GetTelevisionShowById.cs index cc4e6c62a..d7140d76e 100644 --- a/ErsatzTV.Application/Television/Queries/GetTelevisionShowById.cs +++ b/ErsatzTV.Application/Television/Queries/GetTelevisionShowById.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Television; -public record GetTelevisionShowById(int Id) : IRequest>; \ No newline at end of file +public record GetTelevisionShowById(int Id) : IRequest>; diff --git a/ErsatzTV.Application/Television/Queries/GetTelevisionShowByIdHandler.cs b/ErsatzTV.Application/Television/Queries/GetTelevisionShowByIdHandler.cs index 527b4f8d7..73867ae7e 100644 --- a/ErsatzTV.Application/Television/Queries/GetTelevisionShowByIdHandler.cs +++ b/ErsatzTV.Application/Television/Queries/GetTelevisionShowByIdHandler.cs @@ -40,4 +40,4 @@ public class GetTelevisionShowByIdHandler : IRequestHandler Task.FromResult(Option.None)); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Television/TelevisionSeasonViewModel.cs b/ErsatzTV.Application/Television/TelevisionSeasonViewModel.cs index 6d9d637f7..0ad2f4e1e 100644 --- a/ErsatzTV.Application/Television/TelevisionSeasonViewModel.cs +++ b/ErsatzTV.Application/Television/TelevisionSeasonViewModel.cs @@ -7,4 +7,4 @@ public record TelevisionSeasonViewModel( string Year, string Name, string Poster, - string FanArt); \ No newline at end of file + string FanArt); diff --git a/ErsatzTV.Application/Television/TelevisionShowViewModel.cs b/ErsatzTV.Application/Television/TelevisionShowViewModel.cs index c351133aa..23b3c6d01 100644 --- a/ErsatzTV.Application/Television/TelevisionShowViewModel.cs +++ b/ErsatzTV.Application/Television/TelevisionShowViewModel.cs @@ -15,4 +15,4 @@ public record TelevisionShowViewModel( List Studios, List ContentRatings, List Languages, - List Actors); \ No newline at end of file + List Actors); diff --git a/ErsatzTV.Application/Validators/GetMemberName.cs b/ErsatzTV.Application/Validators/GetMemberName.cs index 25fb11498..41fcd8d34 100644 --- a/ErsatzTV.Application/Validators/GetMemberName.cs +++ b/ErsatzTV.Application/Validators/GetMemberName.cs @@ -15,4 +15,4 @@ public static partial class Validators throw new ArgumentException("Expression is not a property"); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Validators/NumericValidation.cs b/ErsatzTV.Application/Validators/NumericValidation.cs index 377c8c28d..49e624540 100644 --- a/ErsatzTV.Application/Validators/NumericValidation.cs +++ b/ErsatzTV.Application/Validators/NumericValidation.cs @@ -12,4 +12,4 @@ public static partial class Validators .Where(i => i >= minimum) .ToValidation( $"[{GetMemberName(value)}] must be greater or equal to {minimum}"); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Validators/StringValidation.cs b/ErsatzTV.Application/Validators/StringValidation.cs index 12a749b60..05a63a17a 100644 --- a/ErsatzTV.Application/Validators/StringValidation.cs +++ b/ErsatzTV.Application/Validators/StringValidation.cs @@ -17,4 +17,4 @@ public static partial class Validators Optional(expression.Compile()(input)) .Where(s => !string.IsNullOrWhiteSpace(s)) .ToValidation($"[{GetMemberName(expression)}] is an empty string"); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Watermarks/Commands/CopyWatermark.cs b/ErsatzTV.Application/Watermarks/Commands/CopyWatermark.cs index 33ff57d8e..7061cdde8 100644 --- a/ErsatzTV.Application/Watermarks/Commands/CopyWatermark.cs +++ b/ErsatzTV.Application/Watermarks/Commands/CopyWatermark.cs @@ -3,4 +3,4 @@ namespace ErsatzTV.Application.Watermarks; public record CopyWatermark - (int WatermarkId, string Name) : IRequest>; \ No newline at end of file + (int WatermarkId, string Name) : IRequest>; diff --git a/ErsatzTV.Application/Watermarks/Commands/CopyWatermarkHandler.cs b/ErsatzTV.Application/Watermarks/Commands/CopyWatermarkHandler.cs index 9e6882028..6a6d309bd 100644 --- a/ErsatzTV.Application/Watermarks/Commands/CopyWatermarkHandler.cs +++ b/ErsatzTV.Application/Watermarks/Commands/CopyWatermarkHandler.cs @@ -46,4 +46,4 @@ public class CopyWatermarkHandler : private static Validation ValidateName(CopyWatermark request) => request.NotEmpty(x => x.Name) .Bind(_ => request.NotLongerThan(50)(x => x.Name)); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Watermarks/Commands/CreateWatermark.cs b/ErsatzTV.Application/Watermarks/Commands/CreateWatermark.cs index 73351e27e..f7e31d36f 100644 --- a/ErsatzTV.Application/Watermarks/Commands/CreateWatermark.cs +++ b/ErsatzTV.Application/Watermarks/Commands/CreateWatermark.cs @@ -18,4 +18,4 @@ public record CreateWatermark( int DurationSeconds, int Opacity) : IRequest>; -public record CreateWatermarkResult(int WatermarkId) : EntityIdResult(WatermarkId); \ No newline at end of file +public record CreateWatermarkResult(int WatermarkId) : EntityIdResult(WatermarkId); diff --git a/ErsatzTV.Application/Watermarks/Commands/CreateWatermarkHandler.cs b/ErsatzTV.Application/Watermarks/Commands/CreateWatermarkHandler.cs index 16374483a..86a6cce8c 100644 --- a/ErsatzTV.Application/Watermarks/Commands/CreateWatermarkHandler.cs +++ b/ErsatzTV.Application/Watermarks/Commands/CreateWatermarkHandler.cs @@ -52,4 +52,4 @@ public class CreateWatermarkHandler : IRequestHandler ValidateName(CreateWatermark request) => request.NotEmpty(x => x.Name) .Bind(_ => request.NotLongerThan(50)(x => x.Name)); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Watermarks/Commands/DeleteWatermark.cs b/ErsatzTV.Application/Watermarks/Commands/DeleteWatermark.cs index 52cee8686..e76372eee 100644 --- a/ErsatzTV.Application/Watermarks/Commands/DeleteWatermark.cs +++ b/ErsatzTV.Application/Watermarks/Commands/DeleteWatermark.cs @@ -2,4 +2,4 @@ namespace ErsatzTV.Application.Watermarks; -public record DeleteWatermark(int WatermarkId) : MediatR.IRequest>; \ No newline at end of file +public record DeleteWatermark(int WatermarkId) : IRequest>; diff --git a/ErsatzTV.Application/Watermarks/Commands/DeleteWatermarkHandler.cs b/ErsatzTV.Application/Watermarks/Commands/DeleteWatermarkHandler.cs index 3dd3b68fb..95bb9809a 100644 --- a/ErsatzTV.Application/Watermarks/Commands/DeleteWatermarkHandler.cs +++ b/ErsatzTV.Application/Watermarks/Commands/DeleteWatermarkHandler.cs @@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore; namespace ErsatzTV.Application.Watermarks; -public class DeleteWatermarkHandler : MediatR.IRequestHandler> +public class DeleteWatermarkHandler : IRequestHandler> { private readonly IDbContextFactory _dbContextFactory; @@ -37,4 +37,4 @@ public class DeleteWatermarkHandler : MediatR.IRequestHandler p.Id, p => p.Id == request.WatermarkId) .Map(o => o.ToValidation($"Watermark {request.WatermarkId} does not exist")); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Watermarks/Commands/UpdateWatermark.cs b/ErsatzTV.Application/Watermarks/Commands/UpdateWatermark.cs index d9b3837a9..0d949abdf 100644 --- a/ErsatzTV.Application/Watermarks/Commands/UpdateWatermark.cs +++ b/ErsatzTV.Application/Watermarks/Commands/UpdateWatermark.cs @@ -19,4 +19,4 @@ public record UpdateWatermark( int DurationSeconds, int Opacity) : IRequest>; -public record UpdateWatermarkResult(int WatermarkId) : EntityIdResult(WatermarkId); \ No newline at end of file +public record UpdateWatermarkResult(int WatermarkId) : EntityIdResult(WatermarkId); diff --git a/ErsatzTV.Application/Watermarks/Commands/UpdateWatermarkHandler.cs b/ErsatzTV.Application/Watermarks/Commands/UpdateWatermarkHandler.cs index de6c6fef7..12146fad1 100644 --- a/ErsatzTV.Application/Watermarks/Commands/UpdateWatermarkHandler.cs +++ b/ErsatzTV.Application/Watermarks/Commands/UpdateWatermarkHandler.cs @@ -59,4 +59,4 @@ public class UpdateWatermarkHandler : IRequestHandler ValidateName(UpdateWatermark updateWatermark) => updateWatermark.NotEmpty(x => x.Name) .Bind(_ => updateWatermark.NotLongerThan(50)(x => x.Name)); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Watermarks/Mapper.cs b/ErsatzTV.Application/Watermarks/Mapper.cs index e59821416..77a92ec42 100644 --- a/ErsatzTV.Application/Watermarks/Mapper.cs +++ b/ErsatzTV.Application/Watermarks/Mapper.cs @@ -19,4 +19,4 @@ internal static class Mapper watermark.FrequencyMinutes, watermark.DurationSeconds, watermark.Opacity); -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Watermarks/Queries/GetAllWatermarks.cs b/ErsatzTV.Application/Watermarks/Queries/GetAllWatermarks.cs index 728d88610..c568195be 100644 --- a/ErsatzTV.Application/Watermarks/Queries/GetAllWatermarks.cs +++ b/ErsatzTV.Application/Watermarks/Queries/GetAllWatermarks.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Watermarks; -public record GetAllWatermarks : IRequest>; \ No newline at end of file +public record GetAllWatermarks : IRequest>; diff --git a/ErsatzTV.Application/Watermarks/Queries/GetAllWatermarksHandler.cs b/ErsatzTV.Application/Watermarks/Queries/GetAllWatermarksHandler.cs index 92910be44..bff1d9263 100644 --- a/ErsatzTV.Application/Watermarks/Queries/GetAllWatermarksHandler.cs +++ b/ErsatzTV.Application/Watermarks/Queries/GetAllWatermarksHandler.cs @@ -20,4 +20,4 @@ public class GetAllWatermarksHandler : IRequestHandler list.Map(ProjectToViewModel).ToList()); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Watermarks/Queries/GetWatermarkById.cs b/ErsatzTV.Application/Watermarks/Queries/GetWatermarkById.cs index aedac4092..209889709 100644 --- a/ErsatzTV.Application/Watermarks/Queries/GetWatermarkById.cs +++ b/ErsatzTV.Application/Watermarks/Queries/GetWatermarkById.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Application.Watermarks; -public record GetWatermarkById(int Id) : IRequest>; \ No newline at end of file +public record GetWatermarkById(int Id) : IRequest>; diff --git a/ErsatzTV.Application/Watermarks/Queries/GetWatermarkByIdHandler.cs b/ErsatzTV.Application/Watermarks/Queries/GetWatermarkByIdHandler.cs index 3635c90af..ea86323af 100644 --- a/ErsatzTV.Application/Watermarks/Queries/GetWatermarkByIdHandler.cs +++ b/ErsatzTV.Application/Watermarks/Queries/GetWatermarkByIdHandler.cs @@ -21,4 +21,4 @@ public class GetWatermarkByIdHandler : IRequestHandler w.Id, w => w.Id == request.Id) .MapT(ProjectToViewModel); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Application/Watermarks/WatermarkViewModel.cs b/ErsatzTV.Application/Watermarks/WatermarkViewModel.cs index b040baa6a..28000fbc9 100644 --- a/ErsatzTV.Application/Watermarks/WatermarkViewModel.cs +++ b/ErsatzTV.Application/Watermarks/WatermarkViewModel.cs @@ -17,4 +17,4 @@ public record WatermarkViewModel( int FrequencyMinutes, int DurationSeconds, int Opacity -); \ No newline at end of file +); diff --git a/ErsatzTV.Core.Tests/Emby/EmbyPathReplacementServiceTests.cs b/ErsatzTV.Core.Tests/Emby/EmbyPathReplacementServiceTests.cs index 3b33a1695..3139b5039 100644 --- a/ErsatzTV.Core.Tests/Emby/EmbyPathReplacementServiceTests.cs +++ b/ErsatzTV.Core.Tests/Emby/EmbyPathReplacementServiceTests.cs @@ -1,8 +1,8 @@ using System.Runtime.InteropServices; using ErsatzTV.Core.Domain; +using ErsatzTV.Core.Emby; using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.Core.Interfaces.Runtime; -using ErsatzTV.Core.Emby; using FluentAssertions; using Microsoft.Extensions.Logging; using Moq; @@ -204,7 +204,7 @@ public class EmbyPathReplacementServiceTests result.Should().Be(@"/mnt/something else/Some Shared Folder/Some Movie/Some Movie.mkv"); } - + [Test] public async Task Should_Not_Throw_For_Null_EmbyPath() { @@ -236,7 +236,7 @@ public class EmbyPathReplacementServiceTests result.Should().Be(@"/mnt/something/Some Shared Folder/Some Movie/Some Movie.mkv"); } - + [Test] public async Task Should_Not_Throw_For_Null_LocalPath() { @@ -268,4 +268,4 @@ public class EmbyPathReplacementServiceTests result.Should().Be(@"/Some Movie/Some Movie.mkv"); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj b/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj index b02962107..07534ec9c 100644 --- a/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj +++ b/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/ErsatzTV.Core.Tests/FFmpeg/FFmpegComplexFilterBuilderTests.cs b/ErsatzTV.Core.Tests/FFmpeg/FFmpegComplexFilterBuilderTests.cs index 4f68a8d59..b0b1f7da3 100644 --- a/ErsatzTV.Core.Tests/FFmpeg/FFmpegComplexFilterBuilderTests.cs +++ b/ErsatzTV.Core.Tests/FFmpeg/FFmpegComplexFilterBuilderTests.cs @@ -40,10 +40,10 @@ public class FFmpegComplexFilterBuilderTests filter.VideoLabel.Should().Be("0:0"); }); } - + [Test] // this needs to be a culture where '.' is a group separator - [SetCulture("it-IT")] + [SetCulture("it-IT")] public void Should_Return_Audio_Filter_With_AudioDuration_Decimal() { var duration = TimeSpan.FromMilliseconds(1000.1); @@ -280,7 +280,7 @@ public class FFmpegComplexFilterBuilderTests watermark.FrequencyMinutes, watermark.DurationSeconds)) : None; - + FFmpegComplexFilterBuilder builder = new FFmpegComplexFilterBuilder() .WithWatermark( Some(watermark), @@ -301,7 +301,7 @@ public class FFmpegComplexFilterBuilderTests filter.VideoLabel.Should().Be(expectedVideoLabel); }); } - + [Test] [TestCase( false, @@ -390,7 +390,7 @@ public class FFmpegComplexFilterBuilderTests "[0:0]scale_cuda=1920:1080,setsar=1,hwdownload,format=nv12,format=yuv420p,hwupload_cuda[vt];[1:v]format=yuva420p,colorchannelmixer=aa=0.90,hwupload_cuda[wmp];[vt][wmp]overlay_cuda=x=134:y=54,hwupload[v]", "0:1", "[v]", - true)] + true)] // TODO: do we need these anymore? interlaced content that isn't handled by mpeg2_cuvid? // [TestCase( // false, @@ -481,7 +481,7 @@ public class FFmpegComplexFilterBuilderTests watermark.FrequencyMinutes, watermark.DurationSeconds)) : None; - + FFmpegComplexFilterBuilder builder = new FFmpegComplexFilterBuilder() .WithHardwareAcceleration(HardwareAccelerationKind.Nvenc) .WithWatermark( @@ -774,4 +774,4 @@ public class FFmpegComplexFilterBuilderTests }); } } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/FFmpeg/FFmpegPlaybackSettingsCalculatorTests.cs b/ErsatzTV.Core.Tests/FFmpeg/FFmpegPlaybackSettingsCalculatorTests.cs index 855461ca7..2484d2b93 100644 --- a/ErsatzTV.Core.Tests/FFmpeg/FFmpegPlaybackSettingsCalculatorTests.cs +++ b/ErsatzTV.Core.Tests/FFmpeg/FFmpegPlaybackSettingsCalculatorTests.cs @@ -43,7 +43,7 @@ public class FFmpegPlaybackSettingsCalculatorTests public void Should_Not_UseSpecifiedThreadCount_ForTransportStream() { // MPEG-TS requires realtime output which is hardcoded to a single thread - + FFmpegProfile ffmpegProfile = TestProfile() with { ThreadCount = 7 }; FFmpegPlaybackSettings actual = _calculator.CalculateSettings( @@ -862,7 +862,10 @@ public class FFmpegPlaybackSettingsCalculatorTests AudioFormat = FFmpegProfileAudioFormat.Ac3 }; - var version = new MediaVersion { SampleAspectRatio = "1:1", Width = 1920, Height = 1080, Duration = TimeSpan.FromMinutes(5) }; // not pulled from here + var version = new MediaVersion + { + SampleAspectRatio = "1:1", Width = 1920, Height = 1080, Duration = TimeSpan.FromMinutes(5) + }; // not pulled from here FFmpegPlaybackSettings actual = _calculator.CalculateSettings( StreamingMode.TransportStream, @@ -937,4 +940,4 @@ public class FFmpegPlaybackSettingsCalculatorTests private static FFmpegProfile TestProfile() => new() { Resolution = new Resolution { Width = 1920, Height = 1080 } }; -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/FFmpeg/HlsPlaylistFilterTests.cs b/ErsatzTV.Core.Tests/FFmpeg/HlsPlaylistFilterTests.cs index bda2c3acc..3a81db7d5 100644 --- a/ErsatzTV.Core.Tests/FFmpeg/HlsPlaylistFilterTests.cs +++ b/ErsatzTV.Core.Tests/FFmpeg/HlsPlaylistFilterTests.cs @@ -10,22 +10,21 @@ namespace ErsatzTV.Core.Tests.FFmpeg; [TestFixture] public class HlsPlaylistFilterTests { - private HlsPlaylistFilter _hlsPlaylistFilter; - [SetUp] - public void SetUp() - { + public void SetUp() => _hlsPlaylistFilter = new HlsPlaylistFilter( new Mock().Object, new Mock>().Object ); - } + + private HlsPlaylistFilter _hlsPlaylistFilter; [Test] public void _hlsPlaylistFilter_ShouldRewriteProgramDateTime() { var start = new DateTimeOffset(2021, 10, 9, 8, 0, 0, TimeSpan.FromHours(-5)); - string[] input = NormalizeLineEndings(@"#EXTM3U + string[] input = NormalizeLineEndings( + @"#EXTM3U #EXT-X-VERSION:6 #EXT-X-TARGETDURATION:4 #EXT-X-MEDIA-SEQUENCE:1137 @@ -45,8 +44,9 @@ live001139.ts").Split(Environment.NewLine); result.PlaylistStart.Should().Be(start); result.Sequence.Should().Be(1137); - result.Playlist.Should().Be(NormalizeLineEndings( - @"#EXTM3U + result.Playlist.Should().Be( + NormalizeLineEndings( + @"#EXTM3U #EXT-X-VERSION:6 #EXT-X-TARGETDURATION:4 #EXT-X-MEDIA-SEQUENCE:1137 @@ -64,12 +64,13 @@ live001138.ts live001139.ts ")); } - + [Test] public void _hlsPlaylistFilter_ShouldLimitSegments() { var start = new DateTimeOffset(2021, 10, 9, 8, 0, 0, TimeSpan.FromHours(-5)); - string[] input = NormalizeLineEndings(@"#EXTM3U + string[] input = NormalizeLineEndings( + @"#EXTM3U #EXT-X-VERSION:6 #EXT-X-TARGETDURATION:4 #EXT-X-MEDIA-SEQUENCE:1137 @@ -89,8 +90,9 @@ live001139.ts").Split(Environment.NewLine); result.PlaylistStart.Should().Be(start); result.Sequence.Should().Be(1137); - result.Playlist.Should().Be(NormalizeLineEndings( - @"#EXTM3U + result.Playlist.Should().Be( + NormalizeLineEndings( + @"#EXTM3U #EXT-X-VERSION:6 #EXT-X-TARGETDURATION:4 #EXT-X-MEDIA-SEQUENCE:1137 @@ -105,12 +107,13 @@ live001137.ts live001138.ts ")); } - + [Test] public void _hlsPlaylistFilter_ShouldAddDiscontinuity() { var start = new DateTimeOffset(2021, 10, 9, 8, 0, 0, TimeSpan.FromHours(-5)); - string[] input = NormalizeLineEndings(@"#EXTM3U + string[] input = NormalizeLineEndings( + @"#EXTM3U #EXT-X-VERSION:6 #EXT-X-TARGETDURATION:4 #EXT-X-MEDIA-SEQUENCE:1137 @@ -135,8 +138,9 @@ live001139.ts").Split(Environment.NewLine); result.PlaylistStart.Should().Be(start); result.Sequence.Should().Be(1137); - result.Playlist.Should().Be(NormalizeLineEndings( - @"#EXTM3U + result.Playlist.Should().Be( + NormalizeLineEndings( + @"#EXTM3U #EXT-X-VERSION:6 #EXT-X-TARGETDURATION:4 #EXT-X-MEDIA-SEQUENCE:1137 @@ -160,7 +164,8 @@ live001139.ts public void _hlsPlaylistFilter_ShouldFilterOldSegments() { var start = new DateTimeOffset(2021, 10, 9, 8, 0, 0, TimeSpan.FromHours(-5)); - string[] input = NormalizeLineEndings(@"#EXTM3U + string[] input = NormalizeLineEndings( + @"#EXTM3U #EXT-X-VERSION:6 #EXT-X-TARGETDURATION:4 #EXT-X-MEDIA-SEQUENCE:1137 @@ -180,8 +185,9 @@ live001139.ts").Split(Environment.NewLine); result.PlaylistStart.Should().Be(start.AddSeconds(8)); result.Sequence.Should().Be(1139); - result.Playlist.Should().Be(NormalizeLineEndings( - @"#EXTM3U + result.Playlist.Should().Be( + NormalizeLineEndings( + @"#EXTM3U #EXT-X-VERSION:6 #EXT-X-TARGETDURATION:4 #EXT-X-MEDIA-SEQUENCE:1139 @@ -193,12 +199,13 @@ live001139.ts").Split(Environment.NewLine); live001139.ts ")); } - + [Test] public void _hlsPlaylistFilter_ShouldFilterOldDiscontinuity() { var start = new DateTimeOffset(2021, 10, 9, 8, 0, 0, TimeSpan.FromHours(-5)); - string[] input = NormalizeLineEndings(@"#EXTM3U + string[] input = NormalizeLineEndings( + @"#EXTM3U #EXT-X-VERSION:6 #EXT-X-TARGETDURATION:4 #EXT-X-MEDIA-SEQUENCE:1137 @@ -219,8 +226,9 @@ live001139.ts").Split(Environment.NewLine); result.PlaylistStart.Should().Be(start.AddSeconds(8)); result.Sequence.Should().Be(1139); - result.Playlist.Should().Be(NormalizeLineEndings( - @"#EXTM3U + result.Playlist.Should().Be( + NormalizeLineEndings( + @"#EXTM3U #EXT-X-VERSION:6 #EXT-X-TARGETDURATION:4 #EXT-X-MEDIA-SEQUENCE:1139 @@ -233,11 +241,9 @@ live001139.ts ")); } - private static string NormalizeLineEndings(string str) - { - return str + private static string NormalizeLineEndings(string str) => + str .Replace("\r\n", "\n") .Replace("\r", "\n") .Replace("\n", Environment.NewLine); - } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/FFmpeg/TranscodingTests.cs b/ErsatzTV.Core.Tests/FFmpeg/TranscodingTests.cs index a6751c326..17977cd91 100644 --- a/ErsatzTV.Core.Tests/FFmpeg/TranscodingTests.cs +++ b/ErsatzTV.Core.Tests/FFmpeg/TranscodingTests.cs @@ -24,7 +24,7 @@ namespace ErsatzTV.Core.Tests.FFmpeg; public class TranscodingTests { private static readonly ILoggerFactory LoggerFactory; - + static TranscodingTests() { Log.Logger = new LoggerConfiguration() @@ -61,6 +61,7 @@ public class TranscodingTests PermanentOpaque, PermanentTransparent, IntermittentOpaque, + IntermittentTransparent // TODO: animated vs static } @@ -87,7 +88,7 @@ public class TranscodingTests Subtitle.Picture, Subtitle.Text }; - + public static Padding[] Paddings = { Padding.NoPadding, @@ -106,27 +107,27 @@ public class TranscodingTests new("libx264", "yuvj420p"), new("libx264", "yuv420p10le"), // new("libx264", "yuv444p10le"), - + new("mpeg1video", "yuv420p"), - + new("mpeg2video", "yuv420p"), - + new("libx265", "yuv420p"), new("libx265", "yuv420p10le"), - + new("mpeg4", "yuv420p"), - + new("libvpx-vp9", "yuv420p"), - + // new("libaom-av1", "yuv420p") // av1 yuv420p10le 51 - + new("msmpeg4v2", "yuv420p"), new("msmpeg4v3", "yuv420p") - + // wmv3 yuv420p 1 }; - + public static Resolution[] Resolutions = { new() { Width = 1920, Height = 1080 }, @@ -165,17 +166,26 @@ public class TranscodingTests }; } - [Test, Combinatorial] + [Test] + [Combinatorial] public async Task Transcode( - [ValueSource(typeof(TestData), nameof(TestData.InputFormats))] InputFormat inputFormat, - [ValueSource(typeof(TestData), nameof(TestData.Resolutions))] Resolution profileResolution, - [ValueSource(typeof(TestData), nameof(TestData.Paddings))] Padding padding, - [ValueSource(typeof(TestData), nameof(TestData.VideoScanKinds))] VideoScanKind videoScanKind, - [ValueSource(typeof(TestData), nameof(TestData.Watermarks))] Watermark watermark, - [ValueSource(typeof(TestData), nameof(TestData.Subtitles))] Subtitle subtitle, - [ValueSource(typeof(TestData), nameof(TestData.VideoFormats))] FFmpegProfileVideoFormat profileVideoFormat, - // [ValueSource(typeof(TestData), nameof(TestData.NoAcceleration))] HardwareAccelerationKind profileAcceleration) - [ValueSource(typeof(TestData), nameof(TestData.NvidiaAcceleration))] HardwareAccelerationKind profileAcceleration) + [ValueSource(typeof(TestData), nameof(TestData.InputFormats))] + InputFormat inputFormat, + [ValueSource(typeof(TestData), nameof(TestData.Resolutions))] + Resolution profileResolution, + [ValueSource(typeof(TestData), nameof(TestData.Paddings))] + Padding padding, + [ValueSource(typeof(TestData), nameof(TestData.VideoScanKinds))] + VideoScanKind videoScanKind, + [ValueSource(typeof(TestData), nameof(TestData.Watermarks))] + Watermark watermark, + [ValueSource(typeof(TestData), nameof(TestData.Subtitles))] + Subtitle subtitle, + [ValueSource(typeof(TestData), nameof(TestData.VideoFormats))] + FFmpegProfileVideoFormat profileVideoFormat, + // [ValueSource(typeof(TestData), nameof(TestData.NoAcceleration))] HardwareAccelerationKind profileAcceleration) + [ValueSource(typeof(TestData), nameof(TestData.NvidiaAcceleration))] + HardwareAccelerationKind profileAcceleration) // [ValueSource(typeof(TestData), nameof(TestData.VaapiAcceleration))] HardwareAccelerationKind profileAcceleration) // [ValueSource(typeof(TestData), nameof(TestData.QsvAcceleration))] HardwareAccelerationKind profileAcceleration) // [ValueSource(typeof(TestData), nameof(TestData.VideoToolboxAcceleration))] HardwareAccelerationKind profileAcceleration) @@ -224,7 +234,7 @@ public class TranscodingTests case Subtitle.Text or Subtitle.Picture: string sourceFile = Path.GetTempFileName() + ".mkv"; File.Move(file, sourceFile, true); - + string tempFileName = Path.GetTempFileName() + ".mkv"; string subPath = Path.Combine( TestContext.CurrentContext.TestDirectory, @@ -334,11 +344,11 @@ public class TranscodingTests .Filter(s => s.MediaStreamKind == MediaStreamKind.Subtitle) .ToList(); - var subtitles = new List(); - + var subtitles = new List(); + foreach (MediaStream stream in subtitleStreams) { - var s = new Core.Domain.Subtitle + var s = new Domain.Subtitle { Codec = stream.Codec, Default = stream.Default, @@ -405,7 +415,7 @@ public class TranscodingTests ChannelSubtitleMode subtitleMode = subtitle switch { Subtitle.Picture or Subtitle.Text => ChannelSubtitleMode.Any, - _ => ChannelSubtitleMode.None + _ => ChannelSubtitleMode.None }; string srtFile = Path.Combine(FileSystemLayout.SubtitleCacheFolder, "test.srt"); @@ -478,7 +488,7 @@ public class TranscodingTests return; } - string error = sb.ToString(); + var error = sb.ToString(); bool isUnsupported = unsupportedMessages.Any(error.Contains); if (profileAcceleration != HardwareAccelerationKind.None && isUnsupported) @@ -527,4 +537,4 @@ public class TranscodingTests private static string ExecutableName(string baseName) => OperatingSystem.IsWindows() ? $"{baseName}.exe" : baseName; -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Fakes/FakeFileEntry.cs b/ErsatzTV.Core.Tests/Fakes/FakeFileEntry.cs index 480aff0e4..1ff6613b6 100644 --- a/ErsatzTV.Core.Tests/Fakes/FakeFileEntry.cs +++ b/ErsatzTV.Core.Tests/Fakes/FakeFileEntry.cs @@ -3,4 +3,4 @@ public record FakeFileEntry(string Path) { public DateTime LastWriteTime { get; set; } = SystemTime.MinValueUtc; -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Fakes/FakeFolderEntry.cs b/ErsatzTV.Core.Tests/Fakes/FakeFolderEntry.cs index a2258c6c1..6b3efc223 100644 --- a/ErsatzTV.Core.Tests/Fakes/FakeFolderEntry.cs +++ b/ErsatzTV.Core.Tests/Fakes/FakeFolderEntry.cs @@ -1,3 +1,3 @@ namespace ErsatzTV.Core.Tests.Fakes; -public record FakeFolderEntry(string Path); \ No newline at end of file +public record FakeFolderEntry(string Path); diff --git a/ErsatzTV.Core.Tests/Fakes/FakeLocalFileSystem.cs b/ErsatzTV.Core.Tests/Fakes/FakeLocalFileSystem.cs index 7a9561125..202265367 100644 --- a/ErsatzTV.Core.Tests/Fakes/FakeLocalFileSystem.cs +++ b/ErsatzTV.Core.Tests/Fakes/FakeLocalFileSystem.cs @@ -48,13 +48,13 @@ public class FakeLocalFileSystem : ILocalFileSystem public bool FileExists(string path) => _files.Any(f => f.Path == path); public bool FolderExists(string folder) => false; - public Task ReadAllBytes(string path) => TestBytes.AsTask(); - public Task> CopyFile(string source, string destination) => Task.FromResult(Right(Unit.Default)); public Unit EmptyFolder(string folder) => Unit.Default; + public Task ReadAllBytes(string path) => TestBytes.AsTask(); + private static List Split(DirectoryInfo path) { var result = new List(); @@ -72,4 +72,4 @@ public class FakeLocalFileSystem : ILocalFileSystem return result; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Fakes/FakeMediaCollectionRepository.cs b/ErsatzTV.Core.Tests/Fakes/FakeMediaCollectionRepository.cs index 6c03cd6e7..1c0101983 100644 --- a/ErsatzTV.Core.Tests/Fakes/FakeMediaCollectionRepository.cs +++ b/ErsatzTV.Core.Tests/Fakes/FakeMediaCollectionRepository.cs @@ -20,7 +20,8 @@ public class FakeMediaCollectionRepository : IMediaCollectionRepository public Task> GetMultiCollectionCollections(int id) => throw new NotSupportedException(); - public Task> GetFakeMultiCollectionCollections(int? collectionId, int? smartCollectionId) => + public Task> + GetFakeMultiCollectionCollections(int? collectionId, int? smartCollectionId) => throw new NotSupportedException(); public Task> PlayoutIdsUsingCollection(int collectionId) => throw new NotSupportedException(); @@ -33,4 +34,4 @@ public class FakeMediaCollectionRepository : IMediaCollectionRepository public Task IsCustomPlaybackOrder(int collectionId) => false.AsTask(); public Task> GetNameFromKey(CollectionKey emptyCollection) => Option.None.AsTask(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Fakes/FakeMovieWithPath.cs b/ErsatzTV.Core.Tests/Fakes/FakeMovieWithPath.cs index 5a028745b..3a54b9224 100644 --- a/ErsatzTV.Core.Tests/Fakes/FakeMovieWithPath.cs +++ b/ErsatzTV.Core.Tests/Fakes/FakeMovieWithPath.cs @@ -21,4 +21,4 @@ public class FakeMovieWithPath : MediaItemScanResult } }) => IsAdded = true; -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Fakes/FakeTelevisionRepository.cs b/ErsatzTV.Core.Tests/Fakes/FakeTelevisionRepository.cs index 5b4601f3c..076577928 100644 --- a/ErsatzTV.Core.Tests/Fakes/FakeTelevisionRepository.cs +++ b/ErsatzTV.Core.Tests/Fakes/FakeTelevisionRepository.cs @@ -94,4 +94,4 @@ public class FakeTelevisionRepository : ITelevisionRepository public Task AddWriter(EpisodeMetadata metadata, Writer writer) => throw new NotSupportedException(); public Task UpdatePath(int mediaFileId, string path) => throw new NotSupportedException(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/GlobalUsings.cs b/ErsatzTV.Core.Tests/GlobalUsings.cs index 9d0867420..66cb869a8 100644 --- a/ErsatzTV.Core.Tests/GlobalUsings.cs +++ b/ErsatzTV.Core.Tests/GlobalUsings.cs @@ -1,4 +1,4 @@ global using LanguageExt; global using static LanguageExt.Prelude; global using Unit = LanguageExt.Unit; -global using Array = System.Array; \ No newline at end of file +global using Array = System.Array; diff --git a/ErsatzTV.Core.Tests/Jellyfin/JellyfinPathReplacementServiceTests.cs b/ErsatzTV.Core.Tests/Jellyfin/JellyfinPathReplacementServiceTests.cs index 539bba537..a0af4d7bc 100644 --- a/ErsatzTV.Core.Tests/Jellyfin/JellyfinPathReplacementServiceTests.cs +++ b/ErsatzTV.Core.Tests/Jellyfin/JellyfinPathReplacementServiceTests.cs @@ -204,7 +204,7 @@ public class JellyfinPathReplacementServiceTests result.Should().Be(@"/mnt/something else/Some Shared Folder/Some Movie/Some Movie.mkv"); } - + [Test] public async Task Should_Not_Throw_For_Null_JellyfinPath() { @@ -236,7 +236,7 @@ public class JellyfinPathReplacementServiceTests result.Should().Be(@"/mnt/something/Some Shared Folder/Some Movie/Some Movie.mkv"); } - + [Test] public async Task Should_Not_Throw_For_Null_LocalPath() { @@ -268,4 +268,4 @@ public class JellyfinPathReplacementServiceTests result.Should().Be(@"/Some Movie/Some Movie.mkv"); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Jellyfin/JellyfinUrlTests.cs b/ErsatzTV.Core.Tests/Jellyfin/JellyfinUrlTests.cs index 0ab7047bb..ca6173f9a 100644 --- a/ErsatzTV.Core.Tests/Jellyfin/JellyfinUrlTests.cs +++ b/ErsatzTV.Core.Tests/Jellyfin/JellyfinUrlTests.cs @@ -115,4 +115,4 @@ public class JellyfinUrlTests url.ToString().Should().Be("https://some.jellyfin.server/jellyfin/Items/2/Images/3?tag=4"); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Metadata/FallbackMetadataProviderTests.cs b/ErsatzTV.Core.Tests/Metadata/FallbackMetadataProviderTests.cs index b30e2106c..f5c425188 100644 --- a/ErsatzTV.Core.Tests/Metadata/FallbackMetadataProviderTests.cs +++ b/ErsatzTV.Core.Tests/Metadata/FallbackMetadataProviderTests.cs @@ -119,4 +119,4 @@ public class FallbackMetadataProviderTests metadata.Should().NotBeNull(); metadata.Title.Should().Be(expectedTitle); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Metadata/LocalStatisticsProviderTests.cs b/ErsatzTV.Core.Tests/Metadata/LocalStatisticsProviderTests.cs index c416c7d0e..02493589c 100644 --- a/ErsatzTV.Core.Tests/Metadata/LocalStatisticsProviderTests.cs +++ b/ErsatzTV.Core.Tests/Metadata/LocalStatisticsProviderTests.cs @@ -15,7 +15,7 @@ public class LocalStatisticsProviderTests { [Test] // this needs to be a culture where '.' is a group separator - [SetCulture("it-IT")] + [SetCulture("it-IT")] public void Test() { var provider = new LocalStatisticsProvider( @@ -33,4 +33,4 @@ public class LocalStatisticsProviderTests result.Duration.Should().Be(TimeSpan.FromSeconds(123.45)); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Metadata/MovieFolderScannerTests.cs b/ErsatzTV.Core.Tests/Metadata/MovieFolderScannerTests.cs index ec5f64c6c..84a48f0a8 100644 --- a/ErsatzTV.Core.Tests/Metadata/MovieFolderScannerTests.cs +++ b/ErsatzTV.Core.Tests/Metadata/MovieFolderScannerTests.cs @@ -65,7 +65,7 @@ public class MovieFolderScannerTests .Returns( (MediaItem mediaItem) => { - ((Movie) mediaItem).MovieMetadata = new List { new() }; + ((Movie)mediaItem).MovieMetadata = new List { new() }; return Task.FromResult(true); }); @@ -411,7 +411,7 @@ public class MovieFolderScannerTests It.Is(i => i.MediaVersions.Head().MediaFiles.Head().Path == moviePath)), Times.Once); } - + [Test] public async Task Should_Ignore_Dot_Underscore_Files( [ValueSource(typeof(LocalFolderScanner), nameof(LocalFolderScanner.VideoFileExtensions))] @@ -630,7 +630,7 @@ public class MovieFolderScannerTests new Mock().Object, new Mock>().Object ); - + private MovieFolderScanner GetService(params FakeFolderEntry[] folders) => new( new FakeLocalFileSystem(new List(), new List(folders)), @@ -650,4 +650,4 @@ public class MovieFolderScannerTests new Mock>().Object ); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Metadata/Nfo/EpisodeNfoReaderTests.cs b/ErsatzTV.Core.Tests/Metadata/Nfo/EpisodeNfoReaderTests.cs index d76ee29a2..f387759f5 100644 --- a/ErsatzTV.Core.Tests/Metadata/Nfo/EpisodeNfoReaderTests.cs +++ b/ErsatzTV.Core.Tests/Metadata/Nfo/EpisodeNfoReaderTests.cs @@ -231,4 +231,4 @@ public class EpisodeNfoReaderTests nfo.Directors[1] == "Director 3") .Should().Be(1); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Plex/PlexPathReplacementServiceTests.cs b/ErsatzTV.Core.Tests/Plex/PlexPathReplacementServiceTests.cs index dd2364685..76faaacfe 100644 --- a/ErsatzTV.Core.Tests/Plex/PlexPathReplacementServiceTests.cs +++ b/ErsatzTV.Core.Tests/Plex/PlexPathReplacementServiceTests.cs @@ -204,7 +204,7 @@ public class PlexPathReplacementServiceTests result.Should().Be(@"/mnt/something else/Some Shared Folder/Some Movie/Some Movie.mkv"); } - + [Test] public async Task Should_Not_Throw_For_Null_PlexPath() { @@ -236,7 +236,7 @@ public class PlexPathReplacementServiceTests result.Should().Be(@"/mnt/something/Some Shared Folder/Some Movie/Some Movie.mkv"); } - + [Test] public async Task Should_Not_Throw_For_Null_LocalPath() { @@ -268,4 +268,4 @@ public class PlexPathReplacementServiceTests result.Should().Be(@"/Some Movie/Some Movie.mkv"); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Scheduling/ChronologicalContentTests.cs b/ErsatzTV.Core.Tests/Scheduling/ChronologicalContentTests.cs index 387f24ab9..767c93ae9 100644 --- a/ErsatzTV.Core.Tests/Scheduling/ChronologicalContentTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/ChronologicalContentTests.cs @@ -71,7 +71,7 @@ public class ChronologicalContentTests private static List Episodes(int count) => Range(1, count).Map( - i => (MediaItem) new Episode + i => (MediaItem)new Episode { Id = i, EpisodeMetadata = new List @@ -84,4 +84,4 @@ public class ChronologicalContentTests }) .Reverse() .ToList(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Scheduling/CustomOrderContentTests.cs b/ErsatzTV.Core.Tests/Scheduling/CustomOrderContentTests.cs index 27249f1ee..05affd295 100644 --- a/ErsatzTV.Core.Tests/Scheduling/CustomOrderContentTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/CustomOrderContentTests.cs @@ -79,7 +79,7 @@ public class CustomOrderContentTests private static List Episodes(int count) => Range(1, count).Map( - i => (MediaItem) new Episode + i => (MediaItem)new Episode { Id = i, EpisodeMetadata = new List @@ -92,4 +92,4 @@ public class CustomOrderContentTests }) .Reverse() .ToList(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Scheduling/MultiPartEpisodeGrouperTests.cs b/ErsatzTV.Core.Tests/Scheduling/MultiPartEpisodeGrouperTests.cs index a1c9c132e..3c34075a7 100644 --- a/ErsatzTV.Core.Tests/Scheduling/MultiPartEpisodeGrouperTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/MultiPartEpisodeGrouperTests.cs @@ -330,4 +330,4 @@ public class MultiPartEpisodeGrouperTests g => g.First == first && g.Additional != null && g.Additional.Count == additional.Count && additional.ForAll(g.Additional.Contains)) .Should().HaveCount(1); -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Scheduling/PlayoutBuilderTests.cs b/ErsatzTV.Core.Tests/Scheduling/PlayoutBuilderTests.cs index 87c7990dd..6a3ddd9f0 100644 --- a/ErsatzTV.Core.Tests/Scheduling/PlayoutBuilderTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/PlayoutBuilderTests.cs @@ -10,2176 +10,2174 @@ using Moq; using NUnit.Framework; using Serilog; -namespace ErsatzTV.Core.Tests.Scheduling +namespace ErsatzTV.Core.Tests.Scheduling; + +[TestFixture] +public class PlayoutBuilderTests { - [TestFixture] - public class PlayoutBuilderTests + private readonly ILogger _logger; + + public PlayoutBuilderTests() { - private readonly ILogger _logger; + Log.Logger = new LoggerConfiguration() + .MinimumLevel.Debug() + .WriteTo.Console() + .Destructure.UsingAttributes() + .CreateLogger(); - public PlayoutBuilderTests() + ILoggerFactory loggerFactory = new LoggerFactory().AddSerilog(Log.Logger); + + _logger = loggerFactory?.CreateLogger(); + } + + [TestFixture] + public class NewPlayout : PlayoutBuilderTests + { + [Test] + [Timeout(2000)] + public async Task OnlyZeroDurationItem_Should_Abort() { - Log.Logger = new LoggerConfiguration() - .MinimumLevel.Debug() - .WriteTo.Console() - .Destructure.UsingAttributes() - .CreateLogger(); + var mediaItems = new List + { + TestMovie(1, TimeSpan.Zero, DateTime.Today) + }; - ILoggerFactory loggerFactory = new LoggerFactory().AddSerilog(Log.Logger); + (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Random); - _logger = loggerFactory?.CreateLogger(); + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset); + + result.Items.Should().BeEmpty(); } - [TestFixture] - public class NewPlayout : PlayoutBuilderTests + [Test] + public async Task ZeroDurationItem_Should_BeSkipped() { - - [Test] - [Timeout(2000)] - public async Task OnlyZeroDurationItem_Should_Abort() + var mediaItems = new List { - var mediaItems = new List - { - TestMovie(1, TimeSpan.Zero, DateTime.Today) - }; + TestMovie(1, TimeSpan.Zero, DateTime.Today), + TestMovie(2, TimeSpan.FromHours(6), DateTime.Today) + }; - (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Random); + (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Random); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset); + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - result.Items.Should().BeEmpty(); - } + result.Items.Count.Should().Be(1); + result.Items.Head().MediaItemId.Should().Be(2); + result.Items.Head().StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + result.Items.Head().FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + } - [Test] - public async Task ZeroDurationItem_Should_BeSkipped() + [Test] + public async Task InitialFlood_Should_StartAtMidnight() + { + var mediaItems = new List { - var mediaItems = new List - { - TestMovie(1, TimeSpan.Zero, DateTime.Today), - TestMovie(2, TimeSpan.FromHours(6), DateTime.Today) - }; + TestMovie(1, TimeSpan.FromHours(6), DateTime.Today) + }; - (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Random); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); + (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Random); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - result.Items.Count.Should().Be(1); - result.Items.Head().MediaItemId.Should().Be(2); - result.Items.Head().StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - result.Items.Head().FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - } + result.Items.Count.Should().Be(1); + result.Items.Head().StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + result.Items.Head().FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + } - [Test] - public async Task InitialFlood_Should_StartAtMidnight() + [Test] + public async Task InitialFlood_Should_StartAtMidnight_With_LateStart() + { + var mediaItems = new List { - var mediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(6), DateTime.Today) - }; + TestMovie(1, TimeSpan.FromHours(6), DateTime.Today) + }; - (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Random); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); + (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Random); + DateTimeOffset start = HoursAfterMidnight(1); + DateTimeOffset finish = start + TimeSpan.FromHours(6); - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - result.Items.Count.Should().Be(1); - result.Items.Head().StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - result.Items.Head().FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - } + result.Items.Count.Should().Be(2); + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + result.Items[1].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + } - [Test] - public async Task InitialFlood_Should_StartAtMidnight_With_LateStart() + [Test] + public async Task ChronologicalContent_Should_CreateChronologicalItems() + { + var mediaItems = new List { - var mediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(6), DateTime.Today) - }; + TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) + }; - (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Random); - DateTimeOffset start = HoursAfterMidnight(1); - DateTimeOffset finish = start + TimeSpan.FromHours(6); + (PlayoutBuilder builder, Playout playout) = + TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(4); - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - result.Items.Count.Should().Be(2); - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - result.Items[1].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - } + result.Items.Count.Should().Be(4); + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); + result.Items[1].MediaItemId.Should().Be(2); + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); + result.Items[2].MediaItemId.Should().Be(1); + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); + result.Items[3].MediaItemId.Should().Be(2); + } - [Test] - public async Task ChronologicalContent_Should_CreateChronologicalItems() + [Test] + public async Task ChronologicalFlood_Should_AnchorAndMaintainExistingPlayout() + { + var mediaItems = new List { - var mediaItems = new List + TestMovie(1, TimeSpan.FromHours(6), DateTime.Today), + TestMovie(2, TimeSpan.FromHours(6), DateTime.Today.AddHours(1)) + }; + + (PlayoutBuilder builder, Playout playout) = + TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(1); + result.Items.Head().MediaItemId.Should().Be(1); + + result.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); + + result.ProgramScheduleAnchors.Count.Should().Be(1); + result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); + + DateTimeOffset start2 = HoursAfterMidnight(1); + DateTimeOffset finish2 = start2 + TimeSpan.FromHours(6); + + Playout result2 = await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); + + result2.Items.Count.Should().Be(2); + result2.Items.Last().StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + result2.Items.Last().MediaItemId.Should().Be(2); + + result2.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(12)); + result2.ProgramScheduleAnchors.Count.Should().Be(1); + result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); + } + + [Test] + public async Task ChronologicalFlood_Should_AnchorAndReturnNewPlayoutItems() + { + var mediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(6), DateTime.Today), + TestMovie(2, TimeSpan.FromHours(6), DateTime.Today.AddHours(1)) + }; + + (PlayoutBuilder builder, Playout playout) = + TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(1); + result.Items.Head().MediaItemId.Should().Be(1); + + result.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); + result.ProgramScheduleAnchors.Count.Should().Be(1); + result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); + + DateTimeOffset start2 = HoursAfterMidnight(1); + DateTimeOffset finish2 = start2 + TimeSpan.FromHours(12); + + Playout result2 = await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); + + result2.Items.Count.Should().Be(3); + result2.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + result2.Items[1].MediaItemId.Should().Be(2); + result2.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + result2.Items[2].MediaItemId.Should().Be(1); + + result2.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(18)); + result2.ProgramScheduleAnchors.Count.Should().Be(1); + result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); + } + + [Test] + public async Task ShuffleFloodReset_Should_IgnoreAnchors() + { + var mediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), DateTime.Today), + TestMovie(2, TimeSpan.FromHours(1), DateTime.Today.AddHours(1)), + TestMovie(3, TimeSpan.FromHours(1), DateTime.Today.AddHours(2)), + TestMovie(4, TimeSpan.FromHours(1), DateTime.Today.AddHours(3)), + TestMovie(5, TimeSpan.FromHours(1), DateTime.Today.AddHours(4)), + TestMovie(6, TimeSpan.FromHours(1), DateTime.Today.AddHours(5)) + }; + + (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Shuffle); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(6); + result.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); + + result.ProgramScheduleAnchors.Count.Should().Be(1); + result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); + + int firstSeedValue = result.ProgramScheduleAnchors.Head().EnumeratorState.Seed; + + DateTimeOffset start2 = HoursAfterMidnight(0); + DateTimeOffset finish2 = start2 + TimeSpan.FromHours(6); + + Playout result2 = await builder.Build(playout, PlayoutBuildMode.Reset, start2, finish2); + + result2.Items.Count.Should().Be(6); + result2.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); + + result2.ProgramScheduleAnchors.Count.Should().Be(1); + result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); + + int secondSeedValue = result2.ProgramScheduleAnchors.Head().EnumeratorState.Seed; + + firstSeedValue.Should().NotBe(secondSeedValue); + } + + [Test] + public async Task ContinuePlayout_ShuffleFlood_Should_MaintainRandomSeed() + { + var mediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), DateTime.Today), + TestMovie(2, TimeSpan.FromHours(1), DateTime.Today.AddHours(1)), + TestMovie(3, TimeSpan.FromHours(1), DateTime.Today.AddHours(3)) + }; + + (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Shuffle); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(6); + result.ProgramScheduleAnchors.Count.Should().Be(1); + result.ProgramScheduleAnchors.Head().EnumeratorState.Seed.Should().BeGreaterThan(0); + + int firstSeedValue = result.ProgramScheduleAnchors.Head().EnumeratorState.Seed; + + DateTimeOffset start2 = HoursAfterMidnight(0); + DateTimeOffset finish2 = start2 + TimeSpan.FromHours(6); + + Playout result2 = await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); + + int secondSeedValue = result2.ProgramScheduleAnchors.Head().EnumeratorState.Seed; + + firstSeedValue.Should().Be(secondSeedValue); + } + + [Test] + public async Task FloodContent_Should_FloodAroundFixedContent_One() + { + var floodCollection = new Collection + { + Id = 1, + Name = "Flood Items", + MediaItems = new List { TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) - }; - - (PlayoutBuilder builder, Playout playout) = - TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(4); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(4); - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); - result.Items[1].MediaItemId.Should().Be(2); - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); - result.Items[2].MediaItemId.Should().Be(1); - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); - result.Items[3].MediaItemId.Should().Be(2); - } - - [Test] - public async Task ChronologicalFlood_Should_AnchorAndMaintainExistingPlayout() - { - var mediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(6), DateTime.Today), - TestMovie(2, TimeSpan.FromHours(6), DateTime.Today.AddHours(1)) - }; - - (PlayoutBuilder builder, Playout playout) = - TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(1); - result.Items.Head().MediaItemId.Should().Be(1); - - result.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); - - result.ProgramScheduleAnchors.Count.Should().Be(1); - result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); - - DateTimeOffset start2 = HoursAfterMidnight(1); - DateTimeOffset finish2 = start2 + TimeSpan.FromHours(6); - - Playout result2 = await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); - - result2.Items.Count.Should().Be(2); - result2.Items.Last().StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - result2.Items.Last().MediaItemId.Should().Be(2); - - result2.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(12)); - result2.ProgramScheduleAnchors.Count.Should().Be(1); - result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); - } - - [Test] - public async Task ChronologicalFlood_Should_AnchorAndReturnNewPlayoutItems() - { - var mediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(6), DateTime.Today), - TestMovie(2, TimeSpan.FromHours(6), DateTime.Today.AddHours(1)) - }; - - (PlayoutBuilder builder, Playout playout) = - TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(1); - result.Items.Head().MediaItemId.Should().Be(1); - - result.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); - result.ProgramScheduleAnchors.Count.Should().Be(1); - result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); - - DateTimeOffset start2 = HoursAfterMidnight(1); - DateTimeOffset finish2 = start2 + TimeSpan.FromHours(12); - - Playout result2 = await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); - - result2.Items.Count.Should().Be(3); - result2.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - result2.Items[1].MediaItemId.Should().Be(2); - result2.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - result2.Items[2].MediaItemId.Should().Be(1); - - result2.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(18)); - result2.ProgramScheduleAnchors.Count.Should().Be(1); - result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); - } - - [Test] - public async Task ShuffleFloodReset_Should_IgnoreAnchors() - { - var mediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), DateTime.Today), - TestMovie(2, TimeSpan.FromHours(1), DateTime.Today.AddHours(1)), - TestMovie(3, TimeSpan.FromHours(1), DateTime.Today.AddHours(2)), - TestMovie(4, TimeSpan.FromHours(1), DateTime.Today.AddHours(3)), - TestMovie(5, TimeSpan.FromHours(1), DateTime.Today.AddHours(4)), - TestMovie(6, TimeSpan.FromHours(1), DateTime.Today.AddHours(5)) - }; - - (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Shuffle); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(6); - result.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); - - result.ProgramScheduleAnchors.Count.Should().Be(1); - result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); - - int firstSeedValue = result.ProgramScheduleAnchors.Head().EnumeratorState.Seed; - - DateTimeOffset start2 = HoursAfterMidnight(0); - DateTimeOffset finish2 = start2 + TimeSpan.FromHours(6); - - Playout result2 = await builder.Build(playout, PlayoutBuildMode.Reset, start2, finish2); - - result2.Items.Count.Should().Be(6); - result2.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); - - result2.ProgramScheduleAnchors.Count.Should().Be(1); - result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); - - int secondSeedValue = result2.ProgramScheduleAnchors.Head().EnumeratorState.Seed; - - firstSeedValue.Should().NotBe(secondSeedValue); - } - - [Test] - public async Task ContinuePlayout_ShuffleFlood_Should_MaintainRandomSeed() - { - var mediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), DateTime.Today), - TestMovie(2, TimeSpan.FromHours(1), DateTime.Today.AddHours(1)), - TestMovie(3, TimeSpan.FromHours(1), DateTime.Today.AddHours(3)) - }; - - (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Shuffle); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(6); - result.ProgramScheduleAnchors.Count.Should().Be(1); - result.ProgramScheduleAnchors.Head().EnumeratorState.Seed.Should().BeGreaterThan(0); - - int firstSeedValue = result.ProgramScheduleAnchors.Head().EnumeratorState.Seed; - - DateTimeOffset start2 = HoursAfterMidnight(0); - DateTimeOffset finish2 = start2 + TimeSpan.FromHours(6); - - Playout result2 = await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); - - int secondSeedValue = result2.ProgramScheduleAnchors.Head().EnumeratorState.Seed; - - firstSeedValue.Should().Be(secondSeedValue); - } - - [Test] - public async Task FloodContent_Should_FloodAroundFixedContent_One() - { - var floodCollection = new Collection - { - Id = 1, - Name = "Flood Items", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) - } - }; - - var fixedCollection = new Collection - { - Id = 2, - Name = "Fixed Items", - MediaItems = new List - { - TestMovie(3, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)) - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (floodCollection.Id, floodCollection.MediaItems.ToList()), - (fixedCollection.Id, fixedCollection.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemFlood - { - Index = 1, - Collection = floodCollection, - CollectionId = floodCollection.Id, - StartTime = null, - PlaybackOrder = PlaybackOrder.Chronological - }, - new ProgramScheduleItemOne - { - Index = 2, - Collection = fixedCollection, - CollectionId = fixedCollection.Id, - StartTime = TimeSpan.FromHours(3), - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(5); - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); - result.Items[1].MediaItemId.Should().Be(2); - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); - result.Items[2].MediaItemId.Should().Be(1); - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); - result.Items[3].MediaItemId.Should().Be(3); - result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(5)); - result.Items[4].MediaItemId.Should().Be(2); - } - - [Test] - public async Task FloodContent_Should_FloodAroundFixedContent_Multiple() - { - var floodCollection = new Collection - { - Id = 1, - Name = "Flood Items", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) - } - }; - - var fixedCollection = new Collection - { - Id = 2, - Name = "Fixed Items", - MediaItems = new List - { - TestMovie(3, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)), - TestMovie(4, TimeSpan.FromHours(1), new DateTime(2020, 1, 2)) - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (floodCollection.Id, floodCollection.MediaItems.ToList()), - (fixedCollection.Id, fixedCollection.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemFlood - { - Index = 1, - Collection = floodCollection, - CollectionId = floodCollection.Id, - StartTime = null, - PlaybackOrder = PlaybackOrder.Chronological - }, - new ProgramScheduleItemMultiple - { - Index = 2, - Collection = fixedCollection, - CollectionId = fixedCollection.Id, - StartTime = TimeSpan.FromHours(3), - Count = 2, - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(7); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(6); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); - result.Items[1].MediaItemId.Should().Be(2); - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); - result.Items[2].MediaItemId.Should().Be(1); - - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); - result.Items[3].MediaItemId.Should().Be(3); - result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(5)); - result.Items[4].MediaItemId.Should().Be(4); - - result.Items[5].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - result.Items[5].MediaItemId.Should().Be(2); - } - - [Test] - public async Task FloodContent_Should_FloodWithFixedStartTime() - { - var floodCollection = new Collection - { - Id = 1, - Name = "Flood Items", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) - } - }; - - var fixedCollection = new Collection - { - Id = 2, - Name = "Fixed Items", - MediaItems = new List - { - TestMovie(3, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)), - TestMovie(4, TimeSpan.FromHours(1), new DateTime(2020, 1, 2)) - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (floodCollection.Id, floodCollection.MediaItems.ToList()), - (fixedCollection.Id, fixedCollection.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemFlood - { - Index = 1, - Collection = floodCollection, - CollectionId = floodCollection.Id, - StartTime = TimeSpan.FromHours(7), - PlaybackOrder = PlaybackOrder.Chronological - }, - new ProgramScheduleItemOne - { - Index = 2, - Collection = fixedCollection, - CollectionId = fixedCollection.Id, - StartTime = TimeSpan.FromHours(12), - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(24); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(6); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(7)); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(8)); - result.Items[1].MediaItemId.Should().Be(2); - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(9)); - result.Items[2].MediaItemId.Should().Be(1); - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(10)); - result.Items[3].MediaItemId.Should().Be(2); - result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(11)); - result.Items[4].MediaItemId.Should().Be(1); - - result.Items[5].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - result.Items[5].MediaItemId.Should().Be(3); - } - - [Test] - public async Task ContinuePlayout_FloodContent_Should_FloodWithFixedStartTime_FromAnchor() - { - var floodCollection = new Collection - { - Id = 1, - Name = "Flood Items", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) - } - }; - - var fixedCollection = new Collection - { - Id = 2, - Name = "Fixed Items", - MediaItems = new List - { - TestMovie(3, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)), - TestMovie(4, TimeSpan.FromHours(1), new DateTime(2020, 1, 2)) - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (floodCollection.Id, floodCollection.MediaItems.ToList()), - (fixedCollection.Id, fixedCollection.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemFlood - { - Index = 1, - Collection = floodCollection, - CollectionId = floodCollection.Id, - StartTime = TimeSpan.FromHours(7), - PlaybackOrder = PlaybackOrder.Chronological - }, - new ProgramScheduleItemOne - { - Index = 2, - Collection = fixedCollection, - CollectionId = fixedCollection.Id, - StartTime = TimeSpan.FromHours(12), - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - Anchor = new PlayoutAnchor - { - NextStart = HoursAfterMidnight(9).UtcDateTime, - ScheduleItemsEnumeratorState = new CollectionEnumeratorState - { - Index = 0, - Seed = 1 - }, - InFlood = true - }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(32); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Continue, start, finish); - - result.Items.Count.Should().Be(5); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(9)); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(10)); - result.Items[1].MediaItemId.Should().Be(2); - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(11)); - result.Items[2].MediaItemId.Should().Be(1); - - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - result.Items[3].MediaItemId.Should().Be(3); - - result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(7)); - result.Items[4].MediaItemId.Should().Be(2); - - result.Anchor.InFlood.Should().BeTrue(); - } - - [Test] - public async Task FloodContent_Should_FloodAroundFixedContent_DurationWithoutOfflineTail() - { - var floodCollection = new Collection - { - Id = 1, - Name = "Flood Items", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) - } - }; - - var fixedCollection = new Collection - { - Id = 2, - Name = "Fixed Items", - MediaItems = new List - { - TestMovie(3, TimeSpan.FromHours(0.75), new DateTime(2020, 1, 1)), - TestMovie(4, TimeSpan.FromHours(1.5), new DateTime(2020, 1, 2)) - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (floodCollection.Id, floodCollection.MediaItems.ToList()), - (fixedCollection.Id, fixedCollection.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemFlood - { - Index = 1, - Collection = floodCollection, - CollectionId = floodCollection.Id, - StartTime = null, - PlaybackOrder = PlaybackOrder.Chronological - }, - new ProgramScheduleItemDuration - { - Index = 2, - Collection = fixedCollection, - CollectionId = fixedCollection.Id, - StartTime = TimeSpan.FromHours(2), - PlayoutDuration = TimeSpan.FromHours(2), - TailMode = TailMode.None, // immediately continue - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(7); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); - result.Items[1].MediaItemId.Should().Be(2); - - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); - result.Items[2].MediaItemId.Should().Be(3); - - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2.75)); - result.Items[3].MediaItemId.Should().Be(1); - result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3.75)); - result.Items[4].MediaItemId.Should().Be(2); - - result.Items[5].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4.75)); - result.Items[5].MediaItemId.Should().Be(1); - result.Items[6].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(5.75)); - result.Items[6].MediaItemId.Should().Be(2); - } - - [Test] - public async Task MultipleContent_Should_WrapAroundDynamicContent_DurationWithoutOfflineTail() - { - var multipleCollection = new Collection - { - Id = 1, - Name = "Multiple Items", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) - } - }; - - var dynamicCollection = new Collection - { - Id = 2, - Name = "Dynamic Items", - MediaItems = new List - { - TestMovie(3, TimeSpan.FromHours(0.75), new DateTime(2020, 1, 1)), - TestMovie(4, TimeSpan.FromHours(1.5), new DateTime(2020, 1, 2)) - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (multipleCollection.Id, multipleCollection.MediaItems.ToList()), - (dynamicCollection.Id, dynamicCollection.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemMultiple - { - Index = 1, - Collection = multipleCollection, - CollectionId = multipleCollection.Id, - StartTime = null, - Count = 2, - PlaybackOrder = PlaybackOrder.Chronological - }, - new ProgramScheduleItemDuration - { - Index = 2, - Collection = dynamicCollection, - CollectionId = dynamicCollection.Id, - StartTime = null, - PlayoutDuration = TimeSpan.FromHours(2), - TailMode = TailMode.None, // immediately continue - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(6); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); - result.Items[1].MediaItemId.Should().Be(2); - - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); - result.Items[2].MediaItemId.Should().Be(3); - - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2.75)); - result.Items[3].MediaItemId.Should().Be(1); - result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3.75)); - result.Items[4].MediaItemId.Should().Be(2); - - result.Items[5].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4.75)); - result.Items[5].MediaItemId.Should().Be(4); - } - - [Test] - public async Task ContinuePlayout_Alternating_MultipleContent_Should_Maintain_Counts() - { - var collectionOne = new Collection - { - Id = 1, - Name = "Multiple Items 1", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) - } - }; - - var collectionTwo = new Collection - { - Id = 2, - Name = "Multiple Items 2", - MediaItems = new List - { - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (collectionOne.Id, collectionOne.MediaItems.ToList()), - (collectionTwo.Id, collectionTwo.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemMultiple - { - Id = 1, - Index = 1, - Collection = collectionOne, - CollectionId = collectionOne.Id, - StartTime = null, - Count = 3, - PlaybackOrder = PlaybackOrder.Chronological - }, - new ProgramScheduleItemMultiple - { - Id = 2, - Index = 2, - Collection = collectionTwo, - CollectionId = collectionTwo.Id, - StartTime = null, - Count = 3, - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - Anchor = new PlayoutAnchor - { - NextStart = HoursAfterMidnight(1).UtcDateTime, - ScheduleItemsEnumeratorState = new CollectionEnumeratorState - { - Index = 0, - Seed = 1 - }, - MultipleRemaining = 2 - }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(5); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Continue, start, finish); - - result.Items.Count.Should().Be(4); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); - result.Items[1].MediaItemId.Should().Be(1); - - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); - result.Items[2].MediaItemId.Should().Be(2); - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4)); - result.Items[3].MediaItemId.Should().Be(2); - - result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(1); - result.Anchor.MultipleRemaining.Should().Be(1); - } - - [Test] - public async Task Auto_Zero_MultipleCount() - { - var collectionOne = new Collection - { - Id = 1, - Name = "Multiple Items 1", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), - TestMovie(3, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) - } - }; - - var collectionTwo = new Collection - { - Id = 2, - Name = "Multiple Items 2", - MediaItems = new List - { - TestMovie(4, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), - TestMovie(5, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (collectionOne.Id, collectionOne.MediaItems.ToList()), - (collectionTwo.Id, collectionTwo.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemMultiple - { - Id = 1, - Index = 1, - Collection = collectionOne, - CollectionId = collectionOne.Id, - StartTime = null, - Count = 0, - PlaybackOrder = PlaybackOrder.Chronological - }, - new ProgramScheduleItemMultiple - { - Id = 2, - Index = 2, - Collection = collectionTwo, - CollectionId = collectionTwo.Id, - StartTime = null, - Count = 0, - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(5); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(5); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(0)); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); - result.Items[1].MediaItemId.Should().Be(2); - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); - result.Items[2].MediaItemId.Should().Be(3); - - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); - result.Items[3].MediaItemId.Should().Be(4); - result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4)); - result.Items[4].MediaItemId.Should().Be(5); - - result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(0); - result.Anchor.MultipleRemaining.Should().BeNull(); - } - - [Test] - public async Task ContinuePlayout_Alternating_Duration_Should_Maintain_Duration() - { - var collectionOne = new Collection - { - Id = 1, - Name = "Duration Items 1", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) - } - }; - - var collectionTwo = new Collection - { - Id = 2, - Name = "Duration Items 2", - MediaItems = new List - { - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (collectionOne.Id, collectionOne.MediaItems.ToList()), - (collectionTwo.Id, collectionTwo.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemDuration - { - Id = 1, - Index = 1, - Collection = collectionOne, - CollectionId = collectionOne.Id, - StartTime = null, - PlayoutDuration = TimeSpan.FromHours(3), - TailMode = TailMode.None, - PlaybackOrder = PlaybackOrder.Chronological - }, - new ProgramScheduleItemDuration - { - Id = 2, - Index = 2, - Collection = collectionTwo, - CollectionId = collectionTwo.Id, - StartTime = null, - PlayoutDuration = TimeSpan.FromHours(3), - TailMode = TailMode.None, - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - Anchor = new PlayoutAnchor - { - NextStart = HoursAfterMidnight(1).UtcDateTime, - ScheduleItemsEnumeratorState = new CollectionEnumeratorState - { - Index = 0, - Seed = 1 - }, - DurationFinish = HoursAfterMidnight(3).UtcDateTime - }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(5); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Continue, start, finish); - - result.Items.Count.Should().Be(4); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); - result.Items[1].MediaItemId.Should().Be(1); - - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); - result.Items[2].MediaItemId.Should().Be(2); - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4)); - result.Items[3].MediaItemId.Should().Be(2); - - result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(1); - result.Anchor.DurationFinish.Should().Be(HoursAfterMidnight(6).UtcDateTime); - } - - [Test] - public async Task Alternating_Duration_With_Filler_Should_Alternate_Schedule_Items() - { - var collectionOne = new Collection - { - Id = 1, - Name = "Duration Items 1", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromMinutes(55), new DateTime(2020, 1, 1)) - } - }; - - var collectionTwo = new Collection - { - Id = 2, - Name = "Duration Items 2", - MediaItems = new List - { - TestMovie(2, TimeSpan.FromMinutes(55), new DateTime(2020, 1, 1)) - } - }; - - var collectionThree = new Collection - { - Id = 3, - Name = "Filler Items", - MediaItems = new List - { - TestMovie(3, TimeSpan.FromMinutes(5), new DateTime(2020, 1, 1)) - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (collectionOne.Id, collectionOne.MediaItems.ToList()), - (collectionTwo.Id, collectionTwo.MediaItems.ToList()), - (collectionThree.Id, collectionThree.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemDuration - { - Id = 1, - Index = 1, - Collection = collectionOne, - CollectionId = collectionOne.Id, - StartTime = null, - PlayoutDuration = TimeSpan.FromHours(3), - PlaybackOrder = PlaybackOrder.Chronological, - TailMode = TailMode.Filler, - TailFiller = new FillerPreset - { - FillerKind = FillerKind.Tail, - Collection = collectionThree, - CollectionId = collectionThree.Id - } - }, - new ProgramScheduleItemDuration - { - Id = 2, - Index = 2, - Collection = collectionTwo, - CollectionId = collectionTwo.Id, - StartTime = null, - PlayoutDuration = TimeSpan.FromHours(3), - PlaybackOrder = PlaybackOrder.Chronological, - TailMode = TailMode.Filler, - TailFiller = new FillerPreset - { - FillerKind = FillerKind.Tail, - Collection = collectionThree, - CollectionId = collectionThree.Id - } - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(12); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromMinutes(0)); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromMinutes(55)); - result.Items[1].MediaItemId.Should().Be(1); - result.Items[2].StartOffset.TimeOfDay.Should().Be(new TimeSpan(1, 50, 0)); - result.Items[2].MediaItemId.Should().Be(1); - - result.Items[3].StartOffset.TimeOfDay.Should().Be(new TimeSpan(2, 45, 0)); - result.Items[3].MediaItemId.Should().Be(3); - result.Items[4].StartOffset.TimeOfDay.Should().Be(new TimeSpan(2, 50, 0)); - result.Items[4].MediaItemId.Should().Be(3); - result.Items[5].StartOffset.TimeOfDay.Should().Be(new TimeSpan(2, 55, 0)); - result.Items[5].MediaItemId.Should().Be(3); - - result.Items[6].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); - result.Items[6].MediaItemId.Should().Be(2); - result.Items[7].StartOffset.TimeOfDay.Should().Be(new TimeSpan(3, 55, 0)); - result.Items[7].MediaItemId.Should().Be(2); - result.Items[8].StartOffset.TimeOfDay.Should().Be(new TimeSpan(4, 50, 0)); - result.Items[8].MediaItemId.Should().Be(2); - - result.Items[9].StartOffset.TimeOfDay.Should().Be(new TimeSpan(5, 45, 0)); - result.Items[9].MediaItemId.Should().Be(3); - result.Items[10].StartOffset.TimeOfDay.Should().Be(new TimeSpan(5, 50, 0)); - result.Items[10].MediaItemId.Should().Be(3); - result.Items[11].StartOffset.TimeOfDay.Should().Be(new TimeSpan(5, 55, 0)); - result.Items[11].MediaItemId.Should().Be(3); - - result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(0); - result.Anchor.DurationFinish.Should().BeNull(); - } - - [Test] - public async Task Duration_Should_Skip_Items_That_Are_Too_Long() - { - var collectionOne = new Collection - { - Id = 1, - Name = "Duration Items 1", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)), - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), - TestMovie(3, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)), - TestMovie(4, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) - } - }; - - var fakeRepository = - new FakeMediaCollectionRepository(Map((collectionOne.Id, collectionOne.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemDuration - { - Id = 1, - Index = 1, - Collection = collectionOne, - CollectionId = collectionOne.Id, - StartTime = null, - PlayoutDuration = TimeSpan.FromHours(1), - PlaybackOrder = PlaybackOrder.Chronological, - TailMode = TailMode.None, - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(6); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(0)); - result.Items[0].MediaItemId.Should().Be(2); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); - result.Items[1].MediaItemId.Should().Be(4); - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); - result.Items[2].MediaItemId.Should().Be(2); - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); - result.Items[3].MediaItemId.Should().Be(4); - result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4)); - result.Items[4].MediaItemId.Should().Be(2); - result.Items[5].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(5)); - result.Items[5].MediaItemId.Should().Be(4); - - result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(0); - result.Anchor.DurationFinish.Should().BeNull(); - } - - [Test] - public async Task Two_Day_Playout_Should_Create_Date_Anchors_For_Midnight() - { - var mediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(6), new DateTime(2002, 1, 1)), - TestMovie(2, TimeSpan.FromHours(6), new DateTime(2003, 1, 1)), - TestMovie(3, TimeSpan.FromHours(6), new DateTime(2004, 1, 1)) - }; - - (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromDays(2); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(8); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - result.Items[0].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - result.Items[1].MediaItemId.Should().Be(2); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - result.Items[1].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - result.Items[2].MediaItemId.Should().Be(3); - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - result.Items[2].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); - result.Items[3].MediaItemId.Should().Be(1); - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); - result.Items[3].FinishOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - result.Items[4].MediaItemId.Should().Be(2); - result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - result.Items[4].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - result.Items[5].MediaItemId.Should().Be(3); - result.Items[5].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - result.Items[5].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - result.Items[6].MediaItemId.Should().Be(1); - result.Items[6].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - result.Items[6].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); - result.Items[7].MediaItemId.Should().Be(2); - result.Items[7].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); - result.Items[7].FinishOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - - result.ProgramScheduleAnchors.Count.Should().Be(2); - result.ProgramScheduleAnchors.Count(a => a.EnumeratorState.Index == 4 % 3).Should().Be(1); - result.ProgramScheduleAnchors.Count(a => a.EnumeratorState.Index == 8 % 3).Should().Be(1); - - int seed = result.ProgramScheduleAnchors[0].EnumeratorState.Seed; - result.ProgramScheduleAnchors.All(a => a.EnumeratorState.Seed == seed).Should().BeTrue(); - } - } - - [TestFixture] - public class ResetPlayout : PlayoutBuilderTests - { - [Test] - public async Task ShuffleFlood_Should_IgnoreAnchors() - { - var mediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), DateTime.Today), - TestMovie(2, TimeSpan.FromHours(1), DateTime.Today.AddHours(1)), - TestMovie(3, TimeSpan.FromHours(1), DateTime.Today.AddHours(2)), - TestMovie(4, TimeSpan.FromHours(1), DateTime.Today.AddHours(3)), - TestMovie(5, TimeSpan.FromHours(1), DateTime.Today.AddHours(4)), - TestMovie(6, TimeSpan.FromHours(1), DateTime.Today.AddHours(5)) - }; - - (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Shuffle); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(6); - result.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); - - result.ProgramScheduleAnchors.Count.Should().Be(1); - result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); - - int firstSeedValue = result.ProgramScheduleAnchors.Head().EnumeratorState.Seed; - - DateTimeOffset start2 = HoursAfterMidnight(0); - DateTimeOffset finish2 = start2 + TimeSpan.FromHours(6); - - Playout result2 = await builder.Build(playout, PlayoutBuildMode.Reset, start2, finish2); - - result2.Items.Count.Should().Be(6); - result2.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); - - result2.ProgramScheduleAnchors.Count.Should().Be(1); - result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); - - int secondSeedValue = result2.ProgramScheduleAnchors.Head().EnumeratorState.Seed; - - firstSeedValue.Should().NotBe(secondSeedValue); - } - } - - [TestFixture] - public class RefreshPlayout : PlayoutBuilderTests - { - [Test] - public async Task Two_Day_Playout_Should_Refresh_From_Midnight_Anchor() - { - var collectionOne = new Collection - { - Id = 1, - Name = "Duration Items 1", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(6), new DateTime(2002, 1, 1)), - TestMovie(2, TimeSpan.FromHours(6), new DateTime(2003, 1, 1)), - TestMovie(3, TimeSpan.FromHours(6), new DateTime(2004, 1, 1)) - } - }; - - var fakeRepository = - new FakeMediaCollectionRepository(Map((collectionOne.Id, collectionOne.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemFlood - { - Id = 1, - Index = 1, - Collection = collectionOne, - CollectionId = collectionOne.Id, - StartTime = null, - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - - // this should be ignored - Anchor = new PlayoutAnchor - { - NextStart = HoursAfterMidnight(1).UtcDateTime, - ScheduleItemsEnumeratorState = new CollectionEnumeratorState - { - Index = 0, - Seed = 1 - }, - DurationFinish = HoursAfterMidnight(3).UtcDateTime - }, - - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - playout.ProgramScheduleAnchors.Add( - new PlayoutProgramScheduleAnchor - { - AnchorDate = HoursAfterMidnight(24).UtcDateTime, - Collection = collectionOne, - CollectionId = collectionOne.Id, - CollectionType = ProgramScheduleItemCollectionType.Collection, - EnumeratorState = new CollectionEnumeratorState - { - Index = 1, - Seed = 12345 - }, - Playout = playout, - ProgramSchedule = playout.ProgramSchedule, - }); - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(24); - DateTimeOffset finish = start + TimeSpan.FromDays(1); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Refresh, start, finish); - - result.Items.Count.Should().Be(4); - result.Items[0].MediaItemId.Should().Be(2); - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - result.Items[0].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - result.Items[1].MediaItemId.Should().Be(3); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - result.Items[1].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - result.Items[2].MediaItemId.Should().Be(1); - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - result.Items[2].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); - result.Items[3].MediaItemId.Should().Be(2); - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); - result.Items[3].FinishOffset.TimeOfDay.Should().Be(TimeSpan.Zero); - } - } - - [TestFixture] - public class ContinuePlayout : PlayoutBuilderTests - { - [Test] - public async Task ChronologicalFlood_Should_AnchorAndMaintainExistingPlayout() - { - var mediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(6), DateTime.Today), - TestMovie(2, TimeSpan.FromHours(6), DateTime.Today.AddHours(1)) - }; - - (PlayoutBuilder builder, Playout playout) = - TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(1); - result.Items.Head().MediaItemId.Should().Be(1); - - result.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); - - result.ProgramScheduleAnchors.Count.Should().Be(1); - result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); - - DateTimeOffset start2 = HoursAfterMidnight(1); - DateTimeOffset finish2 = start2 + TimeSpan.FromHours(6); - - Playout result2 = await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); - - result2.Items.Count.Should().Be(2); - result2.Items.Last().StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - result2.Items.Last().MediaItemId.Should().Be(2); - - result2.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(12)); - result2.ProgramScheduleAnchors.Count.Should().Be(1); - result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); - } - - [Test] - public async Task ChronologicalFlood_Should_AnchorAndReturnNewPlayoutItems() - { - var mediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(6), DateTime.Today), - TestMovie(2, TimeSpan.FromHours(6), DateTime.Today.AddHours(1)) - }; - - (PlayoutBuilder builder, Playout playout) = - TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(1); - result.Items.Head().MediaItemId.Should().Be(1); - - result.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); - result.ProgramScheduleAnchors.Count.Should().Be(1); - result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); - - DateTimeOffset start2 = HoursAfterMidnight(1); - DateTimeOffset finish2 = start2 + TimeSpan.FromHours(12); - - Playout result2 = await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); - - result2.Items.Count.Should().Be(3); - result2.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - result2.Items[1].MediaItemId.Should().Be(2); - result2.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - result2.Items[2].MediaItemId.Should().Be(1); - - result2.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(18)); - result2.ProgramScheduleAnchors.Count.Should().Be(1); - result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); - } - - [Test] - public async Task ChronologicalFlood_Should_AnchorAndReturnNewPlayoutItems_MultiDay() - { - var mediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(6), DateTime.Today), - TestMovie(2, TimeSpan.FromHours(6), DateTime.Today.AddHours(1)) - }; - - (PlayoutBuilder builder, Playout playout) = - TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromDays(1); - - await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - playout.Items.Count.Should().Be(4); - playout.Items.Map(i => i.MediaItemId).ToList().Should().Equal(1, 2, 1, 2); - - playout.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddDays(1)); - playout.ProgramScheduleAnchors.Count.Should().Be(1); - playout.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); - - PlayoutProgramScheduleAnchor headAnchor = playout.ProgramScheduleAnchors.Head(); - - // throw in a detractor anchor - playout builder should prioritize the "continue" anchor - playout.ProgramScheduleAnchors.Insert( - 0, - new PlayoutProgramScheduleAnchor - { - Id = headAnchor.Id + 1, - Collection = headAnchor.Collection, - CollectionId = headAnchor.CollectionId, - Playout = playout, - PlayoutId = playout.Id, - AnchorDate = DateTime.Today.ToUniversalTime(), - CollectionType = headAnchor.CollectionType, - EnumeratorState = new CollectionEnumeratorState - { Index = headAnchor.EnumeratorState.Index + 1, Seed = headAnchor.EnumeratorState.Seed }, - MediaItem = headAnchor.MediaItem, - MediaItemId = headAnchor.MediaItemId, - MultiCollection = headAnchor.MultiCollection, - MultiCollectionId = headAnchor.MultiCollectionId, - ProgramSchedule = headAnchor.ProgramSchedule, - ProgramScheduleId = headAnchor.ProgramScheduleId, - SmartCollection = headAnchor.SmartCollection, - SmartCollectionId = headAnchor.SmartCollectionId - }); - - // continue 1h later - DateTimeOffset start2 = HoursAfterMidnight(1); - DateTimeOffset finish2 = start2 + TimeSpan.FromDays(1); - - await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); - - playout.Items.Count.Should().Be(5); - playout.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(0)); - playout.Items[0].MediaItemId.Should().Be(1); - playout.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - playout.Items[1].MediaItemId.Should().Be(2); - playout.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - playout.Items[2].MediaItemId.Should().Be(1); - playout.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); - playout.Items[3].MediaItemId.Should().Be(2); - playout.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(0)); - playout.Items[4].MediaItemId.Should().Be(1); - - playout.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(30)); - - playout.ProgramScheduleAnchors.Count.Should().Be(2); - playout.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); - - // continue 1h later - DateTimeOffset start3 = HoursAfterMidnight(2); - DateTimeOffset finish3 = start3 + TimeSpan.FromDays(1); - - await builder.Build(playout, PlayoutBuildMode.Continue, start3, finish3); - - playout.Items.Count.Should().Be(5); - playout.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(0)); - playout.Items[0].MediaItemId.Should().Be(1); - playout.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); - playout.Items[1].MediaItemId.Should().Be(2); - playout.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - playout.Items[2].MediaItemId.Should().Be(1); - playout.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); - playout.Items[3].MediaItemId.Should().Be(2); - playout.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(0)); - playout.Items[4].MediaItemId.Should().Be(1); - - playout.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(30)); - - playout.ProgramScheduleAnchors.Count.Should().Be(2); - playout.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); - } - - [Test] - public async Task ShuffleFlood_Should_MaintainRandomSeed() - { - var mediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), DateTime.Today), - TestMovie(2, TimeSpan.FromHours(1), DateTime.Today.AddHours(1)), - TestMovie(3, TimeSpan.FromHours(1), DateTime.Today.AddHours(3)) - }; - - (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Shuffle); - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(6); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); - - result.Items.Count.Should().Be(6); - result.ProgramScheduleAnchors.Count.Should().Be(1); - result.ProgramScheduleAnchors.Head().EnumeratorState.Seed.Should().BeGreaterThan(0); - result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); - - int firstSeedValue = result.ProgramScheduleAnchors.Head().EnumeratorState.Seed; - - DateTimeOffset start2 = HoursAfterMidnight(0); - DateTimeOffset finish2 = start2 + TimeSpan.FromHours(6); - - Playout result2 = await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); - - int secondSeedValue = result2.ProgramScheduleAnchors.Head().EnumeratorState.Seed; - - firstSeedValue.Should().Be(secondSeedValue); - - result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); - } - - [Test] - public async Task FloodContent_Should_FloodWithFixedStartTime_FromAnchor() - { - var floodCollection = new Collection - { - Id = 1, - Name = "Flood Items", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) - } - }; - - var fixedCollection = new Collection - { - Id = 2, - Name = "Fixed Items", - MediaItems = new List - { - TestMovie(3, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)), - TestMovie(4, TimeSpan.FromHours(1), new DateTime(2020, 1, 2)) - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (floodCollection.Id, floodCollection.MediaItems.ToList()), - (fixedCollection.Id, fixedCollection.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemFlood - { - Index = 1, - Collection = floodCollection, - CollectionId = floodCollection.Id, - StartTime = TimeSpan.FromHours(7), - PlaybackOrder = PlaybackOrder.Chronological - }, - new ProgramScheduleItemOne - { - Index = 2, - Collection = fixedCollection, - CollectionId = fixedCollection.Id, - StartTime = TimeSpan.FromHours(12), - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - Anchor = new PlayoutAnchor - { - NextStart = HoursAfterMidnight(9).UtcDateTime, - ScheduleItemsEnumeratorState = new CollectionEnumeratorState - { - Index = 0, - Seed = 1 - }, - InFlood = true - }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(32); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Continue, start, finish); - - result.Items.Count.Should().Be(5); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(9)); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(10)); - result.Items[1].MediaItemId.Should().Be(2); - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(11)); - result.Items[2].MediaItemId.Should().Be(1); - - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); - result.Items[3].MediaItemId.Should().Be(3); - - result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(7)); - result.Items[4].MediaItemId.Should().Be(2); - - result.Anchor.InFlood.Should().BeTrue(); - } - - [Test] - public async Task Alternating_MultipleContent_Should_Maintain_Counts() - { - var collectionOne = new Collection - { - Id = 1, - Name = "Multiple Items 1", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) - } - }; - - var collectionTwo = new Collection - { - Id = 2, - Name = "Multiple Items 2", - MediaItems = new List - { - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (collectionOne.Id, collectionOne.MediaItems.ToList()), - (collectionTwo.Id, collectionTwo.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemMultiple - { - Id = 1, - Index = 1, - Collection = collectionOne, - CollectionId = collectionOne.Id, - StartTime = null, - Count = 3, - PlaybackOrder = PlaybackOrder.Chronological - }, - new ProgramScheduleItemMultiple - { - Id = 2, - Index = 2, - Collection = collectionTwo, - CollectionId = collectionTwo.Id, - StartTime = null, - Count = 3, - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - Anchor = new PlayoutAnchor - { - NextStart = HoursAfterMidnight(1).UtcDateTime, - ScheduleItemsEnumeratorState = new CollectionEnumeratorState - { - Index = 0, - Seed = 1 - }, - MultipleRemaining = 2 - }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(5); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Continue, start, finish); - - result.Items.Count.Should().Be(4); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); - result.Items[1].MediaItemId.Should().Be(1); - - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); - result.Items[2].MediaItemId.Should().Be(2); - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4)); - result.Items[3].MediaItemId.Should().Be(2); - - result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(1); - result.Anchor.MultipleRemaining.Should().Be(1); - } - - [Test] - public async Task Alternating_Duration_Should_Maintain_Duration() - { - var collectionOne = new Collection - { - Id = 1, - Name = "Duration Items 1", - MediaItems = new List - { - TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) - } - }; - - var collectionTwo = new Collection - { - Id = 2, - Name = "Duration Items 2", - MediaItems = new List - { - TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) - } - }; - - var fakeRepository = new FakeMediaCollectionRepository( - Map( - (collectionOne.Id, collectionOne.MediaItems.ToList()), - (collectionTwo.Id, collectionTwo.MediaItems.ToList()))); - - var items = new List - { - new ProgramScheduleItemDuration - { - Id = 1, - Index = 1, - Collection = collectionOne, - CollectionId = collectionOne.Id, - StartTime = null, - PlayoutDuration = TimeSpan.FromHours(3), - TailMode = TailMode.None, - PlaybackOrder = PlaybackOrder.Chronological - }, - new ProgramScheduleItemDuration - { - Id = 2, - Index = 2, - Collection = collectionTwo, - CollectionId = collectionTwo.Id, - StartTime = null, - PlayoutDuration = TimeSpan.FromHours(3), - TailMode = TailMode.None, - PlaybackOrder = PlaybackOrder.Chronological - } - }; - - var playout = new Playout - { - ProgramSchedule = new ProgramSchedule - { - Items = items - }, - Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - Anchor = new PlayoutAnchor - { - NextStart = HoursAfterMidnight(1).UtcDateTime, - ScheduleItemsEnumeratorState = new CollectionEnumeratorState - { - Index = 0, - Seed = 1 - }, - DurationFinish = HoursAfterMidnight(3).UtcDateTime - }, - ProgramScheduleAnchors = new List(), - Items = new List() - }; - - var configRepo = new Mock(); - var televisionRepo = new FakeTelevisionRepository(); - var artistRepo = new Mock(); - var builder = new PlayoutBuilder( - configRepo.Object, - fakeRepository, - televisionRepo, - artistRepo.Object, - _logger); - - DateTimeOffset start = HoursAfterMidnight(0); - DateTimeOffset finish = start + TimeSpan.FromHours(5); - - Playout result = await builder.Build(playout, PlayoutBuildMode.Continue, start, finish); - - result.Items.Count.Should().Be(4); - - result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); - result.Items[0].MediaItemId.Should().Be(1); - result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); - result.Items[1].MediaItemId.Should().Be(1); - - result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); - result.Items[2].MediaItemId.Should().Be(2); - result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4)); - result.Items[3].MediaItemId.Should().Be(2); - - result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(1); - result.Anchor.DurationFinish.Should().Be(HoursAfterMidnight(6).UtcDateTime); - } - } - - private static DateTimeOffset HoursAfterMidnight(int hours) - { - DateTimeOffset now = DateTimeOffset.Now; - return now - now.TimeOfDay + TimeSpan.FromHours(hours); - } - - private static ProgramScheduleItem Flood(Collection mediaCollection, PlaybackOrder playbackOrder) => - new ProgramScheduleItemFlood - { - Index = 1, - Collection = mediaCollection, - CollectionId = mediaCollection.Id, - StartTime = null, - PlaybackOrder = playbackOrder - }; - - private static Movie TestMovie(int id, TimeSpan duration, DateTime aired) => - new() - { - Id = id, - MovieMetadata = new List { new() { ReleaseDate = aired } }, - MediaVersions = new List - { - new() { Duration = duration } } }; - private TestData TestDataFloodForItems(List mediaItems, PlaybackOrder playbackOrder) - { - var mediaCollection = new Collection + var fixedCollection = new Collection { - Id = 1, - MediaItems = mediaItems + Id = 2, + Name = "Fixed Items", + MediaItems = new List + { + TestMovie(3, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (floodCollection.Id, floodCollection.MediaItems.ToList()), + (fixedCollection.Id, fixedCollection.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemFlood + { + Index = 1, + Collection = floodCollection, + CollectionId = floodCollection.Id, + StartTime = null, + PlaybackOrder = PlaybackOrder.Chronological + }, + new ProgramScheduleItemOne + { + Index = 2, + Collection = fixedCollection, + CollectionId = fixedCollection.Id, + StartTime = TimeSpan.FromHours(3), + PlaybackOrder = PlaybackOrder.Chronological + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + ProgramScheduleAnchors = new List(), + Items = new List() }; var configRepo = new Mock(); - var collectionRepo = new FakeMediaCollectionRepository(Map((mediaCollection.Id, mediaItems))); var televisionRepo = new FakeTelevisionRepository(); var artistRepo = new Mock(); var builder = new PlayoutBuilder( configRepo.Object, - collectionRepo, + fakeRepository, televisionRepo, artistRepo.Object, _logger); - var items = new List { Flood(mediaCollection, playbackOrder) }; + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(5); + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); + result.Items[1].MediaItemId.Should().Be(2); + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); + result.Items[2].MediaItemId.Should().Be(1); + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); + result.Items[3].MediaItemId.Should().Be(3); + result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(5)); + result.Items[4].MediaItemId.Should().Be(2); + } + + [Test] + public async Task FloodContent_Should_FloodAroundFixedContent_Multiple() + { + var floodCollection = new Collection + { + Id = 1, + Name = "Flood Items", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) + } + }; + + var fixedCollection = new Collection + { + Id = 2, + Name = "Fixed Items", + MediaItems = new List + { + TestMovie(3, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)), + TestMovie(4, TimeSpan.FromHours(1), new DateTime(2020, 1, 2)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (floodCollection.Id, floodCollection.MediaItems.ToList()), + (fixedCollection.Id, fixedCollection.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemFlood + { + Index = 1, + Collection = floodCollection, + CollectionId = floodCollection.Id, + StartTime = null, + PlaybackOrder = PlaybackOrder.Chronological + }, + new ProgramScheduleItemMultiple + { + Index = 2, + Collection = fixedCollection, + CollectionId = fixedCollection.Id, + StartTime = TimeSpan.FromHours(3), + Count = 2, + PlaybackOrder = PlaybackOrder.Chronological + } + }; var playout = new Playout { - Id = 1, - ProgramSchedule = new ProgramSchedule { Items = items }, + ProgramSchedule = new ProgramSchedule + { + Items = items + }, Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, - Items = new List(), - ProgramScheduleAnchors = new List() + ProgramScheduleAnchors = new List(), + Items = new List() }; - return new TestData(builder, playout); + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(7); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(6); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); + result.Items[1].MediaItemId.Should().Be(2); + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); + result.Items[2].MediaItemId.Should().Be(1); + + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); + result.Items[3].MediaItemId.Should().Be(3); + result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(5)); + result.Items[4].MediaItemId.Should().Be(4); + + result.Items[5].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + result.Items[5].MediaItemId.Should().Be(2); } - private record TestData(PlayoutBuilder Builder, Playout Playout); + [Test] + public async Task FloodContent_Should_FloodWithFixedStartTime() + { + var floodCollection = new Collection + { + Id = 1, + Name = "Flood Items", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) + } + }; + + var fixedCollection = new Collection + { + Id = 2, + Name = "Fixed Items", + MediaItems = new List + { + TestMovie(3, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)), + TestMovie(4, TimeSpan.FromHours(1), new DateTime(2020, 1, 2)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (floodCollection.Id, floodCollection.MediaItems.ToList()), + (fixedCollection.Id, fixedCollection.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemFlood + { + Index = 1, + Collection = floodCollection, + CollectionId = floodCollection.Id, + StartTime = TimeSpan.FromHours(7), + PlaybackOrder = PlaybackOrder.Chronological + }, + new ProgramScheduleItemOne + { + Index = 2, + Collection = fixedCollection, + CollectionId = fixedCollection.Id, + StartTime = TimeSpan.FromHours(12), + PlaybackOrder = PlaybackOrder.Chronological + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(24); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(6); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(7)); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(8)); + result.Items[1].MediaItemId.Should().Be(2); + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(9)); + result.Items[2].MediaItemId.Should().Be(1); + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(10)); + result.Items[3].MediaItemId.Should().Be(2); + result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(11)); + result.Items[4].MediaItemId.Should().Be(1); + + result.Items[5].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + result.Items[5].MediaItemId.Should().Be(3); + } + + [Test] + public async Task ContinuePlayout_FloodContent_Should_FloodWithFixedStartTime_FromAnchor() + { + var floodCollection = new Collection + { + Id = 1, + Name = "Flood Items", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) + } + }; + + var fixedCollection = new Collection + { + Id = 2, + Name = "Fixed Items", + MediaItems = new List + { + TestMovie(3, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)), + TestMovie(4, TimeSpan.FromHours(1), new DateTime(2020, 1, 2)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (floodCollection.Id, floodCollection.MediaItems.ToList()), + (fixedCollection.Id, fixedCollection.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemFlood + { + Index = 1, + Collection = floodCollection, + CollectionId = floodCollection.Id, + StartTime = TimeSpan.FromHours(7), + PlaybackOrder = PlaybackOrder.Chronological + }, + new ProgramScheduleItemOne + { + Index = 2, + Collection = fixedCollection, + CollectionId = fixedCollection.Id, + StartTime = TimeSpan.FromHours(12), + PlaybackOrder = PlaybackOrder.Chronological + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + Anchor = new PlayoutAnchor + { + NextStart = HoursAfterMidnight(9).UtcDateTime, + ScheduleItemsEnumeratorState = new CollectionEnumeratorState + { + Index = 0, + Seed = 1 + }, + InFlood = true + }, + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(32); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Continue, start, finish); + + result.Items.Count.Should().Be(5); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(9)); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(10)); + result.Items[1].MediaItemId.Should().Be(2); + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(11)); + result.Items[2].MediaItemId.Should().Be(1); + + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + result.Items[3].MediaItemId.Should().Be(3); + + result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(7)); + result.Items[4].MediaItemId.Should().Be(2); + + result.Anchor.InFlood.Should().BeTrue(); + } + + [Test] + public async Task FloodContent_Should_FloodAroundFixedContent_DurationWithoutOfflineTail() + { + var floodCollection = new Collection + { + Id = 1, + Name = "Flood Items", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) + } + }; + + var fixedCollection = new Collection + { + Id = 2, + Name = "Fixed Items", + MediaItems = new List + { + TestMovie(3, TimeSpan.FromHours(0.75), new DateTime(2020, 1, 1)), + TestMovie(4, TimeSpan.FromHours(1.5), new DateTime(2020, 1, 2)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (floodCollection.Id, floodCollection.MediaItems.ToList()), + (fixedCollection.Id, fixedCollection.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemFlood + { + Index = 1, + Collection = floodCollection, + CollectionId = floodCollection.Id, + StartTime = null, + PlaybackOrder = PlaybackOrder.Chronological + }, + new ProgramScheduleItemDuration + { + Index = 2, + Collection = fixedCollection, + CollectionId = fixedCollection.Id, + StartTime = TimeSpan.FromHours(2), + PlayoutDuration = TimeSpan.FromHours(2), + TailMode = TailMode.None, // immediately continue + PlaybackOrder = PlaybackOrder.Chronological + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(7); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); + result.Items[1].MediaItemId.Should().Be(2); + + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); + result.Items[2].MediaItemId.Should().Be(3); + + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2.75)); + result.Items[3].MediaItemId.Should().Be(1); + result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3.75)); + result.Items[4].MediaItemId.Should().Be(2); + + result.Items[5].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4.75)); + result.Items[5].MediaItemId.Should().Be(1); + result.Items[6].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(5.75)); + result.Items[6].MediaItemId.Should().Be(2); + } + + [Test] + public async Task MultipleContent_Should_WrapAroundDynamicContent_DurationWithoutOfflineTail() + { + var multipleCollection = new Collection + { + Id = 1, + Name = "Multiple Items", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) + } + }; + + var dynamicCollection = new Collection + { + Id = 2, + Name = "Dynamic Items", + MediaItems = new List + { + TestMovie(3, TimeSpan.FromHours(0.75), new DateTime(2020, 1, 1)), + TestMovie(4, TimeSpan.FromHours(1.5), new DateTime(2020, 1, 2)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (multipleCollection.Id, multipleCollection.MediaItems.ToList()), + (dynamicCollection.Id, dynamicCollection.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemMultiple + { + Index = 1, + Collection = multipleCollection, + CollectionId = multipleCollection.Id, + StartTime = null, + Count = 2, + PlaybackOrder = PlaybackOrder.Chronological + }, + new ProgramScheduleItemDuration + { + Index = 2, + Collection = dynamicCollection, + CollectionId = dynamicCollection.Id, + StartTime = null, + PlayoutDuration = TimeSpan.FromHours(2), + TailMode = TailMode.None, // immediately continue + PlaybackOrder = PlaybackOrder.Chronological + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(6); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); + result.Items[1].MediaItemId.Should().Be(2); + + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); + result.Items[2].MediaItemId.Should().Be(3); + + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2.75)); + result.Items[3].MediaItemId.Should().Be(1); + result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3.75)); + result.Items[4].MediaItemId.Should().Be(2); + + result.Items[5].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4.75)); + result.Items[5].MediaItemId.Should().Be(4); + } + + [Test] + public async Task ContinuePlayout_Alternating_MultipleContent_Should_Maintain_Counts() + { + var collectionOne = new Collection + { + Id = 1, + Name = "Multiple Items 1", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) + } + }; + + var collectionTwo = new Collection + { + Id = 2, + Name = "Multiple Items 2", + MediaItems = new List + { + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (collectionOne.Id, collectionOne.MediaItems.ToList()), + (collectionTwo.Id, collectionTwo.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemMultiple + { + Id = 1, + Index = 1, + Collection = collectionOne, + CollectionId = collectionOne.Id, + StartTime = null, + Count = 3, + PlaybackOrder = PlaybackOrder.Chronological + }, + new ProgramScheduleItemMultiple + { + Id = 2, + Index = 2, + Collection = collectionTwo, + CollectionId = collectionTwo.Id, + StartTime = null, + Count = 3, + PlaybackOrder = PlaybackOrder.Chronological + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + Anchor = new PlayoutAnchor + { + NextStart = HoursAfterMidnight(1).UtcDateTime, + ScheduleItemsEnumeratorState = new CollectionEnumeratorState + { + Index = 0, + Seed = 1 + }, + MultipleRemaining = 2 + }, + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(5); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Continue, start, finish); + + result.Items.Count.Should().Be(4); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); + result.Items[1].MediaItemId.Should().Be(1); + + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); + result.Items[2].MediaItemId.Should().Be(2); + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4)); + result.Items[3].MediaItemId.Should().Be(2); + + result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(1); + result.Anchor.MultipleRemaining.Should().Be(1); + } + + [Test] + public async Task Auto_Zero_MultipleCount() + { + var collectionOne = new Collection + { + Id = 1, + Name = "Multiple Items 1", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), + TestMovie(3, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) + } + }; + + var collectionTwo = new Collection + { + Id = 2, + Name = "Multiple Items 2", + MediaItems = new List + { + TestMovie(4, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), + TestMovie(5, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (collectionOne.Id, collectionOne.MediaItems.ToList()), + (collectionTwo.Id, collectionTwo.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemMultiple + { + Id = 1, + Index = 1, + Collection = collectionOne, + CollectionId = collectionOne.Id, + StartTime = null, + Count = 0, + PlaybackOrder = PlaybackOrder.Chronological + }, + new ProgramScheduleItemMultiple + { + Id = 2, + Index = 2, + Collection = collectionTwo, + CollectionId = collectionTwo.Id, + StartTime = null, + Count = 0, + PlaybackOrder = PlaybackOrder.Chronological + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(5); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(5); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(0)); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); + result.Items[1].MediaItemId.Should().Be(2); + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); + result.Items[2].MediaItemId.Should().Be(3); + + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); + result.Items[3].MediaItemId.Should().Be(4); + result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4)); + result.Items[4].MediaItemId.Should().Be(5); + + result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(0); + result.Anchor.MultipleRemaining.Should().BeNull(); + } + + [Test] + public async Task ContinuePlayout_Alternating_Duration_Should_Maintain_Duration() + { + var collectionOne = new Collection + { + Id = 1, + Name = "Duration Items 1", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) + } + }; + + var collectionTwo = new Collection + { + Id = 2, + Name = "Duration Items 2", + MediaItems = new List + { + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (collectionOne.Id, collectionOne.MediaItems.ToList()), + (collectionTwo.Id, collectionTwo.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemDuration + { + Id = 1, + Index = 1, + Collection = collectionOne, + CollectionId = collectionOne.Id, + StartTime = null, + PlayoutDuration = TimeSpan.FromHours(3), + TailMode = TailMode.None, + PlaybackOrder = PlaybackOrder.Chronological + }, + new ProgramScheduleItemDuration + { + Id = 2, + Index = 2, + Collection = collectionTwo, + CollectionId = collectionTwo.Id, + StartTime = null, + PlayoutDuration = TimeSpan.FromHours(3), + TailMode = TailMode.None, + PlaybackOrder = PlaybackOrder.Chronological + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + Anchor = new PlayoutAnchor + { + NextStart = HoursAfterMidnight(1).UtcDateTime, + ScheduleItemsEnumeratorState = new CollectionEnumeratorState + { + Index = 0, + Seed = 1 + }, + DurationFinish = HoursAfterMidnight(3).UtcDateTime + }, + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(5); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Continue, start, finish); + + result.Items.Count.Should().Be(4); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); + result.Items[1].MediaItemId.Should().Be(1); + + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); + result.Items[2].MediaItemId.Should().Be(2); + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4)); + result.Items[3].MediaItemId.Should().Be(2); + + result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(1); + result.Anchor.DurationFinish.Should().Be(HoursAfterMidnight(6).UtcDateTime); + } + + [Test] + public async Task Alternating_Duration_With_Filler_Should_Alternate_Schedule_Items() + { + var collectionOne = new Collection + { + Id = 1, + Name = "Duration Items 1", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromMinutes(55), new DateTime(2020, 1, 1)) + } + }; + + var collectionTwo = new Collection + { + Id = 2, + Name = "Duration Items 2", + MediaItems = new List + { + TestMovie(2, TimeSpan.FromMinutes(55), new DateTime(2020, 1, 1)) + } + }; + + var collectionThree = new Collection + { + Id = 3, + Name = "Filler Items", + MediaItems = new List + { + TestMovie(3, TimeSpan.FromMinutes(5), new DateTime(2020, 1, 1)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (collectionOne.Id, collectionOne.MediaItems.ToList()), + (collectionTwo.Id, collectionTwo.MediaItems.ToList()), + (collectionThree.Id, collectionThree.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemDuration + { + Id = 1, + Index = 1, + Collection = collectionOne, + CollectionId = collectionOne.Id, + StartTime = null, + PlayoutDuration = TimeSpan.FromHours(3), + PlaybackOrder = PlaybackOrder.Chronological, + TailMode = TailMode.Filler, + TailFiller = new FillerPreset + { + FillerKind = FillerKind.Tail, + Collection = collectionThree, + CollectionId = collectionThree.Id + } + }, + new ProgramScheduleItemDuration + { + Id = 2, + Index = 2, + Collection = collectionTwo, + CollectionId = collectionTwo.Id, + StartTime = null, + PlayoutDuration = TimeSpan.FromHours(3), + PlaybackOrder = PlaybackOrder.Chronological, + TailMode = TailMode.Filler, + TailFiller = new FillerPreset + { + FillerKind = FillerKind.Tail, + Collection = collectionThree, + CollectionId = collectionThree.Id + } + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(12); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromMinutes(0)); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromMinutes(55)); + result.Items[1].MediaItemId.Should().Be(1); + result.Items[2].StartOffset.TimeOfDay.Should().Be(new TimeSpan(1, 50, 0)); + result.Items[2].MediaItemId.Should().Be(1); + + result.Items[3].StartOffset.TimeOfDay.Should().Be(new TimeSpan(2, 45, 0)); + result.Items[3].MediaItemId.Should().Be(3); + result.Items[4].StartOffset.TimeOfDay.Should().Be(new TimeSpan(2, 50, 0)); + result.Items[4].MediaItemId.Should().Be(3); + result.Items[5].StartOffset.TimeOfDay.Should().Be(new TimeSpan(2, 55, 0)); + result.Items[5].MediaItemId.Should().Be(3); + + result.Items[6].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); + result.Items[6].MediaItemId.Should().Be(2); + result.Items[7].StartOffset.TimeOfDay.Should().Be(new TimeSpan(3, 55, 0)); + result.Items[7].MediaItemId.Should().Be(2); + result.Items[8].StartOffset.TimeOfDay.Should().Be(new TimeSpan(4, 50, 0)); + result.Items[8].MediaItemId.Should().Be(2); + + result.Items[9].StartOffset.TimeOfDay.Should().Be(new TimeSpan(5, 45, 0)); + result.Items[9].MediaItemId.Should().Be(3); + result.Items[10].StartOffset.TimeOfDay.Should().Be(new TimeSpan(5, 50, 0)); + result.Items[10].MediaItemId.Should().Be(3); + result.Items[11].StartOffset.TimeOfDay.Should().Be(new TimeSpan(5, 55, 0)); + result.Items[11].MediaItemId.Should().Be(3); + + result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(0); + result.Anchor.DurationFinish.Should().BeNull(); + } + + [Test] + public async Task Duration_Should_Skip_Items_That_Are_Too_Long() + { + var collectionOne = new Collection + { + Id = 1, + Name = "Duration Items 1", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)), + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), + TestMovie(3, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)), + TestMovie(4, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) + } + }; + + var fakeRepository = + new FakeMediaCollectionRepository(Map((collectionOne.Id, collectionOne.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemDuration + { + Id = 1, + Index = 1, + Collection = collectionOne, + CollectionId = collectionOne.Id, + StartTime = null, + PlayoutDuration = TimeSpan.FromHours(1), + PlaybackOrder = PlaybackOrder.Chronological, + TailMode = TailMode.None + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(6); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(0)); + result.Items[0].MediaItemId.Should().Be(2); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); + result.Items[1].MediaItemId.Should().Be(4); + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); + result.Items[2].MediaItemId.Should().Be(2); + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); + result.Items[3].MediaItemId.Should().Be(4); + result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4)); + result.Items[4].MediaItemId.Should().Be(2); + result.Items[5].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(5)); + result.Items[5].MediaItemId.Should().Be(4); + + result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(0); + result.Anchor.DurationFinish.Should().BeNull(); + } + + [Test] + public async Task Two_Day_Playout_Should_Create_Date_Anchors_For_Midnight() + { + var mediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(6), new DateTime(2002, 1, 1)), + TestMovie(2, TimeSpan.FromHours(6), new DateTime(2003, 1, 1)), + TestMovie(3, TimeSpan.FromHours(6), new DateTime(2004, 1, 1)) + }; + + (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromDays(2); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(8); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + result.Items[0].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + result.Items[1].MediaItemId.Should().Be(2); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + result.Items[1].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + result.Items[2].MediaItemId.Should().Be(3); + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + result.Items[2].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); + result.Items[3].MediaItemId.Should().Be(1); + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); + result.Items[3].FinishOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + result.Items[4].MediaItemId.Should().Be(2); + result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + result.Items[4].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + result.Items[5].MediaItemId.Should().Be(3); + result.Items[5].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + result.Items[5].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + result.Items[6].MediaItemId.Should().Be(1); + result.Items[6].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + result.Items[6].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); + result.Items[7].MediaItemId.Should().Be(2); + result.Items[7].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); + result.Items[7].FinishOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + + result.ProgramScheduleAnchors.Count.Should().Be(2); + result.ProgramScheduleAnchors.Count(a => a.EnumeratorState.Index == 4 % 3).Should().Be(1); + result.ProgramScheduleAnchors.Count(a => a.EnumeratorState.Index == 8 % 3).Should().Be(1); + + int seed = result.ProgramScheduleAnchors[0].EnumeratorState.Seed; + result.ProgramScheduleAnchors.All(a => a.EnumeratorState.Seed == seed).Should().BeTrue(); + } } + + [TestFixture] + public class ResetPlayout : PlayoutBuilderTests + { + [Test] + public async Task ShuffleFlood_Should_IgnoreAnchors() + { + var mediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), DateTime.Today), + TestMovie(2, TimeSpan.FromHours(1), DateTime.Today.AddHours(1)), + TestMovie(3, TimeSpan.FromHours(1), DateTime.Today.AddHours(2)), + TestMovie(4, TimeSpan.FromHours(1), DateTime.Today.AddHours(3)), + TestMovie(5, TimeSpan.FromHours(1), DateTime.Today.AddHours(4)), + TestMovie(6, TimeSpan.FromHours(1), DateTime.Today.AddHours(5)) + }; + + (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Shuffle); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(6); + result.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); + + result.ProgramScheduleAnchors.Count.Should().Be(1); + result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); + + int firstSeedValue = result.ProgramScheduleAnchors.Head().EnumeratorState.Seed; + + DateTimeOffset start2 = HoursAfterMidnight(0); + DateTimeOffset finish2 = start2 + TimeSpan.FromHours(6); + + Playout result2 = await builder.Build(playout, PlayoutBuildMode.Reset, start2, finish2); + + result2.Items.Count.Should().Be(6); + result2.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); + + result2.ProgramScheduleAnchors.Count.Should().Be(1); + result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); + + int secondSeedValue = result2.ProgramScheduleAnchors.Head().EnumeratorState.Seed; + + firstSeedValue.Should().NotBe(secondSeedValue); + } + } + + [TestFixture] + public class RefreshPlayout : PlayoutBuilderTests + { + [Test] + public async Task Two_Day_Playout_Should_Refresh_From_Midnight_Anchor() + { + var collectionOne = new Collection + { + Id = 1, + Name = "Duration Items 1", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(6), new DateTime(2002, 1, 1)), + TestMovie(2, TimeSpan.FromHours(6), new DateTime(2003, 1, 1)), + TestMovie(3, TimeSpan.FromHours(6), new DateTime(2004, 1, 1)) + } + }; + + var fakeRepository = + new FakeMediaCollectionRepository(Map((collectionOne.Id, collectionOne.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemFlood + { + Id = 1, + Index = 1, + Collection = collectionOne, + CollectionId = collectionOne.Id, + StartTime = null, + PlaybackOrder = PlaybackOrder.Chronological + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + + // this should be ignored + Anchor = new PlayoutAnchor + { + NextStart = HoursAfterMidnight(1).UtcDateTime, + ScheduleItemsEnumeratorState = new CollectionEnumeratorState + { + Index = 0, + Seed = 1 + }, + DurationFinish = HoursAfterMidnight(3).UtcDateTime + }, + + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + playout.ProgramScheduleAnchors.Add( + new PlayoutProgramScheduleAnchor + { + AnchorDate = HoursAfterMidnight(24).UtcDateTime, + Collection = collectionOne, + CollectionId = collectionOne.Id, + CollectionType = ProgramScheduleItemCollectionType.Collection, + EnumeratorState = new CollectionEnumeratorState + { + Index = 1, + Seed = 12345 + }, + Playout = playout, + ProgramSchedule = playout.ProgramSchedule + }); + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(24); + DateTimeOffset finish = start + TimeSpan.FromDays(1); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Refresh, start, finish); + + result.Items.Count.Should().Be(4); + result.Items[0].MediaItemId.Should().Be(2); + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + result.Items[0].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + result.Items[1].MediaItemId.Should().Be(3); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + result.Items[1].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + result.Items[2].MediaItemId.Should().Be(1); + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + result.Items[2].FinishOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); + result.Items[3].MediaItemId.Should().Be(2); + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); + result.Items[3].FinishOffset.TimeOfDay.Should().Be(TimeSpan.Zero); + } + } + + [TestFixture] + public class ContinuePlayout : PlayoutBuilderTests + { + [Test] + public async Task ChronologicalFlood_Should_AnchorAndMaintainExistingPlayout() + { + var mediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(6), DateTime.Today), + TestMovie(2, TimeSpan.FromHours(6), DateTime.Today.AddHours(1)) + }; + + (PlayoutBuilder builder, Playout playout) = + TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(1); + result.Items.Head().MediaItemId.Should().Be(1); + + result.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); + + result.ProgramScheduleAnchors.Count.Should().Be(1); + result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); + + DateTimeOffset start2 = HoursAfterMidnight(1); + DateTimeOffset finish2 = start2 + TimeSpan.FromHours(6); + + Playout result2 = await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); + + result2.Items.Count.Should().Be(2); + result2.Items.Last().StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + result2.Items.Last().MediaItemId.Should().Be(2); + + result2.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(12)); + result2.ProgramScheduleAnchors.Count.Should().Be(1); + result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); + } + + [Test] + public async Task ChronologicalFlood_Should_AnchorAndReturnNewPlayoutItems() + { + var mediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(6), DateTime.Today), + TestMovie(2, TimeSpan.FromHours(6), DateTime.Today.AddHours(1)) + }; + + (PlayoutBuilder builder, Playout playout) = + TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(1); + result.Items.Head().MediaItemId.Should().Be(1); + + result.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(6)); + result.ProgramScheduleAnchors.Count.Should().Be(1); + result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); + + DateTimeOffset start2 = HoursAfterMidnight(1); + DateTimeOffset finish2 = start2 + TimeSpan.FromHours(12); + + Playout result2 = await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); + + result2.Items.Count.Should().Be(3); + result2.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + result2.Items[1].MediaItemId.Should().Be(2); + result2.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + result2.Items[2].MediaItemId.Should().Be(1); + + result2.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(18)); + result2.ProgramScheduleAnchors.Count.Should().Be(1); + result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); + } + + [Test] + public async Task ChronologicalFlood_Should_AnchorAndReturnNewPlayoutItems_MultiDay() + { + var mediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(6), DateTime.Today), + TestMovie(2, TimeSpan.FromHours(6), DateTime.Today.AddHours(1)) + }; + + (PlayoutBuilder builder, Playout playout) = + TestDataFloodForItems(mediaItems, PlaybackOrder.Chronological); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromDays(1); + + await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + playout.Items.Count.Should().Be(4); + playout.Items.Map(i => i.MediaItemId).ToList().Should().Equal(1, 2, 1, 2); + + playout.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddDays(1)); + playout.ProgramScheduleAnchors.Count.Should().Be(1); + playout.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); + + PlayoutProgramScheduleAnchor headAnchor = playout.ProgramScheduleAnchors.Head(); + + // throw in a detractor anchor - playout builder should prioritize the "continue" anchor + playout.ProgramScheduleAnchors.Insert( + 0, + new PlayoutProgramScheduleAnchor + { + Id = headAnchor.Id + 1, + Collection = headAnchor.Collection, + CollectionId = headAnchor.CollectionId, + Playout = playout, + PlayoutId = playout.Id, + AnchorDate = DateTime.Today.ToUniversalTime(), + CollectionType = headAnchor.CollectionType, + EnumeratorState = new CollectionEnumeratorState + { Index = headAnchor.EnumeratorState.Index + 1, Seed = headAnchor.EnumeratorState.Seed }, + MediaItem = headAnchor.MediaItem, + MediaItemId = headAnchor.MediaItemId, + MultiCollection = headAnchor.MultiCollection, + MultiCollectionId = headAnchor.MultiCollectionId, + ProgramSchedule = headAnchor.ProgramSchedule, + ProgramScheduleId = headAnchor.ProgramScheduleId, + SmartCollection = headAnchor.SmartCollection, + SmartCollectionId = headAnchor.SmartCollectionId + }); + + // continue 1h later + DateTimeOffset start2 = HoursAfterMidnight(1); + DateTimeOffset finish2 = start2 + TimeSpan.FromDays(1); + + await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); + + playout.Items.Count.Should().Be(5); + playout.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(0)); + playout.Items[0].MediaItemId.Should().Be(1); + playout.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + playout.Items[1].MediaItemId.Should().Be(2); + playout.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + playout.Items[2].MediaItemId.Should().Be(1); + playout.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); + playout.Items[3].MediaItemId.Should().Be(2); + playout.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(0)); + playout.Items[4].MediaItemId.Should().Be(1); + + playout.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(30)); + + playout.ProgramScheduleAnchors.Count.Should().Be(2); + playout.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); + + // continue 1h later + DateTimeOffset start3 = HoursAfterMidnight(2); + DateTimeOffset finish3 = start3 + TimeSpan.FromDays(1); + + await builder.Build(playout, PlayoutBuildMode.Continue, start3, finish3); + + playout.Items.Count.Should().Be(5); + playout.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(0)); + playout.Items[0].MediaItemId.Should().Be(1); + playout.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(6)); + playout.Items[1].MediaItemId.Should().Be(2); + playout.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + playout.Items[2].MediaItemId.Should().Be(1); + playout.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(18)); + playout.Items[3].MediaItemId.Should().Be(2); + playout.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(0)); + playout.Items[4].MediaItemId.Should().Be(1); + + playout.Anchor.NextStartOffset.Should().Be(DateTime.Today.AddHours(30)); + + playout.ProgramScheduleAnchors.Count.Should().Be(2); + playout.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(1); + } + + [Test] + public async Task ShuffleFlood_Should_MaintainRandomSeed() + { + var mediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), DateTime.Today), + TestMovie(2, TimeSpan.FromHours(1), DateTime.Today.AddHours(1)), + TestMovie(3, TimeSpan.FromHours(1), DateTime.Today.AddHours(3)) + }; + + (PlayoutBuilder builder, Playout playout) = TestDataFloodForItems(mediaItems, PlaybackOrder.Shuffle); + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(6); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Reset, start, finish); + + result.Items.Count.Should().Be(6); + result.ProgramScheduleAnchors.Count.Should().Be(1); + result.ProgramScheduleAnchors.Head().EnumeratorState.Seed.Should().BeGreaterThan(0); + result.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); + + int firstSeedValue = result.ProgramScheduleAnchors.Head().EnumeratorState.Seed; + + DateTimeOffset start2 = HoursAfterMidnight(0); + DateTimeOffset finish2 = start2 + TimeSpan.FromHours(6); + + Playout result2 = await builder.Build(playout, PlayoutBuildMode.Continue, start2, finish2); + + int secondSeedValue = result2.ProgramScheduleAnchors.Head().EnumeratorState.Seed; + + firstSeedValue.Should().Be(secondSeedValue); + + result2.ProgramScheduleAnchors.Head().EnumeratorState.Index.Should().Be(0); + } + + [Test] + public async Task FloodContent_Should_FloodWithFixedStartTime_FromAnchor() + { + var floodCollection = new Collection + { + Id = 1, + Name = "Flood Items", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)), + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 2, 1)) + } + }; + + var fixedCollection = new Collection + { + Id = 2, + Name = "Fixed Items", + MediaItems = new List + { + TestMovie(3, TimeSpan.FromHours(2), new DateTime(2020, 1, 1)), + TestMovie(4, TimeSpan.FromHours(1), new DateTime(2020, 1, 2)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (floodCollection.Id, floodCollection.MediaItems.ToList()), + (fixedCollection.Id, fixedCollection.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemFlood + { + Index = 1, + Collection = floodCollection, + CollectionId = floodCollection.Id, + StartTime = TimeSpan.FromHours(7), + PlaybackOrder = PlaybackOrder.Chronological + }, + new ProgramScheduleItemOne + { + Index = 2, + Collection = fixedCollection, + CollectionId = fixedCollection.Id, + StartTime = TimeSpan.FromHours(12), + PlaybackOrder = PlaybackOrder.Chronological + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + Anchor = new PlayoutAnchor + { + NextStart = HoursAfterMidnight(9).UtcDateTime, + ScheduleItemsEnumeratorState = new CollectionEnumeratorState + { + Index = 0, + Seed = 1 + }, + InFlood = true + }, + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(32); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Continue, start, finish); + + result.Items.Count.Should().Be(5); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(9)); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(10)); + result.Items[1].MediaItemId.Should().Be(2); + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(11)); + result.Items[2].MediaItemId.Should().Be(1); + + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(12)); + result.Items[3].MediaItemId.Should().Be(3); + + result.Items[4].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(7)); + result.Items[4].MediaItemId.Should().Be(2); + + result.Anchor.InFlood.Should().BeTrue(); + } + + [Test] + public async Task Alternating_MultipleContent_Should_Maintain_Counts() + { + var collectionOne = new Collection + { + Id = 1, + Name = "Multiple Items 1", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) + } + }; + + var collectionTwo = new Collection + { + Id = 2, + Name = "Multiple Items 2", + MediaItems = new List + { + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (collectionOne.Id, collectionOne.MediaItems.ToList()), + (collectionTwo.Id, collectionTwo.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemMultiple + { + Id = 1, + Index = 1, + Collection = collectionOne, + CollectionId = collectionOne.Id, + StartTime = null, + Count = 3, + PlaybackOrder = PlaybackOrder.Chronological + }, + new ProgramScheduleItemMultiple + { + Id = 2, + Index = 2, + Collection = collectionTwo, + CollectionId = collectionTwo.Id, + StartTime = null, + Count = 3, + PlaybackOrder = PlaybackOrder.Chronological + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + Anchor = new PlayoutAnchor + { + NextStart = HoursAfterMidnight(1).UtcDateTime, + ScheduleItemsEnumeratorState = new CollectionEnumeratorState + { + Index = 0, + Seed = 1 + }, + MultipleRemaining = 2 + }, + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(5); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Continue, start, finish); + + result.Items.Count.Should().Be(4); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); + result.Items[1].MediaItemId.Should().Be(1); + + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); + result.Items[2].MediaItemId.Should().Be(2); + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4)); + result.Items[3].MediaItemId.Should().Be(2); + + result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(1); + result.Anchor.MultipleRemaining.Should().Be(1); + } + + [Test] + public async Task Alternating_Duration_Should_Maintain_Duration() + { + var collectionOne = new Collection + { + Id = 1, + Name = "Duration Items 1", + MediaItems = new List + { + TestMovie(1, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) + } + }; + + var collectionTwo = new Collection + { + Id = 2, + Name = "Duration Items 2", + MediaItems = new List + { + TestMovie(2, TimeSpan.FromHours(1), new DateTime(2020, 1, 1)) + } + }; + + var fakeRepository = new FakeMediaCollectionRepository( + Map( + (collectionOne.Id, collectionOne.MediaItems.ToList()), + (collectionTwo.Id, collectionTwo.MediaItems.ToList()))); + + var items = new List + { + new ProgramScheduleItemDuration + { + Id = 1, + Index = 1, + Collection = collectionOne, + CollectionId = collectionOne.Id, + StartTime = null, + PlayoutDuration = TimeSpan.FromHours(3), + TailMode = TailMode.None, + PlaybackOrder = PlaybackOrder.Chronological + }, + new ProgramScheduleItemDuration + { + Id = 2, + Index = 2, + Collection = collectionTwo, + CollectionId = collectionTwo.Id, + StartTime = null, + PlayoutDuration = TimeSpan.FromHours(3), + TailMode = TailMode.None, + PlaybackOrder = PlaybackOrder.Chronological + } + }; + + var playout = new Playout + { + ProgramSchedule = new ProgramSchedule + { + Items = items + }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + Anchor = new PlayoutAnchor + { + NextStart = HoursAfterMidnight(1).UtcDateTime, + ScheduleItemsEnumeratorState = new CollectionEnumeratorState + { + Index = 0, + Seed = 1 + }, + DurationFinish = HoursAfterMidnight(3).UtcDateTime + }, + ProgramScheduleAnchors = new List(), + Items = new List() + }; + + var configRepo = new Mock(); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + fakeRepository, + televisionRepo, + artistRepo.Object, + _logger); + + DateTimeOffset start = HoursAfterMidnight(0); + DateTimeOffset finish = start + TimeSpan.FromHours(5); + + Playout result = await builder.Build(playout, PlayoutBuildMode.Continue, start, finish); + + result.Items.Count.Should().Be(4); + + result.Items[0].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(1)); + result.Items[0].MediaItemId.Should().Be(1); + result.Items[1].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(2)); + result.Items[1].MediaItemId.Should().Be(1); + + result.Items[2].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(3)); + result.Items[2].MediaItemId.Should().Be(2); + result.Items[3].StartOffset.TimeOfDay.Should().Be(TimeSpan.FromHours(4)); + result.Items[3].MediaItemId.Should().Be(2); + + result.Anchor.ScheduleItemsEnumeratorState.Index.Should().Be(1); + result.Anchor.DurationFinish.Should().Be(HoursAfterMidnight(6).UtcDateTime); + } + } + + private static DateTimeOffset HoursAfterMidnight(int hours) + { + DateTimeOffset now = DateTimeOffset.Now; + return now - now.TimeOfDay + TimeSpan.FromHours(hours); + } + + private static ProgramScheduleItem Flood(Collection mediaCollection, PlaybackOrder playbackOrder) => + new ProgramScheduleItemFlood + { + Index = 1, + Collection = mediaCollection, + CollectionId = mediaCollection.Id, + StartTime = null, + PlaybackOrder = playbackOrder + }; + + private static Movie TestMovie(int id, TimeSpan duration, DateTime aired) => + new() + { + Id = id, + MovieMetadata = new List { new() { ReleaseDate = aired } }, + MediaVersions = new List + { + new() { Duration = duration } + } + }; + + private TestData TestDataFloodForItems(List mediaItems, PlaybackOrder playbackOrder) + { + var mediaCollection = new Collection + { + Id = 1, + MediaItems = mediaItems + }; + + var configRepo = new Mock(); + var collectionRepo = new FakeMediaCollectionRepository(Map((mediaCollection.Id, mediaItems))); + var televisionRepo = new FakeTelevisionRepository(); + var artistRepo = new Mock(); + var builder = new PlayoutBuilder( + configRepo.Object, + collectionRepo, + televisionRepo, + artistRepo.Object, + _logger); + + var items = new List { Flood(mediaCollection, playbackOrder) }; + + var playout = new Playout + { + Id = 1, + ProgramSchedule = new ProgramSchedule { Items = items }, + Channel = new Channel(Guid.Empty) { Id = 1, Name = "Test Channel" }, + Items = new List(), + ProgramScheduleAnchors = new List() + }; + + return new TestData(builder, playout); + } + + private record TestData(PlayoutBuilder Builder, Playout Playout); } diff --git a/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerBaseTests.cs b/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerBaseTests.cs index f310b4f2e..588083455 100644 --- a/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerBaseTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerBaseTests.cs @@ -271,7 +271,7 @@ public class PlayoutModeSchedulerBaseTests : SchedulerTestBase Dictionary enumerators = CollectionEnumerators( scheduleItem, enumerator); - + // too lazy to make another enumerator for the filler that we don't want enumerators.Add(CollectionKey.ForFillerPreset(scheduleItem.MidRollFiller), enumerator); @@ -328,7 +328,7 @@ public class PlayoutModeSchedulerBaseTests : SchedulerTestBase Dictionary enumerators = CollectionEnumerators( scheduleItem, enumerator); - + enumerators.Add(CollectionKey.ForFillerPreset(scheduleItem.MidRollFiller), fillerEnumerator); List playoutItems = Scheduler() @@ -343,10 +343,10 @@ public class PlayoutModeSchedulerBaseTests : SchedulerTestBase Finish = startState.CurrentTime.AddHours(1).UtcDateTime }, new List - { - new() { StartTime = TimeSpan.Zero, EndTime = TimeSpan.FromMinutes(6) }, - new() { StartTime = TimeSpan.FromMinutes(6), EndTime = TimeSpan.FromMinutes(60) } - }); + { + new() { StartTime = TimeSpan.Zero, EndTime = TimeSpan.FromMinutes(6) }, + new() { StartTime = TimeSpan.FromMinutes(6), EndTime = TimeSpan.FromMinutes(60) } + }); playoutItems.Count.Should().Be(3); playoutItems[0].MediaItemId.Should().Be(1); @@ -427,4 +427,4 @@ public class PlayoutModeSchedulerBaseTests : SchedulerTestBase DateTimeOffset hardStop) => throw new NotSupportedException(); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerDurationTests.cs b/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerDurationTests.cs index f8868b5eb..2bade648a 100644 --- a/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerDurationTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerDurationTests.cs @@ -37,7 +37,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase new CollectionEnumeratorState()); PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); - + var scheduler = new PlayoutModeSchedulerDuration(new Mock().Object); (PlayoutBuilderState playoutBuilderState, List playoutItems) = scheduler.Schedule( startState, @@ -78,7 +78,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutItems[2].FillerKind.Should().Be(FillerKind.None); playoutItems[2].GuideFinish.HasValue.Should().BeTrue(); } - + [Test] public void Should_Fill_Exact_Duration_CustomTitle() { @@ -96,7 +96,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase PlaybackOrder = PlaybackOrder.Chronological, CustomTitle = "Custom Title" }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -104,7 +104,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase var enumerator = new ChronologicalMediaCollectionEnumerator( collectionOne.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerDuration(new Mock().Object); @@ -150,7 +150,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutItems[2].GuideFinish.HasValue.Should().BeTrue(); playoutItems[2].CustomTitle.Should().Be("Custom Title"); } - + [Test] public void Should_Not_Have_Gap_Duration_Tail_Mode_None() { @@ -167,7 +167,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase TailMode = TailMode.None, PlaybackOrder = PlaybackOrder.Chronological }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -175,7 +175,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase var enumerator = new ChronologicalMediaCollectionEnumerator( collectionOne.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerDuration(new Mock().Object); @@ -195,7 +195,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutBuilderState.MultipleRemaining.IsNone.Should().BeTrue(); playoutBuilderState.InDurationFiller.Should().BeFalse(); playoutBuilderState.ScheduleItemsEnumerator.State.Index.Should().Be(0); - + enumerator.State.Index.Should().Be(1); playoutItems.Count.Should().Be(3); @@ -218,7 +218,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutItems[2].FillerKind.Should().Be(FillerKind.None); playoutItems[2].GuideFinish.HasValue.Should().BeTrue(); } - + [Test] public void Should_Have_Gap_Duration_Tail_Mode_Offline_No_Fallback() { @@ -235,7 +235,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase TailMode = TailMode.Offline, PlaybackOrder = PlaybackOrder.Chronological }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -243,7 +243,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase var enumerator = new ChronologicalMediaCollectionEnumerator( collectionOne.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerDuration(new Mock().Object); @@ -264,7 +264,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutBuilderState.MultipleRemaining.IsNone.Should().BeTrue(); playoutBuilderState.InDurationFiller.Should().BeFalse(); playoutBuilderState.ScheduleItemsEnumerator.State.Index.Should().Be(0); - + enumerator.State.Index.Should().Be(1); playoutItems.Count.Should().Be(3); @@ -287,7 +287,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutItems[2].FillerKind.Should().Be(FillerKind.None); playoutItems[2].GuideFinish.HasValue.Should().BeTrue(); } - + [Test] public void Should_Not_Have_Gap_Duration_Tail_Mode_Offline_With_Fallback() { @@ -311,7 +311,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase CollectionId = collectionTwo.Id } }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -319,11 +319,11 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase var enumerator1 = new ChronologicalMediaCollectionEnumerator( collectionOne.MediaItems, new CollectionEnumeratorState()); - + var enumerator2 = new ChronologicalMediaCollectionEnumerator( collectionTwo.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerDuration(new Mock().Object); @@ -343,7 +343,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutBuilderState.MultipleRemaining.IsNone.Should().BeTrue(); playoutBuilderState.InDurationFiller.Should().BeFalse(); playoutBuilderState.ScheduleItemsEnumerator.State.Index.Should().Be(0); - + enumerator1.State.Index.Should().Be(1); enumerator2.State.Index.Should().Be(1); @@ -366,7 +366,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutItems[2].GuideGroup.Should().Be(3); playoutItems[2].FillerKind.Should().Be(FillerKind.None); playoutItems[2].GuideFinish.HasValue.Should().BeTrue(); - + playoutItems[3].MediaItemId.Should().Be(3); playoutItems[3].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 45, 0))); playoutItems[3].GuideGroup.Should().Be(3); @@ -397,7 +397,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase CollectionId = collectionTwo.Id } }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -409,7 +409,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase var enumerator2 = new ChronologicalMediaCollectionEnumerator( collectionTwo.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerDuration(new Mock().Object); @@ -429,7 +429,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutBuilderState.MultipleRemaining.IsNone.Should().BeTrue(); playoutBuilderState.InDurationFiller.Should().BeFalse(); playoutBuilderState.ScheduleItemsEnumerator.State.Index.Should().Be(0); - + enumerator1.State.Index.Should().Be(1); enumerator2.State.Index.Should().Be(1); @@ -471,7 +471,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutItems[5].FillerKind.Should().Be(FillerKind.Tail); playoutItems[3].GuideFinish.HasValue.Should().BeFalse(); } - + [Test] public void Should_Have_Gap_Duration_Tail_Mode_Filler_No_Fallback() { @@ -495,7 +495,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase CollectionId = collectionTwo.Id } }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -507,7 +507,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase var enumerator2 = new ChronologicalMediaCollectionEnumerator( collectionTwo.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerDuration(new Mock().Object); @@ -527,7 +527,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutBuilderState.MultipleRemaining.IsNone.Should().BeTrue(); playoutBuilderState.InDurationFiller.Should().BeFalse(); playoutBuilderState.ScheduleItemsEnumerator.State.Index.Should().Be(0); - + enumerator1.State.Index.Should().Be(1); enumerator2.State.Index.Should().Be(1); @@ -600,7 +600,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase CollectionId = collectionThree.Id } }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -616,7 +616,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase var enumerator3 = new ChronologicalMediaCollectionEnumerator( collectionThree.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerDuration(new Mock().Object); @@ -642,7 +642,7 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutBuilderState.MultipleRemaining.IsNone.Should().BeTrue(); playoutBuilderState.InDurationFiller.Should().BeFalse(); playoutBuilderState.ScheduleItemsEnumerator.State.Index.Should().Be(0); - + enumerator1.State.Index.Should().Be(1); enumerator2.State.Index.Should().Be(1); enumerator3.State.Index.Should().Be(1); @@ -691,4 +691,4 @@ public class PlayoutModeSchedulerDurationTests : SchedulerTestBase playoutItems[6].FillerKind.Should().Be(FillerKind.Fallback); playoutItems[6].GuideFinish.HasValue.Should().BeFalse(); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerFloodTests.cs b/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerFloodTests.cs index 70b636673..96d3523b0 100644 --- a/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerFloodTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerFloodTests.cs @@ -37,11 +37,11 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase scheduleItem, NextScheduleItem }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( sortedScheduleItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerFlood(new Mock().Object); @@ -81,7 +81,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase playoutItems[2].GuideGroup.Should().Be(3); playoutItems[2].FillerKind.Should().Be(FillerKind.None); } - + [Test] public void Should_Fill_Exactly_To_Next_Schedule_Item_Flood() { @@ -109,14 +109,14 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase // this caused trouble with the peek logic and the IsFlood flag new ProgramScheduleItemFlood { - StartTime = TimeSpan.FromHours(3), + StartTime = TimeSpan.FromHours(3) } }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( sortedScheduleItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerFlood(new Mock().Object); @@ -156,7 +156,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase playoutItems[2].GuideGroup.Should().Be(3); playoutItems[2].FillerKind.Should().Be(FillerKind.None); } - + [Test] public void Should_Fill_Exactly_To_Next_Schedule_Item_With_Post_Roll_Multiple_One() { @@ -200,7 +200,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( sortedScheduleItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerFlood(new Mock().Object); @@ -283,11 +283,11 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase scheduleItem, NextScheduleItem }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( sortedScheduleItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerFlood(new Mock().Object); @@ -364,11 +364,11 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase scheduleItem, NextScheduleItem }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( sortedScheduleItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerFlood(new Mock().Object); @@ -461,11 +461,11 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase scheduleItem, NextScheduleItem }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( sortedScheduleItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerFlood(new Mock().Object); @@ -511,7 +511,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase playoutItems[3].GuideGroup.Should().Be(3); playoutItems[3].FillerKind.Should().Be(FillerKind.Fallback); } - + [Test] public void Should_Have_Gap_With_Tail_No_Fallback() { @@ -548,11 +548,11 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase scheduleItem, NextScheduleItem }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( sortedScheduleItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerFlood(new Mock().Object); @@ -655,7 +655,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase scheduleItem, NextScheduleItem }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( sortedScheduleItems, new CollectionEnumeratorState()); @@ -774,7 +774,7 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase scheduleItem, NextScheduleItem }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( sortedScheduleItems, new CollectionEnumeratorState()); @@ -829,6 +829,6 @@ public class PlayoutModeSchedulerFloodTests : SchedulerTestBase protected override ProgramScheduleItem NextScheduleItem => new ProgramScheduleItemOne { - StartTime = TimeSpan.FromHours(3), + StartTime = TimeSpan.FromHours(3) }; -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerMultipleTests.cs b/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerMultipleTests.cs index bfe37da57..9615b691b 100644 --- a/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerMultipleTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerMultipleTests.cs @@ -29,7 +29,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase FallbackFiller = null, Count = 3 }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -42,7 +42,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase { { CollectionKey.ForScheduleItem(scheduleItem), collectionOne.MediaItems } }.ToMap(); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock().Object); @@ -100,7 +100,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase FallbackFiller = null, Count = 3 }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -113,7 +113,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase { { CollectionKey.ForScheduleItem(scheduleItem), collectionOne.MediaItems } }.ToMap(); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock().Object); @@ -177,7 +177,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase FallbackFiller = null, Count = 3 }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -195,7 +195,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase { CollectionKey.ForScheduleItem(scheduleItem), collectionOne.MediaItems }, { CollectionKey.ForFillerPreset(scheduleItem.TailFiller), collectionTwo.MediaItems } }.ToMap(); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock().Object); @@ -275,7 +275,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase }, Count = 3 }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -293,7 +293,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase { CollectionKey.ForScheduleItem(scheduleItem), collectionOne.MediaItems }, { CollectionKey.ForFillerPreset(scheduleItem.FallbackFiller), collectionTwo.MediaItems } }.ToMap(); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock().Object); @@ -339,7 +339,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase playoutItems[3].GuideGroup.Should().Be(3); playoutItems[3].FillerKind.Should().Be(FillerKind.Fallback); } - + [Test] public void Should_Have_Gap_With_Tail_No_Fallback() { @@ -363,7 +363,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase FallbackFiller = null, Count = 3 }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -381,7 +381,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase { CollectionKey.ForScheduleItem(scheduleItem), collectionOne.MediaItems }, { CollectionKey.ForFillerPreset(scheduleItem.TailFiller), collectionTwo.MediaItems } }.ToMap(); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock().Object); @@ -416,7 +416,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase playoutItems[1].StartOffset.Should().Be(startState.CurrentTime.AddMinutes(55)); playoutItems[1].GuideGroup.Should().Be(2); playoutItems[1].FillerKind.Should().Be(FillerKind.None); - + playoutItems[2].MediaItemId.Should().Be(1); playoutItems[2].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(1, 50, 0))); playoutItems[2].GuideGroup.Should().Be(3); @@ -431,7 +431,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase playoutItems[4].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 49, 0))); playoutItems[4].GuideGroup.Should().Be(3); playoutItems[4].FillerKind.Should().Be(FillerKind.Tail); - + playoutItems[5].MediaItemId.Should().Be(3); playoutItems[5].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 53, 0))); playoutItems[5].GuideGroup.Should().Be(3); @@ -467,7 +467,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase }, Count = 3 }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -532,12 +532,12 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase playoutItems[1].StartOffset.Should().Be(startState.CurrentTime.AddMinutes(55)); playoutItems[1].GuideGroup.Should().Be(2); playoutItems[1].FillerKind.Should().Be(FillerKind.None); - + playoutItems[2].MediaItemId.Should().Be(1); playoutItems[2].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(1, 50, 0))); playoutItems[2].GuideGroup.Should().Be(3); playoutItems[2].FillerKind.Should().Be(FillerKind.None); - + playoutItems[3].MediaItemId.Should().Be(3); playoutItems[3].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 45, 0))); playoutItems[3].GuideGroup.Should().Be(3); @@ -547,7 +547,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase playoutItems[4].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 49, 0))); playoutItems[4].GuideGroup.Should().Be(3); playoutItems[4].FillerKind.Should().Be(FillerKind.Tail); - + playoutItems[5].MediaItemId.Should().Be(3); playoutItems[5].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 53, 0))); playoutItems[5].GuideGroup.Should().Be(3); @@ -588,7 +588,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase }, Count = 3 }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -611,7 +611,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase { CollectionKey.ForFillerPreset(scheduleItem.TailFiller), collectionTwo.MediaItems }, { CollectionKey.ForFillerPreset(scheduleItem.FallbackFiller), collectionThree.MediaItems } }.ToMap(); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerMultiple(collectionMediaItems, new Mock().Object); @@ -653,7 +653,7 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase playoutItems[1].StartOffset.Should().Be(startState.CurrentTime.AddHours(1)); playoutItems[1].GuideGroup.Should().Be(2); playoutItems[1].FillerKind.Should().Be(FillerKind.None); - + playoutItems[2].MediaItemId.Should().Be(1); playoutItems[2].StartOffset.Should().Be(startState.CurrentTime.AddHours(2)); playoutItems[2].GuideGroup.Should().Be(3); @@ -664,4 +664,4 @@ public class PlayoutModeSchedulerMultipleTests : SchedulerTestBase { StartTime = TimeSpan.FromHours(3) }; -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerOneTests.cs b/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerOneTests.cs index ab11ed92f..51487adc2 100644 --- a/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerOneTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/PlayoutModeSchedulerOneTests.cs @@ -27,7 +27,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase TailFiller = null, FallbackFiller = null }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -35,7 +35,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase var enumerator = new ChronologicalMediaCollectionEnumerator( collectionOne.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerOne(new Mock().Object); @@ -94,7 +94,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase Collection = collectionThree } }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -110,13 +110,19 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase var enumerator3 = new ChronologicalMediaCollectionEnumerator( collectionThree.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerOne(new Mock().Object); (PlayoutBuilderState playoutBuilderState, List playoutItems) = scheduler.Schedule( startState, - CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.TailFiller, enumerator2, scheduleItem.FallbackFiller, enumerator3), + CollectionEnumerators( + scheduleItem, + enumerator1, + scheduleItem.TailFiller, + enumerator2, + scheduleItem.FallbackFiller, + enumerator3), scheduleItem, NextScheduleItem, HardStop(scheduleItemsEnumerator)); @@ -165,7 +171,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase }, FallbackFiller = null }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -177,7 +183,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase var enumerator2 = new ChronologicalMediaCollectionEnumerator( collectionTwo.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerOne(new Mock().Object); @@ -217,7 +223,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase playoutItems[2].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 50, 0))); playoutItems[2].GuideGroup.Should().Be(1); playoutItems[2].FillerKind.Should().Be(FillerKind.Tail); - + playoutItems[3].MediaItemId.Should().Be(3); playoutItems[3].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 55, 0))); playoutItems[3].GuideGroup.Should().Be(1); @@ -246,7 +252,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase CollectionId = collectionTwo.Id } }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -258,7 +264,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase var enumerator2 = new ChronologicalMediaCollectionEnumerator( collectionTwo.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerOne(new Mock().Object); @@ -294,7 +300,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase playoutItems[1].GuideGroup.Should().Be(1); playoutItems[1].FillerKind.Should().Be(FillerKind.Fallback); } - + [Test] public void Should_Have_Gap_With_Tail_No_Fallback() { @@ -317,7 +323,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase }, FallbackFiller = null }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -329,7 +335,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase var enumerator2 = new ChronologicalMediaCollectionEnumerator( collectionTwo.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerOne(new Mock().Object); @@ -369,7 +375,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase playoutItems[2].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 49, 0))); playoutItems[2].GuideGroup.Should().Be(1); playoutItems[2].FillerKind.Should().Be(FillerKind.Tail); - + playoutItems[3].MediaItemId.Should().Be(3); playoutItems[3].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 53, 0))); playoutItems[3].GuideGroup.Should().Be(1); @@ -404,7 +410,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase CollectionId = collectionThree.Id } }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -420,7 +426,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase var enumerator3 = new ChronologicalMediaCollectionEnumerator( collectionThree.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerOne(new Mock().Object); @@ -467,7 +473,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase playoutItems[2].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 49, 0))); playoutItems[2].GuideGroup.Should().Be(1); playoutItems[2].FillerKind.Should().Be(FillerKind.Tail); - + playoutItems[3].MediaItemId.Should().Be(3); playoutItems[3].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 53, 0))); playoutItems[3].GuideGroup.Should().Be(1); @@ -507,7 +513,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase CollectionId = collectionThree.Id } }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -523,7 +529,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase var enumerator3 = new ChronologicalMediaCollectionEnumerator( collectionThree.MediaItems, new CollectionEnumeratorState()); - + PlayoutBuilderState startState = StartState(scheduleItemsEnumerator); var scheduler = new PlayoutModeSchedulerOne(new Mock().Object); @@ -592,7 +598,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase CollectionId = collectionThree.Id } }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -614,7 +620,13 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase var scheduler = new PlayoutModeSchedulerOne(new Mock().Object); (PlayoutBuilderState playoutBuilderState, List playoutItems) = scheduler.Schedule( startState, - CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.PostRollFiller, enumerator2, scheduleItem.FallbackFiller, enumerator3), + CollectionEnumerators( + scheduleItem, + enumerator1, + scheduleItem.PostRollFiller, + enumerator2, + scheduleItem.FallbackFiller, + enumerator3), scheduleItem, NextScheduleItem, HardStop(scheduleItemsEnumerator)); @@ -648,7 +660,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase playoutItems[2].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 50, 0))); playoutItems[2].GuideGroup.Should().Be(1); playoutItems[2].FillerKind.Should().Be(FillerKind.PostRoll); - + playoutItems[3].MediaItemId.Should().Be(3); playoutItems[3].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 55, 0))); playoutItems[3].GuideGroup.Should().Be(1); @@ -685,7 +697,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase CollectionId = collectionThree.Id } }; - + var scheduleItemsEnumerator = new OrderedScheduleItemsEnumerator( new List { scheduleItem }, new CollectionEnumeratorState()); @@ -707,7 +719,13 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase var scheduler = new PlayoutModeSchedulerOne(new Mock().Object); (PlayoutBuilderState playoutBuilderState, List playoutItems) = scheduler.Schedule( startState, - CollectionEnumerators(scheduleItem, enumerator1, scheduleItem.PostRollFiller, enumerator2, scheduleItem.FallbackFiller, enumerator3), + CollectionEnumerators( + scheduleItem, + enumerator1, + scheduleItem.PostRollFiller, + enumerator2, + scheduleItem.FallbackFiller, + enumerator3), scheduleItem, NextScheduleItem, HardStop(scheduleItemsEnumerator)); @@ -742,7 +760,7 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase playoutItems[2].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 50, 0))); playoutItems[2].GuideGroup.Should().Be(1); playoutItems[2].FillerKind.Should().Be(FillerKind.PostRoll); - + playoutItems[3].MediaItemId.Should().Be(3); playoutItems[3].StartOffset.Should().Be(startState.CurrentTime.Add(new TimeSpan(2, 55, 0))); playoutItems[3].GuideGroup.Should().Be(1); @@ -753,4 +771,4 @@ public class PlayoutModeSchedulerOneTests : SchedulerTestBase { StartTime = TimeSpan.FromHours(3) }; -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Scheduling/RandomizedContentTests.cs b/ErsatzTV.Core.Tests/Scheduling/RandomizedContentTests.cs index cb7f6055c..20d53a132 100644 --- a/ErsatzTV.Core.Tests/Scheduling/RandomizedContentTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/RandomizedContentTests.cs @@ -86,7 +86,7 @@ public class RandomizedContentTests private static List Episodes(int count) => Range(1, count).Map( - i => (MediaItem) new Episode + i => (MediaItem)new Episode { Id = i, EpisodeMetadata = new List @@ -99,4 +99,4 @@ public class RandomizedContentTests }) .Reverse() .ToList(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Scheduling/SchedulerTestBase.cs b/ErsatzTV.Core.Tests/Scheduling/SchedulerTestBase.cs index 4938b367a..b1fc2501a 100644 --- a/ErsatzTV.Core.Tests/Scheduling/SchedulerTestBase.cs +++ b/ErsatzTV.Core.Tests/Scheduling/SchedulerTestBase.cs @@ -7,34 +7,38 @@ namespace ErsatzTV.Core.Tests.Scheduling; public abstract class SchedulerTestBase { - protected static PlayoutBuilderState StartState(IScheduleItemsEnumerator scheduleItemsEnumerator) => new( - scheduleItemsEnumerator, - Prelude.None, - Prelude.None, - false, - false, - 1, - new DateTimeOffset(new DateTime(2020, 10, 18, 0, 0, 0, DateTimeKind.Local))); - protected virtual ProgramScheduleItem NextScheduleItem => new ProgramScheduleItemOne { StartTime = null }; + protected static PlayoutBuilderState StartState(IScheduleItemsEnumerator scheduleItemsEnumerator) => new( + scheduleItemsEnumerator, + None, + None, + false, + false, + 1, + new DateTimeOffset(new DateTime(2020, 10, 18, 0, 0, 0, DateTimeKind.Local))); + protected static DateTimeOffset HardStop(IScheduleItemsEnumerator scheduleItemsEnumerator) => StartState(scheduleItemsEnumerator).CurrentTime.AddHours(6); protected static Dictionary CollectionEnumerators( - ProgramScheduleItem scheduleItem, IMediaCollectionEnumerator enumerator) => + ProgramScheduleItem scheduleItem, + IMediaCollectionEnumerator enumerator) => new() { { CollectionKey.ForScheduleItem(scheduleItem), enumerator } }; protected static Dictionary CollectionEnumerators( - ProgramScheduleItem scheduleItem, IMediaCollectionEnumerator enumerator1, - FillerPreset fillerPreset, IMediaCollectionEnumerator enumerator2, - FillerPreset fillerPreset2, IMediaCollectionEnumerator enumerator3) => + ProgramScheduleItem scheduleItem, + IMediaCollectionEnumerator enumerator1, + FillerPreset fillerPreset, + IMediaCollectionEnumerator enumerator2, + FillerPreset fillerPreset2, + IMediaCollectionEnumerator enumerator3) => new() { { CollectionKey.ForScheduleItem(scheduleItem), enumerator1 }, @@ -44,7 +48,7 @@ public abstract class SchedulerTestBase private static Movie TestMovie(int id, TimeSpan duration, DateTime aired, int chapterCount = 0) { - var result = new Movie() + var result = new Movie { Id = id, MovieMetadata = new List { new() { ReleaseDate = aired } }, @@ -79,11 +83,13 @@ public abstract class SchedulerTestBase }; protected static Dictionary CollectionEnumerators( - ProgramScheduleItem scheduleItem, IMediaCollectionEnumerator enumerator1, - FillerPreset fillerPreset, IMediaCollectionEnumerator enumerator2) => + ProgramScheduleItem scheduleItem, + IMediaCollectionEnumerator enumerator1, + FillerPreset fillerPreset, + IMediaCollectionEnumerator enumerator2) => new() { { CollectionKey.ForScheduleItem(scheduleItem), enumerator1 }, { CollectionKey.ForFillerPreset(fillerPreset), enumerator2 } }; -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Scheduling/ShuffledContentTests.cs b/ErsatzTV.Core.Tests/Scheduling/ShuffledContentTests.cs index 306fdf84c..a83ad044c 100644 --- a/ErsatzTV.Core.Tests/Scheduling/ShuffledContentTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/ShuffledContentTests.cs @@ -133,7 +133,7 @@ public class ShuffledContentTests private static List Episodes(int count) => Range(1, count).Map( - i => (MediaItem) new Episode + i => (MediaItem)new Episode { Id = i, EpisodeMetadata = new List @@ -146,4 +146,4 @@ public class ShuffledContentTests }) .Reverse() .ToList(); -} \ No newline at end of file +} diff --git a/ErsatzTV.Core.Tests/Scheduling/ShuffledMediaCollectionEnumeratorTests.cs b/ErsatzTV.Core.Tests/Scheduling/ShuffledMediaCollectionEnumeratorTests.cs index 0ab61d337..7631a802c 100644 --- a/ErsatzTV.Core.Tests/Scheduling/ShuffledMediaCollectionEnumeratorTests.cs +++ b/ErsatzTV.Core.Tests/Scheduling/ShuffledMediaCollectionEnumeratorTests.cs @@ -15,7 +15,7 @@ public class ShuffledMediaCollectionEnumeratorTests new GroupedMediaItem(new MediaItem { Id = 2 }, new List()), new GroupedMediaItem(new MediaItem { Id = 3 }, new List()) }; - + [Test] public void Peek_Zero_Should_Match_Current() { @@ -30,7 +30,7 @@ public class ShuffledMediaCollectionEnumeratorTests peek.ValueUnsafe().Id.Should().Be(1); current.ValueUnsafe().Id.Should().Be(1); } - + [Test] public void Peek_One_Should_Match_Next() { @@ -47,7 +47,7 @@ public class ShuffledMediaCollectionEnumeratorTests peek.ValueUnsafe().Id.Should().Be(2); next.ValueUnsafe().Id.Should().Be(2); } - + [Test] public void Peek_Two_Should_Match_NextNext() { @@ -65,7 +65,7 @@ public class ShuffledMediaCollectionEnumeratorTests peek.ValueUnsafe().Id.Should().Be(3); next.ValueUnsafe().Id.Should().Be(3); } - + [Test] public void Peek_Three_Should_Match_NextNextNext() { @@ -84,4 +84,4 @@ public class ShuffledMediaCollectionEnumeratorTests peek.ValueUnsafe().Id.Should().Be(2); next.ValueUnsafe().Id.Should().Be(2); } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/BaseError.cs b/ErsatzTV.Core/BaseError.cs index 5e540cdf6..cdd4e5320 100644 --- a/ErsatzTV.Core/BaseError.cs +++ b/ErsatzTV.Core/BaseError.cs @@ -12,4 +12,4 @@ public class BaseError : NewType public static class ErrorExtensions { public static BaseError Join(this Seq errors) => string.Join("; ", errors); -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Channel.cs b/ErsatzTV.Core/Domain/Channel.cs index 7fe30a2df..5927ef1ce 100644 --- a/ErsatzTV.Core/Domain/Channel.cs +++ b/ErsatzTV.Core/Domain/Channel.cs @@ -25,4 +25,4 @@ public class Channel public string PreferredAudioLanguageCode { get; set; } public string PreferredSubtitleLanguageCode { get; set; } public ChannelSubtitleMode SubtitleMode { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/ChannelWatermark.cs b/ErsatzTV.Core/Domain/ChannelWatermark.cs index 6f56ce3dd..5bbd29dc7 100644 --- a/ErsatzTV.Core/Domain/ChannelWatermark.cs +++ b/ErsatzTV.Core/Domain/ChannelWatermark.cs @@ -30,4 +30,4 @@ public enum ChannelWatermarkImageSource { Custom = 0, ChannelLogo = 1 -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Collection/Collection.cs b/ErsatzTV.Core/Domain/Collection/Collection.cs index 5dbdb5674..57004fce8 100644 --- a/ErsatzTV.Core/Domain/Collection/Collection.cs +++ b/ErsatzTV.Core/Domain/Collection/Collection.cs @@ -9,4 +9,4 @@ public class Collection public List CollectionItems { get; set; } public List MultiCollections { get; set; } public List MultiCollectionItems { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Collection/CollectionItem.cs b/ErsatzTV.Core/Domain/Collection/CollectionItem.cs index c66ce687f..09d49e21a 100644 --- a/ErsatzTV.Core/Domain/Collection/CollectionItem.cs +++ b/ErsatzTV.Core/Domain/Collection/CollectionItem.cs @@ -7,4 +7,4 @@ public class CollectionItem public int MediaItemId { get; set; } public MediaItem MediaItem { get; set; } public int? CustomIndex { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Collection/MultiCollection.cs b/ErsatzTV.Core/Domain/Collection/MultiCollection.cs index ecfab3066..57258b3b1 100644 --- a/ErsatzTV.Core/Domain/Collection/MultiCollection.cs +++ b/ErsatzTV.Core/Domain/Collection/MultiCollection.cs @@ -8,4 +8,4 @@ public class MultiCollection public List SmartCollections { get; set; } public List MultiCollectionItems { get; set; } public List MultiCollectionSmartItems { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Collection/MultiCollectionItem.cs b/ErsatzTV.Core/Domain/Collection/MultiCollectionItem.cs index ce2428992..0b928b719 100644 --- a/ErsatzTV.Core/Domain/Collection/MultiCollectionItem.cs +++ b/ErsatzTV.Core/Domain/Collection/MultiCollectionItem.cs @@ -8,4 +8,4 @@ public class MultiCollectionItem public Collection Collection { get; set; } public bool ScheduleAsGroup { get; set; } public PlaybackOrder PlaybackOrder { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Collection/MultiCollectionSmartItem.cs b/ErsatzTV.Core/Domain/Collection/MultiCollectionSmartItem.cs index 7315c4301..ed09c6bfe 100644 --- a/ErsatzTV.Core/Domain/Collection/MultiCollectionSmartItem.cs +++ b/ErsatzTV.Core/Domain/Collection/MultiCollectionSmartItem.cs @@ -8,4 +8,4 @@ public class MultiCollectionSmartItem public SmartCollection SmartCollection { get; set; } public bool ScheduleAsGroup { get; set; } public PlaybackOrder PlaybackOrder { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Collection/SmartCollection.cs b/ErsatzTV.Core/Domain/Collection/SmartCollection.cs index 2c05997a7..efbb42763 100644 --- a/ErsatzTV.Core/Domain/Collection/SmartCollection.cs +++ b/ErsatzTV.Core/Domain/Collection/SmartCollection.cs @@ -7,4 +7,4 @@ public class SmartCollection public string Query { get; set; } public List MultiCollections { get; set; } public List MultiCollectionSmartItems { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Collection/TraktList.cs b/ErsatzTV.Core/Domain/Collection/TraktList.cs index d88881d28..46a290491 100644 --- a/ErsatzTV.Core/Domain/Collection/TraktList.cs +++ b/ErsatzTV.Core/Domain/Collection/TraktList.cs @@ -10,4 +10,4 @@ public class TraktList public string Description { get; set; } public int ItemCount { get; set; } public List Items { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Collection/TraktListItem.cs b/ErsatzTV.Core/Domain/Collection/TraktListItem.cs index ed6d76ef4..4d2cde68e 100644 --- a/ErsatzTV.Core/Domain/Collection/TraktListItem.cs +++ b/ErsatzTV.Core/Domain/Collection/TraktListItem.cs @@ -25,4 +25,4 @@ public class TraktListItem TraktListItemKind.Season => $"{Title} ({Year}) S{Season:00}", _ => $"{Title} ({Year}) S{Season:00}E{Episode:00}" }; -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Collection/TraktListItemGuid.cs b/ErsatzTV.Core/Domain/Collection/TraktListItemGuid.cs index a60007157..599e709f0 100644 --- a/ErsatzTV.Core/Domain/Collection/TraktListItemGuid.cs +++ b/ErsatzTV.Core/Domain/Collection/TraktListItemGuid.cs @@ -6,4 +6,4 @@ public class TraktListItemGuid public string Guid { get; set; } public int TraktListItemId { get; set; } public TraktListItem TraktListItem { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Collection/TraktListItemKind.cs b/ErsatzTV.Core/Domain/Collection/TraktListItemKind.cs index 1c2d6035d..908289c36 100644 --- a/ErsatzTV.Core/Domain/Collection/TraktListItemKind.cs +++ b/ErsatzTV.Core/Domain/Collection/TraktListItemKind.cs @@ -6,4 +6,4 @@ public enum TraktListItemKind Show, Season, Episode -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/CollectionEnumeratorState.cs b/ErsatzTV.Core/Domain/CollectionEnumeratorState.cs index 5740d7c58..cf1c082a3 100644 --- a/ErsatzTV.Core/Domain/CollectionEnumeratorState.cs +++ b/ErsatzTV.Core/Domain/CollectionEnumeratorState.cs @@ -4,4 +4,4 @@ public class CollectionEnumeratorState { public int Seed { get; set; } public int Index { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/ConfigElement.cs b/ErsatzTV.Core/Domain/ConfigElement.cs index 258f21a66..bcd3ba40d 100644 --- a/ErsatzTV.Core/Domain/ConfigElement.cs +++ b/ErsatzTV.Core/Domain/ConfigElement.cs @@ -5,4 +5,4 @@ public class ConfigElement public int Id { get; set; } public string Key { get; set; } public string Value { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/ConfigElementKey.cs b/ErsatzTV.Core/Domain/ConfigElementKey.cs index 83e11270a..3edc0ad08 100644 --- a/ErsatzTV.Core/Domain/ConfigElementKey.cs +++ b/ErsatzTV.Core/Domain/ConfigElementKey.cs @@ -33,4 +33,4 @@ public class ConfigElementKey public static ConfigElementKey FillerPresetsPageSize => new("pages.filler_presets.page_size"); public static ConfigElementKey LibraryRefreshInterval => new("scanner.library_refresh_interval"); public static ConfigElementKey PlayoutDaysToBuild => new("playout.days_to_build"); -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/FFmpegProfile.cs b/ErsatzTV.Core/Domain/FFmpegProfile.cs index 104d30746..0c4ca7677 100644 --- a/ErsatzTV.Core/Domain/FFmpegProfile.cs +++ b/ErsatzTV.Core/Domain/FFmpegProfile.cs @@ -44,4 +44,4 @@ public record FFmpegProfile NormalizeFramerate = false, HardwareAcceleration = HardwareAccelerationKind.None }; -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/FFmpegProfileAudioFormat.cs b/ErsatzTV.Core/Domain/FFmpegProfileAudioFormat.cs index 19f8e6280..9ac4caf75 100644 --- a/ErsatzTV.Core/Domain/FFmpegProfileAudioFormat.cs +++ b/ErsatzTV.Core/Domain/FFmpegProfileAudioFormat.cs @@ -3,9 +3,9 @@ public enum FFmpegProfileAudioFormat { None = 0, - + Aac = 1, Ac3 = 2, - + Copy = 99 } diff --git a/ErsatzTV.Core/Domain/FFmpegProfileVideoFormat.cs b/ErsatzTV.Core/Domain/FFmpegProfileVideoFormat.cs index 3ae517c44..475070239 100644 --- a/ErsatzTV.Core/Domain/FFmpegProfileVideoFormat.cs +++ b/ErsatzTV.Core/Domain/FFmpegProfileVideoFormat.cs @@ -3,10 +3,10 @@ public enum FFmpegProfileVideoFormat { None = 0, - + H264 = 1, Hevc = 2, Mpeg2Video = 3, - + Copy = 99 } diff --git a/ErsatzTV.Core/Domain/Filler/FillerKind.cs b/ErsatzTV.Core/Domain/Filler/FillerKind.cs index 7f140b20f..60d2b86f4 100644 --- a/ErsatzTV.Core/Domain/Filler/FillerKind.cs +++ b/ErsatzTV.Core/Domain/Filler/FillerKind.cs @@ -8,4 +8,4 @@ public enum FillerKind PostRoll = 3, Tail = 4, Fallback = 5 -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Filler/FillerMode.cs b/ErsatzTV.Core/Domain/Filler/FillerMode.cs index 7a086c93a..3fe6c6d7b 100644 --- a/ErsatzTV.Core/Domain/Filler/FillerMode.cs +++ b/ErsatzTV.Core/Domain/Filler/FillerMode.cs @@ -6,4 +6,4 @@ public enum FillerMode Duration = 1, Count = 2, Pad = 3 -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Filler/FillerPreset.cs b/ErsatzTV.Core/Domain/Filler/FillerPreset.cs index 542c54532..76ead81ba 100644 --- a/ErsatzTV.Core/Domain/Filler/FillerPreset.cs +++ b/ErsatzTV.Core/Domain/Filler/FillerPreset.cs @@ -18,4 +18,4 @@ public class FillerPreset public MultiCollection MultiCollection { get; set; } public int? SmartCollectionId { get; set; } public SmartCollection SmartCollection { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/GuideMode.cs b/ErsatzTV.Core/Domain/GuideMode.cs index 4c800e8ab..1f40f9c71 100644 --- a/ErsatzTV.Core/Domain/GuideMode.cs +++ b/ErsatzTV.Core/Domain/GuideMode.cs @@ -4,4 +4,4 @@ public enum GuideMode { Normal = 0, Filler = 1 -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/HardwareAccelerationKind.cs b/ErsatzTV.Core/Domain/HardwareAccelerationKind.cs index c987b464e..635fc4a6e 100644 --- a/ErsatzTV.Core/Domain/HardwareAccelerationKind.cs +++ b/ErsatzTV.Core/Domain/HardwareAccelerationKind.cs @@ -7,4 +7,4 @@ public enum HardwareAccelerationKind Nvenc = 2, Vaapi = 3, VideoToolbox = 4 -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/LanguageCode.cs b/ErsatzTV.Core/Domain/LanguageCode.cs index 3bd52ead5..75a524052 100644 --- a/ErsatzTV.Core/Domain/LanguageCode.cs +++ b/ErsatzTV.Core/Domain/LanguageCode.cs @@ -8,4 +8,4 @@ public class LanguageCode public string TwoCode { get; set; } public string EnglishName { get; set; } public string FrenchName { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Library/EmbyLibrary.cs b/ErsatzTV.Core/Domain/Library/EmbyLibrary.cs index c4b55d4a2..1b26b8626 100644 --- a/ErsatzTV.Core/Domain/Library/EmbyLibrary.cs +++ b/ErsatzTV.Core/Domain/Library/EmbyLibrary.cs @@ -4,4 +4,4 @@ public class EmbyLibrary : Library { public string ItemId { get; set; } public bool ShouldSyncItems { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Library/JellyfinLibrary.cs b/ErsatzTV.Core/Domain/Library/JellyfinLibrary.cs index a7729edcf..8820fb496 100644 --- a/ErsatzTV.Core/Domain/Library/JellyfinLibrary.cs +++ b/ErsatzTV.Core/Domain/Library/JellyfinLibrary.cs @@ -4,4 +4,4 @@ public class JellyfinLibrary : Library { public string ItemId { get; set; } public bool ShouldSyncItems { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Library/Library.cs b/ErsatzTV.Core/Domain/Library/Library.cs index 1b447d724..82470f063 100644 --- a/ErsatzTV.Core/Domain/Library/Library.cs +++ b/ErsatzTV.Core/Domain/Library/Library.cs @@ -11,4 +11,4 @@ public abstract class Library public MediaSource MediaSource { get; set; } public List Paths { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Library/LibraryFolder.cs b/ErsatzTV.Core/Domain/Library/LibraryFolder.cs index 8c37aeb43..c65f84eb5 100644 --- a/ErsatzTV.Core/Domain/Library/LibraryFolder.cs +++ b/ErsatzTV.Core/Domain/Library/LibraryFolder.cs @@ -7,4 +7,4 @@ public class LibraryFolder public int LibraryPathId { get; set; } public LibraryPath LibraryPath { get; set; } public string Etag { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Library/LibraryMediaKind.cs b/ErsatzTV.Core/Domain/Library/LibraryMediaKind.cs index 7b36cd9f1..f87579c3c 100644 --- a/ErsatzTV.Core/Domain/Library/LibraryMediaKind.cs +++ b/ErsatzTV.Core/Domain/Library/LibraryMediaKind.cs @@ -7,4 +7,4 @@ public enum LibraryMediaKind MusicVideos = 3, OtherVideos = 4, Songs = 5 -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Library/LibraryPath.cs b/ErsatzTV.Core/Domain/Library/LibraryPath.cs index 060e75f1a..3c0da692b 100644 --- a/ErsatzTV.Core/Domain/Library/LibraryPath.cs +++ b/ErsatzTV.Core/Domain/Library/LibraryPath.cs @@ -11,4 +11,4 @@ public class LibraryPath public List MediaItems { get; set; } public List LibraryFolders { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Library/LocalLibrary.cs b/ErsatzTV.Core/Domain/Library/LocalLibrary.cs index 1213f9ea7..e0b7c9efd 100644 --- a/ErsatzTV.Core/Domain/Library/LocalLibrary.cs +++ b/ErsatzTV.Core/Domain/Library/LocalLibrary.cs @@ -2,4 +2,4 @@ public class LocalLibrary : Library { -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Library/PlexLibrary.cs b/ErsatzTV.Core/Domain/Library/PlexLibrary.cs index acf403d7c..ccdebd862 100644 --- a/ErsatzTV.Core/Domain/Library/PlexLibrary.cs +++ b/ErsatzTV.Core/Domain/Library/PlexLibrary.cs @@ -4,4 +4,4 @@ public class PlexLibrary : Library { public string Key { get; set; } public bool ShouldSyncItems { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/LogEntry.cs b/ErsatzTV.Core/Domain/LogEntry.cs index 1d29ea975..66a53f0fe 100644 --- a/ErsatzTV.Core/Domain/LogEntry.cs +++ b/ErsatzTV.Core/Domain/LogEntry.cs @@ -6,4 +6,4 @@ public record LogEntry( string Level, string Exception, string RenderedMessage, - string Properties); \ No newline at end of file + string Properties); diff --git a/ErsatzTV.Core/Domain/MediaItem/Artist.cs b/ErsatzTV.Core/Domain/MediaItem/Artist.cs index d16a6e1ed..d4b78d45a 100644 --- a/ErsatzTV.Core/Domain/MediaItem/Artist.cs +++ b/ErsatzTV.Core/Domain/MediaItem/Artist.cs @@ -4,4 +4,4 @@ public class Artist : MediaItem { public List MusicVideos { get; set; } public List ArtistMetadata { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/BackgroundImageMediaVersion.cs b/ErsatzTV.Core/Domain/MediaItem/BackgroundImageMediaVersion.cs index 01ce6395b..07c899bb5 100644 --- a/ErsatzTV.Core/Domain/MediaItem/BackgroundImageMediaVersion.cs +++ b/ErsatzTV.Core/Domain/MediaItem/BackgroundImageMediaVersion.cs @@ -2,4 +2,4 @@ public class BackgroundImageMediaVersion : MediaVersion { -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/CoverArtMediaVersion.cs b/ErsatzTV.Core/Domain/MediaItem/CoverArtMediaVersion.cs index bcd1adcfa..99fc92254 100644 --- a/ErsatzTV.Core/Domain/MediaItem/CoverArtMediaVersion.cs +++ b/ErsatzTV.Core/Domain/MediaItem/CoverArtMediaVersion.cs @@ -2,4 +2,4 @@ public class CoverArtMediaVersion : MediaVersion { -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/EmbyEpisode.cs b/ErsatzTV.Core/Domain/MediaItem/EmbyEpisode.cs index dd25bcd1f..dd154b993 100644 --- a/ErsatzTV.Core/Domain/MediaItem/EmbyEpisode.cs +++ b/ErsatzTV.Core/Domain/MediaItem/EmbyEpisode.cs @@ -7,4 +7,4 @@ public class EmbyEpisode : Episode { public string ItemId { get; set; } public string Etag { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/EmbyMovie.cs b/ErsatzTV.Core/Domain/MediaItem/EmbyMovie.cs index 4c888813c..b81684b75 100644 --- a/ErsatzTV.Core/Domain/MediaItem/EmbyMovie.cs +++ b/ErsatzTV.Core/Domain/MediaItem/EmbyMovie.cs @@ -4,4 +4,4 @@ public class EmbyMovie : Movie { public string ItemId { get; set; } public string Etag { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/EmbySeason.cs b/ErsatzTV.Core/Domain/MediaItem/EmbySeason.cs index 07bb5f952..63cd50678 100644 --- a/ErsatzTV.Core/Domain/MediaItem/EmbySeason.cs +++ b/ErsatzTV.Core/Domain/MediaItem/EmbySeason.cs @@ -4,4 +4,4 @@ public class EmbySeason : Season { public string ItemId { get; set; } public string Etag { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/EmbyShow.cs b/ErsatzTV.Core/Domain/MediaItem/EmbyShow.cs index 15929b185..4ff8c0f93 100644 --- a/ErsatzTV.Core/Domain/MediaItem/EmbyShow.cs +++ b/ErsatzTV.Core/Domain/MediaItem/EmbyShow.cs @@ -4,4 +4,4 @@ public class EmbyShow : Show { public string ItemId { get; set; } public string Etag { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/Episode.cs b/ErsatzTV.Core/Domain/MediaItem/Episode.cs index d8ffbd794..32e240e4f 100644 --- a/ErsatzTV.Core/Domain/MediaItem/Episode.cs +++ b/ErsatzTV.Core/Domain/MediaItem/Episode.cs @@ -9,4 +9,4 @@ public class Episode : MediaItem public Season Season { get; set; } public List EpisodeMetadata { get; set; } public List MediaVersions { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/FallbackMediaVersion.cs b/ErsatzTV.Core/Domain/MediaItem/FallbackMediaVersion.cs index 5c7824343..94670140a 100644 --- a/ErsatzTV.Core/Domain/MediaItem/FallbackMediaVersion.cs +++ b/ErsatzTV.Core/Domain/MediaItem/FallbackMediaVersion.cs @@ -2,4 +2,4 @@ public class FallbackMediaVersion : MediaVersion { -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/JellyfinEpisode.cs b/ErsatzTV.Core/Domain/MediaItem/JellyfinEpisode.cs index b79b27a28..38646ce75 100644 --- a/ErsatzTV.Core/Domain/MediaItem/JellyfinEpisode.cs +++ b/ErsatzTV.Core/Domain/MediaItem/JellyfinEpisode.cs @@ -7,4 +7,4 @@ public class JellyfinEpisode : Episode { public string ItemId { get; set; } public string Etag { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/JellyfinMovie.cs b/ErsatzTV.Core/Domain/MediaItem/JellyfinMovie.cs index d5a955e97..9ae3a79e8 100644 --- a/ErsatzTV.Core/Domain/MediaItem/JellyfinMovie.cs +++ b/ErsatzTV.Core/Domain/MediaItem/JellyfinMovie.cs @@ -4,4 +4,4 @@ public class JellyfinMovie : Movie { public string ItemId { get; set; } public string Etag { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/JellyfinSeason.cs b/ErsatzTV.Core/Domain/MediaItem/JellyfinSeason.cs index 7dda603ee..b0b0650c4 100644 --- a/ErsatzTV.Core/Domain/MediaItem/JellyfinSeason.cs +++ b/ErsatzTV.Core/Domain/MediaItem/JellyfinSeason.cs @@ -4,4 +4,4 @@ public class JellyfinSeason : Season { public string ItemId { get; set; } public string Etag { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/JellyfinShow.cs b/ErsatzTV.Core/Domain/MediaItem/JellyfinShow.cs index 11d1b2233..73c3c0545 100644 --- a/ErsatzTV.Core/Domain/MediaItem/JellyfinShow.cs +++ b/ErsatzTV.Core/Domain/MediaItem/JellyfinShow.cs @@ -4,4 +4,4 @@ public class JellyfinShow : Show { public string ItemId { get; set; } public string Etag { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/MediaChapter.cs b/ErsatzTV.Core/Domain/MediaItem/MediaChapter.cs index 566f366c9..5726aaa1e 100644 --- a/ErsatzTV.Core/Domain/MediaItem/MediaChapter.cs +++ b/ErsatzTV.Core/Domain/MediaItem/MediaChapter.cs @@ -9,4 +9,4 @@ public class MediaChapter public TimeSpan StartTime { get; set; } public TimeSpan EndTime { get; set; } public string Title { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/MediaFile.cs b/ErsatzTV.Core/Domain/MediaItem/MediaFile.cs index 4f4413bc5..56cf4fdb8 100644 --- a/ErsatzTV.Core/Domain/MediaItem/MediaFile.cs +++ b/ErsatzTV.Core/Domain/MediaItem/MediaFile.cs @@ -7,4 +7,4 @@ public class MediaFile public int MediaVersionId { get; set; } public MediaVersion MediaVersion { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/MediaItem.cs b/ErsatzTV.Core/Domain/MediaItem/MediaItem.cs index 85002d163..a1b4d8148 100644 --- a/ErsatzTV.Core/Domain/MediaItem/MediaItem.cs +++ b/ErsatzTV.Core/Domain/MediaItem/MediaItem.cs @@ -9,4 +9,4 @@ public class MediaItem public List CollectionItems { get; set; } public List TraktListItems { get; set; } public MediaItemState State { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/MediaStream.cs b/ErsatzTV.Core/Domain/MediaItem/MediaStream.cs index 384837771..9939a7b05 100644 --- a/ErsatzTV.Core/Domain/MediaItem/MediaStream.cs +++ b/ErsatzTV.Core/Domain/MediaItem/MediaStream.cs @@ -19,4 +19,4 @@ public class MediaStream public string MimeType { get; set; } public int MediaVersionId { get; set; } public MediaVersion MediaVersion { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/MediaStreamKind.cs b/ErsatzTV.Core/Domain/MediaItem/MediaStreamKind.cs index e00179686..82fcf4410 100644 --- a/ErsatzTV.Core/Domain/MediaItem/MediaStreamKind.cs +++ b/ErsatzTV.Core/Domain/MediaItem/MediaStreamKind.cs @@ -6,4 +6,4 @@ public enum MediaStreamKind Audio = 2, Subtitle = 3, Attachment = 4 -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/MediaVersion.cs b/ErsatzTV.Core/Domain/MediaItem/MediaVersion.cs index 0a4455ea5..c4091ad24 100644 --- a/ErsatzTV.Core/Domain/MediaItem/MediaVersion.cs +++ b/ErsatzTV.Core/Domain/MediaItem/MediaVersion.cs @@ -18,4 +18,4 @@ public class MediaVersion : IDisplaySize public DateTime DateUpdated { get; set; } public int Width { get; set; } public int Height { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/Movie.cs b/ErsatzTV.Core/Domain/MediaItem/Movie.cs index 55da04a9e..8d6b062df 100644 --- a/ErsatzTV.Core/Domain/MediaItem/Movie.cs +++ b/ErsatzTV.Core/Domain/MediaItem/Movie.cs @@ -4,4 +4,4 @@ public class Movie : MediaItem { public List MovieMetadata { get; set; } public List MediaVersions { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/MusicVideo.cs b/ErsatzTV.Core/Domain/MediaItem/MusicVideo.cs index e2c2234bd..c8da619af 100644 --- a/ErsatzTV.Core/Domain/MediaItem/MusicVideo.cs +++ b/ErsatzTV.Core/Domain/MediaItem/MusicVideo.cs @@ -6,4 +6,4 @@ public class MusicVideo : MediaItem public Artist Artist { get; set; } public List MusicVideoMetadata { get; set; } public List MediaVersions { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/OtherVideo.cs b/ErsatzTV.Core/Domain/MediaItem/OtherVideo.cs index 775c801c9..1f2160aea 100644 --- a/ErsatzTV.Core/Domain/MediaItem/OtherVideo.cs +++ b/ErsatzTV.Core/Domain/MediaItem/OtherVideo.cs @@ -4,4 +4,4 @@ public class OtherVideo : MediaItem { public List OtherVideoMetadata { get; set; } public List MediaVersions { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/PlexEpisode.cs b/ErsatzTV.Core/Domain/MediaItem/PlexEpisode.cs index fb53a5349..ee1b8613f 100644 --- a/ErsatzTV.Core/Domain/MediaItem/PlexEpisode.cs +++ b/ErsatzTV.Core/Domain/MediaItem/PlexEpisode.cs @@ -3,4 +3,4 @@ public class PlexEpisode : Episode { public string Key { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/PlexMediaFile.cs b/ErsatzTV.Core/Domain/MediaItem/PlexMediaFile.cs index 41010f8c1..b00153a64 100644 --- a/ErsatzTV.Core/Domain/MediaItem/PlexMediaFile.cs +++ b/ErsatzTV.Core/Domain/MediaItem/PlexMediaFile.cs @@ -4,4 +4,4 @@ public class PlexMediaFile : MediaFile { public int PlexId { get; set; } public string Key { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/PlexMovie.cs b/ErsatzTV.Core/Domain/MediaItem/PlexMovie.cs index 442e9917e..f61d82c17 100644 --- a/ErsatzTV.Core/Domain/MediaItem/PlexMovie.cs +++ b/ErsatzTV.Core/Domain/MediaItem/PlexMovie.cs @@ -3,4 +3,4 @@ public class PlexMovie : Movie { public string Key { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/PlexSeason.cs b/ErsatzTV.Core/Domain/MediaItem/PlexSeason.cs index 244e60042..fdc5d42b3 100644 --- a/ErsatzTV.Core/Domain/MediaItem/PlexSeason.cs +++ b/ErsatzTV.Core/Domain/MediaItem/PlexSeason.cs @@ -3,4 +3,4 @@ public class PlexSeason : Season { public string Key { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/PlexShow.cs b/ErsatzTV.Core/Domain/MediaItem/PlexShow.cs index f2f0de123..76db93b8a 100644 --- a/ErsatzTV.Core/Domain/MediaItem/PlexShow.cs +++ b/ErsatzTV.Core/Domain/MediaItem/PlexShow.cs @@ -3,4 +3,4 @@ public class PlexShow : Show { public string Key { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/Season.cs b/ErsatzTV.Core/Domain/MediaItem/Season.cs index bc1819ddf..a395dd128 100644 --- a/ErsatzTV.Core/Domain/MediaItem/Season.cs +++ b/ErsatzTV.Core/Domain/MediaItem/Season.cs @@ -8,4 +8,4 @@ public class Season : MediaItem public List Episodes { get; set; } public List SeasonMetadata { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/Show.cs b/ErsatzTV.Core/Domain/MediaItem/Show.cs index 4d9ed1a5a..baa22e8fd 100644 --- a/ErsatzTV.Core/Domain/MediaItem/Show.cs +++ b/ErsatzTV.Core/Domain/MediaItem/Show.cs @@ -4,4 +4,4 @@ public class Show : MediaItem { public List Seasons { get; set; } public List ShowMetadata { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/Song.cs b/ErsatzTV.Core/Domain/MediaItem/Song.cs index ae1db64ea..e4ac5a120 100644 --- a/ErsatzTV.Core/Domain/MediaItem/Song.cs +++ b/ErsatzTV.Core/Domain/MediaItem/Song.cs @@ -4,4 +4,4 @@ public class Song : MediaItem { public List SongMetadata { get; set; } public List MediaVersions { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaItem/VideoScanKind.cs b/ErsatzTV.Core/Domain/MediaItem/VideoScanKind.cs index edd1012c6..06481c9a4 100644 --- a/ErsatzTV.Core/Domain/MediaItem/VideoScanKind.cs +++ b/ErsatzTV.Core/Domain/MediaItem/VideoScanKind.cs @@ -5,4 +5,4 @@ public enum VideoScanKind Unknown = 0, Progressive = 1, Interlaced = 2 -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaSource/EmbyConnection.cs b/ErsatzTV.Core/Domain/MediaSource/EmbyConnection.cs index e38797d5b..33e100429 100644 --- a/ErsatzTV.Core/Domain/MediaSource/EmbyConnection.cs +++ b/ErsatzTV.Core/Domain/MediaSource/EmbyConnection.cs @@ -6,4 +6,4 @@ public class EmbyConnection public string Address { get; set; } public int EmbyMediaSourceId { get; set; } public EmbyMediaSource EmbyMediaSource { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaSource/EmbyMediaSource.cs b/ErsatzTV.Core/Domain/MediaSource/EmbyMediaSource.cs index 06dc6e926..1024860f1 100644 --- a/ErsatzTV.Core/Domain/MediaSource/EmbyMediaSource.cs +++ b/ErsatzTV.Core/Domain/MediaSource/EmbyMediaSource.cs @@ -6,4 +6,4 @@ public class EmbyMediaSource : MediaSource public string OperatingSystem { get; set; } public List Connections { get; set; } public List PathReplacements { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaSource/EmbyPathReplacement.cs b/ErsatzTV.Core/Domain/MediaSource/EmbyPathReplacement.cs index ec456a698..40151994d 100644 --- a/ErsatzTV.Core/Domain/MediaSource/EmbyPathReplacement.cs +++ b/ErsatzTV.Core/Domain/MediaSource/EmbyPathReplacement.cs @@ -7,4 +7,4 @@ public class EmbyPathReplacement public string LocalPath { get; set; } public int EmbyMediaSourceId { get; set; } public EmbyMediaSource EmbyMediaSource { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaSource/JellyfinConnection.cs b/ErsatzTV.Core/Domain/MediaSource/JellyfinConnection.cs index 21f3d42e1..0e0351975 100644 --- a/ErsatzTV.Core/Domain/MediaSource/JellyfinConnection.cs +++ b/ErsatzTV.Core/Domain/MediaSource/JellyfinConnection.cs @@ -6,4 +6,4 @@ public class JellyfinConnection public string Address { get; set; } public int JellyfinMediaSourceId { get; set; } public JellyfinMediaSource JellyfinMediaSource { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaSource/JellyfinMediaSource.cs b/ErsatzTV.Core/Domain/MediaSource/JellyfinMediaSource.cs index 940498985..94c697821 100644 --- a/ErsatzTV.Core/Domain/MediaSource/JellyfinMediaSource.cs +++ b/ErsatzTV.Core/Domain/MediaSource/JellyfinMediaSource.cs @@ -6,4 +6,4 @@ public class JellyfinMediaSource : MediaSource public string OperatingSystem { get; set; } public List Connections { get; set; } public List PathReplacements { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaSource/JellyfinPathReplacement.cs b/ErsatzTV.Core/Domain/MediaSource/JellyfinPathReplacement.cs index c227a4794..b42df6268 100644 --- a/ErsatzTV.Core/Domain/MediaSource/JellyfinPathReplacement.cs +++ b/ErsatzTV.Core/Domain/MediaSource/JellyfinPathReplacement.cs @@ -7,4 +7,4 @@ public class JellyfinPathReplacement public string LocalPath { get; set; } public int JellyfinMediaSourceId { get; set; } public JellyfinMediaSource JellyfinMediaSource { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaSource/LocalMediaSource.cs b/ErsatzTV.Core/Domain/MediaSource/LocalMediaSource.cs index 9b619a6af..b08c2fc69 100644 --- a/ErsatzTV.Core/Domain/MediaSource/LocalMediaSource.cs +++ b/ErsatzTV.Core/Domain/MediaSource/LocalMediaSource.cs @@ -2,4 +2,4 @@ public class LocalMediaSource : MediaSource { -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaSource/MediaSource.cs b/ErsatzTV.Core/Domain/MediaSource/MediaSource.cs index 207e7342d..cefb30466 100644 --- a/ErsatzTV.Core/Domain/MediaSource/MediaSource.cs +++ b/ErsatzTV.Core/Domain/MediaSource/MediaSource.cs @@ -5,4 +5,4 @@ public abstract class MediaSource public int Id { get; set; } public List Libraries { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaSource/PlexConnection.cs b/ErsatzTV.Core/Domain/MediaSource/PlexConnection.cs index 286026b81..4d7500a42 100644 --- a/ErsatzTV.Core/Domain/MediaSource/PlexConnection.cs +++ b/ErsatzTV.Core/Domain/MediaSource/PlexConnection.cs @@ -7,4 +7,4 @@ public class PlexConnection public string Uri { get; set; } public int PlexMediaSourceId { get; set; } public PlexMediaSource PlexMediaSource { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaSource/PlexMediaSource.cs b/ErsatzTV.Core/Domain/MediaSource/PlexMediaSource.cs index 924fc0c52..e9562abc8 100644 --- a/ErsatzTV.Core/Domain/MediaSource/PlexMediaSource.cs +++ b/ErsatzTV.Core/Domain/MediaSource/PlexMediaSource.cs @@ -11,4 +11,4 @@ public class PlexMediaSource : MediaSource // public bool IsOwned { get; set; } public List Connections { get; set; } public List PathReplacements { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/MediaSource/PlexPathReplacement.cs b/ErsatzTV.Core/Domain/MediaSource/PlexPathReplacement.cs index 8b317ef3b..53e7b1b51 100644 --- a/ErsatzTV.Core/Domain/MediaSource/PlexPathReplacement.cs +++ b/ErsatzTV.Core/Domain/MediaSource/PlexPathReplacement.cs @@ -7,4 +7,4 @@ public class PlexPathReplacement public string LocalPath { get; set; } public int PlexMediaSourceId { get; set; } public PlexMediaSource PlexMediaSource { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Metadata/Actor.cs b/ErsatzTV.Core/Domain/Metadata/Actor.cs index 456db3d0f..d5b9c3a3b 100644 --- a/ErsatzTV.Core/Domain/Metadata/Actor.cs +++ b/ErsatzTV.Core/Domain/Metadata/Actor.cs @@ -8,4 +8,4 @@ public class Actor public int? Order { get; set; } public int? ArtworkId { get; set; } public Artwork Artwork { get; set; } -} \ No newline at end of file +} diff --git a/ErsatzTV.Core/Domain/Metadata/ArtistMetadata.cs b/ErsatzTV.Core/Domain/Metadata/ArtistMetadata.cs index 59d7dc7c0..65e7a9b9d 100644 --- a/ErsatzTV.Core/Domain/Metadata/ArtistMetadata.cs +++ b/ErsatzTV.Core/Domain/Metadata/ArtistMetadata.cs @@ -9,4 +9,4 @@ public class ArtistMetadata : Metadata public Artist Artist { get; set; } public List