Merge pull request #3336 from telans/specific-fixes

Fix trivial SA1005, SA1111, SA1508, SA1510 warnings
This commit is contained in:
Anthony Lavado
2020-06-14 22:51:29 -04:00
committed by GitHub
201 changed files with 281 additions and 520 deletions

View File

@@ -35,12 +35,10 @@ namespace MediaBrowser.Controller.Channels
public interface IDisableMediaSourceDisplay
{
}
public interface ISupportsMediaProbe
{
}
public interface IHasFolderAttributes

View File

@@ -300,7 +300,7 @@ namespace MediaBrowser.Controller.Entities
{
get
{
//if (IsOffline)
// if (IsOffline)
//{
// return LocationType.Offline;
//}
@@ -676,7 +676,7 @@ namespace MediaBrowser.Controller.Entities
/// <returns>System.String.</returns>
protected virtual string CreateSortName()
{
if (Name == null) return null; //some items may not have name filled in properly
if (Name == null) return null; // some items may not have name filled in properly
if (!EnableAlphaNumericSorting)
{
@@ -736,7 +736,7 @@ namespace MediaBrowser.Controller.Entities
builder.Append(chunkBuilder);
}
//logger.LogDebug("ModifySortChunks Start: {0} End: {1}", name, builder.ToString());
// logger.LogDebug("ModifySortChunks Start: {0} End: {1}", name, builder.ToString());
return builder.ToString().RemoveDiacritics();
}
@@ -767,7 +767,6 @@ namespace MediaBrowser.Controller.Entities
get => GetParent() as Folder;
set
{
}
}
@@ -1011,7 +1010,7 @@ namespace MediaBrowser.Controller.Entities
return PlayAccess.None;
}
//if (!user.IsParentalScheduleAllowed())
// if (!user.IsParentalScheduleAllowed())
//{
// return PlayAccess.None;
//}
@@ -1064,7 +1063,6 @@ namespace MediaBrowser.Controller.Entities
}
return 1;
}).ThenBy(i => i.Video3DFormat.HasValue ? 1 : 0)
.ThenByDescending(i =>
{
@@ -1247,8 +1245,7 @@ namespace MediaBrowser.Controller.Entities
// Support plex/xbmc convention
files.AddRange(fileSystemChildren
.Where(i => !i.IsDirectory && string.Equals(FileSystem.GetFileNameWithoutExtension(i), ThemeSongFilename, StringComparison.OrdinalIgnoreCase))
);
.Where(i => !i.IsDirectory && string.Equals(FileSystem.GetFileNameWithoutExtension(i), ThemeSongFilename, StringComparison.OrdinalIgnoreCase)));
return LibraryManager.ResolvePaths(files, directoryService, null, new LibraryOptions())
.OfType<Audio.Audio>()
@@ -1347,12 +1344,10 @@ namespace MediaBrowser.Controller.Entities
protected virtual void TriggerOnRefreshStart()
{
}
protected virtual void TriggerOnRefreshComplete()
{
}
/// <summary>
@@ -2175,7 +2170,7 @@ namespace MediaBrowser.Controller.Entities
var data = UserDataManager.GetUserData(user, this);
//I think it is okay to do this here.
// I think it is okay to do this here.
// if this is only called when a user is manually forcing something to un-played
// then it probably is what we want to do...
data.PlayCount = 0;
@@ -2760,8 +2755,8 @@ namespace MediaBrowser.Controller.Entities
newOptions.ForceSave = true;
}
//var parentId = Id;
//if (!video.IsOwnedItem || video.ParentId != parentId)
// var parentId = Id;
// if (!video.IsOwnedItem || video.ParentId != parentId)
//{
// video.IsOwnedItem = true;
// video.ParentId = parentId;

View File

@@ -27,7 +27,7 @@ namespace MediaBrowser.Controller.Entities
[JsonIgnore]
public override bool SupportsPeople => false;
//public override double? GetDefaultPrimaryImageAspectRatio()
// public override double? GetDefaultPrimaryImageAspectRatio()
//{
// double value = 16;
// value /= 9;

View File

@@ -213,8 +213,8 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
protected virtual List<BaseItem> LoadChildren()
{
//logger.LogDebug("Loading children from {0} {1} {2}", GetType().Name, Id, Path);
//just load our children from the repo - the library will be validated and maintained in other processes
// logger.LogDebug("Loading children from {0} {1} {2}", GetType().Name, Id, Path);
// just load our children from the repo - the library will be validated and maintained in other processes
return GetCachedChildren();
}
@@ -500,7 +500,6 @@ namespace MediaBrowser.Controller.Entities
if (series != null)
{
await series.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
}
await container.RefreshAllMetadata(refreshOptions, progress, cancellationToken).ConfigureAwait(false);
}
@@ -615,7 +614,6 @@ namespace MediaBrowser.Controller.Entities
{
EnableImages = false
}
});
return result.TotalRecordCount;
@@ -1223,7 +1221,7 @@ namespace MediaBrowser.Controller.Entities
throw new ArgumentNullException(nameof(user));
}
//the true root should return our users root folder children
// the true root should return our users root folder children
if (IsPhysicalRoot)
{
return LibraryManager.GetUserRootFolder().GetChildren(user, includeLinkedChildren);
@@ -1629,7 +1627,6 @@ namespace MediaBrowser.Controller.Entities
Recursive = true,
IsFolder = false,
EnableTotalRecordCount = false
});
// Sweep through recursively and update status
@@ -1647,7 +1644,6 @@ namespace MediaBrowser.Controller.Entities
IsFolder = false,
IsVirtualItem = false,
EnableTotalRecordCount = false
});
return itemsResult

View File

@@ -47,7 +47,7 @@ namespace MediaBrowser.Controller.Entities
{
var user = query.User;
//if (query.IncludeItemTypes != null &&
// if (query.IncludeItemTypes != null &&
// query.IncludeItemTypes.Length == 1 &&
// string.Equals(query.IncludeItemTypes[0], "Playlist", StringComparison.OrdinalIgnoreCase))
//{
@@ -270,7 +270,6 @@ namespace MediaBrowser.Controller.Entities
_logger.LogError(ex, "Error getting genre");
return null;
}
})
.Where(i => i != null)
.Select(i => GetUserViewWithName(i.Name, SpecialFolder.MovieGenre, i.SortName, parent));
@@ -347,7 +346,6 @@ namespace MediaBrowser.Controller.Entities
Limit = query.Limit,
StartIndex = query.StartIndex,
UserId = query.User.Id
}, parentFolders, query.DtoOptions);
return result;
@@ -384,7 +382,6 @@ namespace MediaBrowser.Controller.Entities
IncludeItemTypes = new[] { typeof(Series).Name },
Recursive = true,
EnableTotalRecordCount = false
}).Items
.SelectMany(i => i.Genres)
.DistinctNames()
@@ -399,7 +396,6 @@ namespace MediaBrowser.Controller.Entities
_logger.LogError(ex, "Error getting genre");
return null;
}
})
.Where(i => i != null)
.Select(i => GetUserViewWithName(i.Name, SpecialFolder.TvGenre, i.SortName, parent));
@@ -424,7 +420,7 @@ namespace MediaBrowser.Controller.Entities
{
return new QueryResult<BaseItem>
{
Items = result.Items, //TODO Fix The co-variant conversion between T[] and BaseItem[], this can generate runtime issues if T is not BaseItem.
Items = result.Items, // TODO Fix The co-variant conversion between T[] and BaseItem[], this can generate runtime issues if T is not BaseItem.
TotalRecordCount = result.TotalRecordCount
};
}

View File

@@ -535,7 +535,6 @@ namespace MediaBrowser.Controller.Entities
{
ItemId = Id,
Index = DefaultVideoStreamIndex.Value
}).FirstOrDefault();
}

View File

@@ -77,7 +77,7 @@ namespace MediaBrowser.Controller.IO
if (string.IsNullOrEmpty(newPath))
{
//invalid shortcut - could be old or target could just be unavailable
// invalid shortcut - could be old or target could just be unavailable
logger.LogWarning("Encountered invalid shortcut: " + fullName);
continue;
}
@@ -118,7 +118,6 @@ namespace MediaBrowser.Controller.IO
}
return returnResult;
}
}
}

View File

@@ -89,7 +89,6 @@ namespace MediaBrowser.Controller.Library
return parentDir.Length > _appPaths.RootFolderPath.Length
&& parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase);
}
}
@@ -129,7 +128,6 @@ namespace MediaBrowser.Controller.Library
}
return item != null;
}
return false;
}

View File

@@ -9,12 +9,10 @@ namespace MediaBrowser.Controller.LiveTv
{
public LiveTvConflictException()
{
}
public LiveTvConflictException(string message)
: base(message)
{
}
}
}

View File

@@ -147,7 +147,7 @@ namespace MediaBrowser.Controller.LiveTv
public override string ContainingFolderPath => Path;
//[JsonIgnore]
//public override string MediaType
// public override string MediaType
//{
// get
// {

View File

@@ -759,7 +759,6 @@ namespace MediaBrowser.Controller.MediaEncoding
}
param += " -look_ahead 0";
}
else if (string.Equals(videoEncoder, "h264_nvenc", StringComparison.OrdinalIgnoreCase) // h264 (h264_nvenc)
|| string.Equals(videoEncoder, "hevc_nvenc", StringComparison.OrdinalIgnoreCase))
@@ -768,7 +767,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
case "veryslow":
param += "-preset slow"; //lossless is only supported on maxwell and newer(2014+)
param += "-preset slow"; // lossless is only supported on maxwell and newer(2014+)
break;
case "slow":
@@ -999,7 +998,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (string.IsNullOrEmpty(videoStream.Profile))
{
//return false;
// return false;
}
var requestedProfile = requestedProfiles[0];
@@ -1072,7 +1071,7 @@ namespace MediaBrowser.Controller.MediaEncoding
{
if (!videoStream.Level.HasValue)
{
//return false;
// return false;
}
if (videoStream.Level.HasValue && videoStream.Level.Value > requestLevel)
@@ -1327,7 +1326,6 @@ namespace MediaBrowser.Controller.MediaEncoding
// wmav2 currently only supports two channel output
transcoderChannelLimit = 2;
}
else if (codec.IndexOf("mp3", StringComparison.OrdinalIgnoreCase) != -1)
{
// libmp3lame currently only supports two channel output
@@ -1462,7 +1460,6 @@ namespace MediaBrowser.Controller.MediaEncoding
" -map 0:{0}",
state.AudioStream.Index);
}
else
{
args += " -map -0:a";
@@ -1648,7 +1645,6 @@ namespace MediaBrowser.Controller.MediaEncoding
outputSizeParam = outputSizeParam.TrimStart(',');
retStr = " -filter_complex \"[{0}:{1}]{4}[sub];[0:{2}]{3}[base];[base][sub]overlay\"";
}
else if (string.Equals(outputVideoCodec, "h264_qsv", StringComparison.OrdinalIgnoreCase))
{
/*
@@ -1933,11 +1929,11 @@ namespace MediaBrowser.Controller.MediaEncoding
break;
case Video3DFormat.FullSideBySide:
filter = "crop=iw/2:ih:0:0,setdar=dar=a,crop=min(iw\\,ih*dar):min(ih\\,iw/dar):(iw-min(iw\\,iw*sar))/2:(ih - min (ih\\,ih/sar))/2,setsar=sar=1,scale={0}:trunc({0}/dar/2)*2";
//fsbs crop width in half,set the display aspect,crop out any black bars we may have made the scale width to requestedWidth.
// fsbs crop width in half,set the display aspect,crop out any black bars we may have made the scale width to requestedWidth.
break;
case Video3DFormat.HalfTopAndBottom:
filter = "crop=iw:ih/2:0:0,scale=(iw*2):ih),setdar=dar=a,crop=min(iw\\,ih*dar):min(ih\\,iw/dar):(iw-min(iw\\,iw*sar))/2:(ih - min (ih\\,ih/sar))/2,setsar=sar=1,scale={0}:trunc({0}/dar/2)*2";
//htab crop height in half,scale to correct size, set the display aspect,crop out any black bars we may have made the scale width to requestedWidth
// htab crop height in half,scale to correct size, set the display aspect,crop out any black bars we may have made the scale width to requestedWidth
break;
case Video3DFormat.FullTopAndBottom:
filter = "crop=iw:ih/2:0:0,setdar=dar=a,crop=min(iw\\,ih*dar):min(ih\\,iw/dar):(iw-min(iw\\,iw*sar))/2:(ih - min (ih\\,ih/sar))/2,setsar=sar=1,scale={0}:trunc({0}/dar/2)*2";
@@ -2556,7 +2552,7 @@ namespace MediaBrowser.Controller.MediaEncoding
case "h265":
if (_mediaEncoder.SupportsDecoder("hevc_qsv") && encodingOptions.HardwareDecodingCodecs.Contains("hevc", StringComparer.OrdinalIgnoreCase))
{
//return "-c:v hevc_qsv -load_plugin hevc_hw ";
// return "-c:v hevc_qsv -load_plugin hevc_hw ";
return "-c:v hevc_qsv";
}
break;
@@ -2574,7 +2570,6 @@ namespace MediaBrowser.Controller.MediaEncoding
break;
}
}
else if (string.Equals(encodingOptions.HardwareAccelerationType, "nvenc", StringComparison.OrdinalIgnoreCase))
{
switch (videoStream.Codec.ToLowerInvariant())
@@ -2619,7 +2614,6 @@ namespace MediaBrowser.Controller.MediaEncoding
break;
}
}
else if (string.Equals(encodingOptions.HardwareAccelerationType, "mediacodec", StringComparison.OrdinalIgnoreCase))
{
switch (videoStream.Codec.ToLowerInvariant())
@@ -2664,7 +2658,6 @@ namespace MediaBrowser.Controller.MediaEncoding
break;
}
}
else if (string.Equals(encodingOptions.HardwareAccelerationType, "omx", StringComparison.OrdinalIgnoreCase))
{
switch (videoStream.Codec.ToLowerInvariant())
@@ -2696,7 +2689,6 @@ namespace MediaBrowser.Controller.MediaEncoding
break;
}
}
else if (string.Equals(encodingOptions.HardwareAccelerationType, "amf", StringComparison.OrdinalIgnoreCase))
{
if (Environment.OSVersion.Platform == PlatformID.Win32NT)

View File

@@ -214,7 +214,7 @@ namespace MediaBrowser.Controller.Net
}
catch (ObjectDisposedException)
{
//TODO Investigate and properly fix.
// TODO Investigate and properly fix.
}
lock (_activeConnections)

View File

@@ -44,6 +44,5 @@ namespace MediaBrowser.Controller.Persistence
/// <param name="cancellationToken"></param>
/// <returns></returns>
void SaveAllUserData(long userId, UserItemData[] userData, CancellationToken cancellationToken);
}
}

View File

@@ -22,6 +22,5 @@ namespace MediaBrowser.Controller.Plugins
/// </summary>
public interface IRunBeforeStartup
{
}
}

View File

@@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.SyncPlay
public class GroupInfo
{
/// <summary>
/// Default ping value used for sessions.
/// Gets the default ping value used for sessions.
/// </summary>
public long DefaulPing { get; } = 500;
@@ -31,13 +31,13 @@ namespace MediaBrowser.Controller.SyncPlay
public BaseItem PlayingItem { get; set; }
/// <summary>
/// Gets or sets whether playback is paused.
/// Gets or sets a value indicating whether playback is paused.
/// </summary>
/// <value>Playback is paused.</value>
public bool IsPaused { get; set; }
/// <summary>
/// Gets or sets the position ticks.
/// Gets or sets a value indicating whether there are position ticks.
/// </summary>
/// <value>The position ticks.</value>
public long PositionTicks { get; set; }