Merge remote-tracking branch 'upstream/api-migration' into api-channel

This commit is contained in:
crobibero
2020-06-13 15:20:13 -06:00
1017 changed files with 20637 additions and 10122 deletions

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Model.Entities;
@@ -71,7 +71,7 @@ namespace Jellyfin.Api.Helpers
}
return null;
}).Where(i => i.HasValue).Select(i => i.Value).ToArray();
}).Where(i => i.HasValue).Select(i => i!.Value).ToArray();
}
/// <summary>
@@ -85,5 +85,24 @@ namespace Jellyfin.Api.Helpers
? Array.Empty<ItemFilter>()
: filters.Split(',').Select(v => Enum.Parse<ItemFilter>(v, true));
}
/// <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(new[] { separator }, StringSplitOptions.RemoveEmptyEntries)
: value.Split(separator);
}
}
}