mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 09:34:44 +01:00
Merge pull request #4633 from crobibero/guid-params
Use Guid as API parameter type where possible
This commit is contained in:
@@ -540,18 +540,18 @@ namespace Emby.Server.Implementations.Channels
|
||||
{
|
||||
IncludeItemTypes = new[] { nameof(Channel) },
|
||||
OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) }
|
||||
}).Select(i => GetChannelFeatures(i.ToString("N", CultureInfo.InvariantCulture))).ToArray();
|
||||
}).Select(i => GetChannelFeatures(i)).ToArray();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public ChannelFeatures GetChannelFeatures(string id)
|
||||
public ChannelFeatures GetChannelFeatures(Guid? id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
if (!id.HasValue)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
}
|
||||
|
||||
var channel = GetChannel(id);
|
||||
var channel = GetChannel(id.Value);
|
||||
var channelProvider = GetChannelProvider(channel);
|
||||
|
||||
return GetChannelFeaturesDto(channel, channelProvider, channelProvider.GetChannelFeatures());
|
||||
|
||||
@@ -2462,9 +2462,19 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
public BaseItem GetParentItem(string parentId, Guid? userId)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(parentId))
|
||||
if (string.IsNullOrEmpty(parentId))
|
||||
{
|
||||
return GetItemById(new Guid(parentId));
|
||||
return GetParentItem((Guid?)null, userId);
|
||||
}
|
||||
|
||||
return GetParentItem(new Guid(parentId), userId);
|
||||
}
|
||||
|
||||
public BaseItem GetParentItem(Guid? parentId, Guid? userId)
|
||||
{
|
||||
if (parentId.HasValue)
|
||||
{
|
||||
return GetItemById(parentId.Value);
|
||||
}
|
||||
|
||||
if (userId.HasValue && userId != Guid.Empty)
|
||||
|
||||
@@ -156,8 +156,8 @@ namespace Emby.Server.Implementations.Library
|
||||
ExcludeItemTypes = excludeItemTypes.ToArray(),
|
||||
IncludeItemTypes = includeItemTypes.ToArray(),
|
||||
Limit = query.Limit,
|
||||
IncludeItemsByName = string.IsNullOrEmpty(query.ParentId),
|
||||
ParentId = string.IsNullOrEmpty(query.ParentId) ? Guid.Empty : new Guid(query.ParentId),
|
||||
IncludeItemsByName = !query.ParentId.HasValue,
|
||||
ParentId = query.ParentId ?? Guid.Empty,
|
||||
OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) },
|
||||
Recursive = true,
|
||||
|
||||
|
||||
@@ -56,13 +56,11 @@ namespace Emby.Server.Implementations.TV
|
||||
return GetResult(GetNextUpEpisodes(request, user, new[] { presentationUniqueKey }, dtoOptions), request);
|
||||
}
|
||||
|
||||
var parentIdGuid = string.IsNullOrEmpty(request.ParentId) ? (Guid?)null : new Guid(request.ParentId);
|
||||
|
||||
BaseItem[] parents;
|
||||
|
||||
if (parentIdGuid.HasValue)
|
||||
if (request.ParentId.HasValue)
|
||||
{
|
||||
var parent = _libraryManager.GetItemById(parentIdGuid.Value);
|
||||
var parent = _libraryManager.GetItemById(request.ParentId.Value);
|
||||
|
||||
if (parent != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user