Replace == null with is null
This commit is contained in:
parent
b2def4c9ea
commit
c7d50d640e
|
@ -191,7 +191,7 @@ namespace Emby.Dlna.Didl
|
||||||
|
|
||||||
private void AddVideoResource(XmlWriter writer, BaseItem video, string deviceId, Filter filter, StreamInfo streamInfo = null)
|
private void AddVideoResource(XmlWriter writer, BaseItem video, string deviceId, Filter filter, StreamInfo streamInfo = null)
|
||||||
{
|
{
|
||||||
if (streamInfo == null)
|
if (streamInfo is null)
|
||||||
{
|
{
|
||||||
var sources = _mediaSourceManager.GetStaticMediaSources(video, true, _user);
|
var sources = _mediaSourceManager.GetStaticMediaSources(video, true, _user);
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ namespace Emby.Dlna.Didl
|
||||||
.FirstOrDefault(i => string.Equals(info.Format, i.Format, StringComparison.OrdinalIgnoreCase)
|
.FirstOrDefault(i => string.Equals(info.Format, i.Format, StringComparison.OrdinalIgnoreCase)
|
||||||
&& i.Method == SubtitleDeliveryMethod.External);
|
&& i.Method == SubtitleDeliveryMethod.External);
|
||||||
|
|
||||||
if (subtitleProfile == null)
|
if (subtitleProfile is null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -392,7 +392,7 @@ namespace Emby.Dlna.Didl
|
||||||
|
|
||||||
var filename = url.Substring(0, url.IndexOf('?', StringComparison.Ordinal));
|
var filename = url.Substring(0, url.IndexOf('?', StringComparison.Ordinal));
|
||||||
|
|
||||||
var mimeType = mediaProfile == null || string.IsNullOrEmpty(mediaProfile.MimeType)
|
var mimeType = mediaProfile is null || string.IsNullOrEmpty(mediaProfile.MimeType)
|
||||||
? MimeTypes.GetMimeType(filename)
|
? MimeTypes.GetMimeType(filename)
|
||||||
: mediaProfile.MimeType;
|
: mediaProfile.MimeType;
|
||||||
|
|
||||||
|
@ -533,7 +533,7 @@ namespace Emby.Dlna.Didl
|
||||||
{
|
{
|
||||||
writer.WriteStartElement(string.Empty, "res", NsDidl);
|
writer.WriteStartElement(string.Empty, "res", NsDidl);
|
||||||
|
|
||||||
if (streamInfo == null)
|
if (streamInfo is null)
|
||||||
{
|
{
|
||||||
var sources = _mediaSourceManager.GetStaticMediaSources(audio, true, _user);
|
var sources = _mediaSourceManager.GetStaticMediaSources(audio, true, _user);
|
||||||
|
|
||||||
|
@ -598,7 +598,7 @@ namespace Emby.Dlna.Didl
|
||||||
|
|
||||||
var filename = url.Substring(0, url.IndexOf('?', StringComparison.Ordinal));
|
var filename = url.Substring(0, url.IndexOf('?', StringComparison.Ordinal));
|
||||||
|
|
||||||
var mimeType = mediaProfile == null || string.IsNullOrEmpty(mediaProfile.MimeType)
|
var mimeType = mediaProfile is null || string.IsNullOrEmpty(mediaProfile.MimeType)
|
||||||
? MimeTypes.GetMimeType(filename)
|
? MimeTypes.GetMimeType(filename)
|
||||||
: mediaProfile.MimeType;
|
: mediaProfile.MimeType;
|
||||||
|
|
||||||
|
@ -695,7 +695,7 @@ namespace Emby.Dlna.Didl
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not a samsung device
|
// Not a samsung device
|
||||||
if (secAttribute == null)
|
if (secAttribute is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -909,7 +909,7 @@ namespace Emby.Dlna.Didl
|
||||||
AddValue(writer, "dc", "creator", artist, NsDc);
|
AddValue(writer, "dc", "creator", artist, NsDc);
|
||||||
|
|
||||||
// If it doesn't support album artists (musicvideo), then tag as both
|
// If it doesn't support album artists (musicvideo), then tag as both
|
||||||
if (hasAlbumArtists == null)
|
if (hasAlbumArtists is null)
|
||||||
{
|
{
|
||||||
AddAlbumArtist(writer, artist);
|
AddAlbumArtist(writer, artist);
|
||||||
}
|
}
|
||||||
|
@ -973,7 +973,7 @@ namespace Emby.Dlna.Didl
|
||||||
{
|
{
|
||||||
ImageDownloadInfo imageInfo = GetImageInfo(item);
|
ImageDownloadInfo imageInfo = GetImageInfo(item);
|
||||||
|
|
||||||
if (imageInfo == null)
|
if (imageInfo is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1036,7 +1036,7 @@ namespace Emby.Dlna.Didl
|
||||||
{
|
{
|
||||||
var imageInfo = GetImageInfo(item);
|
var imageInfo = GetImageInfo(item);
|
||||||
|
|
||||||
if (imageInfo == null)
|
if (imageInfo is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1116,7 +1116,7 @@ namespace Emby.Dlna.Didl
|
||||||
|
|
||||||
private BaseItem GetFirstParentWithImageBelowUserRoot(BaseItem item)
|
private BaseItem GetFirstParentWithImageBelowUserRoot(BaseItem item)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace Emby.Dlna
|
||||||
var profile = GetProfiles()
|
var profile = GetProfiles()
|
||||||
.FirstOrDefault(i => i.Identification != null && IsMatch(deviceInfo, i.Identification));
|
.FirstOrDefault(i => i.Identification != null && IsMatch(deviceInfo, i.Identification));
|
||||||
|
|
||||||
if (profile == null)
|
if (profile is null)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("No matching device profile found. The default will need to be used. \n{@Profile}", deviceInfo);
|
_logger.LogInformation("No matching device profile found. The default will need to be used. \n{@Profile}", deviceInfo);
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ namespace Emby.Dlna
|
||||||
ArgumentNullException.ThrowIfNull(headers);
|
ArgumentNullException.ThrowIfNull(headers);
|
||||||
|
|
||||||
var profile = GetProfiles().FirstOrDefault(i => i.Identification != null && IsMatch(headers, i.Identification));
|
var profile = GetProfiles().FirstOrDefault(i => i.Identification != null && IsMatch(headers, i.Identification));
|
||||||
if (profile == null)
|
if (profile is null)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("No matching device profile found. {@Headers}", headers);
|
_logger.LogDebug("No matching device profile found. {@Headers}", headers);
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ namespace Emby.Dlna
|
||||||
|
|
||||||
var info = GetProfileInfosInternal().FirstOrDefault(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));
|
var info = GetProfileInfosInternal().FirstOrDefault(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (info == null)
|
if (info is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ namespace Emby.Dlna
|
||||||
|
|
||||||
var resource = GetType().Namespace + ".Images." + filename.ToLowerInvariant();
|
var resource = GetType().Namespace + ".Images." + filename.ToLowerInvariant();
|
||||||
var stream = _assembly.GetManifestResourceStream(resource);
|
var stream = _assembly.GetManifestResourceStream(resource);
|
||||||
if (stream == null)
|
if (stream is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,7 +199,7 @@ namespace Emby.Dlna.Main
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (_communicationsServer == null)
|
if (_communicationsServer is null)
|
||||||
{
|
{
|
||||||
var enableMultiSocketBinding = OperatingSystem.IsWindows() ||
|
var enableMultiSocketBinding = OperatingSystem.IsWindows() ||
|
||||||
OperatingSystem.IsLinux();
|
OperatingSystem.IsLinux();
|
||||||
|
|
|
@ -220,14 +220,14 @@ namespace Emby.Dlna.PlayTo
|
||||||
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "SetMute");
|
var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "SetMute");
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var service = GetServiceRenderingControl();
|
var service = GetServiceRenderingControl();
|
||||||
|
|
||||||
if (service == null)
|
if (service is null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -260,14 +260,14 @@ namespace Emby.Dlna.PlayTo
|
||||||
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "SetVolume");
|
var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "SetVolume");
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var service = GetServiceRenderingControl();
|
var service = GetServiceRenderingControl();
|
||||||
|
|
||||||
if (service == null)
|
if (service is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Unable to find service");
|
throw new InvalidOperationException("Unable to find service");
|
||||||
}
|
}
|
||||||
|
@ -291,14 +291,14 @@ namespace Emby.Dlna.PlayTo
|
||||||
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "Seek");
|
var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "Seek");
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var service = GetAvTransportService();
|
var service = GetAvTransportService();
|
||||||
|
|
||||||
if (service == null)
|
if (service is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Unable to find service");
|
throw new InvalidOperationException("Unable to find service");
|
||||||
}
|
}
|
||||||
|
@ -324,7 +324,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
_logger.LogDebug("{0} - SetAvTransport Uri: {1} DlnaHeaders: {2}", Properties.Name, url, header);
|
_logger.LogDebug("{0} - SetAvTransport Uri: {1} DlnaHeaders: {2}", Properties.Name, url, header);
|
||||||
|
|
||||||
var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "SetAVTransportURI");
|
var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "SetAVTransportURI");
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
|
|
||||||
var service = GetAvTransportService();
|
var service = GetAvTransportService();
|
||||||
|
|
||||||
if (service == null)
|
if (service is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Unable to find service");
|
throw new InvalidOperationException("Unable to find service");
|
||||||
}
|
}
|
||||||
|
@ -381,7 +381,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
_logger.LogDebug("{PropertyName} - SetNextAvTransport Uri: {Url} DlnaHeaders: {Header}", Properties.Name, url, header);
|
_logger.LogDebug("{PropertyName} - SetNextAvTransport Uri: {Url} DlnaHeaders: {Header}", Properties.Name, url, header);
|
||||||
|
|
||||||
var command = avCommands.ServiceActions.FirstOrDefault(c => string.Equals(c.Name, "SetNextAVTransportURI", StringComparison.OrdinalIgnoreCase));
|
var command = avCommands.ServiceActions.FirstOrDefault(c => string.Equals(c.Name, "SetNextAVTransportURI", StringComparison.OrdinalIgnoreCase));
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -394,7 +394,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
|
|
||||||
var service = GetAvTransportService();
|
var service = GetAvTransportService();
|
||||||
|
|
||||||
if (service == null)
|
if (service is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Unable to find service");
|
throw new InvalidOperationException("Unable to find service");
|
||||||
}
|
}
|
||||||
|
@ -418,13 +418,13 @@ namespace Emby.Dlna.PlayTo
|
||||||
private Task SetPlay(TransportCommands avCommands, CancellationToken cancellationToken)
|
private Task SetPlay(TransportCommands avCommands, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "Play");
|
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "Play");
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
var service = GetAvTransportService();
|
var service = GetAvTransportService();
|
||||||
if (service == null)
|
if (service is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Unable to find service");
|
throw new InvalidOperationException("Unable to find service");
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
public async Task SetPlay(CancellationToken cancellationToken)
|
public async Task SetPlay(CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||||
if (avCommands == null)
|
if (avCommands is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -455,7 +455,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "Stop");
|
var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "Stop");
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -479,7 +479,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "Pause");
|
var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "Pause");
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -513,7 +513,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
|
|
||||||
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (avCommands == null)
|
if (avCommands is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -538,7 +538,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
|
|
||||||
var currentObject = tuple.Track;
|
var currentObject = tuple.Track;
|
||||||
|
|
||||||
if (tuple.Success && currentObject == null)
|
if (tuple.Success && currentObject is null)
|
||||||
{
|
{
|
||||||
currentObject = await GetMediaInfo(avCommands, cancellationToken).ConfigureAwait(false);
|
currentObject = await GetMediaInfo(avCommands, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -607,14 +607,14 @@ namespace Emby.Dlna.PlayTo
|
||||||
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "GetVolume");
|
var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "GetVolume");
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var service = GetServiceRenderingControl();
|
var service = GetServiceRenderingControl();
|
||||||
|
|
||||||
if (service == null)
|
if (service is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -626,7 +626,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
rendererCommands.BuildPost(command, service.ServiceType),
|
rendererCommands.BuildPost(command, service.ServiceType),
|
||||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (result == null || result.Document == null)
|
if (result is null || result.Document is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -657,14 +657,14 @@ namespace Emby.Dlna.PlayTo
|
||||||
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "GetMute");
|
var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "GetMute");
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var service = GetServiceRenderingControl();
|
var service = GetServiceRenderingControl();
|
||||||
|
|
||||||
if (service == null)
|
if (service is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -676,7 +676,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
rendererCommands.BuildPost(command, service.ServiceType),
|
rendererCommands.BuildPost(command, service.ServiceType),
|
||||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (result == null || result.Document == null)
|
if (result is null || result.Document is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -691,13 +691,13 @@ namespace Emby.Dlna.PlayTo
|
||||||
private async Task<TransportState?> GetTransportInfo(TransportCommands avCommands, CancellationToken cancellationToken)
|
private async Task<TransportState?> GetTransportInfo(TransportCommands avCommands, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetTransportInfo");
|
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetTransportInfo");
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var service = GetAvTransportService();
|
var service = GetAvTransportService();
|
||||||
if (service == null)
|
if (service is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -709,7 +709,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
avCommands.BuildPost(command, service.ServiceType),
|
avCommands.BuildPost(command, service.ServiceType),
|
||||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (result == null || result.Document == null)
|
if (result is null || result.Document is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -731,19 +731,19 @@ namespace Emby.Dlna.PlayTo
|
||||||
private async Task<UBaseObject> GetMediaInfo(TransportCommands avCommands, CancellationToken cancellationToken)
|
private async Task<UBaseObject> GetMediaInfo(TransportCommands avCommands, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetMediaInfo");
|
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetMediaInfo");
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var service = GetAvTransportService();
|
var service = GetAvTransportService();
|
||||||
if (service == null)
|
if (service is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Unable to find service");
|
throw new InvalidOperationException("Unable to find service");
|
||||||
}
|
}
|
||||||
|
|
||||||
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||||
if (rendererCommands == null)
|
if (rendererCommands is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -755,14 +755,14 @@ namespace Emby.Dlna.PlayTo
|
||||||
rendererCommands.BuildPost(command, service.ServiceType),
|
rendererCommands.BuildPost(command, service.ServiceType),
|
||||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (result == null || result.Document == null)
|
if (result is null || result.Document is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var track = result.Document.Descendants("CurrentURIMetaData").FirstOrDefault();
|
var track = result.Document.Descendants("CurrentURIMetaData").FirstOrDefault();
|
||||||
|
|
||||||
if (track == null)
|
if (track is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -778,7 +778,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
|
|
||||||
track = result.Document.Descendants("CurrentURI").FirstOrDefault();
|
track = result.Document.Descendants("CurrentURI").FirstOrDefault();
|
||||||
|
|
||||||
if (track == null)
|
if (track is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -801,21 +801,21 @@ namespace Emby.Dlna.PlayTo
|
||||||
private async Task<(bool Success, UBaseObject Track)> GetPositionInfo(TransportCommands avCommands, CancellationToken cancellationToken)
|
private async Task<(bool Success, UBaseObject Track)> GetPositionInfo(TransportCommands avCommands, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetPositionInfo");
|
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetPositionInfo");
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
return (false, null);
|
return (false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
var service = GetAvTransportService();
|
var service = GetAvTransportService();
|
||||||
|
|
||||||
if (service == null)
|
if (service is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Unable to find service");
|
throw new InvalidOperationException("Unable to find service");
|
||||||
}
|
}
|
||||||
|
|
||||||
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (rendererCommands == null)
|
if (rendererCommands is null)
|
||||||
{
|
{
|
||||||
return (false, null);
|
return (false, null);
|
||||||
}
|
}
|
||||||
|
@ -827,7 +827,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
rendererCommands.BuildPost(command, service.ServiceType),
|
rendererCommands.BuildPost(command, service.ServiceType),
|
||||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (result == null || result.Document == null)
|
if (result is null || result.Document is null)
|
||||||
{
|
{
|
||||||
return (false, null);
|
return (false, null);
|
||||||
}
|
}
|
||||||
|
@ -858,7 +858,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
|
|
||||||
var track = result.Document.Descendants("TrackMetaData").FirstOrDefault();
|
var track = result.Document.Descendants("TrackMetaData").FirstOrDefault();
|
||||||
|
|
||||||
if (track == null)
|
if (track is null)
|
||||||
{
|
{
|
||||||
// If track is null, some vendors do this, use GetMediaInfo instead.
|
// If track is null, some vendors do this, use GetMediaInfo instead.
|
||||||
return (true, null);
|
return (true, null);
|
||||||
|
@ -882,7 +882,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
_logger.LogError(ex, "Uncaught exception while parsing xml");
|
_logger.LogError(ex, "Uncaught exception while parsing xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uPnpResponse == null)
|
if (uPnpResponse is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Failed to parse xml: \n {Xml}", trackString);
|
_logger.LogError("Failed to parse xml: \n {Xml}", trackString);
|
||||||
return (true, null);
|
return (true, null);
|
||||||
|
@ -985,7 +985,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
}
|
}
|
||||||
|
|
||||||
var avService = GetAvTransportService();
|
var avService = GetAvTransportService();
|
||||||
if (avService == null)
|
if (avService is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -995,7 +995,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
var httpClient = new DlnaHttpClient(_logger, _httpClientFactory);
|
var httpClient = new DlnaHttpClient(_logger, _httpClientFactory);
|
||||||
|
|
||||||
var document = await httpClient.GetDataAsync(url, cancellationToken).ConfigureAwait(false);
|
var document = await httpClient.GetDataAsync(url, cancellationToken).ConfigureAwait(false);
|
||||||
if (document == null)
|
if (document is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1017,7 +1017,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
}
|
}
|
||||||
|
|
||||||
var avService = GetServiceRenderingControl();
|
var avService = GetServiceRenderingControl();
|
||||||
if (avService == null)
|
if (avService is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Device AvService is null");
|
throw new ArgumentException("Device AvService is null");
|
||||||
}
|
}
|
||||||
|
@ -1027,7 +1027,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
var httpClient = new DlnaHttpClient(_logger, _httpClientFactory);
|
var httpClient = new DlnaHttpClient(_logger, _httpClientFactory);
|
||||||
_logger.LogDebug("Dlna Device.GetRenderingProtocolAsync");
|
_logger.LogDebug("Dlna Device.GetRenderingProtocolAsync");
|
||||||
var document = await httpClient.GetDataAsync(url, cancellationToken).ConfigureAwait(false);
|
var document = await httpClient.GetDataAsync(url, cancellationToken).ConfigureAwait(false);
|
||||||
if (document == null)
|
if (document is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1062,7 +1062,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
var ssdpHttpClient = new DlnaHttpClient(logger, httpClientFactory);
|
var ssdpHttpClient = new DlnaHttpClient(logger, httpClientFactory);
|
||||||
|
|
||||||
var document = await ssdpHttpClient.GetDataAsync(url.ToString(), cancellationToken).ConfigureAwait(false);
|
var document = await ssdpHttpClient.GetDataAsync(url.ToString(), cancellationToken).ConfigureAwait(false);
|
||||||
if (document == null)
|
if (document is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1149,13 +1149,13 @@ namespace Emby.Dlna.PlayTo
|
||||||
|
|
||||||
foreach (var services in document.Descendants(UPnpNamespaces.Ud.GetName("serviceList")))
|
foreach (var services in document.Descendants(UPnpNamespaces.Ud.GetName("serviceList")))
|
||||||
{
|
{
|
||||||
if (services == null)
|
if (services is null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var servicesList = services.Descendants(UPnpNamespaces.Ud.GetName("service"));
|
var servicesList = services.Descendants(UPnpNamespaces.Ud.GetName("service"));
|
||||||
if (servicesList == null)
|
if (servicesList is null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1212,14 +1212,14 @@ namespace Emby.Dlna.PlayTo
|
||||||
var previousMediaInfo = CurrentMediaInfo;
|
var previousMediaInfo = CurrentMediaInfo;
|
||||||
CurrentMediaInfo = mediaInfo;
|
CurrentMediaInfo = mediaInfo;
|
||||||
|
|
||||||
if (mediaInfo == null)
|
if (mediaInfo is null)
|
||||||
{
|
{
|
||||||
if (previousMediaInfo != null)
|
if (previousMediaInfo != null)
|
||||||
{
|
{
|
||||||
OnPlaybackStop(previousMediaInfo);
|
OnPlaybackStop(previousMediaInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (previousMediaInfo == null)
|
else if (previousMediaInfo is null)
|
||||||
{
|
{
|
||||||
if (state != TransportState.STOPPED)
|
if (state != TransportState.STOPPED)
|
||||||
{
|
{
|
||||||
|
|
|
@ -164,7 +164,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
}
|
}
|
||||||
|
|
||||||
streamInfo = StreamParams.ParseFromUrl(e.NewMediaInfo.Url, _libraryManager, _mediaSourceManager);
|
streamInfo = StreamParams.ParseFromUrl(e.NewMediaInfo.Url, _libraryManager, _mediaSourceManager);
|
||||||
if (streamInfo.Item == null)
|
if (streamInfo.Item is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
{
|
{
|
||||||
var streamInfo = StreamParams.ParseFromUrl(e.MediaInfo.Url, _libraryManager, _mediaSourceManager);
|
var streamInfo = StreamParams.ParseFromUrl(e.MediaInfo.Url, _libraryManager, _mediaSourceManager);
|
||||||
|
|
||||||
if (streamInfo.Item == null)
|
if (streamInfo.Item is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -210,7 +210,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
|
|
||||||
var mediaSource = await streamInfo.GetMediaSource(CancellationToken.None).ConfigureAwait(false);
|
var mediaSource = await streamInfo.GetMediaSource(CancellationToken.None).ConfigureAwait(false);
|
||||||
|
|
||||||
var duration = mediaSource == null
|
var duration = mediaSource is null
|
||||||
? _device.Duration?.Ticks
|
? _device.Duration?.Ticks
|
||||||
: mediaSource.RunTimeTicks;
|
: mediaSource.RunTimeTicks;
|
||||||
|
|
||||||
|
@ -865,7 +865,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
throw new ObjectDisposedException(GetType().Name);
|
throw new ObjectDisposedException(GetType().Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_device == null)
|
if (_device is null)
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,10 +176,10 @@ namespace Emby.Dlna.PlayTo
|
||||||
|
|
||||||
var controller = sessionInfo.SessionControllers.OfType<PlayToController>().FirstOrDefault();
|
var controller = sessionInfo.SessionControllers.OfType<PlayToController>().FirstOrDefault();
|
||||||
|
|
||||||
if (controller == null)
|
if (controller is null)
|
||||||
{
|
{
|
||||||
var device = await Device.CreateuPnpDeviceAsync(uri, _httpClientFactory, _logger, cancellationToken).ConfigureAwait(false);
|
var device = await Device.CreateuPnpDeviceAsync(uri, _httpClientFactory, _logger, cancellationToken).ConfigureAwait(false);
|
||||||
if (device == null)
|
if (device is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Ignoring device as xml response is invalid.");
|
_logger.LogError("Ignoring device as xml response is invalid.");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace Emby.Dlna.Ssdp
|
||||||
{
|
{
|
||||||
lock (_syncLock)
|
lock (_syncLock)
|
||||||
{
|
{
|
||||||
if (_listenerCount > 0 && _deviceLocator == null && _commsServer != null)
|
if (_listenerCount > 0 && _deviceLocator is null && _commsServer != null)
|
||||||
{
|
{
|
||||||
_deviceLocator = new SsdpDeviceLocator(_commsServer);
|
_deviceLocator = new SsdpDeviceLocator(_commsServer);
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ namespace Emby.Dlna.Ssdp
|
||||||
{
|
{
|
||||||
var originalHeaders = e.DiscoveredDevice.ResponseHeaders;
|
var originalHeaders = e.DiscoveredDevice.ResponseHeaders;
|
||||||
|
|
||||||
var headerDict = originalHeaders == null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase);
|
var headerDict = originalHeaders is null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);
|
var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ namespace Emby.Dlna.Ssdp
|
||||||
{
|
{
|
||||||
var originalHeaders = e.DiscoveredDevice.ResponseHeaders;
|
var originalHeaders = e.DiscoveredDevice.ResponseHeaders;
|
||||||
|
|
||||||
var headerDict = originalHeaders == null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase);
|
var headerDict = originalHeaders is null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);
|
var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
|
|
@ -436,7 +436,7 @@ namespace Emby.Drawing
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string? GetImageCacheTag(User user)
|
public string? GetImageCacheTag(User user)
|
||||||
{
|
{
|
||||||
if (user.ProfileImage == null)
|
if (user.ProfileImage is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ namespace Emby.Naming.AudioBook
|
||||||
|
|
||||||
foreach (var group in groupedBy)
|
foreach (var group in groupedBy)
|
||||||
{
|
{
|
||||||
if (group.Key.ChapterNumber == null && group.Key.PartNumber == null)
|
if (group.Key.ChapterNumber is null && group.Key.PartNumber is null)
|
||||||
{
|
{
|
||||||
if (group.Count() > 1 || haveChaptersOrPages)
|
if (group.Count() > 1 || haveChaptersOrPages)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Emby.Naming.AudioBook
|
||||||
var match = new Regex(expression, RegexOptions.IgnoreCase).Match(name);
|
var match = new Regex(expression, RegexOptions.IgnoreCase).Match(name);
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
if (result.Name == null)
|
if (result.Name is null)
|
||||||
{
|
{
|
||||||
var value = match.Groups["name"];
|
var value = match.Groups["name"];
|
||||||
if (value.Success)
|
if (value.Success)
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace Emby.Naming.ExternalFiles
|
||||||
// Try to translate to three character code
|
// Try to translate to three character code
|
||||||
var culture = _localizationManager.FindLanguageInfo(currentSliceWithoutSeparator);
|
var culture = _localizationManager.FindLanguageInfo(currentSliceWithoutSeparator);
|
||||||
|
|
||||||
if (culture != null && pathInfo.Language == null)
|
if (culture != null && pathInfo.Language is null)
|
||||||
{
|
{
|
||||||
pathInfo.Language = culture.ThreeLetterISOLanguageName;
|
pathInfo.Language = culture.ThreeLetterISOLanguageName;
|
||||||
extraString = extraString.Replace(currentSlice, string.Empty, StringComparison.OrdinalIgnoreCase);
|
extraString = extraString.Replace(currentSlice, string.Empty, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
|
@ -26,7 +26,7 @@ namespace Emby.Naming.Video
|
||||||
// Filter out all extras, otherwise they could cause stacks to not be resolved
|
// Filter out all extras, otherwise they could cause stacks to not be resolved
|
||||||
// See the unit test TestStackedWithTrailer
|
// See the unit test TestStackedWithTrailer
|
||||||
var nonExtras = videoInfos
|
var nonExtras = videoInfos
|
||||||
.Where(i => i.ExtraType == null)
|
.Where(i => i.ExtraType is null)
|
||||||
.Select(i => new FileSystemMetadata { FullName = i.Path, IsDirectory = i.IsDirectory });
|
.Select(i => new FileSystemMetadata { FullName = i.Path, IsDirectory = i.IsDirectory });
|
||||||
|
|
||||||
var stackResult = StackResolver.Resolve(nonExtras, namingOptions).ToList();
|
var stackResult = StackResolver.Resolve(nonExtras, namingOptions).ToList();
|
||||||
|
@ -42,7 +42,7 @@ namespace Emby.Naming.Video
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current.ExtraType == null)
|
if (current.ExtraType is null)
|
||||||
{
|
{
|
||||||
standaloneMedia.Add(current);
|
standaloneMedia.Add(current);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,7 @@ namespace Emby.Naming.Video
|
||||||
name = cleanDateTimeResult.Name;
|
name = cleanDateTimeResult.Name;
|
||||||
year = cleanDateTimeResult.Year;
|
year = cleanDateTimeResult.Year;
|
||||||
|
|
||||||
if (extraResult.ExtraType == null
|
if (extraResult.ExtraType is null
|
||||||
&& TryCleanString(name, namingOptions, out var newName))
|
&& TryCleanString(name, namingOptions, out var newName))
|
||||||
{
|
{
|
||||||
name = newName;
|
name = newName;
|
||||||
|
|
|
@ -141,7 +141,7 @@ namespace Emby.Notifications
|
||||||
|
|
||||||
lock (_libraryChangedSyncLock)
|
lock (_libraryChangedSyncLock)
|
||||||
{
|
{
|
||||||
if (_libraryUpdateTimer == null)
|
if (_libraryUpdateTimer is null)
|
||||||
{
|
{
|
||||||
_libraryUpdateTimer = new Timer(
|
_libraryUpdateTimer = new Timer(
|
||||||
LibraryUpdateTimerCallback,
|
LibraryUpdateTimerCallback,
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace Emby.Notifications
|
||||||
|
|
||||||
var users = GetUserIds(request, options)
|
var users = GetUserIds(request, options)
|
||||||
.Select(i => _userManager.GetUserById(i))
|
.Select(i => _userManager.GetUserById(i))
|
||||||
.Where(i => relatedItem == null || relatedItem.IsVisibleStandalone(i))
|
.Where(i => relatedItem is null || relatedItem.IsVisibleStandalone(i))
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
var title = request.Name;
|
var title = request.Name;
|
||||||
|
|
|
@ -144,7 +144,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
{
|
{
|
||||||
IConfigurationFactory factory = Activator.CreateInstance<T>();
|
IConfigurationFactory factory = Activator.CreateInstance<T>();
|
||||||
|
|
||||||
if (_configurationFactories == null)
|
if (_configurationFactories is null)
|
||||||
{
|
{
|
||||||
_configurationFactories = new[] { factory };
|
_configurationFactories = new[] { factory };
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
configurationManager._configurationStores,
|
configurationManager._configurationStores,
|
||||||
i => string.Equals(i.Key, k, StringComparison.OrdinalIgnoreCase));
|
i => string.Equals(i.Key, k, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (configurationInfo == null)
|
if (configurationInfo is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException("Configuration with key " + k + " not found.");
|
throw new ResourceNotFoundException("Configuration with key " + k + " not found.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace Emby.Server.Implementations.AppBase
|
||||||
Span<byte> newBytes = stream.GetBuffer().AsSpan(0, (int)stream.Length);
|
Span<byte> newBytes = stream.GetBuffer().AsSpan(0, (int)stream.Length);
|
||||||
|
|
||||||
// If the file didn't exist before, or if something has changed, re-save
|
// If the file didn't exist before, or if something has changed, re-save
|
||||||
if (buffer == null || !newBytes.SequenceEqual(buffer))
|
if (buffer is null || !newBytes.SequenceEqual(buffer))
|
||||||
{
|
{
|
||||||
var directory = Path.GetDirectoryName(path) ?? throw new ArgumentException($"Provided path ({path}) is not valid.", nameof(path));
|
var directory = Path.GetDirectoryName(path) ?? throw new ArgumentException($"Provided path ({path}) is not valid.", nameof(path));
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
public Task DeleteItem(BaseItem item)
|
public Task DeleteItem(BaseItem item)
|
||||||
{
|
{
|
||||||
var internalChannel = _libraryManager.GetItemById(item.ChannelId);
|
var internalChannel = _libraryManager.GetItemById(item.ChannelId);
|
||||||
if (internalChannel == null)
|
if (internalChannel is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException(nameof(item.ChannelId));
|
throw new ArgumentException(nameof(item.ChannelId));
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
if (query.StartIndex.HasValue || query.Limit.HasValue)
|
if (query.StartIndex.HasValue || query.Limit.HasValue)
|
||||||
{
|
{
|
||||||
int startIndex = query.StartIndex ?? 0;
|
int startIndex = query.StartIndex ?? 0;
|
||||||
int count = query.Limit == null ? totalCount - startIndex : Math.Min(query.Limit.Value, totalCount - startIndex);
|
int count = query.Limit is null ? totalCount - startIndex : Math.Min(query.Limit.Value, totalCount - startIndex);
|
||||||
all = all.GetRange(startIndex, count);
|
all = all.GetRange(startIndex, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,7 +355,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
{
|
{
|
||||||
var path = Path.Combine(item.GetInternalMetadataPath(), "channelmediasourceinfos.json");
|
var path = Path.Combine(item.GetInternalMetadataPath(), "channelmediasourceinfos.json");
|
||||||
|
|
||||||
if (mediaSources == null || mediaSources.Count == 0)
|
if (mediaSources is null || mediaSources.Count == 0)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -447,7 +447,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
|
|
||||||
var item = _libraryManager.GetItemById(id) as Channel;
|
var item = _libraryManager.GetItemById(id) as Channel;
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
item = new Channel
|
item = new Channel
|
||||||
{
|
{
|
||||||
|
@ -861,7 +861,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
|
|
||||||
var result = await channel.GetChannelItems(query, cancellationToken).ConfigureAwait(false);
|
var result = await channel.GetChannelItems(query, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (result == null)
|
if (result is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Channel returned a null result from GetChannelItems");
|
throw new InvalidOperationException("Channel returned a null result from GetChannelItems");
|
||||||
}
|
}
|
||||||
|
@ -955,7 +955,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
_logger.LogError(ex, "Error retrieving channel item from database");
|
_logger.LogError(ex, "Error retrieving channel item from database");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
item = new T();
|
item = new T();
|
||||||
isNew = true;
|
isNew = true;
|
||||||
|
@ -1193,7 +1193,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
var result = GetAllChannels()
|
var result = GetAllChannels()
|
||||||
.FirstOrDefault(i => GetInternalChannelId(i.Name).Equals(channel.ChannelId) || string.Equals(i.Name, channel.Name, StringComparison.OrdinalIgnoreCase));
|
.FirstOrDefault(i => GetInternalChannelId(i.Name).Equals(channel.ChannelId) || string.Equals(i.Name, channel.Name, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (result == null)
|
if (result is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException("No channel provider found for channel " + channel.Name);
|
throw new ResourceNotFoundException("No channel provider found for channel " + channel.Name);
|
||||||
}
|
}
|
||||||
|
@ -1206,7 +1206,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
var result = GetAllChannels()
|
var result = GetAllChannels()
|
||||||
.FirstOrDefault(i => internalChannelId.Equals(GetInternalChannelId(i.Name)));
|
.FirstOrDefault(i => internalChannelId.Equals(GetInternalChannelId(i.Name)));
|
||||||
|
|
||||||
if (result == null)
|
if (result is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException("No channel provider found for channel id " + internalChannelId);
|
throw new ResourceNotFoundException("No channel provider found for channel id " + internalChannelId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ namespace Emby.Server.Implementations.Collections
|
||||||
{
|
{
|
||||||
var folder = GetCollectionsFolder(false).GetAwaiter().GetResult();
|
var folder = GetCollectionsFolder(false).GetAwaiter().GetResult();
|
||||||
|
|
||||||
return folder == null
|
return folder is null
|
||||||
? Enumerable.Empty<BoxSet>()
|
? Enumerable.Empty<BoxSet>()
|
||||||
: folder.GetChildren(user, true).OfType<BoxSet>();
|
: folder.GetChildren(user, true).OfType<BoxSet>();
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ namespace Emby.Server.Implementations.Collections
|
||||||
|
|
||||||
var parentFolder = await GetCollectionsFolder(true).ConfigureAwait(false);
|
var parentFolder = await GetCollectionsFolder(true).ConfigureAwait(false);
|
||||||
|
|
||||||
if (parentFolder == null)
|
if (parentFolder is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException(nameof(parentFolder));
|
throw new ArgumentException(nameof(parentFolder));
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ namespace Emby.Server.Implementations.Collections
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(id);
|
var item = _libraryManager.GetItemById(id);
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("No item exists with the supplied Id");
|
throw new ArgumentException("No item exists with the supplied Id");
|
||||||
}
|
}
|
||||||
|
@ -267,7 +267,7 @@ namespace Emby.Server.Implementations.Collections
|
||||||
|
|
||||||
var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value.Equals(guidId)) || (childItem != null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));
|
var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value.Equals(guidId)) || (childItem != null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));
|
||||||
|
|
||||||
if (child == null)
|
if (child is null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("No collection title exists with the supplied Id");
|
_logger.LogWarning("No collection title exists with the supplied Id");
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -253,7 +253,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam))
|
if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam))
|
||||||
{
|
{
|
||||||
if (value == null)
|
if (value is null)
|
||||||
{
|
{
|
||||||
bindParam.BindNull();
|
bindParam.BindNull();
|
||||||
}
|
}
|
||||||
|
|
|
@ -691,7 +691,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
private string GetPathToSave(string path)
|
private string GetPathToSave(string path)
|
||||||
{
|
{
|
||||||
if (path == null)
|
if (path is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -890,7 +890,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
saveItemStatement.TryBind("@UnratedType", item.GetBlockUnratedType().ToString());
|
saveItemStatement.TryBind("@UnratedType", item.GetBlockUnratedType().ToString());
|
||||||
|
|
||||||
if (topParent == null)
|
if (topParent is null)
|
||||||
{
|
{
|
||||||
saveItemStatement.TryBindNull("@TopParentId");
|
saveItemStatement.TryBindNull("@TopParentId");
|
||||||
}
|
}
|
||||||
|
@ -1414,7 +1414,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
var type = _typeMapper.GetType(typeString);
|
var type = _typeMapper.GetType(typeString);
|
||||||
|
|
||||||
if (type == null)
|
if (type is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1433,7 +1433,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1444,7 +1444,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -2151,7 +2151,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
|
|
||||||
private static bool EnableJoinUserData(InternalItemsQuery query)
|
private static bool EnableJoinUserData(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
if (query.User == null)
|
if (query.User is null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2497,7 +2497,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
var item = query.SimilarTo;
|
var item = query.SimilarTo;
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4522,7 +4522,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
if (query.ExcludeInheritedTags.Length > 0)
|
if (query.ExcludeInheritedTags.Length > 0)
|
||||||
{
|
{
|
||||||
var paramName = "@ExcludeInheritedTags";
|
var paramName = "@ExcludeInheritedTags";
|
||||||
if (statement == null)
|
if (statement is null)
|
||||||
{
|
{
|
||||||
int index = 0;
|
int index = 0;
|
||||||
string excludedTags = string.Join(',', query.ExcludeInheritedTags.Select(_ => paramName + index++));
|
string excludedTags = string.Join(',', query.ExcludeInheritedTags.Select(_ => paramName + index++));
|
||||||
|
@ -4732,7 +4732,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.User == null)
|
if (query.User is null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -235,14 +235,14 @@ namespace Emby.Server.Implementations.Dto
|
||||||
|
|
||||||
if (options.ContainsField(ItemFields.CanDelete))
|
if (options.ContainsField(ItemFields.CanDelete))
|
||||||
{
|
{
|
||||||
dto.CanDelete = user == null
|
dto.CanDelete = user is null
|
||||||
? item.CanDelete()
|
? item.CanDelete()
|
||||||
: item.CanDelete(user);
|
: item.CanDelete(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.ContainsField(ItemFields.CanDownload))
|
if (options.ContainsField(ItemFields.CanDownload))
|
||||||
{
|
{
|
||||||
dto.CanDownload = user == null
|
dto.CanDownload = user is null
|
||||||
? item.CanDownload()
|
? item.CanDownload()
|
||||||
: item.CanDownload(user);
|
: item.CanDownload(user);
|
||||||
}
|
}
|
||||||
|
@ -571,7 +571,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}).Where(i => i != null)
|
}).Where(i => i != null)
|
||||||
.Where(i => user == null ?
|
.Where(i => user is null ?
|
||||||
true :
|
true :
|
||||||
i.IsVisible(user))
|
i.IsVisible(user))
|
||||||
.GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
|
.GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
|
||||||
|
@ -1143,7 +1143,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
if (episodeSeries != null)
|
if (episodeSeries != null)
|
||||||
{
|
{
|
||||||
dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, episodeSeries, ImageType.Primary);
|
dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, episodeSeries, ImageType.Primary);
|
||||||
if (dto.ImageTags == null || !dto.ImageTags.ContainsKey(ImageType.Primary))
|
if (dto.ImageTags is null || !dto.ImageTags.ContainsKey(ImageType.Primary))
|
||||||
{
|
{
|
||||||
AttachPrimaryImageAspectRatio(dto, episodeSeries);
|
AttachPrimaryImageAspectRatio(dto, episodeSeries);
|
||||||
}
|
}
|
||||||
|
@ -1193,7 +1193,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
if (series != null)
|
if (series != null)
|
||||||
{
|
{
|
||||||
dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, series, ImageType.Primary);
|
dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, series, ImageType.Primary);
|
||||||
if (dto.ImageTags == null || !dto.ImageTags.ContainsKey(ImageType.Primary))
|
if (dto.ImageTags is null || !dto.ImageTags.ContainsKey(ImageType.Primary))
|
||||||
{
|
{
|
||||||
AttachPrimaryImageAspectRatio(dto, series);
|
AttachPrimaryImageAspectRatio(dto, series);
|
||||||
}
|
}
|
||||||
|
@ -1276,7 +1276,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
|
|
||||||
var parent = currentItem.DisplayParent ?? currentItem.GetOwner() ?? currentItem.GetParent();
|
var parent = currentItem.DisplayParent ?? currentItem.GetOwner() ?? currentItem.GetParent();
|
||||||
|
|
||||||
if (parent == null && originalItem is not UserRootFolder && originalItem is not UserView && originalItem is not AggregateFolder && originalItem is not ICollectionFolder && originalItem is not Channel)
|
if (parent is null && originalItem is not UserRootFolder && originalItem is not UserView && originalItem is not AggregateFolder && originalItem is not ICollectionFolder && originalItem is not Channel)
|
||||||
{
|
{
|
||||||
parent = _libraryManager.GetCollectionFolders(originalItem).FirstOrDefault();
|
parent = _libraryManager.GetCollectionFolders(originalItem).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
@ -1315,7 +1315,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
|| parent is Series)
|
|| parent is Series)
|
||||||
{
|
{
|
||||||
parent ??= isFirst ? GetImageDisplayParent(item, item) ?? owner : parent;
|
parent ??= isFirst ? GetImageDisplayParent(item, item) ?? owner : parent;
|
||||||
if (parent == null)
|
if (parent is null)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1403,7 +1403,7 @@ namespace Emby.Server.Implementations.Dto
|
||||||
{
|
{
|
||||||
var imageInfo = item.GetImageInfo(ImageType.Primary, 0);
|
var imageInfo = item.GetImageInfo(ImageType.Primary, 0);
|
||||||
|
|
||||||
if (imageInfo == null)
|
if (imageInfo is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
|
|
||||||
lock (_libraryChangedSyncLock)
|
lock (_libraryChangedSyncLock)
|
||||||
{
|
{
|
||||||
if (LibraryUpdateTimer == null)
|
if (LibraryUpdateTimer is null)
|
||||||
{
|
{
|
||||||
LibraryUpdateTimer = new Timer(
|
LibraryUpdateTimer = new Timer(
|
||||||
LibraryUpdateTimerCallback,
|
LibraryUpdateTimerCallback,
|
||||||
|
@ -227,7 +227,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
|
|
||||||
lock (_libraryChangedSyncLock)
|
lock (_libraryChangedSyncLock)
|
||||||
{
|
{
|
||||||
if (LibraryUpdateTimer == null)
|
if (LibraryUpdateTimer is null)
|
||||||
{
|
{
|
||||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite);
|
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite);
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
|
|
||||||
lock (_libraryChangedSyncLock)
|
lock (_libraryChangedSyncLock)
|
||||||
{
|
{
|
||||||
if (LibraryUpdateTimer == null)
|
if (LibraryUpdateTimer is null)
|
||||||
{
|
{
|
||||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite);
|
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
|
|
||||||
lock (_syncLock)
|
lock (_syncLock)
|
||||||
{
|
{
|
||||||
if (_updateTimer == null)
|
if (_updateTimer is null)
|
||||||
{
|
{
|
||||||
_updateTimer = new Timer(
|
_updateTimer = new Timer(
|
||||||
UpdateTimerCallback,
|
UpdateTimerCallback,
|
||||||
|
|
|
@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
ReadResult result = await reader.ReadAsync().ConfigureAwait(false);
|
ReadResult result = await reader.ReadAsync().ConfigureAwait(false);
|
||||||
ReadOnlySequence<byte> buffer = result.Buffer;
|
ReadOnlySequence<byte> buffer = result.Buffer;
|
||||||
|
|
||||||
if (OnReceive == null)
|
if (OnReceive is null)
|
||||||
{
|
{
|
||||||
// Tell the PipeReader how much of the buffer we have consumed
|
// Tell the PipeReader how much of the buffer we have consumed
|
||||||
reader.AdvanceTo(buffer.End);
|
reader.AdvanceTo(buffer.End);
|
||||||
|
@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.HttpServer
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stub == null)
|
if (stub is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Error processing web socket message");
|
_logger.LogError("Error processing web socket message");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_timer == null)
|
if (_timer is null)
|
||||||
{
|
{
|
||||||
_timer = new Timer(OnTimerCallback, null, TimeSpan.FromSeconds(_configurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1));
|
_timer = new Timer(OnTimerCallback, null, TimeSpan.FromSeconds(_configurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1));
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
BaseItem? item = null;
|
BaseItem? item = null;
|
||||||
|
|
||||||
while (item == null && !string.IsNullOrEmpty(path))
|
while (item is null && !string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
item = _libraryManager.FindByPath(path, null);
|
item = _libraryManager.FindByPath(path, null);
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ namespace Emby.Server.Implementations.IO
|
||||||
{
|
{
|
||||||
item = item.GetOwner() ?? item.GetParent();
|
item = item.GetOwner() ?? item.GetParent();
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_rootFolder == null)
|
if (_rootFolder is null)
|
||||||
{
|
{
|
||||||
lock (_rootFolderSyncLock)
|
lock (_rootFolderSyncLock)
|
||||||
{
|
{
|
||||||
|
@ -656,7 +656,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
if (parent != null)
|
if (parent != null)
|
||||||
{
|
{
|
||||||
var multiItemResolvers = resolvers == null ? MultiItemResolvers : resolvers.OfType<IMultiItemResolver>().ToArray();
|
var multiItemResolvers = resolvers is null ? MultiItemResolvers : resolvers.OfType<IMultiItemResolver>().ToArray();
|
||||||
|
|
||||||
foreach (var resolver in multiItemResolvers)
|
foreach (var resolver in multiItemResolvers)
|
||||||
{
|
{
|
||||||
|
@ -770,11 +770,11 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
public Folder GetUserRootFolder()
|
public Folder GetUserRootFolder()
|
||||||
{
|
{
|
||||||
if (_userRootFolder == null)
|
if (_userRootFolder is null)
|
||||||
{
|
{
|
||||||
lock (_userRootFolderSyncLock)
|
lock (_userRootFolderSyncLock)
|
||||||
{
|
{
|
||||||
if (_userRootFolder == null)
|
if (_userRootFolder is null)
|
||||||
{
|
{
|
||||||
var userRootPath = _configurationManager.ApplicationPaths.DefaultUserViewsPath;
|
var userRootPath = _configurationManager.ApplicationPaths.DefaultUserViewsPath;
|
||||||
|
|
||||||
|
@ -792,7 +792,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
_logger.LogError(ex, "Error creating UserRootFolder {Path}", newItemId);
|
_logger.LogError(ex, "Error creating UserRootFolder {Path}", newItemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmpItem == null)
|
if (tmpItem is null)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Creating new userRootFolder with DeepCopy");
|
_logger.LogDebug("Creating new userRootFolder with DeepCopy");
|
||||||
tmpItem = ((Folder)ResolvePath(_fileSystem.GetDirectoryInfo(userRootPath))).DeepCopy<Folder, UserRootFolder>();
|
tmpItem = ((Folder)ResolvePath(_fileSystem.GetDirectoryInfo(userRootPath))).DeepCopy<Folder, UserRootFolder>();
|
||||||
|
@ -961,7 +961,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
var path = getPathFn(name);
|
var path = getPathFn(name);
|
||||||
var id = GetItemByNameId<T>(path);
|
var id = GetItemByNameId<T>(path);
|
||||||
var item = GetItemById(id) as T;
|
var item = GetItemById(id) as T;
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
item = new T
|
item = new T
|
||||||
{
|
{
|
||||||
|
@ -1627,7 +1627,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
// Get an existing item by Id
|
// Get an existing item by Id
|
||||||
video = GetItemById(info.ItemId.Value) as Video;
|
video = GetItemById(info.ItemId.Value) as Video;
|
||||||
|
|
||||||
if (video == null)
|
if (video is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Unable to locate item with Id {ID}.", info.ItemId.Value);
|
_logger.LogError("Unable to locate item with Id {ID}.", info.ItemId.Value);
|
||||||
}
|
}
|
||||||
|
@ -1639,7 +1639,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
// Try to resolve the path into a video
|
// Try to resolve the path into a video
|
||||||
video = ResolvePath(_fileSystem.GetFileSystemInfo(info.Path)) as Video;
|
video = ResolvePath(_fileSystem.GetFileSystemInfo(info.Path)) as Video;
|
||||||
|
|
||||||
if (video == null)
|
if (video is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Intro resolver returned null for {Path}.", info.Path);
|
_logger.LogError("Intro resolver returned null for {Path}.", info.Path);
|
||||||
}
|
}
|
||||||
|
@ -1711,7 +1711,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
foreach (var (name, sortOrder) in orderBy)
|
foreach (var (name, sortOrder) in orderBy)
|
||||||
{
|
{
|
||||||
var comparer = GetComparer(name, user);
|
var comparer = GetComparer(name, user);
|
||||||
if (comparer == null)
|
if (comparer is null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2010,7 +2010,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
var parent = item.GetParent();
|
var parent = item.GetParent();
|
||||||
|
|
||||||
if (parent == null || parent is AggregateFolder)
|
if (parent is null || parent is AggregateFolder)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2018,7 +2018,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
item = parent;
|
item = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return new List<Folder>();
|
return new List<Folder>();
|
||||||
}
|
}
|
||||||
|
@ -2032,7 +2032,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
var parent = item.GetParent();
|
var parent = item.GetParent();
|
||||||
|
|
||||||
if (parent == null || parent is AggregateFolder)
|
if (parent is null || parent is AggregateFolder)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2040,7 +2040,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
item = parent;
|
item = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return new List<Folder>();
|
return new List<Folder>();
|
||||||
}
|
}
|
||||||
|
@ -2064,7 +2064,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
.Find(folder => folder is CollectionFolder) as CollectionFolder;
|
.Find(folder => folder is CollectionFolder) as CollectionFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
return collectionFolder == null ? new LibraryOptions() : collectionFolder.GetLibraryOptions();
|
return collectionFolder is null ? new LibraryOptions() : collectionFolder.GetLibraryOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetContentType(BaseItem item)
|
public string GetContentType(BaseItem item)
|
||||||
|
@ -2129,7 +2129,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
private string GetTopFolderContentType(BaseItem item)
|
private string GetTopFolderContentType(BaseItem item)
|
||||||
{
|
{
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -2137,7 +2137,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
while (!item.ParentId.Equals(default))
|
while (!item.ParentId.Equals(default))
|
||||||
{
|
{
|
||||||
var parent = item.GetParent();
|
var parent = item.GetParent();
|
||||||
if (parent == null || parent is AggregateFolder)
|
if (parent is null || parent is AggregateFolder)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2177,7 +2177,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
var refresh = false;
|
var refresh = false;
|
||||||
|
|
||||||
if (item == null || !string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase))
|
if (item is null || !string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(path);
|
Directory.CreateDirectory(path);
|
||||||
|
|
||||||
|
@ -2225,7 +2225,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
var isNew = false;
|
var isNew = false;
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(path);
|
Directory.CreateDirectory(path);
|
||||||
|
|
||||||
|
@ -2289,7 +2289,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
var isNew = false;
|
var isNew = false;
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(path);
|
Directory.CreateDirectory(path);
|
||||||
|
|
||||||
|
@ -2362,7 +2362,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
var isNew = false;
|
var isNew = false;
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
Directory.CreateDirectory(path);
|
Directory.CreateDirectory(path);
|
||||||
|
|
||||||
|
@ -2459,7 +2459,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
episodeInfo = resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming);
|
episodeInfo = resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming);
|
||||||
// Resolve from parent folder if it's not the Season folder
|
// Resolve from parent folder if it's not the Season folder
|
||||||
var parent = episode.GetParent();
|
var parent = episode.GetParent();
|
||||||
if (episodeInfo == null && parent.GetType() == typeof(Folder))
|
if (episodeInfo is null && parent.GetType() == typeof(Folder))
|
||||||
{
|
{
|
||||||
episodeInfo = resolver.Resolve(parent.Path, true, null, null, isAbsoluteNaming);
|
episodeInfo = resolver.Resolve(parent.Path, true, null, null, isAbsoluteNaming);
|
||||||
if (episodeInfo != null)
|
if (episodeInfo != null)
|
||||||
|
@ -2620,7 +2620,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
public IEnumerable<BaseItem> FindExtras(BaseItem owner, IReadOnlyList<FileSystemMetadata> fileSystemChildren, IDirectoryService directoryService)
|
public IEnumerable<BaseItem> FindExtras(BaseItem owner, IReadOnlyList<FileSystemMetadata> fileSystemChildren, IDirectoryService directoryService)
|
||||||
{
|
{
|
||||||
var ownerVideoInfo = VideoResolver.Resolve(owner.Path, owner.IsFolder, _namingOptions);
|
var ownerVideoInfo = VideoResolver.Resolve(owner.Path, owner.IsFolder, _namingOptions);
|
||||||
if (ownerVideoInfo == null)
|
if (ownerVideoInfo is null)
|
||||||
{
|
{
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
@ -2754,7 +2754,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.Where(i => i != null)
|
.Where(i => i != null)
|
||||||
.Where(i => query.User == null ?
|
.Where(i => query.User is null ?
|
||||||
true :
|
true :
|
||||||
i.IsVisible(query.User))
|
i.IsVisible(query.User))
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
|
@ -60,7 +60,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mediaInfo == null)
|
if (mediaInfo is null)
|
||||||
{
|
{
|
||||||
if (addProbeDelay)
|
if (addProbeDelay)
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||||
|
|
||||||
if (audioStream == null || audioStream.Index == -1)
|
if (audioStream is null || audioStream.Index == -1)
|
||||||
{
|
{
|
||||||
mediaSource.DefaultAudioStreamIndex = null;
|
mediaSource.DefaultAudioStreamIndex = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,7 +383,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
var preferredSubs = NormalizeLanguage(user.SubtitleLanguagePreference);
|
var preferredSubs = NormalizeLanguage(user.SubtitleLanguagePreference);
|
||||||
|
|
||||||
var defaultAudioIndex = source.DefaultAudioStreamIndex;
|
var defaultAudioIndex = source.DefaultAudioStreamIndex;
|
||||||
var audioLangage = defaultAudioIndex == null
|
var audioLangage = defaultAudioIndex is null
|
||||||
? null
|
? null
|
||||||
: source.MediaStreams.Where(i => i.Type == MediaStreamType.Audio && i.Index == defaultAudioIndex).Select(i => i.Language).FirstOrDefault();
|
: source.MediaStreams.Where(i => i.Type == MediaStreamType.Audio && i.Index == defaultAudioIndex).Select(i => i.Language).FirstOrDefault();
|
||||||
|
|
||||||
|
@ -417,13 +417,13 @@ namespace Emby.Server.Implementations.Library
|
||||||
public void SetDefaultAudioAndSubtitleStreamIndexes(BaseItem item, MediaSourceInfo source, User user)
|
public void SetDefaultAudioAndSubtitleStreamIndexes(BaseItem item, MediaSourceInfo source, User user)
|
||||||
{
|
{
|
||||||
// Item would only be null if the app didn't supply ItemId as part of the live stream open request
|
// Item would only be null if the app didn't supply ItemId as part of the live stream open request
|
||||||
var mediaType = item == null ? MediaType.Video : item.MediaType;
|
var mediaType = item is null ? MediaType.Video : item.MediaType;
|
||||||
|
|
||||||
if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
var userData = item == null ? new UserItemData() : _userDataManager.GetUserData(user, item);
|
var userData = item is null ? new UserItemData() : _userDataManager.GetUserData(user, item);
|
||||||
|
|
||||||
var allowRememberingSelection = item == null || item.EnableRememberingTrackSelections;
|
var allowRememberingSelection = item is null || item.EnableRememberingTrackSelections;
|
||||||
|
|
||||||
SetDefaultAudioStreamIndex(source, userData, user, allowRememberingSelection);
|
SetDefaultAudioStreamIndex(source, userData, user, allowRememberingSelection);
|
||||||
SetDefaultSubtitleStreamIndex(source, userData, user, allowRememberingSelection);
|
SetDefaultSubtitleStreamIndex(source, userData, user, allowRememberingSelection);
|
||||||
|
@ -543,7 +543,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||||
|
|
||||||
if (audioStream == null || audioStream.Index == -1)
|
if (audioStream is null || audioStream.Index == -1)
|
||||||
{
|
{
|
||||||
mediaSource.DefaultAudioStreamIndex = null;
|
mediaSource.DefaultAudioStreamIndex = null;
|
||||||
}
|
}
|
||||||
|
@ -638,7 +638,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mediaInfo == null)
|
if (mediaInfo is null)
|
||||||
{
|
{
|
||||||
if (addProbeDelay)
|
if (addProbeDelay)
|
||||||
{
|
{
|
||||||
|
@ -713,7 +713,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||||
|
|
||||||
if (audioStream == null || audioStream.Index == -1)
|
if (audioStream is null || audioStream.Index == -1)
|
||||||
{
|
{
|
||||||
mediaSource.DefaultAudioStreamIndex = null;
|
mediaSource.DefaultAudioStreamIndex = null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
|
|
||||||
// Make sure DateCreated and DateModified have values
|
// Make sure DateCreated and DateModified have values
|
||||||
var fileInfo = directoryService.GetFile(item.Path);
|
var fileInfo = directoryService.GetFile(item.Path);
|
||||||
if (fileInfo == null)
|
if (fileInfo is null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,7 +116,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
|
|
||||||
// Use regular audio type for mixed libraries, owned items and music
|
// Use regular audio type for mixed libraries, owned items and music
|
||||||
if (isMixedCollectionType ||
|
if (isMixedCollectionType ||
|
||||||
args.Parent == null ||
|
args.Parent is null ||
|
||||||
isMusicCollectionType)
|
isMusicCollectionType)
|
||||||
{
|
{
|
||||||
item = new MediaBrowser.Controller.Entities.Audio.Audio();
|
item = new MediaBrowser.Controller.Entities.Audio.Audio();
|
||||||
|
@ -144,7 +144,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||||
// TODO: Allow GetMultiDiscMovie in here
|
// TODO: Allow GetMultiDiscMovie in here
|
||||||
var result = ResolveMultipleAudio(args.Parent, args.GetActualFileSystemChildren(), parseName);
|
var result = ResolveMultipleAudio(args.Parent, args.GetActualFileSystemChildren(), parseName);
|
||||||
|
|
||||||
if (result == null || result.Items.Count != 1 || result.Items[0] is not AudioBook item)
|
if (result is null || result.Items.Count != 1 || result.Items[0] is not AudioBook item)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
videoType = VideoType.Dvd;
|
videoType = VideoType.Dvd;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (videoType == null)
|
if (videoType is null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
videoInfo = VideoResolver.Resolve(args.Path, false, NamingOptions, parseName);
|
videoInfo = VideoResolver.Resolve(args.Path, false, NamingOptions, parseName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (videoInfo == null || (!videoInfo.IsStub && !VideoResolver.IsVideoFile(args.Path, NamingOptions)))
|
if (videoInfo is null || (!videoInfo.IsStub && !VideoResolver.IsVideoFile(args.Path, NamingOptions)))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
public bool TryGetExtraTypeForOwner(string path, VideoFileInfo ownerVideoFileInfo, [NotNullWhen(true)] out ExtraType? extraType)
|
public bool TryGetExtraTypeForOwner(string path, VideoFileInfo ownerVideoFileInfo, [NotNullWhen(true)] out ExtraType? extraType)
|
||||||
{
|
{
|
||||||
var extraResult = GetExtraInfo(path, _namingOptions);
|
var extraResult = GetExtraInfo(path, _namingOptions);
|
||||||
if (extraResult.ExtraType == null)
|
if (extraResult.ExtraType is null)
|
||||||
{
|
{
|
||||||
extraType = null;
|
extraType = null;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||||
{
|
{
|
||||||
base.SetInitialItemValues(item, args);
|
base.SetInitialItemValues(item, args);
|
||||||
|
|
||||||
item.IsRoot = args.Parent == null;
|
item.IsRoot = args.Parent is null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||||
if (string.IsNullOrEmpty(collectionType))
|
if (string.IsNullOrEmpty(collectionType))
|
||||||
{
|
{
|
||||||
// Owned items will be caught by the video extra resolver
|
// Owned items will be caught by the video extra resolver
|
||||||
if (args.Parent == null)
|
if (args.Parent is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -127,10 +127,10 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore extras
|
// ignore extras
|
||||||
return movie?.ExtraType == null ? movie : null;
|
return movie?.ExtraType is null ? movie : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.Parent == null)
|
if (args.Parent is null)
|
||||||
{
|
{
|
||||||
return base.Resolve(args);
|
return base.Resolve(args);
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||||
if (string.IsNullOrEmpty(collectionType))
|
if (string.IsNullOrEmpty(collectionType))
|
||||||
{
|
{
|
||||||
// Owned items should just use the plain video type
|
// Owned items should just use the plain video type
|
||||||
if (parent == null)
|
if (parent is null)
|
||||||
{
|
{
|
||||||
return ResolveVideos<Video>(parent, files, false, collectionType, false);
|
return ResolveVideos<Video>(parent, files, false, collectionType, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
{
|
{
|
||||||
var parent = args.Parent;
|
var parent = args.Parent;
|
||||||
|
|
||||||
if (parent == null)
|
if (parent is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
var episode = ResolveVideo<Episode>(args, false);
|
var episode = ResolveVideo<Episode>(args, false);
|
||||||
|
|
||||||
// Ignore extras
|
// Ignore extras
|
||||||
if (episode == null || episode.ExtraType != null)
|
if (episode is null || episode.ExtraType != null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assume season 1 if there's no season folder and a season number could not be determined
|
// Assume season 1 if there's no season folder and a season number could not be determined
|
||||||
if (season == null && !episode.ParentIndexNumber.HasValue && (episode.IndexNumber.HasValue || episode.PremiereDate.HasValue))
|
if (season is null && !episode.ParentIndexNumber.HasValue && (episode.IndexNumber.HasValue || episode.PremiereDate.HasValue))
|
||||||
{
|
{
|
||||||
episode.ParentIndexNumber = 1;
|
episode.ParentIndexNumber = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(query.UserId);
|
var user = _userManager.GetUserById(query.UserId);
|
||||||
|
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("User Id specified in the query does not exist.", nameof(query));
|
throw new ArgumentException("User Id specified in the query does not exist.", nameof(query));
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ namespace Emby.Server.Implementations.Library
|
||||||
// Only grab the index container for media
|
// Only grab the index container for media
|
||||||
var container = item.IsFolder || !request.GroupItems ? null : item.LatestItemsIndexContainer;
|
var container = item.IsFolder || !request.GroupItems ? null : item.LatestItemsIndexContainer;
|
||||||
|
|
||||||
if (container == null)
|
if (container is null)
|
||||||
{
|
{
|
||||||
list.Add(new Tuple<BaseItem, List<BaseItem>>(null, new List<BaseItem> { item }));
|
list.Add(new Tuple<BaseItem, List<BaseItem>>(null, new List<BaseItem> { item }));
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var boxSet = boxSets.FirstOrDefault(b => b?.Name == collectionName) as BoxSet;
|
var boxSet = boxSets.FirstOrDefault(b => b?.Name == collectionName) as BoxSet;
|
||||||
if (boxSet == null)
|
if (boxSet is null)
|
||||||
{
|
{
|
||||||
// won't automatically create collection if only one movie in it
|
// won't automatically create collection if only one movie in it
|
||||||
if (movieIds.Count >= 2)
|
if (movieIds.Count >= 2)
|
||||||
|
|
|
@ -295,7 +295,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
}
|
}
|
||||||
|
|
||||||
var program = GetProgramInfoFromCache(timer);
|
var program = GetProgramInfoFromCache(timer);
|
||||||
if (program == null)
|
if (program is null)
|
||||||
{
|
{
|
||||||
OnTimerOutOfDate(timer);
|
OnTimerOutOfDate(timer);
|
||||||
continue;
|
continue;
|
||||||
|
@ -642,7 +642,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
programInfo = GetProgramInfoFromCache(info);
|
programInfo = GetProgramInfoFromCache(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (programInfo == null)
|
if (programInfo is null)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Unable to find program with Id {0}. Will search using start date", info.ProgramId);
|
_logger.LogInformation("Unable to find program with Id {0}. Will search using start date", info.ProgramId);
|
||||||
programInfo = GetProgramInfoFromCache(info.ChannelId, info.StartDate);
|
programInfo = GetProgramInfoFromCache(info.ChannelId, info.StartDate);
|
||||||
|
@ -744,7 +744,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
{
|
{
|
||||||
var existingTimer = _timerProvider.GetTimer(updatedTimer.Id);
|
var existingTimer = _timerProvider.GetTimer(updatedTimer.Id);
|
||||||
|
|
||||||
if (existingTimer == null)
|
if (existingTimer is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException();
|
throw new ResourceNotFoundException();
|
||||||
}
|
}
|
||||||
|
@ -912,7 +912,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
|
|
||||||
var epgChannel = await GetEpgChannelFromTunerChannel(provider.Item1, provider.Item2, channel, cancellationToken).ConfigureAwait(false);
|
var epgChannel = await GetEpgChannelFromTunerChannel(provider.Item1, provider.Item2, channel, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (epgChannel == null)
|
if (epgChannel is null)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("EPG channel not found for tuner channel {0}-{1} from {2}-{3}", channel.Number, channel.Name, provider.Item1.Name, provider.Item2.ListingsId ?? string.Empty);
|
_logger.LogDebug("EPG channel not found for tuner channel {0}-{1} from {2}-{3}", channel.Number, channel.Name, provider.Item1.Name, provider.Item2.ListingsId ?? string.Empty);
|
||||||
continue;
|
continue;
|
||||||
|
@ -945,7 +945,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
{
|
{
|
||||||
var provider = _liveTvManager.ListingProviders.FirstOrDefault(l => string.Equals(l.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
var provider = _liveTvManager.ListingProviders.FirstOrDefault(l => string.Equals(l.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
return provider == null ? null : new Tuple<IListingsProvider, ListingsProviderInfo>(provider, i);
|
return provider is null ? null : new Tuple<IListingsProvider, ListingsProviderInfo>(provider, i);
|
||||||
})
|
})
|
||||||
.Where(i => i != null)
|
.Where(i => i != null)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -1232,7 +1232,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
programInfo = GetProgramInfoFromCache(timer);
|
programInfo = GetProgramInfoFromCache(timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (programInfo == null)
|
if (programInfo is null)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Unable to find program with Id {0}. Will search using start date", timer.ProgramId);
|
_logger.LogInformation("Unable to find program with Id {0}. Will search using start date", timer.ProgramId);
|
||||||
programInfo = GetProgramInfoFromCache(timer.ChannelId, timer.StartDate);
|
programInfo = GetProgramInfoFromCache(timer.ChannelId, timer.StartDate);
|
||||||
|
@ -1437,7 +1437,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
|
|
||||||
var parentPath = Path.GetDirectoryName(path);
|
var parentPath = Path.GetDirectoryName(path);
|
||||||
|
|
||||||
while (item == null && !string.IsNullOrEmpty(path))
|
while (item is null && !string.IsNullOrEmpty(path))
|
||||||
{
|
{
|
||||||
item = _libraryManager.FindByPath(path, null);
|
item = _libraryManager.FindByPath(path, null);
|
||||||
|
|
||||||
|
@ -1474,7 +1474,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
var seriesTimerId = timer.SeriesTimerId;
|
var seriesTimerId = timer.SeriesTimerId;
|
||||||
var seriesTimer = _seriesTimerProvider.GetAll().FirstOrDefault(i => string.Equals(i.Id, seriesTimerId, StringComparison.OrdinalIgnoreCase));
|
var seriesTimer = _seriesTimerProvider.GetAll().FirstOrDefault(i => string.Equals(i.Id, seriesTimerId, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (seriesTimer == null || seriesTimer.KeepUpTo <= 0)
|
if (seriesTimer is null || seriesTimer.KeepUpTo <= 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1695,7 +1695,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
_ => null
|
_ => null
|
||||||
};
|
};
|
||||||
|
|
||||||
if (imageSaveFilenameWithoutExtension == null)
|
if (imageSaveFilenameWithoutExtension is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1782,7 +1782,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
}).FirstOrDefault() as LiveTvProgram;
|
}).FirstOrDefault() as LiveTvProgram;
|
||||||
|
|
||||||
// dummy this up
|
// dummy this up
|
||||||
if (program == null)
|
if (program is null)
|
||||||
{
|
{
|
||||||
program = new LiveTvProgram
|
program = new LiveTvProgram
|
||||||
{
|
{
|
||||||
|
@ -2240,7 +2240,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
? null
|
? null
|
||||||
: _timerProvider.GetTimerByProgramId(timer.ProgramId));
|
: _timerProvider.GetTimerByProgramId(timer.ProgramId));
|
||||||
|
|
||||||
if (existingTimer == null)
|
if (existingTimer is null)
|
||||||
{
|
{
|
||||||
if (ShouldCancelTimerForSeriesTimer(seriesTimer, timer))
|
if (ShouldCancelTimerForSeriesTimer(seriesTimer, timer))
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
||||||
{
|
{
|
||||||
var bytes = File.ReadAllBytes(_dataPath);
|
var bytes = File.ReadAllBytes(_dataPath);
|
||||||
_items = JsonSerializer.Deserialize<T[]>(bytes, _jsonOptions);
|
_items = JsonSerializer.Deserialize<T[]>(bytes, _jsonOptions);
|
||||||
if (_items == null)
|
if (_items is null)
|
||||||
{
|
{
|
||||||
Logger.LogError("Error deserializing {Path}, data was null", _dataPath);
|
Logger.LogError("Error deserializing {Path}, data was null", _dataPath);
|
||||||
_items = Array.Empty<T>();
|
_items = Array.Empty<T>();
|
||||||
|
|
|
@ -111,7 +111,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
using var response = await Send(options, true, info, cancellationToken).ConfigureAwait(false);
|
using var response = await Send(options, true, info, cancellationToken).ConfigureAwait(false);
|
||||||
await using var responseStream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
await using var responseStream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||||
var dailySchedules = await JsonSerializer.DeserializeAsync<IReadOnlyList<DayDto>>(responseStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
var dailySchedules = await JsonSerializer.DeserializeAsync<IReadOnlyList<DayDto>>(responseStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||||
if (dailySchedules == null)
|
if (dailySchedules is null)
|
||||||
{
|
{
|
||||||
return Array.Empty<ProgramInfo>();
|
return Array.Empty<ProgramInfo>();
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
using var innerResponse = await Send(programRequestOptions, true, info, cancellationToken).ConfigureAwait(false);
|
using var innerResponse = await Send(programRequestOptions, true, info, cancellationToken).ConfigureAwait(false);
|
||||||
await using var innerResponseStream = await innerResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
await using var innerResponseStream = await innerResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||||
var programDetails = await JsonSerializer.DeserializeAsync<IReadOnlyList<ProgramDetailsDto>>(innerResponseStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
var programDetails = await JsonSerializer.DeserializeAsync<IReadOnlyList<ProgramDetailsDto>>(innerResponseStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||||
if (programDetails == null)
|
if (programDetails is null)
|
||||||
{
|
{
|
||||||
return Array.Empty<ProgramInfo>();
|
return Array.Empty<ProgramInfo>();
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
|
|
||||||
private ProgramInfo GetProgram(string channelId, ProgramDto programInfo, ProgramDetailsDto details)
|
private ProgramInfo GetProgram(string channelId, ProgramDto programInfo, ProgramDetailsDto details)
|
||||||
{
|
{
|
||||||
if (programInfo.AirDateTime == null)
|
if (programInfo.AirDateTime is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
EpisodeTitle = episodeTitle,
|
EpisodeTitle = episodeTitle,
|
||||||
Audio = audioType,
|
Audio = audioType,
|
||||||
// IsNew = programInfo.@new ?? false,
|
// IsNew = programInfo.@new ?? false,
|
||||||
IsRepeat = programInfo.New == null,
|
IsRepeat = programInfo.New is null,
|
||||||
IsSeries = string.Equals(details.EntityType, "episode", StringComparison.OrdinalIgnoreCase),
|
IsSeries = string.Equals(details.EntityType, "episode", StringComparison.OrdinalIgnoreCase),
|
||||||
ImageUrl = details.PrimaryImage,
|
ImageUrl = details.PrimaryImage,
|
||||||
ThumbImageUrl = details.ThumbImage,
|
ThumbImageUrl = details.ThumbImage,
|
||||||
|
@ -407,7 +407,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
.ThenByDescending(i => GetSizeOrder(i))
|
.ThenByDescending(i => GetSizeOrder(i))
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (match == null)
|
if (match is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -785,7 +785,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
using var httpResponse = await Send(options, true, info, cancellationToken).ConfigureAwait(false);
|
using var httpResponse = await Send(options, true, info, cancellationToken).ConfigureAwait(false);
|
||||||
await using var stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
await using var stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||||
var root = await JsonSerializer.DeserializeAsync<ChannelDto>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
var root = await JsonSerializer.DeserializeAsync<ChannelDto>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||||
if (root == null)
|
if (root is null)
|
||||||
{
|
{
|
||||||
return new List<ChannelInfo>();
|
return new List<ChannelInfo>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
||||||
HasImage = !string.IsNullOrEmpty(program.Icon?.Source),
|
HasImage = !string.IsNullOrEmpty(program.Icon?.Source),
|
||||||
OfficialRating = string.IsNullOrEmpty(program.Rating?.Value) ? null : program.Rating.Value,
|
OfficialRating = string.IsNullOrEmpty(program.Rating?.Value) ? null : program.Rating.Value,
|
||||||
CommunityRating = program.StarRating,
|
CommunityRating = program.StarRating,
|
||||||
SeriesId = program.Episode == null ? null : program.Title?.GetMD5().ToString("N", CultureInfo.InvariantCulture)
|
SeriesId = program.Episode is null ? null : program.Title?.GetMD5().ToString("N", CultureInfo.InvariantCulture)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(program.ProgramId))
|
if (string.IsNullOrWhiteSpace(program.ProgramId))
|
||||||
|
|
|
@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
dto.ProgramId = GetInternalProgramId(info.ProgramId).ToString("N", CultureInfo.InvariantCulture);
|
dto.ProgramId = GetInternalProgramId(info.ProgramId).ToString("N", CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days.ToArray());
|
dto.DayPattern = info.Days is null ? null : GetDayPattern(info.Days.ToArray());
|
||||||
|
|
||||||
FillImages(dto, info.Name, info.SeriesId);
|
FillImages(dto, info.Name, info.SeriesId);
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Length == 0)
|
if (dto.ParentBackdropImageTags is null || dto.ParentBackdropImageTags.Length == 0)
|
||||||
{
|
{
|
||||||
image = program.GetImageInfo(ImageType.Backdrop, 0);
|
image = program.GetImageInfo(ImageType.Backdrop, 0);
|
||||||
if (image != null)
|
if (image != null)
|
||||||
|
@ -305,7 +305,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
DtoOptions = new DtoOptions(false)
|
DtoOptions = new DtoOptions(false)
|
||||||
}).FirstOrDefault();
|
}).FirstOrDefault();
|
||||||
|
|
||||||
if (program == null)
|
if (program is null)
|
||||||
{
|
{
|
||||||
program = _libraryManager.GetItemList(new InternalItemsQuery
|
program = _libraryManager.GetItemList(new InternalItemsQuery
|
||||||
{
|
{
|
||||||
|
@ -334,7 +334,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Length == 0)
|
if (dto.ParentBackdropImageTags is null || dto.ParentBackdropImageTags.Length == 0)
|
||||||
{
|
{
|
||||||
image = program.GetImageInfo(ImageType.Backdrop, 0);
|
image = program.GetImageInfo(ImageType.Backdrop, 0);
|
||||||
if (image != null)
|
if (image != null)
|
||||||
|
|
|
@ -434,7 +434,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
|
|
||||||
var item = _libraryManager.GetItemById(id) as LiveTvChannel;
|
var item = _libraryManager.GetItemById(id) as LiveTvChannel;
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
item = new LiveTvChannel
|
item = new LiveTvChannel
|
||||||
{
|
{
|
||||||
|
@ -948,7 +948,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
|
|
||||||
var channel = _libraryManager.GetItemById(program.ChannelId);
|
var channel = _libraryManager.GetItemById(program.ChannelId);
|
||||||
|
|
||||||
if (channel == null)
|
if (channel is null)
|
||||||
{
|
{
|
||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
@ -1314,7 +1314,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
|
|
||||||
private QueryResult<BaseItem> GetEmbyRecordings(RecordingQuery query, DtoOptions dtoOptions, User user)
|
private QueryResult<BaseItem> GetEmbyRecordings(RecordingQuery query, DtoOptions dtoOptions, User user)
|
||||||
{
|
{
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
return new QueryResult<BaseItem>();
|
return new QueryResult<BaseItem>();
|
||||||
}
|
}
|
||||||
|
@ -1702,7 +1702,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
{
|
{
|
||||||
var timer = await GetTimer(id, CancellationToken.None).ConfigureAwait(false);
|
var timer = await GetTimer(id, CancellationToken.None).ConfigureAwait(false);
|
||||||
|
|
||||||
if (timer == null)
|
if (timer is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException(string.Format(CultureInfo.InvariantCulture, "Timer with Id {0} not found", id));
|
throw new ResourceNotFoundException(string.Format(CultureInfo.InvariantCulture, "Timer with Id {0} not found", id));
|
||||||
}
|
}
|
||||||
|
@ -1721,7 +1721,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
{
|
{
|
||||||
var timer = await GetSeriesTimer(id, CancellationToken.None).ConfigureAwait(false);
|
var timer = await GetSeriesTimer(id, CancellationToken.None).ConfigureAwait(false);
|
||||||
|
|
||||||
if (timer == null)
|
if (timer is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException(string.Format(CultureInfo.InvariantCulture, "SeriesTimer with Id {0} not found", id));
|
throw new ResourceNotFoundException(string.Format(CultureInfo.InvariantCulture, "SeriesTimer with Id {0} not found", id));
|
||||||
}
|
}
|
||||||
|
@ -1834,7 +1834,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
{
|
{
|
||||||
var internalChannelId = _tvDtoService.GetInternalChannelId(i.Item2.Name, i.Item1.ChannelId);
|
var internalChannelId = _tvDtoService.GetInternalChannelId(i.Item2.Name, i.Item1.ChannelId);
|
||||||
var channel = _libraryManager.GetItemById(internalChannelId);
|
var channel = _libraryManager.GetItemById(internalChannelId);
|
||||||
channelName = channel == null ? null : channel.Name;
|
channelName = channel is null ? null : channel.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _tvDtoService.GetSeriesTimerInfoDto(i.Item1, i.Item2, channelName);
|
return _tvDtoService.GetSeriesTimerInfoDto(i.Item1, i.Item2, channelName);
|
||||||
|
@ -2147,7 +2147,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
|
|
||||||
var service = _services.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture), parts[0], StringComparison.OrdinalIgnoreCase));
|
var service = _services.FirstOrDefault(i => string.Equals(i.GetType().FullName.GetMD5().ToString("N", CultureInfo.InvariantCulture), parts[0], StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (service == null)
|
if (service is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Service not found.");
|
throw new ArgumentException("Service not found.");
|
||||||
}
|
}
|
||||||
|
@ -2178,7 +2178,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
|
|
||||||
var provider = _tunerHosts.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
var provider = _tunerHosts.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (provider == null)
|
if (provider is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException();
|
throw new ResourceNotFoundException();
|
||||||
}
|
}
|
||||||
|
@ -2222,7 +2222,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
|
|
||||||
var provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
var provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (provider == null)
|
if (provider is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException(
|
throw new ResourceNotFoundException(
|
||||||
string.Format(
|
string.Format(
|
||||||
|
@ -2334,7 +2334,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
{
|
{
|
||||||
var provider = _listingProviders.FirstOrDefault(i => string.Equals(providerType, i.Type, StringComparison.OrdinalIgnoreCase));
|
var provider = _listingProviders.FirstOrDefault(i => string.Equals(providerType, i.Type, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (provider == null)
|
if (provider is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException();
|
throw new ResourceNotFoundException();
|
||||||
}
|
}
|
||||||
|
@ -2347,7 +2347,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
|
|
||||||
var provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
var provider = _listingProviders.FirstOrDefault(i => string.Equals(info.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (provider == null)
|
if (provider is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException();
|
throw new ResourceNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,7 +302,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
||||||
|
|
||||||
var hdHomerunChannelInfo = channels.FirstOrDefault() as HdHomerunChannelInfo;
|
var hdHomerunChannelInfo = channels.FirstOrDefault() as HdHomerunChannelInfo;
|
||||||
|
|
||||||
if (hdHomerunChannelInfo == null || hdHomerunChannelInfo.IsLegacyTuner)
|
if (hdHomerunChannelInfo is null || hdHomerunChannelInfo.IsLegacyTuner)
|
||||||
{
|
{
|
||||||
return await GetTunerInfosUdp(info, cancellationToken).ConfigureAwait(false);
|
return await GetTunerInfosUdp(info, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -329,14 +329,14 @@ namespace Emby.Server.Implementations.Localization
|
||||||
{
|
{
|
||||||
await using var stream = _assembly.GetManifestResourceStream(resourcePath);
|
await using var stream = _assembly.GetManifestResourceStream(resourcePath);
|
||||||
// If a Culture doesn't have a translation the stream will be null and it defaults to en-us further up the chain
|
// If a Culture doesn't have a translation the stream will be null and it defaults to en-us further up the chain
|
||||||
if (stream == null)
|
if (stream is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Missing translation/culture resource: {ResourcePath}", resourcePath);
|
_logger.LogError("Missing translation/culture resource: {ResourcePath}", resourcePath);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dict = await JsonSerializer.DeserializeAsync<Dictionary<string, string>>(stream, _jsonOptions).ConfigureAwait(false);
|
var dict = await JsonSerializer.DeserializeAsync<Dictionary<string, string>>(stream, _jsonOptions).ConfigureAwait(false);
|
||||||
if (dict == null)
|
if (dict is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException($"Resource contains invalid data: '{stream}'");
|
throw new InvalidOperationException($"Resource contains invalid data: '{stream}'");
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||||
|
|
||||||
var folderName = _fileSystem.GetValidFilename(name);
|
var folderName = _fileSystem.GetValidFilename(name);
|
||||||
var parentFolder = GetPlaylistsFolder(Guid.Empty);
|
var parentFolder = GetPlaylistsFolder(Guid.Empty);
|
||||||
if (parentFolder == null)
|
if (parentFolder is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException(nameof(parentFolder));
|
throw new ArgumentException(nameof(parentFolder));
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("No item exists with the supplied Id");
|
throw new ArgumentException("No item exists with the supplied Id");
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||||
|
|
||||||
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
|
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
|
||||||
{
|
{
|
||||||
if (query.User == null)
|
if (query.User is null)
|
||||||
{
|
{
|
||||||
query.Recursive = false;
|
query.Recursive = false;
|
||||||
return base.GetItemsInternal(query);
|
return base.GetItemsInternal(query);
|
||||||
|
|
|
@ -174,7 +174,7 @@ namespace Emby.Server.Implementations.Plugins
|
||||||
foreach (var pluginServiceRegistrator in _appHost.GetExportTypes<IPluginServiceRegistrator>())
|
foreach (var pluginServiceRegistrator in _appHost.GetExportTypes<IPluginServiceRegistrator>())
|
||||||
{
|
{
|
||||||
var plugin = GetPluginByAssembly(pluginServiceRegistrator.Assembly);
|
var plugin = GetPluginByAssembly(pluginServiceRegistrator.Assembly);
|
||||||
if (plugin == null)
|
if (plugin is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Unable to find plugin in assembly {Assembly}", pluginServiceRegistrator.Assembly.FullName);
|
_logger.LogError("Unable to find plugin in assembly {Assembly}", pluginServiceRegistrator.Assembly.FullName);
|
||||||
continue;
|
continue;
|
||||||
|
@ -263,7 +263,7 @@ namespace Emby.Server.Implementations.Plugins
|
||||||
{
|
{
|
||||||
LocalPlugin? plugin;
|
LocalPlugin? plugin;
|
||||||
|
|
||||||
if (version == null)
|
if (version is null)
|
||||||
{
|
{
|
||||||
// If no version is given, return the current instance.
|
// If no version is given, return the current instance.
|
||||||
var plugins = _plugins.Where(p => p.Id.Equals(id)).ToList();
|
var plugins = _plugins.Where(p => p.Id.Equals(id)).ToList();
|
||||||
|
@ -320,7 +320,7 @@ namespace Emby.Server.Implementations.Plugins
|
||||||
ArgumentNullException.ThrowIfNull(assembly);
|
ArgumentNullException.ThrowIfNull(assembly);
|
||||||
|
|
||||||
var plugin = _plugins.FirstOrDefault(p => p.DllFiles.Contains(assembly.Location));
|
var plugin = _plugins.FirstOrDefault(p => p.DllFiles.Contains(assembly.Location));
|
||||||
if (plugin == null)
|
if (plugin is null)
|
||||||
{
|
{
|
||||||
// A plugin's assembly didn't cause this issue, so ignore it.
|
// A plugin's assembly didn't cause this issue, so ignore it.
|
||||||
return;
|
return;
|
||||||
|
@ -442,7 +442,7 @@ namespace Emby.Server.Implementations.Plugins
|
||||||
_logger.LogDebug("Creating instance of {Type}", type);
|
_logger.LogDebug("Creating instance of {Type}", type);
|
||||||
// _appHost.ServiceProvider is already assigned when we create the plugins
|
// _appHost.ServiceProvider is already assigned when we create the plugins
|
||||||
var instance = (IPlugin)ActivatorUtilities.CreateInstance(_appHost.ServiceProvider!, type);
|
var instance = (IPlugin)ActivatorUtilities.CreateInstance(_appHost.ServiceProvider!, type);
|
||||||
if (plugin == null)
|
if (plugin is null)
|
||||||
{
|
{
|
||||||
// Create a dummy record for the providers.
|
// Create a dummy record for the providers.
|
||||||
// TODO: remove this code once all provided have been released as separate plugins.
|
// TODO: remove this code once all provided have been released as separate plugins.
|
||||||
|
@ -711,7 +711,7 @@ namespace Emby.Server.Implementations.Plugins
|
||||||
&& p.IsEnabledAndSupported
|
&& p.IsEnabledAndSupported
|
||||||
&& p.Version != plugin.Version);
|
&& p.Version != plugin.Version);
|
||||||
|
|
||||||
if (previousVersion == null)
|
if (previousVersion is null)
|
||||||
{
|
{
|
||||||
// This value is memory only - so that the web will show restart required.
|
// This value is memory only - so that the web will show restart required.
|
||||||
plugin.Manifest.Status = PluginStatus.Restart;
|
plugin.Manifest.Status = PluginStatus.Restart;
|
||||||
|
|
|
@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
|
|
||||||
lock (_lastExecutionResultSyncLock)
|
lock (_lastExecutionResultSyncLock)
|
||||||
{
|
{
|
||||||
if (_lastExecutionResult == null && !_readFromFile)
|
if (_lastExecutionResult is null && !_readFromFile)
|
||||||
{
|
{
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,7 +94,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
{
|
{
|
||||||
var scheduledTask = ScheduledTasks.FirstOrDefault(t => t.ScheduledTask.GetType() == typeof(T));
|
var scheduledTask = ScheduledTasks.FirstOrDefault(t => t.ScheduledTask.GetType() == typeof(T));
|
||||||
|
|
||||||
if (scheduledTask == null)
|
if (scheduledTask is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", typeof(T).Name);
|
_logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", typeof(T).Name);
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
{
|
{
|
||||||
var scheduledTask = ScheduledTasks.FirstOrDefault(t => t.ScheduledTask.GetType() == typeof(T));
|
var scheduledTask = ScheduledTasks.FirstOrDefault(t => t.ScheduledTask.GetType() == typeof(T));
|
||||||
|
|
||||||
if (scheduledTask == null)
|
if (scheduledTask is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Unable to find scheduled task of type {0} in Execute.", typeof(T).Name);
|
_logger.LogError("Unable to find scheduled task of type {0} in Execute.", typeof(T).Name);
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
||||||
{
|
{
|
||||||
var scheduledTask = ScheduledTasks.FirstOrDefault(t => t.ScheduledTask.GetType() == task.GetType());
|
var scheduledTask = ScheduledTasks.FirstOrDefault(t => t.ScheduledTask.GetType() == task.GetType());
|
||||||
|
|
||||||
if (scheduledTask == null)
|
if (scheduledTask is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", task.GetType().Name);
|
_logger.LogError("Unable to find scheduled task of type {0} in QueueScheduledTask.", task.GetType().Name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Triggers
|
||||||
|
|
||||||
DateTime triggerDate;
|
DateTime triggerDate;
|
||||||
|
|
||||||
if (lastResult == null)
|
if (lastResult is null)
|
||||||
{
|
{
|
||||||
// Task has never been completed before
|
// Task has never been completed before
|
||||||
triggerDate = DateTime.UtcNow.AddHours(1);
|
triggerDate = DateTime.UtcNow.AddHours(1);
|
||||||
|
|
|
@ -377,11 +377,11 @@ namespace Emby.Server.Implementations.Session
|
||||||
info.MediaSourceId = info.ItemId.ToString("N", CultureInfo.InvariantCulture);
|
info.MediaSourceId = info.ItemId.ToString("N", CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!info.ItemId.Equals(default) && info.Item == null && libraryItem != null)
|
if (!info.ItemId.Equals(default) && info.Item is null && libraryItem != null)
|
||||||
{
|
{
|
||||||
var current = session.NowPlayingItem;
|
var current = session.NowPlayingItem;
|
||||||
|
|
||||||
if (current == null || !info.ItemId.Equals(current.Id))
|
if (current is null || !info.ItemId.Equals(current.Id))
|
||||||
{
|
{
|
||||||
var runtimeTicks = libraryItem.RunTimeTicks;
|
var runtimeTicks = libraryItem.RunTimeTicks;
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
sessionInfo.UserId = user?.Id ?? Guid.Empty;
|
sessionInfo.UserId = user?.Id ?? Guid.Empty;
|
||||||
sessionInfo.UserName = user?.Username;
|
sessionInfo.UserName = user?.Username;
|
||||||
sessionInfo.UserPrimaryImageTag = user?.ProfileImage == null ? null : GetImageCacheTag(user);
|
sessionInfo.UserPrimaryImageTag = user?.ProfileImage is null ? null : GetImageCacheTag(user);
|
||||||
sessionInfo.RemoteEndPoint = remoteEndPoint;
|
sessionInfo.RemoteEndPoint = remoteEndPoint;
|
||||||
sessionInfo.Client = appName;
|
sessionInfo.Client = appName;
|
||||||
|
|
||||||
|
@ -506,7 +506,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
sessionInfo.ApplicationVersion = appVersion;
|
sessionInfo.ApplicationVersion = appVersion;
|
||||||
|
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
sessionInfo.AdditionalUsers = Array.Empty<SessionUserInfo>();
|
sessionInfo.AdditionalUsers = Array.Empty<SessionUserInfo>();
|
||||||
}
|
}
|
||||||
|
@ -536,7 +536,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
sessionInfo.UserId = user?.Id ?? Guid.Empty;
|
sessionInfo.UserId = user?.Id ?? Guid.Empty;
|
||||||
sessionInfo.UserName = username;
|
sessionInfo.UserName = username;
|
||||||
sessionInfo.UserPrimaryImageTag = user?.ProfileImage == null ? null : GetImageCacheTag(user);
|
sessionInfo.UserPrimaryImageTag = user?.ProfileImage is null ? null : GetImageCacheTag(user);
|
||||||
sessionInfo.RemoteEndPoint = remoteEndPoint;
|
sessionInfo.RemoteEndPoint = remoteEndPoint;
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(deviceName))
|
if (string.IsNullOrEmpty(deviceName))
|
||||||
|
@ -570,7 +570,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
var user = _userManager.GetUserById(session.UserId);
|
var user = _userManager.GetUserById(session.UserId);
|
||||||
|
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("User not found");
|
throw new InvalidOperationException("User not found");
|
||||||
}
|
}
|
||||||
|
@ -618,7 +618,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
await OnPlaybackStopped(new PlaybackStopInfo
|
await OnPlaybackStopped(new PlaybackStopInfo
|
||||||
{
|
{
|
||||||
Item = session.NowPlayingItem,
|
Item = session.NowPlayingItem,
|
||||||
ItemId = session.NowPlayingItem == null ? Guid.Empty : session.NowPlayingItem.Id,
|
ItemId = session.NowPlayingItem is null ? Guid.Empty : session.NowPlayingItem.Id,
|
||||||
SessionId = session.Id,
|
SessionId = session.Id,
|
||||||
MediaSourceId = session.PlayState?.MediaSourceId,
|
MediaSourceId = session.PlayState?.MediaSourceId,
|
||||||
PositionTicks = session.PlayState?.PositionTicks
|
PositionTicks = session.PlayState?.PositionTicks
|
||||||
|
@ -912,11 +912,11 @@ namespace Emby.Server.Implementations.Session
|
||||||
info.MediaSourceId = info.ItemId.ToString("N", CultureInfo.InvariantCulture);
|
info.MediaSourceId = info.ItemId.ToString("N", CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!info.ItemId.Equals(default) && info.Item == null && libraryItem != null)
|
if (!info.ItemId.Equals(default) && info.Item is null && libraryItem != null)
|
||||||
{
|
{
|
||||||
var current = session.NowPlayingItem;
|
var current = session.NowPlayingItem;
|
||||||
|
|
||||||
if (current == null || !info.ItemId.Equals(current.Id))
|
if (current is null || !info.ItemId.Equals(current.Id))
|
||||||
{
|
{
|
||||||
MediaSourceInfo mediaSource = null;
|
MediaSourceInfo mediaSource = null;
|
||||||
|
|
||||||
|
@ -1037,7 +1037,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
private SessionInfo GetSession(string sessionId, bool throwOnMissing = true)
|
private SessionInfo GetSession(string sessionId, bool throwOnMissing = true)
|
||||||
{
|
{
|
||||||
var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId, StringComparison.Ordinal));
|
var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId, StringComparison.Ordinal));
|
||||||
if (session == null && throwOnMissing)
|
if (session is null && throwOnMissing)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException(
|
throw new ResourceNotFoundException(
|
||||||
string.Format(CultureInfo.InvariantCulture, "Session {0} not found.", sessionId));
|
string.Format(CultureInfo.InvariantCulture, "Session {0} not found.", sessionId));
|
||||||
|
@ -1051,7 +1051,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
// Accept either device id or session id
|
// Accept either device id or session id
|
||||||
var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId, StringComparison.Ordinal));
|
var session = Sessions.FirstOrDefault(i => string.Equals(i.Id, sessionId, StringComparison.Ordinal));
|
||||||
|
|
||||||
if (session == null)
|
if (session is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException(
|
throw new ResourceNotFoundException(
|
||||||
string.Format(CultureInfo.InvariantCulture, "Session {0} not found.", sessionId));
|
string.Format(CultureInfo.InvariantCulture, "Session {0} not found.", sessionId));
|
||||||
|
@ -1231,7 +1231,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(id);
|
var item = _libraryManager.GetItemById(id);
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("A non-existent item Id {0} was passed into TranslateItemForPlayback", id);
|
_logger.LogError("A non-existent item Id {0} was passed into TranslateItemForPlayback", id);
|
||||||
return Array.Empty<BaseItem>();
|
return Array.Empty<BaseItem>();
|
||||||
|
@ -1284,7 +1284,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(id);
|
var item = _libraryManager.GetItemById(id);
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("A non-existent item Id {0} was passed into TranslateItemForInstantMix", id);
|
_logger.LogError("A non-existent item Id {0} was passed into TranslateItemForInstantMix", id);
|
||||||
return new List<BaseItem>();
|
return new List<BaseItem>();
|
||||||
|
@ -1480,7 +1480,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
true).ConfigureAwait(false);
|
true).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
AuthenticationFailed?.Invoke(this, new GenericEventArgs<AuthenticationRequest>(request));
|
AuthenticationFailed?.Invoke(this, new GenericEventArgs<AuthenticationRequest>(request));
|
||||||
throw new AuthenticationException("Invalid username or password entered.");
|
throw new AuthenticationException("Invalid username or password entered.");
|
||||||
|
@ -1541,7 +1541,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
foreach (var auth in allExistingForDevice)
|
foreach (var auth in allExistingForDevice)
|
||||||
{
|
{
|
||||||
if (existing == null || !string.Equals(auth.AccessToken, existing.AccessToken, StringComparison.Ordinal))
|
if (existing is null || !string.Equals(auth.AccessToken, existing.AccessToken, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1677,7 +1677,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
|
|
||||||
var dtoOptions = _itemInfoDtoOptions;
|
var dtoOptions = _itemInfoDtoOptions;
|
||||||
|
|
||||||
if (_itemInfoDtoOptions == null)
|
if (_itemInfoDtoOptions is null)
|
||||||
{
|
{
|
||||||
dtoOptions = new DtoOptions
|
dtoOptions = new DtoOptions
|
||||||
{
|
{
|
||||||
|
|
|
@ -202,7 +202,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
{
|
{
|
||||||
lock (_keepAliveLock)
|
lock (_keepAliveLock)
|
||||||
{
|
{
|
||||||
if (_keepAliveCancellationToken == null)
|
if (_keepAliveCancellationToken is null)
|
||||||
{
|
{
|
||||||
_keepAliveCancellationToken = new CancellationTokenSource();
|
_keepAliveCancellationToken = new CancellationTokenSource();
|
||||||
// Start KeepAlive watcher
|
// Start KeepAlive watcher
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.Session
|
||||||
.OrderByDescending(i => i.LastActivityDate)
|
.OrderByDescending(i => i.LastActivityDate)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (socket == null)
|
if (socket is null)
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,9 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
var episode1 = x as Episode;
|
var episode1 = x as Episode;
|
||||||
var episode2 = y as Episode;
|
var episode2 = y as Episode;
|
||||||
|
|
||||||
if (episode1 == null)
|
if (episode1 is null)
|
||||||
{
|
{
|
||||||
if (episode2 == null)
|
if (episode2 is null)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (episode2 == null)
|
if (episode2 is null)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
{
|
{
|
||||||
var userdata = UserDataRepository.GetUserData(User, x);
|
var userdata = UserDataRepository.GetUserData(User, x);
|
||||||
|
|
||||||
return userdata == null ? 0 : userdata.PlayCount;
|
return userdata is null ? 0 : userdata.PlayCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// <returns>DateTime.</returns>
|
/// <returns>DateTime.</returns>
|
||||||
private static DateTime GetDate(BaseItem? x)
|
private static DateTime GetDate(BaseItem? x)
|
||||||
{
|
{
|
||||||
if (x == null)
|
if (x is null)
|
||||||
{
|
{
|
||||||
return DateTime.MinValue;
|
return DateTime.MinValue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Emby.Server.Implementations.Sorting
|
||||||
/// <returns>DateTime.</returns>
|
/// <returns>DateTime.</returns>
|
||||||
private static int GetValue(BaseItem? x)
|
private static int GetValue(BaseItem? x)
|
||||||
{
|
{
|
||||||
if (x == null)
|
if (x is null)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||||
private bool HasAccessToQueue(User user, IReadOnlyList<Guid> queue)
|
private bool HasAccessToQueue(User user, IReadOnlyList<Guid> queue)
|
||||||
{
|
{
|
||||||
// Check if queue is empty.
|
// Check if queue is empty.
|
||||||
if (queue == null || queue.Count == 0)
|
if (queue is null || queue.Count == 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||||
private bool AllUsersHaveAccessToQueue(IReadOnlyList<Guid> queue)
|
private bool AllUsersHaveAccessToQueue(IReadOnlyList<Guid> queue)
|
||||||
{
|
{
|
||||||
// Check if queue is empty.
|
// Check if queue is empty.
|
||||||
if (queue == null || queue.Count == 0)
|
if (queue is null || queue.Count == 0)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,12 +102,12 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void NewGroup(SessionInfo session, NewGroupRequest request, CancellationToken cancellationToken)
|
public void NewGroup(SessionInfo session, NewGroupRequest request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (session == null)
|
if (session is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Session is null!");
|
throw new InvalidOperationException("Session is null!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request == null)
|
if (request is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Request is null!");
|
throw new InvalidOperationException("Request is null!");
|
||||||
}
|
}
|
||||||
|
@ -138,12 +138,12 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void JoinGroup(SessionInfo session, JoinGroupRequest request, CancellationToken cancellationToken)
|
public void JoinGroup(SessionInfo session, JoinGroupRequest request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (session == null)
|
if (session is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Session is null!");
|
throw new InvalidOperationException("Session is null!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request == null)
|
if (request is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Request is null!");
|
throw new InvalidOperationException("Request is null!");
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||||
{
|
{
|
||||||
_groups.TryGetValue(request.GroupId, out Group group);
|
_groups.TryGetValue(request.GroupId, out Group group);
|
||||||
|
|
||||||
if (group == null)
|
if (group is null)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Session {SessionId} tried to join group {GroupId} that does not exist.", session.Id, request.GroupId);
|
_logger.LogWarning("Session {SessionId} tried to join group {GroupId} that does not exist.", session.Id, request.GroupId);
|
||||||
|
|
||||||
|
@ -204,12 +204,12 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void LeaveGroup(SessionInfo session, LeaveGroupRequest request, CancellationToken cancellationToken)
|
public void LeaveGroup(SessionInfo session, LeaveGroupRequest request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (session == null)
|
if (session is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Session is null!");
|
throw new InvalidOperationException("Session is null!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request == null)
|
if (request is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Request is null!");
|
throw new InvalidOperationException("Request is null!");
|
||||||
}
|
}
|
||||||
|
@ -257,12 +257,12 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public List<GroupInfoDto> ListGroups(SessionInfo session, ListGroupsRequest request)
|
public List<GroupInfoDto> ListGroups(SessionInfo session, ListGroupsRequest request)
|
||||||
{
|
{
|
||||||
if (session == null)
|
if (session is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Session is null!");
|
throw new InvalidOperationException("Session is null!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request == null)
|
if (request is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Request is null!");
|
throw new InvalidOperationException("Request is null!");
|
||||||
}
|
}
|
||||||
|
@ -291,12 +291,12 @@ namespace Emby.Server.Implementations.SyncPlay
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void HandleRequest(SessionInfo session, IGroupPlaybackRequest request, CancellationToken cancellationToken)
|
public void HandleRequest(SessionInfo session, IGroupPlaybackRequest request, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (session == null)
|
if (session is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Session is null!");
|
throw new InvalidOperationException("Session is null!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request == null)
|
if (request is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("Request is null!");
|
throw new InvalidOperationException("Request is null!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace Emby.Server.Implementations.TV
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(query.UserId);
|
var user = _userManager.GetUserById(query.UserId);
|
||||||
|
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("User not found");
|
throw new ArgumentException("User not found");
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ namespace Emby.Server.Implementations.TV
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(request.UserId);
|
var user = _userManager.GetUserById(request.UserId);
|
||||||
|
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("User not found");
|
throw new ArgumentException("User not found");
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.Updates
|
||||||
PackageInfo[]? packages = await _httpClientFactory.CreateClient(NamedClient.Default)
|
PackageInfo[]? packages = await _httpClientFactory.CreateClient(NamedClient.Default)
|
||||||
.GetFromJsonAsync<PackageInfo[]>(new Uri(manifest), _jsonSerializerOptions, cancellationToken).ConfigureAwait(false);
|
.GetFromJsonAsync<PackageInfo[]>(new Uri(manifest), _jsonSerializerOptions, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (packages == null)
|
if (packages is null)
|
||||||
{
|
{
|
||||||
return Array.Empty<PackageInfo>();
|
return Array.Empty<PackageInfo>();
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ namespace Emby.Server.Implementations.Updates
|
||||||
var package = FilterPackages(availablePackages, name, id, specificVersion).FirstOrDefault();
|
var package = FilterPackages(availablePackages, name, id, specificVersion).FirstOrDefault();
|
||||||
|
|
||||||
// Package not found in repository
|
// Package not found in repository
|
||||||
if (package == null)
|
if (package is null)
|
||||||
{
|
{
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ namespace Emby.Server.Implementations.Updates
|
||||||
/// <param name="plugin">The <see cref="LocalPlugin"/> to uninstall.</param>
|
/// <param name="plugin">The <see cref="LocalPlugin"/> to uninstall.</param>
|
||||||
public void UninstallPlugin(LocalPlugin plugin)
|
public void UninstallPlugin(LocalPlugin plugin)
|
||||||
{
|
{
|
||||||
if (plugin == null)
|
if (plugin is null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -565,7 +565,7 @@ namespace Emby.Server.Implementations.Updates
|
||||||
?? _pluginManager.Plugins.FirstOrDefault(p => p.Name.Equals(package.Name, StringComparison.OrdinalIgnoreCase) && p.Version.Equals(package.Version));
|
?? _pluginManager.Plugins.FirstOrDefault(p => p.Name.Equals(package.Name, StringComparison.OrdinalIgnoreCase) && p.Version.Equals(package.Version));
|
||||||
|
|
||||||
await PerformPackageInstallation(package, plugin?.Manifest.Status ?? PluginStatus.Active, cancellationToken).ConfigureAwait(false);
|
await PerformPackageInstallation(package, plugin?.Manifest.Status ?? PluginStatus.Active, cancellationToken).ConfigureAwait(false);
|
||||||
_logger.LogInformation("Plugin {Action}: {PluginName} {PluginVersion}", plugin == null ? "installed" : "updated", package.Name, package.Version);
|
_logger.LogInformation("Plugin {Action}: {PluginName} {PluginVersion}", plugin is null ? "installed" : "updated", package.Name, package.Version);
|
||||||
|
|
||||||
return plugin != null;
|
return plugin != null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace Jellyfin.Api.Auth.AnonymousLanAccessPolicy
|
||||||
var ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress;
|
var ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress;
|
||||||
|
|
||||||
// Loopback will be on LAN, so we can accept null.
|
// Loopback will be on LAN, so we can accept null.
|
||||||
if (ip == null || _networkManager.IsInLocalNetwork(ip))
|
if (ip is null || _networkManager.IsInLocalNetwork(ip))
|
||||||
{
|
{
|
||||||
context.Succeed(requirement);
|
context.Succeed(requirement);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace Jellyfin.Api.Auth
|
||||||
|
|
||||||
// Ensure userId links to a valid user.
|
// Ensure userId links to a valid user.
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
var configurationType = _configurationManager.GetConfigurationType(key);
|
var configurationType = _configurationManager.GetConfigurationType(key);
|
||||||
var deserializedConfiguration = configuration.Deserialize(configurationType, _serializerOptions);
|
var deserializedConfiguration = configuration.Deserialize(configurationType, _serializerOptions);
|
||||||
|
|
||||||
if (deserializedConfiguration == null)
|
if (deserializedConfiguration is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Body doesn't contain a valid configuration");
|
throw new ArgumentException("Body doesn't contain a valid configuration");
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult GetDashboardConfigurationPage([FromQuery] string? name)
|
public ActionResult GetDashboardConfigurationPage([FromQuery] string? name)
|
||||||
{
|
{
|
||||||
var altPage = GetPluginPages().FirstOrDefault(p => string.Equals(p.Item1.Name, name, StringComparison.OrdinalIgnoreCase));
|
var altPage = GetPluginPages().FirstOrDefault(p => string.Equals(p.Item1.Name, name, StringComparison.OrdinalIgnoreCase));
|
||||||
if (altPage == null)
|
if (altPage is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
IPlugin plugin = altPage.Item2;
|
IPlugin plugin = altPage.Item2;
|
||||||
string resourcePath = altPage.Item1.EmbeddedResourcePath;
|
string resourcePath = altPage.Item1.EmbeddedResourcePath;
|
||||||
Stream? stream = plugin.GetType().Assembly.GetManifestResourceStream(resourcePath);
|
Stream? stream = plugin.GetType().Assembly.GetManifestResourceStream(resourcePath);
|
||||||
if (stream == null)
|
if (stream is null)
|
||||||
{
|
{
|
||||||
_logger.LogError("Failed to get resource {Resource} from plugin {Plugin}", resourcePath, plugin.Name);
|
_logger.LogError("Failed to get resource {Resource} from plugin {Plugin}", resourcePath, plugin.Name);
|
||||||
return NotFound();
|
return NotFound();
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public async Task<ActionResult<DeviceInfo>> GetDeviceInfo([FromQuery, Required] string id)
|
public async Task<ActionResult<DeviceInfo>> GetDeviceInfo([FromQuery, Required] string id)
|
||||||
{
|
{
|
||||||
var deviceInfo = await _deviceManager.GetDevice(id).ConfigureAwait(false);
|
var deviceInfo = await _deviceManager.GetDevice(id).ConfigureAwait(false);
|
||||||
if (deviceInfo == null)
|
if (deviceInfo is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public async Task<ActionResult<DeviceOptions>> GetDeviceOptions([FromQuery, Required] string id)
|
public async Task<ActionResult<DeviceOptions>> GetDeviceOptions([FromQuery, Required] string id)
|
||||||
{
|
{
|
||||||
var deviceInfo = await _deviceManager.GetDeviceOptions(id).ConfigureAwait(false);
|
var deviceInfo = await _deviceManager.GetDeviceOptions(id).ConfigureAwait(false);
|
||||||
if (deviceInfo == null)
|
if (deviceInfo is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public async Task<ActionResult> DeleteDevice([FromQuery, Required] string id)
|
public async Task<ActionResult> DeleteDevice([FromQuery, Required] string id)
|
||||||
{
|
{
|
||||||
var existingDevice = await _deviceManager.GetDevice(id).ConfigureAwait(false);
|
var existingDevice = await _deviceManager.GetDevice(id).ConfigureAwait(false);
|
||||||
if (existingDevice == null)
|
if (existingDevice is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult<DeviceProfile> GetProfile([FromRoute, Required] string profileId)
|
public ActionResult<DeviceProfile> GetProfile([FromRoute, Required] string profileId)
|
||||||
{
|
{
|
||||||
var profile = _dlnaManager.GetProfile(profileId);
|
var profile = _dlnaManager.GetProfile(profileId);
|
||||||
if (profile == null)
|
if (profile is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult DeleteProfile([FromRoute, Required] string profileId)
|
public ActionResult DeleteProfile([FromRoute, Required] string profileId)
|
||||||
{
|
{
|
||||||
var existingDeviceProfile = _dlnaManager.GetProfile(profileId);
|
var existingDeviceProfile = _dlnaManager.GetProfile(profileId);
|
||||||
if (existingDeviceProfile == null)
|
if (existingDeviceProfile is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult UpdateProfile([FromRoute, Required] string profileId, [FromBody] DeviceProfile deviceProfile)
|
public ActionResult UpdateProfile([FromRoute, Required] string profileId, [FromBody] DeviceProfile deviceProfile)
|
||||||
{
|
{
|
||||||
var existingDeviceProfile = _dlnaManager.GetProfile(profileId);
|
var existingDeviceProfile = _dlnaManager.GetProfile(profileId);
|
||||||
if (existingDeviceProfile == null)
|
if (existingDeviceProfile is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,7 +274,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
private ActionResult GetIconInternal(string fileName)
|
private ActionResult GetIconInternal(string fileName)
|
||||||
{
|
{
|
||||||
var icon = _dlnaManager.GetIcon(fileName);
|
var icon = _dlnaManager.GetIcon(fileName);
|
||||||
if (icon == null)
|
if (icon is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1482,7 +1482,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
startTranscoding = true;
|
startTranscoding = true;
|
||||||
segmentId = 0;
|
segmentId = 0;
|
||||||
}
|
}
|
||||||
else if (currentTranscodingIndex == null)
|
else if (currentTranscodingIndex is null)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Starting transcoding because currentTranscodingIndex=null");
|
_logger.LogDebug("Starting transcoding because currentTranscodingIndex=null");
|
||||||
startTranscoding = true;
|
startTranscoding = true;
|
||||||
|
@ -1665,7 +1665,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
/// <returns>The command line arguments for audio transcoding.</returns>
|
/// <returns>The command line arguments for audio transcoding.</returns>
|
||||||
private string GetAudioArguments(StreamState state)
|
private string GetAudioArguments(StreamState state)
|
||||||
{
|
{
|
||||||
if (state.AudioStream == null)
|
if (state.AudioStream is null)
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
@ -1762,7 +1762,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
/// <returns>The command line arguments for video transcoding.</returns>
|
/// <returns>The command line arguments for video transcoding.</returns>
|
||||||
private string GetVideoArguments(StreamState state, int startNumber, bool isEventPlaylist)
|
private string GetVideoArguments(StreamState state, int startNumber, bool isEventPlaylist)
|
||||||
{
|
{
|
||||||
if (state.VideoStream == null)
|
if (state.VideoStream is null)
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
@ -1969,14 +1969,14 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
var job = _transcodingJobHelper.GetTranscodingJob(playlist, TranscodingJobType);
|
var job = _transcodingJobHelper.GetTranscodingJob(playlist, TranscodingJobType);
|
||||||
|
|
||||||
if (job == null || job.HasExited)
|
if (job is null || job.HasExited)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var file = GetLastTranscodingFile(playlist, segmentExtension, _fileSystem);
|
var file = GetLastTranscodingFile(playlist, segmentExtension, _fileSystem);
|
||||||
|
|
||||||
if (file == null)
|
if (file is null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
|
|
||||||
if (validatePathDto.ValidateWritable)
|
if (validatePathDto.ValidateWritable)
|
||||||
{
|
{
|
||||||
if (validatePathDto.Path == null)
|
if (validatePathDto.Path is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException(nameof(validatePathDto.Path));
|
throw new ResourceNotFoundException(nameof(validatePathDto.Path));
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,7 +182,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
|
|
||||||
if ((recursive ?? true) || parentItem is UserView || parentItem is ICollectionFolder)
|
if ((recursive ?? true) || parentItem is UserView || parentItem is ICollectionFolder)
|
||||||
{
|
{
|
||||||
genreQuery.AncestorIds = parentItem == null ? Array.Empty<Guid>() : new[] { parentItem.Id };
|
genreQuery.AncestorIds = parentItem is null ? Array.Empty<Guid>() : new[] { parentItem.Id };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -167,7 +167,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return playlistPath == null
|
return playlistPath is null
|
||||||
? NotFound("Hls segment not found.")
|
? NotFound("Hls segment not found.")
|
||||||
: GetFileResult(file, playlistPath);
|
: GetFileResult(file, playlistPath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
.Select(i => Path.GetFullPath(Path.Combine(_applicationPaths.GeneralPath, name, filename + i)))
|
.Select(i => Path.GetFullPath(Path.Combine(_applicationPaths.GeneralPath, name, filename + i)))
|
||||||
.FirstOrDefault(System.IO.File.Exists);
|
.FirstOrDefault(System.IO.File.Exists);
|
||||||
|
|
||||||
if (path == null)
|
if (path is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
if (user?.ProfileImage == null)
|
if (user?.ProfileImage is null)
|
||||||
{
|
{
|
||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
if (user?.ProfileImage == null)
|
if (user?.ProfileImage is null)
|
||||||
{
|
{
|
||||||
return NoContent();
|
return NoContent();
|
||||||
}
|
}
|
||||||
|
@ -279,7 +279,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] int? imageIndex)
|
[FromQuery] int? imageIndex)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -307,7 +307,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromRoute] int imageIndex)
|
[FromRoute] int imageIndex)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromRoute, Required] ImageType imageType)
|
[FromRoute, Required] ImageType imageType)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -371,7 +371,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromRoute] int imageIndex)
|
[FromRoute] int imageIndex)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery, Required] int newIndex)
|
[FromQuery, Required] int newIndex)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -430,7 +430,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public async Task<ActionResult<IEnumerable<ImageInfo>>> GetItemImageInfos([FromRoute, Required] Guid itemId)
|
public async Task<ActionResult<IEnumerable<ImageInfo>>> GetItemImageInfos([FromRoute, Required] Guid itemId)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -537,7 +537,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] int? imageIndex)
|
[FromQuery] int? imageIndex)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -620,7 +620,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] string? foregroundLayer)
|
[FromQuery] string? foregroundLayer)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -703,7 +703,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromRoute, Required] int imageIndex)
|
[FromRoute, Required] int imageIndex)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -786,7 +786,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromRoute, Required] int imageIndex)
|
[FromRoute, Required] int imageIndex)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetArtist(name);
|
var item = _libraryManager.GetArtist(name);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -869,7 +869,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] int? imageIndex)
|
[FromQuery] int? imageIndex)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetGenre(name);
|
var item = _libraryManager.GetGenre(name);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -952,7 +952,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] string? foregroundLayer)
|
[FromQuery] string? foregroundLayer)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetGenre(name);
|
var item = _libraryManager.GetGenre(name);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -1035,7 +1035,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] int? imageIndex)
|
[FromQuery] int? imageIndex)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetMusicGenre(name);
|
var item = _libraryManager.GetMusicGenre(name);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -1118,7 +1118,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] string? foregroundLayer)
|
[FromQuery] string? foregroundLayer)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetMusicGenre(name);
|
var item = _libraryManager.GetMusicGenre(name);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -1201,7 +1201,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] int? imageIndex)
|
[FromQuery] int? imageIndex)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetPerson(name);
|
var item = _libraryManager.GetPerson(name);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -1284,7 +1284,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] string? foregroundLayer)
|
[FromQuery] string? foregroundLayer)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetPerson(name);
|
var item = _libraryManager.GetPerson(name);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -1367,7 +1367,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] int? imageIndex)
|
[FromQuery] int? imageIndex)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetStudio(name);
|
var item = _libraryManager.GetStudio(name);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -1450,7 +1450,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] string? foregroundLayer)
|
[FromQuery] string? foregroundLayer)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetStudio(name);
|
var item = _libraryManager.GetStudio(name);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -1533,7 +1533,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] int? imageIndex)
|
[FromQuery] int? imageIndex)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
if (user?.ProfileImage == null)
|
if (user?.ProfileImage is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -1634,7 +1634,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] string? foregroundLayer)
|
[FromQuery] string? foregroundLayer)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
if (user?.ProfileImage == null)
|
if (user?.ProfileImage is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -1944,10 +1944,10 @@ namespace Jellyfin.Api.Controllers
|
||||||
unplayedCount = null;
|
unplayedCount = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imageInfo == null)
|
if (imageInfo is null)
|
||||||
{
|
{
|
||||||
imageInfo = item?.GetImageInfo(imageType, imageIndex ?? 0);
|
imageInfo = item?.GetImageInfo(imageType, imageIndex ?? 0);
|
||||||
if (imageInfo == null)
|
if (imageInfo is null)
|
||||||
{
|
{
|
||||||
return NotFound(string.Format(NumberFormatInfo.InvariantInfo, "{0} does not have an image of type {1}", item?.Name, imageType));
|
return NotFound(string.Format(NumberFormatInfo.InvariantInfo, "{0} does not have an image of type {1}", item?.Name, imageType));
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult<IEnumerable<ExternalIdInfo>> GetExternalIdInfos([FromRoute, Required] Guid itemId)
|
public ActionResult<IEnumerable<ExternalIdInfo>> GetExternalIdInfos([FromRoute, Required] Guid itemId)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] bool replaceAllImages = false)
|
[FromQuery] bool replaceAllImages = false)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public async Task<ActionResult> UpdateItem([FromRoute, Required] Guid itemId, [FromBody, Required] BaseItemDto request)
|
public async Task<ActionResult> UpdateItem([FromRoute, Required] Guid itemId, [FromBody, Required] BaseItemDto request)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult UpdateItemContentType([FromRoute, Required] Guid itemId, [FromQuery] string? contentType)
|
public ActionResult UpdateItemContentType([FromRoute, Required] Guid itemId, [FromQuery] string? contentType)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult GetFile([FromRoute, Required] Guid itemId)
|
public ActionResult GetFile([FromRoute, Required] Guid itemId)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
: _libraryManager.GetUserRootFolder())
|
: _libraryManager.GetUserRootFolder())
|
||||||
: _libraryManager.GetItemById(itemId);
|
: _libraryManager.GetItemById(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound("Item not found.");
|
return NotFound("Item not found.");
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent = item.GetParent();
|
var parent = item.GetParent();
|
||||||
if (parent == null)
|
if (parent is null)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
: _libraryManager.GetUserRootFolder())
|
: _libraryManager.GetUserRootFolder())
|
||||||
: _libraryManager.GetItemById(itemId);
|
: _libraryManager.GetItemById(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound("Item not found.");
|
return NotFound("Item not found.");
|
||||||
}
|
}
|
||||||
|
@ -237,7 +237,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent = item.GetParent();
|
var parent = item.GetParent();
|
||||||
if (parent == null)
|
if (parent is null)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -435,7 +435,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound("Item not found");
|
return NotFound("Item not found");
|
||||||
}
|
}
|
||||||
|
@ -610,7 +610,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public async Task<ActionResult> GetDownload([FromRoute, Required] Guid itemId)
|
public async Task<ActionResult> GetDownload([FromRoute, Required] Guid itemId)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -763,7 +763,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
await AssertUserCanManageLiveTv().ConfigureAwait(false);
|
await AssertUserCanManageLiveTv().ConfigureAwait(false);
|
||||||
|
|
||||||
var item = _libraryManager.GetItemById(recordingId);
|
var item = _libraryManager.GetItemById(recordingId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -840,7 +840,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public async Task<ActionResult<SeriesTimerInfoDto>> GetSeriesTimer([FromRoute, Required] string timerId)
|
public async Task<ActionResult<SeriesTimerInfoDto>> GetSeriesTimer([FromRoute, Required] string timerId)
|
||||||
{
|
{
|
||||||
var timer = await _liveTvManager.GetSeriesTimer(timerId, CancellationToken.None).ConfigureAwait(false);
|
var timer = await _liveTvManager.GetSeriesTimer(timerId, CancellationToken.None).ConfigureAwait(false);
|
||||||
if (timer == null)
|
if (timer is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -1201,7 +1201,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult GetLiveStreamFile([FromRoute, Required] string streamId, [FromRoute, Required] string container)
|
public ActionResult GetLiveStreamFile([FromRoute, Required] string streamId, [FromRoute, Required] string container)
|
||||||
{
|
{
|
||||||
var liveStreamInfo = _mediaSourceManager.GetLiveStreamInfoByUniqueId(streamId);
|
var liveStreamInfo = _mediaSourceManager.GetLiveStreamInfoByUniqueId(streamId);
|
||||||
if (liveStreamInfo == null)
|
if (liveStreamInfo is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
var profile = playbackInfoDto?.DeviceProfile;
|
var profile = playbackInfoDto?.DeviceProfile;
|
||||||
_logger.LogDebug("GetPostedPlaybackInfo profile: {@Profile}", profile);
|
_logger.LogDebug("GetPostedPlaybackInfo profile: {@Profile}", profile);
|
||||||
|
|
||||||
if (profile == null)
|
if (profile is null)
|
||||||
{
|
{
|
||||||
var caps = _deviceManager.GetCapabilities(User.GetDeviceId());
|
var caps = _deviceManager.GetCapabilities(User.GetDeviceId());
|
||||||
if (caps != null)
|
if (caps != null)
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
assemblyGuid ?? default)
|
assemblyGuid ?? default)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (result == null)
|
if (result is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
specificVersion: string.IsNullOrEmpty(version) ? null : Version.Parse(version))
|
specificVersion: string.IsNullOrEmpty(version) ? null : Version.Parse(version))
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (package == null)
|
if (package is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
.AddClientFields(User);
|
.AddClientFields(User);
|
||||||
|
|
||||||
var item = _libraryManager.GetPerson(name);
|
var item = _libraryManager.GetPerson(name);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes)
|
[FromQuery, ModelBinder(typeof(CommaDelimitedArrayModelBinder))] ImageType[] enableImageTypes)
|
||||||
{
|
{
|
||||||
var playlist = (Playlist)_libraryManager.GetItemById(playlistId);
|
var playlist = (Playlist)_libraryManager.GetItemById(playlistId);
|
||||||
if (playlist == null)
|
if (playlist is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,7 +353,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
if (method == PlayMethod.Transcode)
|
if (method == PlayMethod.Transcode)
|
||||||
{
|
{
|
||||||
var job = string.IsNullOrWhiteSpace(playSessionId) ? null : _transcodingJobHelper.GetTranscodingJob(playSessionId);
|
var job = string.IsNullOrWhiteSpace(playSessionId) ? null : _transcodingJobHelper.GetTranscodingJob(playSessionId);
|
||||||
if (job == null)
|
if (job is null)
|
||||||
{
|
{
|
||||||
return PlayMethod.DirectPlay;
|
return PlayMethod.DirectPlay;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult EnablePlugin([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version)
|
public ActionResult EnablePlugin([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version)
|
||||||
{
|
{
|
||||||
var plugin = _pluginManager.GetPlugin(pluginId, version);
|
var plugin = _pluginManager.GetPlugin(pluginId, version);
|
||||||
if (plugin == null)
|
if (plugin is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult DisablePlugin([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version)
|
public ActionResult DisablePlugin([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version)
|
||||||
{
|
{
|
||||||
var plugin = _pluginManager.GetPlugin(pluginId, version);
|
var plugin = _pluginManager.GetPlugin(pluginId, version);
|
||||||
if (plugin == null)
|
if (plugin is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult UninstallPluginByVersion([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version)
|
public ActionResult UninstallPluginByVersion([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version)
|
||||||
{
|
{
|
||||||
var plugin = _pluginManager.GetPlugin(pluginId, version);
|
var plugin = _pluginManager.GetPlugin(pluginId, version);
|
||||||
if (plugin == null)
|
if (plugin is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
var plugins = _pluginManager.Plugins.Where(p => p.Id.Equals(pluginId));
|
var plugins = _pluginManager.Plugins.Where(p => p.Id.Equals(pluginId));
|
||||||
|
|
||||||
// Select the un-instanced one first.
|
// Select the un-instanced one first.
|
||||||
var plugin = plugins.FirstOrDefault(p => p.Instance == null) ?? plugins.OrderBy(p => p.Manifest.Status).FirstOrDefault();
|
var plugin = plugins.FirstOrDefault(p => p.Instance is null) ?? plugins.OrderBy(p => p.Manifest.Status).FirstOrDefault();
|
||||||
|
|
||||||
if (plugin != null)
|
if (plugin != null)
|
||||||
{
|
{
|
||||||
|
@ -225,13 +225,13 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult GetPluginImage([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version)
|
public ActionResult GetPluginImage([FromRoute, Required] Guid pluginId, [FromRoute, Required] Version version)
|
||||||
{
|
{
|
||||||
var plugin = _pluginManager.GetPlugin(pluginId, version);
|
var plugin = _pluginManager.GetPlugin(pluginId, version);
|
||||||
if (plugin == null)
|
if (plugin is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
var imagePath = Path.Combine(plugin.Path, plugin.Manifest.ImagePath ?? string.Empty);
|
var imagePath = Path.Combine(plugin.Path, plugin.Manifest.ImagePath ?? string.Empty);
|
||||||
if (plugin.Manifest.ImagePath == null || !System.IO.File.Exists(imagePath))
|
if (plugin.Manifest.ImagePath is null || !System.IO.File.Exists(imagePath))
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] bool includeAllLanguages = false)
|
[FromQuery] bool includeAllLanguages = false)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult<IEnumerable<ImageProviderInfo>> GetRemoteImageProviders([FromRoute, Required] Guid itemId)
|
public ActionResult<IEnumerable<ImageProviderInfo>> GetRemoteImageProviders([FromRoute, Required] Guid itemId)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] string? imageUrl)
|
[FromQuery] string? imageUrl)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
var task = _taskManager.ScheduledTasks.FirstOrDefault(i =>
|
var task = _taskManager.ScheduledTasks.FirstOrDefault(i =>
|
||||||
string.Equals(i.Id, taskId, StringComparison.OrdinalIgnoreCase));
|
string.Equals(i.Id, taskId, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (task == null)
|
if (task is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
|
var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
|
||||||
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
|
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (task == null)
|
if (task is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
|
var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
|
||||||
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
|
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (task == null)
|
if (task is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
|
var task = _taskManager.ScheduledTasks.FirstOrDefault(o =>
|
||||||
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
|
o.Id.Equals(taskId, StringComparison.OrdinalIgnoreCase));
|
||||||
if (task == null)
|
if (task is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
var itemWithImage = item.HasImage(ImageType.Thumb) ? item : null;
|
var itemWithImage = item.HasImage(ImageType.Thumb) ? item : null;
|
||||||
|
|
||||||
if (itemWithImage == null && item is Episode)
|
if (itemWithImage is null && item is Episode)
|
||||||
{
|
{
|
||||||
itemWithImage = GetParentWithImage<Series>(item, ImageType.Thumb);
|
itemWithImage = GetParentWithImage<Series>(item, ImageType.Thumb);
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
var currentSession = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext).ConfigureAwait(false);
|
var currentSession = await RequestHelpers.GetSession(_sessionManager, _userManager, HttpContext).ConfigureAwait(false);
|
||||||
|
|
||||||
if (command == null)
|
if (command is null)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Request body may not be null");
|
throw new ArgumentException("Request body may not be null");
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(itemId);
|
var item = _libraryManager.GetItemById(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,7 +247,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
.GetSeasons(user, dtoOptions)
|
.GetSeasons(user, dtoOptions)
|
||||||
.FirstOrDefault(i => i.IndexNumber == season.Value);
|
.FirstOrDefault(i => i.IndexNumber == season.Value);
|
||||||
|
|
||||||
episodes = seasonItem == null ?
|
episodes = seasonItem is null ?
|
||||||
new List<BaseItem>()
|
new List<BaseItem>()
|
||||||
: ((Season)seasonItem).GetEpisodes(user, dtoOptions);
|
: ((Season)seasonItem).GetEpisodes(user, dtoOptions);
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
|
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
return NotFound("User not found");
|
return NotFound("User not found");
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
|
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
return NotFound("User not found");
|
return NotFound("User not found");
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
|
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
|
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
return NotFound("User not found");
|
return NotFound("User not found");
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
HttpContext.GetNormalizedRemoteIp().ToString(),
|
HttpContext.GetNormalizedRemoteIp().ToString(),
|
||||||
false).ConfigureAwait(false);
|
false).ConfigureAwait(false);
|
||||||
|
|
||||||
if (success == null)
|
if (success is null)
|
||||||
{
|
{
|
||||||
return StatusCode(StatusCodes.Status403Forbidden, "Invalid user or password entered.");
|
return StatusCode(StatusCodes.Status403Forbidden, "Invalid user or password entered.");
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
|
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
|
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
return NotFound("User not found");
|
return NotFound("User not found");
|
||||||
}
|
}
|
||||||
|
@ -544,7 +544,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
return BadRequest();
|
return BadRequest();
|
||||||
}
|
}
|
||||||
|
|
|
@ -402,7 +402,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
|
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
? _libraryManager.GetUserRootFolder()
|
? _libraryManager.GetUserRootFolder()
|
||||||
: _libraryManager.GetItemById(itemId);
|
: _libraryManager.GetItemById(itemId);
|
||||||
|
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult<IEnumerable<SpecialViewOptionDto>> GetGroupingOptions([FromRoute, Required] Guid userId)
|
public ActionResult<IEnumerable<SpecialViewOptionDto>> GetGroupingOptions([FromRoute, Required] Guid userId)
|
||||||
{
|
{
|
||||||
var user = _userManager.GetUserById(userId);
|
var user = _userManager.GetUserById(userId);
|
||||||
if (user == null)
|
if (user is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetItemById(videoId);
|
var item = _libraryManager.GetItemById(videoId);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
var video = (Video)_libraryManager.GetItemById(itemId);
|
var video = (Video)_libraryManager.GetItemById(itemId);
|
||||||
|
|
||||||
if (video == null)
|
if (video is null)
|
||||||
{
|
{
|
||||||
return NotFound("The video either does not exist or the id does not belong to a video.");
|
return NotFound("The video either does not exist or the id does not belong to a video.");
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
}
|
}
|
||||||
|
|
||||||
var primaryVersion = items.FirstOrDefault(i => i.MediaSourceCount > 1 && string.IsNullOrEmpty(i.PrimaryVersionId));
|
var primaryVersion = items.FirstOrDefault(i => i.MediaSourceCount > 1 && string.IsNullOrEmpty(i.PrimaryVersionId));
|
||||||
if (primaryVersion == null)
|
if (primaryVersion is null)
|
||||||
{
|
{
|
||||||
primaryVersion = items
|
primaryVersion = items
|
||||||
.OrderBy(i =>
|
.OrderBy(i =>
|
||||||
|
@ -444,7 +444,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
StreamingHelpers.AddDlnaHeaders(state, Response.Headers, true, state.Request.StartTimeTicks, Request, _dlnaManager);
|
StreamingHelpers.AddDlnaHeaders(state, Response.Headers, true, state.Request.StartTimeTicks, Request, _dlnaManager);
|
||||||
|
|
||||||
var liveStreamInfo = _mediaSourceManager.GetLiveStreamInfo(streamingRequest.LiveStreamId);
|
var liveStreamInfo = _mediaSourceManager.GetLiveStreamInfo(streamingRequest.LiveStreamId);
|
||||||
if (liveStreamInfo == null)
|
if (liveStreamInfo is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
public ActionResult<BaseItemDto> GetYear([FromRoute, Required] int year, [FromQuery] Guid? userId)
|
public ActionResult<BaseItemDto> GetYear([FromRoute, Required] int year, [FromQuery] Guid? userId)
|
||||||
{
|
{
|
||||||
var item = _libraryManager.GetYear(year);
|
var item = _libraryManager.GetYear(year);
|
||||||
if (item == null)
|
if (item is null)
|
||||||
{
|
{
|
||||||
return NotFound();
|
return NotFound();
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace Jellyfin.Api.Helpers
|
||||||
TranscodingJobType transcodingJobType,
|
TranscodingJobType transcodingJobType,
|
||||||
StreamingRequestDto streamingRequest)
|
StreamingRequestDto streamingRequest)
|
||||||
{
|
{
|
||||||
if (_httpContextAccessor.HttpContext == null)
|
if (_httpContextAccessor.HttpContext is null)
|
||||||
{
|
{
|
||||||
throw new ResourceNotFoundException(nameof(_httpContextAccessor.HttpContext));
|
throw new ResourceNotFoundException(nameof(_httpContextAccessor.HttpContext));
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ namespace Jellyfin.Api.Helpers
|
||||||
StreamingHelpers.AddDlnaHeaders(state, _httpContextAccessor.HttpContext.Response.Headers, true, streamingRequest.StartTimeTicks, _httpContextAccessor.HttpContext.Request, _dlnaManager);
|
StreamingHelpers.AddDlnaHeaders(state, _httpContextAccessor.HttpContext.Response.Headers, true, streamingRequest.StartTimeTicks, _httpContextAccessor.HttpContext.Request, _dlnaManager);
|
||||||
|
|
||||||
var liveStreamInfo = _mediaSourceManager.GetLiveStreamInfo(streamingRequest.LiveStreamId);
|
var liveStreamInfo = _mediaSourceManager.GetLiveStreamInfo(streamingRequest.LiveStreamId);
|
||||||
if (liveStreamInfo == null)
|
if (liveStreamInfo is null)
|
||||||
{
|
{
|
||||||
throw new FileNotFoundException();
|
throw new FileNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user