Remove redundant 'else' keywords

pull/9607/head
Stepan Goremykin 1 year ago
parent b6cfdb8b92
commit 910617bbc3

@ -1309,7 +1309,8 @@ namespace Emby.Server.Implementations.Data
{
return false;
}
else if (type == typeof(UserRootFolder))
if (type == typeof(UserRootFolder))
{
return false;
}
@ -1319,55 +1320,68 @@ namespace Emby.Server.Implementations.Data
{
return false;
}
else if (type == typeof(MusicArtist))
if (type == typeof(MusicArtist))
{
return false;
}
else if (type == typeof(Person))
if (type == typeof(Person))
{
return false;
}
else if (type == typeof(MusicGenre))
if (type == typeof(MusicGenre))
{
return false;
}
else if (type == typeof(Genre))
if (type == typeof(Genre))
{
return false;
}
else if (type == typeof(Studio))
if (type == typeof(Studio))
{
return false;
}
else if (type == typeof(PlaylistsFolder))
if (type == typeof(PlaylistsFolder))
{
return false;
}
else if (type == typeof(PhotoAlbum))
if (type == typeof(PhotoAlbum))
{
return false;
}
else if (type == typeof(Year))
if (type == typeof(Year))
{
return false;
}
else if (type == typeof(Book))
if (type == typeof(Book))
{
return false;
}
else if (type == typeof(LiveTvProgram))
if (type == typeof(LiveTvProgram))
{
return false;
}
else if (type == typeof(AudioBook))
if (type == typeof(AudioBook))
{
return false;
}
else if (type == typeof(Audio))
if (type == typeof(Audio))
{
return false;
}
else if (type == typeof(MusicAlbum))
if (type == typeof(MusicAlbum))
{
return false;
}

@ -78,7 +78,8 @@ namespace Emby.Server.Implementations.Library.Resolvers
Set3DFormat(videoTmp);
return videoTmp;
}
else if (IsBluRayDirectory(filename))
if (IsBluRayDirectory(filename))
{
var videoTmp = new TVideoType
{

@ -627,10 +627,8 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
_timerProvider.Update(existingTimer);
return Task.FromResult(existingTimer.Id);
}
else
{
throw new ArgumentException("A scheduled recording already exists for this program.");
}
throw new ArgumentException("A scheduled recording already exists for this program.");
}
info.Id = Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);

@ -415,14 +415,13 @@ namespace Emby.Server.Implementations.LiveTv.Listings
{
return null;
}
else if (uri.IndexOf("http", StringComparison.OrdinalIgnoreCase) != -1)
if (uri.IndexOf("http", StringComparison.OrdinalIgnoreCase) != -1)
{
return uri;
}
else
{
return apiUrl + "/image/" + uri + "?token=" + token;
}
return apiUrl + "/image/" + uri + "?token=" + token;
}
private static double GetAspectRatio(ImageDataDto i)

@ -620,10 +620,8 @@ namespace Emby.Server.Implementations.SyncPlay
RestartCurrentItem();
return true;
}
else
{
return false;
}
return false;
}
/// <inheritdoc />
@ -637,10 +635,8 @@ namespace Emby.Server.Implementations.SyncPlay
RestartCurrentItem();
return true;
}
else
{
return false;
}
return false;
}
/// <inheritdoc />

@ -339,10 +339,8 @@ namespace Emby.Server.Implementations.SyncPlay
{
return sessionsCounter > 0;
}
else
{
return false;
}
return false;
}
/// <summary>

@ -533,10 +533,8 @@ public class SubtitleController : BaseJellyfinApiController
_logger.LogDebug("Fallback font size is {FileSize} Bytes", fileSize);
return PhysicalFile(fontFile.FullName, MimeTypes.GetMimeType(fontFile.FullName));
}
else
{
_logger.LogWarning("The selected font is null or empty");
}
_logger.LogWarning("The selected font is null or empty");
}
else
{

@ -500,10 +500,8 @@ namespace Jellyfin.Networking.Manager
{
return true;
}
else
{
return address.IsPrivateAddressRange();
}
return address.IsPrivateAddressRange();
}
/// <inheritdoc/>
@ -1171,13 +1169,15 @@ namespace Jellyfin.Networking.Manager
bindPreference = addr.Value;
break;
}
else if ((addr.Key.Address.Equals(IPAddress.Any) || addr.Key.Address.Equals(IPAddress.IPv6Any)) && isInExternalSubnet)
if ((addr.Key.Address.Equals(IPAddress.Any) || addr.Key.Address.Equals(IPAddress.IPv6Any)) && isInExternalSubnet)
{
// External.
bindPreference = addr.Value;
break;
}
else if (addr.Key.Contains(source))
if (addr.Key.Contains(source))
{
// Match ip address.
bindPreference = addr.Value;

@ -801,16 +801,14 @@ namespace MediaBrowser.Controller.Entities
{
return allowed.Contains(ChannelId);
}
else
{
var collectionFolders = LibraryManager.GetCollectionFolders(this, allCollectionFolders);
foreach (var folder in collectionFolders)
var collectionFolders = LibraryManager.GetCollectionFolders(this, allCollectionFolders);
foreach (var folder in collectionFolders)
{
if (allowed.Contains(folder.Id))
{
if (allowed.Contains(folder.Id))
{
return true;
}
return true;
}
}

@ -197,10 +197,8 @@ namespace MediaBrowser.Controller.LiveTv
{
return 2.0 / 3;
}
else
{
return 16.0 / 9;
}
return 16.0 / 9;
}
public override string GetClientTypeName()

@ -557,7 +557,8 @@ namespace MediaBrowser.Controller.MediaEncoding
{
return Array.FindIndex(_videoProfilesH264, x => string.Equals(x, profile, StringComparison.OrdinalIgnoreCase));
}
else if (string.Equals("hevc", videoCodec, StringComparison.OrdinalIgnoreCase))
if (string.Equals("hevc", videoCodec, StringComparison.OrdinalIgnoreCase))
{
return Array.FindIndex(_videoProfilesH265, x => string.Equals(x, profile, StringComparison.OrdinalIgnoreCase));
}
@ -1109,19 +1110,19 @@ namespace MediaBrowser.Controller.MediaEncoding
{
return "-bsf:v h264_mp4toannexb";
}
else if (IsH265(stream))
if (IsH265(stream))
{
return "-bsf:v hevc_mp4toannexb";
}
else if (IsAAC(stream))
if (IsAAC(stream))
{
// Convert adts header(mpegts) to asc header(mp4).
return "-bsf:a aac_adtstoasc";
}
else
{
return null;
}
return null;
}
public static string GetAudioBitStreamArguments(EncodingJobInfo state, string segmentContainer, string mediaSourceContainer)
@ -1199,10 +1200,8 @@ namespace MediaBrowser.Controller.MediaEncoding
{
return FormattableString.Invariant($" -rc_mode CBR -b:v {bitrate} -maxrate {bitrate} -bufsize {bufsize}");
}
else
{
return FormattableString.Invariant($" -rc_mode VBR -b:v {bitrate} -maxrate {bitrate} -bufsize {bufsize}");
}
return FormattableString.Invariant($" -rc_mode VBR -b:v {bitrate} -maxrate {bitrate} -bufsize {bufsize}");
}
return FormattableString.Invariant($" -b:v {bitrate} -maxrate {bitrate} -bufsize {bufsize}");
@ -2762,79 +2761,76 @@ namespace MediaBrowser.Controller.MediaEncoding
widthParam,
heightParam);
}
else
{
return GetFixedSwScaleFilter(threedFormat, requestedWidth.Value, requestedHeight.Value);
}
return GetFixedSwScaleFilter(threedFormat, requestedWidth.Value, requestedHeight.Value);
}
// If Max dimensions were supplied, for width selects lowest even number between input width and width req size and selects lowest even number from in width*display aspect and requested size
else if (requestedMaxWidth.HasValue && requestedMaxHeight.HasValue)
if (requestedMaxWidth.HasValue && requestedMaxHeight.HasValue)
{
var maxWidthParam = requestedMaxWidth.Value.ToString(CultureInfo.InvariantCulture);
var maxHeightParam = requestedMaxHeight.Value.ToString(CultureInfo.InvariantCulture);
return string.Format(
CultureInfo.InvariantCulture,
"scale=trunc(min(max(iw\\,ih*a)\\,min({0}\\,{1}*a))/{2})*{2}:trunc(min(max(iw/a\\,ih)\\,min({0}/a\\,{1}))/2)*2",
maxWidthParam,
maxHeightParam,
scaleVal);
CultureInfo.InvariantCulture,
"scale=trunc(min(max(iw\\,ih*a)\\,min({0}\\,{1}*a))/{2})*{2}:trunc(min(max(iw/a\\,ih)\\,min({0}/a\\,{1}))/2)*2",
maxWidthParam,
maxHeightParam,
scaleVal);
}
// If a fixed width was requested
else if (requestedWidth.HasValue)
if (requestedWidth.HasValue)
{
if (threedFormat.HasValue)
{
// This method can handle 0 being passed in for the requested height
return GetFixedSwScaleFilter(threedFormat, requestedWidth.Value, 0);
}
else
{
var widthParam = requestedWidth.Value.ToString(CultureInfo.InvariantCulture);
return string.Format(
CultureInfo.InvariantCulture,
"scale={0}:trunc(ow/a/2)*2",
widthParam);
}
var widthParam = requestedWidth.Value.ToString(CultureInfo.InvariantCulture);
return string.Format(
CultureInfo.InvariantCulture,
"scale={0}:trunc(ow/a/2)*2",
widthParam);
}
// If a fixed height was requested
else if (requestedHeight.HasValue)
if (requestedHeight.HasValue)
{
var heightParam = requestedHeight.Value.ToString(CultureInfo.InvariantCulture);
return string.Format(
CultureInfo.InvariantCulture,
"scale=trunc(oh*a/{1})*{1}:{0}",
heightParam,
scaleVal);
CultureInfo.InvariantCulture,
"scale=trunc(oh*a/{1})*{1}:{0}",
heightParam,
scaleVal);
}
// If a max width was requested
else if (requestedMaxWidth.HasValue)
if (requestedMaxWidth.HasValue)
{
var maxWidthParam = requestedMaxWidth.Value.ToString(CultureInfo.InvariantCulture);
return string.Format(
CultureInfo.InvariantCulture,
"scale=trunc(min(max(iw\\,ih*a)\\,{0})/{1})*{1}:trunc(ow/a/2)*2",
maxWidthParam,
scaleVal);
CultureInfo.InvariantCulture,
"scale=trunc(min(max(iw\\,ih*a)\\,{0})/{1})*{1}:trunc(ow/a/2)*2",
maxWidthParam,
scaleVal);
}
// If a max height was requested
else if (requestedMaxHeight.HasValue)
if (requestedMaxHeight.HasValue)
{
var maxHeightParam = requestedMaxHeight.Value.ToString(CultureInfo.InvariantCulture);
return string.Format(
CultureInfo.InvariantCulture,
"scale=trunc(oh*a/{1})*{1}:min(max(iw/a\\,ih)\\,{0})",
maxHeightParam,
scaleVal);
CultureInfo.InvariantCulture,
"scale=trunc(oh*a/{1})*{1}:min(max(iw/a\\,ih)\\,{0})",
maxHeightParam,
scaleVal);
}
return string.Empty;
@ -2908,18 +2904,21 @@ namespace MediaBrowser.Controller.MediaEncoding
"yadif_cuda={0}:-1:0",
doubleRateDeint ? "1" : "0");
}
else if (hwDeintSuffix.Contains("vaapi", StringComparison.OrdinalIgnoreCase))
if (hwDeintSuffix.Contains("vaapi", StringComparison.OrdinalIgnoreCase))
{
return string.Format(
CultureInfo.InvariantCulture,
"deinterlace_vaapi=rate={0}",
doubleRateDeint ? "field" : "frame");
}
else if (hwDeintSuffix.Contains("qsv", StringComparison.OrdinalIgnoreCase))
if (hwDeintSuffix.Contains("qsv", StringComparison.OrdinalIgnoreCase))
{
return "deinterlace_qsv=mode=2";
}
else if (hwDeintSuffix.Contains("videotoolbox", StringComparison.OrdinalIgnoreCase))
if (hwDeintSuffix.Contains("videotoolbox", StringComparison.OrdinalIgnoreCase))
{
return string.Format(
CultureInfo.InvariantCulture,
@ -2950,7 +2949,8 @@ namespace MediaBrowser.Controller.MediaEncoding
options.VppTonemappingBrightness,
options.VppTonemappingContrast);
}
else if (string.Equals(hwTonemapSuffix, "vulkan", StringComparison.OrdinalIgnoreCase))
if (string.Equals(hwTonemapSuffix, "vulkan", StringComparison.OrdinalIgnoreCase))
{
args = "libplacebo=format={1}:tonemapping={2}:color_primaries=bt709:color_trc=bt709:colorspace=bt709:peak_detect=0:upscaler=none:downscaler=none";
@ -4826,26 +4826,27 @@ namespace MediaBrowser.Controller.MediaEncoding
{
return videoStream.BitDepth.Value;
}
else if (string.Equals(videoStream.PixelFormat, "yuv420p", StringComparison.OrdinalIgnoreCase)
|| string.Equals(videoStream.PixelFormat, "yuvj420p", StringComparison.OrdinalIgnoreCase)
|| string.Equals(videoStream.PixelFormat, "yuv444p", StringComparison.OrdinalIgnoreCase))
if (string.Equals(videoStream.PixelFormat, "yuv420p", StringComparison.OrdinalIgnoreCase)
|| string.Equals(videoStream.PixelFormat, "yuvj420p", StringComparison.OrdinalIgnoreCase)
|| string.Equals(videoStream.PixelFormat, "yuv444p", StringComparison.OrdinalIgnoreCase))
{
return 8;
}
else if (string.Equals(videoStream.PixelFormat, "yuv420p10le", StringComparison.OrdinalIgnoreCase)
|| string.Equals(videoStream.PixelFormat, "yuv444p10le", StringComparison.OrdinalIgnoreCase))
if (string.Equals(videoStream.PixelFormat, "yuv420p10le", StringComparison.OrdinalIgnoreCase)
|| string.Equals(videoStream.PixelFormat, "yuv444p10le", StringComparison.OrdinalIgnoreCase))
{
return 10;
}
else if (string.Equals(videoStream.PixelFormat, "yuv420p12le", StringComparison.OrdinalIgnoreCase)
|| string.Equals(videoStream.PixelFormat, "yuv444p12le", StringComparison.OrdinalIgnoreCase))
if (string.Equals(videoStream.PixelFormat, "yuv420p12le", StringComparison.OrdinalIgnoreCase)
|| string.Equals(videoStream.PixelFormat, "yuv444p12le", StringComparison.OrdinalIgnoreCase))
{
return 12;
}
else
{
return 8;
}
return 8;
}
return 0;
@ -5077,11 +5078,9 @@ namespace MediaBrowser.Controller.MediaEncoding
return " -hwaccel cuda" + (outputHwSurface ? " -hwaccel_output_format cuda" : string.Empty)
+ (nvdecNoInternalCopy ? " -hwaccel_flags +unsafe_output" : string.Empty) + " -threads 1" + (isAv1 ? " -c:v av1" : string.Empty);
}
else
{
// cuvid decoder doesn't have threading issue.
return " -hwaccel cuda" + (outputHwSurface ? " -hwaccel_output_format cuda" : string.Empty);
}
// cuvid decoder doesn't have threading issue.
return " -hwaccel cuda" + (outputHwSurface ? " -hwaccel_output_format cuda" : string.Empty);
}
}
@ -5439,7 +5438,8 @@ namespace MediaBrowser.Controller.MediaEncoding
// Automatically set thread count
return mustSetThreadCount ? Math.Max(Environment.ProcessorCount - 1, 1) : 0;
}
else if (threads >= Environment.ProcessorCount)
if (threads >= Environment.ProcessorCount)
{
return Environment.ProcessorCount;
}

@ -533,11 +533,9 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
_logger.LogWarning("Session {SessionId} is seeking to wrong position, correcting.", session.Id);
return;
}
else
{
// Session is ready.
context.SetBuffering(session, false);
}
// Session is ready.
context.SetBuffering(session, false);
if (!context.IsBuffering())
{

@ -313,17 +313,13 @@ namespace MediaBrowser.Controller.SyncPlay.Queue
return true;
}
else
{
// Restoring playing item.
SetPlayingItemByPlaylistId(playingItem.PlaylistItemId);
return false;
}
}
else
{
// Restoring playing item.
SetPlayingItemByPlaylistId(playingItem.PlaylistItemId);
return false;
}
return false;
}
/// <summary>
@ -528,10 +524,8 @@ namespace MediaBrowser.Controller.SyncPlay.Queue
{
return _shuffledPlaylist;
}
else
{
return _sortedPlaylist;
}
return _sortedPlaylist;
}
/// <summary>
@ -544,14 +538,13 @@ namespace MediaBrowser.Controller.SyncPlay.Queue
{
return null;
}
else if (ShuffleMode.Equals(GroupShuffleMode.Shuffle))
if (ShuffleMode.Equals(GroupShuffleMode.Shuffle))
{
return _shuffledPlaylist[PlayingItemIndex];
}
else
{
return _sortedPlaylist[PlayingItemIndex];
}
return _sortedPlaylist[PlayingItemIndex];
}
}
}

@ -231,10 +231,8 @@ namespace MediaBrowser.MediaEncoding.Attachments
throw new InvalidOperationException(
string.Format(CultureInfo.InvariantCulture, "ffmpeg attachment extraction failed for {0} to {1}", inputPath, outputPath));
}
else
{
_logger.LogInformation("ffmpeg attachment extraction completed for {InputPath} to {OutputPath}", inputPath, outputPath);
}
_logger.LogInformation("ffmpeg attachment extraction completed for {InputPath} to {OutputPath}", inputPath, outputPath);
}
private async Task<Stream> GetAttachmentStream(
@ -376,10 +374,8 @@ namespace MediaBrowser.MediaEncoding.Attachments
throw new InvalidOperationException(
string.Format(CultureInfo.InvariantCulture, "ffmpeg attachment extraction failed for {0} to {1}", inputPath, outputPath));
}
else
{
_logger.LogInformation("ffmpeg attachment extraction completed for {InputPath} to {OutputPath}", inputPath, outputPath);
}
_logger.LogInformation("ffmpeg attachment extraction completed for {InputPath} to {OutputPath}", inputPath, outputPath);
}
private string GetAttachmentCachePath(string mediaPath, MediaSourceInfo mediaSource, int attachmentStreamIndex)

@ -217,12 +217,14 @@ namespace MediaBrowser.MediaEncoding.Encoder
return false;
}
else if (version < MinVersion) // Version is below what we recommend
if (version < MinVersion) // Version is below what we recommend
{
_logger.LogWarning("FFmpeg validation: The minimum recommended version is {MinVersion}", MinVersion);
return false;
}
else if (MaxVersion is not null && version > MaxVersion) // Version is above what we recommend
if (MaxVersion is not null && version > MaxVersion) // Version is above what we recommend
{
_logger.LogWarning("FFmpeg validation: The maximum recommended version is {MaxVersion}", MaxVersion);
return false;

@ -624,10 +624,8 @@ namespace MediaBrowser.MediaEncoding.Subtitles
throw new FfmpegException(
string.Format(CultureInfo.InvariantCulture, "ffmpeg subtitle extraction failed for {0} to {1}", inputPath, outputPath));
}
else
{
_logger.LogInformation("ffmpeg subtitle extraction completed for {InputPath} to {OutputPath}", inputPath, outputPath);
}
_logger.LogInformation("ffmpeg subtitle extraction completed for {InputPath} to {OutputPath}", inputPath, outputPath);
if (string.Equals(outputCodec, "ass", StringComparison.OrdinalIgnoreCase))
{

@ -80,7 +80,8 @@ namespace MediaBrowser.Model.Cryptography
{
throw new FormatException("Hash string must contain a valid id");
}
else if (nextSegment == -1)
if (nextSegment == -1)
{
return new PasswordHash(hashString.ToString(), Array.Empty<byte>());
}

@ -1075,31 +1075,38 @@ namespace MediaBrowser.Model.Dlna
{
return 128000;
}
else if (totalBitrate <= 2000000)
if (totalBitrate <= 2000000)
{
return 384000;
}
else if (totalBitrate <= 3000000)
if (totalBitrate <= 3000000)
{
return 448000;
}
else if (totalBitrate <= 4000000)
if (totalBitrate <= 4000000)
{
return 640000;
}
else if (totalBitrate <= 5000000)
if (totalBitrate <= 5000000)
{
return 768000;
}
else if (totalBitrate <= 10000000)
if (totalBitrate <= 10000000)
{
return 1536000;
}
else if (totalBitrate <= 15000000)
if (totalBitrate <= 15000000)
{
return 2304000;
}
else if (totalBitrate <= 20000000)
if (totalBitrate <= 20000000)
{
return 3584000;
}
@ -1443,7 +1450,8 @@ namespace MediaBrowser.Model.Dlna
{
return false;
}
else if (ContainerProfile.ContainsContainer(normalizedContainers, "mkv")
if (ContainerProfile.ContainsContainer(normalizedContainers, "mkv")
|| ContainerProfile.ContainsContainer(normalizedContainers, "matroska"))
{
return true;

@ -17,11 +17,13 @@ namespace MediaBrowser.Model.MediaInfo
{
return "Dolby Digital";
}
else if (string.Equals(codec, "eac3", StringComparison.OrdinalIgnoreCase))
if (string.Equals(codec, "eac3", StringComparison.OrdinalIgnoreCase))
{
return "Dolby Digital+";
}
else if (string.Equals(codec, "dca", StringComparison.OrdinalIgnoreCase))
if (string.Equals(codec, "dca", StringComparison.OrdinalIgnoreCase))
{
return "DTS";
}

@ -221,10 +221,8 @@ namespace Rssdp.Infrastructure
{
return trimmedSegment.Substring(1, trimmedSegment.Length - 2);
}
else
{
return trimmedSegment;
}
return trimmedSegment;
}
}
}

@ -171,10 +171,8 @@ namespace Rssdp
{
return "uuid:" + this.Uuid;
}
else
{
return _Udn;
}
return _Udn;
}
set

@ -585,10 +585,8 @@ namespace Rssdp.Infrastructure
{
return OneSecond;
}
else
{
return searchWaitTime.Subtract(OneSecond);
}
return searchWaitTime.Subtract(OneSecond);
}
private DiscoveredSsdpDevice FindExistingDeviceNotification(IEnumerable<DiscoveredSsdpDevice> devices, string notificationType, string usn)

@ -571,10 +571,8 @@ namespace Rssdp.Infrastructure
{
return nonzeroCacheLifetimesQuery.Min();
}
else
{
return TimeSpan.Zero;
}
return TimeSpan.Zero;
}
private string GetFirstHeaderValue(System.Net.Http.Headers.HttpRequestHeaders httpRequestHeaders, string headerName)

@ -20,11 +20,13 @@ namespace Jellyfin.Extensions
{
return 0;
}
else if (s1 is null)
if (s1 is null)
{
return -1;
}
else if (s2 is null)
if (s2 is null)
{
return 1;
}
@ -37,11 +39,13 @@ namespace Jellyfin.Extensions
{
return 0;
}
else if (len1 == 0)
if (len1 == 0)
{
return -1;
}
else if (len2 == 0)
if (len2 == 0)
{
return 1;
}
@ -82,7 +86,8 @@ namespace Jellyfin.Extensions
{
return -1;
}
else if (span1Len > span2Len)
if (span1Len > span2Len)
{
return 1;
}

Loading…
Cancel
Save