Apply suggestions from code review

Co-authored-by: Cody Robibero <cody@robibe.ro>
This commit is contained in:
nyanmisaka 2022-06-16 22:11:06 +08:00
parent be72001ff9
commit 477b922e4a
4 changed files with 7 additions and 8 deletions

View file

@ -1761,8 +1761,7 @@ namespace MediaBrowser.Controller.MediaEncoding
return false; return false;
} }
if (!string.IsNullOrEmpty(videoStream.VideoRangeType) if (!requestedRangeTypes.Contains(videoStream.VideoRangeType, StringComparison.OrdinalIgnoreCase))
&& !requestedRangeTypes.Contains(videoStream.VideoRangeType, StringComparison.OrdinalIgnoreCase))
{ {
return false; return false;
} }

View file

@ -1867,7 +1867,7 @@ namespace MediaBrowser.Model.Dlna
// change from split by | to comma // change from split by | to comma
// strip spaces to avoid having to encode // strip spaces to avoid having to encode
var values = value var values = value
.Split('|', StringSplitOptions.RemoveEmptyEntries); .Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
if (condition.Condition == ProfileConditionType.Equals) if (condition.Condition == ProfileConditionType.Equals)
{ {
@ -1876,7 +1876,7 @@ namespace MediaBrowser.Model.Dlna
else if (condition.Condition == ProfileConditionType.EqualsAny) else if (condition.Condition == ProfileConditionType.EqualsAny)
{ {
var currentValue = item.GetOption(qualifier, "rangetype"); var currentValue = item.GetOption(qualifier, "rangetype");
if (!string.IsNullOrEmpty(currentValue) && values.Any(value => value == currentValue)) if (!string.IsNullOrEmpty(currentValue) && values.Any(v => string.Equals(v, currentValue, StringComparison.OrdinalIgnoreCase)))
{ {
item.SetOption(qualifier, "rangetype", currentValue); item.SetOption(qualifier, "rangetype", currentValue);
} }

View file

@ -293,7 +293,7 @@ namespace MediaBrowser.Model.Dlna
} }
var targetVideoCodecs = TargetVideoCodec; var targetVideoCodecs = TargetVideoCodec;
var videoCodec = targetVideoCodecs.Length == 0 ? null : targetVideoCodecs[0]; var videoCodec = targetVideoCodecs.FirstOrDefault();
if (!string.IsNullOrEmpty(videoCodec)) if (!string.IsNullOrEmpty(videoCodec))
{ {
return GetOption(videoCodec, "rangetype"); return GetOption(videoCodec, "rangetype");

View file

@ -104,7 +104,7 @@ namespace MediaBrowser.Model.Entities
{ {
get get
{ {
var (videoRange, videoRangeType) = getVideoColorRange(); var (videoRange, _) = GetVideoColorRange();
return videoRange; return videoRange;
} }
@ -118,7 +118,7 @@ namespace MediaBrowser.Model.Entities
{ {
get get
{ {
var (videoRange, videoRangeType) = getVideoColorRange(); var (_, videoRangeType) = GetVideoColorRange();
return videoRangeType; return videoRangeType;
} }
@ -563,7 +563,7 @@ namespace MediaBrowser.Model.Entities
return true; return true;
} }
public (string VideoRange, string VideoRangeType) getVideoColorRange() public (string VideoRange, string VideoRangeType) GetVideoColorRange()
{ {
if (Type != MediaStreamType.Video) if (Type != MediaStreamType.Video)
{ {