Browse Source

appease the c# compiler (#17)

pull/27/head
Jason Dove 5 years ago committed by GitHub
parent
commit
0b5a6f9dcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      ErsatzTV.Application/MediaSources/Commands/SynchronizePlexLibrariesHandler.cs
  2. 6
      ErsatzTV.Application/MediaSources/Mapper.cs
  3. 6
      ErsatzTV.Application/ProgramSchedules/Commands/ProgramScheduleItemCommandBase.cs
  4. 7
      ErsatzTV.Application/ProgramSchedules/Mapper.cs
  5. 28
      ErsatzTV.Core/FFmpeg/FFmpegProcessBuilder.cs
  6. 6
      ErsatzTV.Infrastructure/Data/Repositories/MediaCollectionRepository.cs
  7. 2
      ErsatzTV.Infrastructure/Plex/PlexTvApiClient.cs
  8. 13
      ErsatzTV.sln.DotSettings
  9. 5
      ErsatzTV/Services/PlexService.cs
  10. 2
      ErsatzTV/Shared/MainLayout.razor

2
ErsatzTV.Application/MediaSources/Commands/SynchronizePlexLibrariesHandler.cs

@ -86,7 +86,7 @@ namespace ErsatzTV.Application.MediaSources.Commands @@ -86,7 +86,7 @@ namespace ErsatzTV.Application.MediaSources.Commands
error =>
{
_logger.LogWarning(
"Unable to synchronize libraries from Plex server {PlexServer}: {Error}",
"Unable to synchronize libraries from plex server {PlexServer}: {Error}",
connectionParameters.PlexMediaSource.Name,
error.Value);

6
ErsatzTV.Application/MediaSources/Mapper.cs

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
using System.Linq;
using System;
using System.Linq;
using ErsatzTV.Core.Domain;
using static LanguageExt.Prelude;
@ -10,7 +11,8 @@ namespace ErsatzTV.Application.MediaSources @@ -10,7 +11,8 @@ namespace ErsatzTV.Application.MediaSources
mediaSource switch
{
LocalMediaSource lms => new LocalMediaSourceViewModel(lms.Id, lms.Name, lms.Folder),
PlexMediaSource pms => ProjectToViewModel(pms)
PlexMediaSource pms => ProjectToViewModel(pms),
_ => throw new NotSupportedException($"Unsupported media source {mediaSource.GetType().Name}")
};
internal static PlexMediaSourceViewModel ProjectToViewModel(PlexMediaSource plexMediaSource) =>

6
ErsatzTV.Application/ProgramSchedules/Commands/ProgramScheduleItemCommandBase.cs

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using ErsatzTV.Core;
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Interfaces.Repositories;
@ -88,7 +89,8 @@ namespace ErsatzTV.Application.ProgramSchedules.Commands @@ -88,7 +89,8 @@ namespace ErsatzTV.Application.ProgramSchedules.Commands
MediaCollectionId = item.MediaCollectionId,
PlayoutDuration = item.PlayoutDuration.GetValueOrDefault(),
OfflineTail = item.OfflineTail.GetValueOrDefault()
}
},
_ => throw new NotSupportedException($"Unsupported playout mode {item.PlayoutMode}")
};
}
}

7
ErsatzTV.Application/ProgramSchedules/Mapper.cs

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
using ErsatzTV.Core.Domain;
using System;
using ErsatzTV.Core.Domain;
namespace ErsatzTV.Application.ProgramSchedules
{
@ -40,7 +41,9 @@ namespace ErsatzTV.Application.ProgramSchedules @@ -40,7 +41,9 @@ namespace ErsatzTV.Application.ProgramSchedules
one.Index,
one.StartType,
one.StartTime,
MediaCollections.Mapper.ProjectToViewModel(one.MediaCollection))
MediaCollections.Mapper.ProjectToViewModel(one.MediaCollection)),
_ => throw new NotSupportedException(
$"Unsupported program schedule item type {programScheduleItem.GetType().Name}")
};
}
}

28
ErsatzTV.Core/FFmpeg/FFmpegProcessBuilder.cs

@ -285,7 +285,7 @@ namespace ErsatzTV.Core.FFmpeg @@ -285,7 +285,7 @@ namespace ErsatzTV.Core.FFmpeg
bool hasVideoFilters = _videoFilters.Any();
if (hasVideoFilters)
{
(string filter, string finalLabel) = GenerateFilter(_videoFilters, StreamType.Video);
(string filter, string finalLabel) = GenerateVideoFilter(_videoFilters);
complexFilter.Append(filter);
videoLabel = finalLabel;
}
@ -297,7 +297,7 @@ namespace ErsatzTV.Core.FFmpeg @@ -297,7 +297,7 @@ namespace ErsatzTV.Core.FFmpeg
complexFilter.Append(';');
}
(string filter, string finalLabel) = GenerateFilter(_audioFilters, StreamType.Audio);
(string filter, string finalLabel) = GenerateAudioFilter(_audioFilters);
complexFilter.Append(filter);
audioLabel = finalLabel;
}
@ -348,20 +348,16 @@ namespace ErsatzTV.Core.FFmpeg @@ -348,20 +348,16 @@ namespace ErsatzTV.Core.FFmpeg
};
}
private FilterResult GenerateFilter(Queue<string> filterQueue, StreamType streamType)
private FilterResult GenerateVideoFilter(Queue<string> filterQueue) =>
GenerateFilter(filterQueue, "null", 'v');
private FilterResult GenerateAudioFilter(Queue<string> filterQueue) =>
GenerateFilter(filterQueue, "anull", 'a');
private static FilterResult GenerateFilter(Queue<string> filterQueue, string nullFilter, char av)
{
var filter = new StringBuilder();
var index = 0;
string nullFilter = streamType switch
{
StreamType.Audio => "anull",
StreamType.Video => "null"
};
char av = streamType switch
{
StreamType.Audio => 'a',
StreamType.Video => 'v'
};
filter.Append($"[0:{av}]{nullFilter}[{av}{index}]");
while (filterQueue.TryDequeue(out string result))
{
@ -372,11 +368,5 @@ namespace ErsatzTV.Core.FFmpeg @@ -372,11 +368,5 @@ namespace ErsatzTV.Core.FFmpeg
}
private record FilterResult(string Filter, string FinalLabel);
private enum StreamType
{
Audio,
Video
}
}
}

6
ErsatzTV.Infrastructure/Data/Repositories/MediaCollectionRepository.cs

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ErsatzTV.Core.AggregateModels;
@ -68,7 +69,8 @@ namespace ErsatzTV.Infrastructure.Data.Repositories @@ -68,7 +69,8 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
collection => collection switch
{
SimpleMediaCollection s => SimpleItems(s),
TelevisionMediaCollection t => TelevisionItems(t)
TelevisionMediaCollection t => TelevisionItems(t),
_ => throw new NotSupportedException($"Unsupported collection type {collection.GetType().Name}")
}).Bind(x => x.Sequence());
public Task<Option<List<MediaItem>>> GetSimpleMediaCollectionItems(int id) =>

2
ErsatzTV.Infrastructure/Plex/PlexTvApiClient.cs

@ -105,7 +105,7 @@ namespace ErsatzTV.Infrastructure.Plex @@ -105,7 +105,7 @@ namespace ErsatzTV.Infrastructure.Plex
return true;
}
}
catch (Exception ex)
catch (Exception)
{
// ignored
}

13
ErsatzTV.sln.DotSettings

@ -2,18 +2,24 @@ @@ -2,18 +2,24 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DTO/@EntryIndexedValue">DTO</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HDHR/@EntryIndexedValue">HDHR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=SAR/@EntryIndexedValue">SAR</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=anull/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=apad/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=bufsize/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=cgop/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Deinterlace/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=deinterlaced/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=discardcorrupt/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=drawtext/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ersatztv/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=faststart/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ffconcat/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=fflags/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ffprobe/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=fontfile/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Fprobe/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=genpts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=igndts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Libavfilter/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=libx/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=maxrate/@EntryIndexedValue">True</s:Boolean>
@ -21,5 +27,10 @@ @@ -21,5 +27,10 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=mpegts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=muxdelay/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=muxpreload/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=nostats/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pixfmt/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=playout/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Playouts/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Playouts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=probesize/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=setsar/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=yadif/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

5
ErsatzTV/Services/PlexService.cs

@ -63,14 +63,15 @@ namespace ErsatzTV.Services @@ -63,14 +63,15 @@ namespace ErsatzTV.Services
TryCompletePlexPinFlow pinRequest => CompletePinFlow(pinRequest, cancellationToken),
SynchronizePlexMediaSources sourcesRequest => SynchronizeSources(
sourcesRequest,
cancellationToken)
cancellationToken),
_ => throw new NotSupportedException($"Unsupported request type: {request.GetType().Name}")
};
await requestTask;
}
catch (Exception ex)
{
_logger.LogWarning(ex, "Failed to process poll for Plex auth token request");
_logger.LogWarning(ex, "Failed to process plex background service request");
}
}
}

2
ErsatzTV/Shared/MainLayout.razor

@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
<MudNavLink Href="/schedules">Schedules</MudNavLink>
<MudNavLink Href="/playouts">Playouts</MudNavLink>
<MudNavLink Href="/system/logs">Logs</MudNavLink>
<MudDivider Class="my-6" DividerType="DividerType.Middle" />
<MudDivider Class="my-6" DividerType="DividerType.Middle"/>
<MudContainer Style="text-align: right" Class="mr-6">
<MudText Typo="Typo.body2">ErsatzTV Version</MudText>
<MudText Typo="Typo.body2" Color="Color.Info">@InfoVersion</MudText>

Loading…
Cancel
Save