Merge pull request #5097 from Bond-009/cleanup4
Remove useless abstraction and clean up formatting
This commit is contained in:
commit
4a2678e63b
|
@ -278,7 +278,7 @@ namespace Jellyfin.Api.Controllers
|
||||||
var directPlayProfiles = new DirectPlayProfile[len];
|
var directPlayProfiles = new DirectPlayProfile[len];
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
var parts = RequestHelpers.Split(containers[i], '|', true);
|
var parts = containers[i].Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
var audioCodecs = parts.Length == 1 ? null : string.Join(',', parts.Skip(1));
|
var audioCodecs = parts.Length == 1 ? null : string.Join(',', parts.Skip(1));
|
||||||
|
|
||||||
|
@ -312,25 +312,52 @@ namespace Jellyfin.Api.Controllers
|
||||||
if (maxAudioSampleRate.HasValue)
|
if (maxAudioSampleRate.HasValue)
|
||||||
{
|
{
|
||||||
// codec profile
|
// codec profile
|
||||||
conditions.Add(new ProfileCondition { Condition = ProfileConditionType.LessThanEqual, IsRequired = false, Property = ProfileConditionValue.AudioSampleRate, Value = maxAudioSampleRate.Value.ToString(CultureInfo.InvariantCulture) });
|
conditions.Add(
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
IsRequired = false,
|
||||||
|
Property = ProfileConditionValue.AudioSampleRate,
|
||||||
|
Value = maxAudioSampleRate.Value.ToString(CultureInfo.InvariantCulture)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxAudioBitDepth.HasValue)
|
if (maxAudioBitDepth.HasValue)
|
||||||
{
|
{
|
||||||
// codec profile
|
// codec profile
|
||||||
conditions.Add(new ProfileCondition { Condition = ProfileConditionType.LessThanEqual, IsRequired = false, Property = ProfileConditionValue.AudioBitDepth, Value = maxAudioBitDepth.Value.ToString(CultureInfo.InvariantCulture) });
|
conditions.Add(
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
IsRequired = false,
|
||||||
|
Property = ProfileConditionValue.AudioBitDepth,
|
||||||
|
Value = maxAudioBitDepth.Value.ToString(CultureInfo.InvariantCulture)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxAudioChannels.HasValue)
|
if (maxAudioChannels.HasValue)
|
||||||
{
|
{
|
||||||
// codec profile
|
// codec profile
|
||||||
conditions.Add(new ProfileCondition { Condition = ProfileConditionType.LessThanEqual, IsRequired = false, Property = ProfileConditionValue.AudioChannels, Value = maxAudioChannels.Value.ToString(CultureInfo.InvariantCulture) });
|
conditions.Add(
|
||||||
|
new ProfileCondition
|
||||||
|
{
|
||||||
|
Condition = ProfileConditionType.LessThanEqual,
|
||||||
|
IsRequired = false,
|
||||||
|
Property = ProfileConditionValue.AudioChannels,
|
||||||
|
Value = maxAudioChannels.Value.ToString(CultureInfo.InvariantCulture)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conditions.Count > 0)
|
if (conditions.Count > 0)
|
||||||
{
|
{
|
||||||
// codec profile
|
// codec profile
|
||||||
codecProfiles.Add(new CodecProfile { Type = CodecType.Audio, Container = string.Join(',', containers), Conditions = conditions.ToArray() });
|
codecProfiles.Add(
|
||||||
|
new CodecProfile
|
||||||
|
{
|
||||||
|
Type = CodecType.Audio,
|
||||||
|
Container = string.Join(',', containers),
|
||||||
|
Conditions = conditions.ToArray()
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceProfile.CodecProfiles = codecProfiles.ToArray();
|
deviceProfile.CodecProfiles = codecProfiles.ToArray();
|
||||||
|
|
|
@ -51,25 +51,6 @@ namespace Jellyfin.Api.Helpers
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Splits a string at a separating character into an array of substrings.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value">The string to split.</param>
|
|
||||||
/// <param name="separator">The char that separates the substrings.</param>
|
|
||||||
/// <param name="removeEmpty">Option to remove empty substrings from the array.</param>
|
|
||||||
/// <returns>An array of the substrings.</returns>
|
|
||||||
internal static string[] Split(string? value, char separator, bool removeEmpty)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(value))
|
|
||||||
{
|
|
||||||
return Array.Empty<string>();
|
|
||||||
}
|
|
||||||
|
|
||||||
return removeEmpty
|
|
||||||
? value.Split(separator, StringSplitOptions.RemoveEmptyEntries)
|
|
||||||
: value.Split(separator);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if the user can update an entry.
|
/// Checks if the user can update an entry.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user