|
|
|
@ -619,7 +619,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
|
|
|
|
|
var queryResult = folder.GetItems(query);
|
|
|
|
|
|
|
|
|
|
return ToResult(queryResult);
|
|
|
|
|
return ToResult(startIndex, queryResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -642,7 +642,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
|
|
|
|
|
var result = _libraryManager.GetItemsResult(query);
|
|
|
|
|
|
|
|
|
|
return ToResult(result);
|
|
|
|
|
return ToResult(startIndex, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -707,11 +707,10 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
serverItems = serverItems[..limit.Value];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new QueryResult<ServerItem>
|
|
|
|
|
{
|
|
|
|
|
Items = serverItems,
|
|
|
|
|
TotalRecordCount = serverItems.Length
|
|
|
|
|
};
|
|
|
|
|
return new QueryResult<ServerItem>(
|
|
|
|
|
startIndex,
|
|
|
|
|
serverItems.Length,
|
|
|
|
|
serverItems);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -764,11 +763,10 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
array = array[..limit.Value];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new QueryResult<ServerItem>
|
|
|
|
|
{
|
|
|
|
|
Items = array,
|
|
|
|
|
TotalRecordCount = array.Length
|
|
|
|
|
};
|
|
|
|
|
return new QueryResult<ServerItem>(
|
|
|
|
|
startIndex,
|
|
|
|
|
array.Length,
|
|
|
|
|
array);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -790,11 +788,10 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
.Select(i => new ServerItem(i, StubType.Folder))
|
|
|
|
|
.ToArray();
|
|
|
|
|
|
|
|
|
|
return new QueryResult<ServerItem>
|
|
|
|
|
{
|
|
|
|
|
Items = items,
|
|
|
|
|
TotalRecordCount = totalRecordCount
|
|
|
|
|
};
|
|
|
|
|
return new QueryResult<ServerItem>(
|
|
|
|
|
startIndex,
|
|
|
|
|
totalRecordCount,
|
|
|
|
|
items);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -850,11 +847,10 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
serverItems = serverItems[..limit.Value];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new QueryResult<ServerItem>
|
|
|
|
|
{
|
|
|
|
|
Items = serverItems,
|
|
|
|
|
TotalRecordCount = serverItems.Length
|
|
|
|
|
};
|
|
|
|
|
return new QueryResult<ServerItem>(
|
|
|
|
|
startIndex,
|
|
|
|
|
serverItems.Length,
|
|
|
|
|
serverItems);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -879,7 +875,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
|
|
|
|
|
var result = _libraryManager.GetItemsResult(query);
|
|
|
|
|
|
|
|
|
|
return ToResult(result);
|
|
|
|
|
return ToResult(query.StartIndex, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -894,7 +890,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
|
|
|
|
|
var result = _libraryManager.GetItemsResult(query);
|
|
|
|
|
|
|
|
|
|
return ToResult(result);
|
|
|
|
|
return ToResult(query.StartIndex, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -914,7 +910,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
|
|
|
|
|
var result = _libraryManager.GetItemsResult(query);
|
|
|
|
|
|
|
|
|
|
return ToResult(result);
|
|
|
|
|
return ToResult(query.StartIndex, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -931,7 +927,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
query.AncestorIds = new[] { parent.Id };
|
|
|
|
|
var genresResult = _libraryManager.GetGenres(query);
|
|
|
|
|
|
|
|
|
|
return ToResult(genresResult);
|
|
|
|
|
return ToResult(query.StartIndex, genresResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -947,7 +943,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
query.AncestorIds = new[] { parent.Id };
|
|
|
|
|
var genresResult = _libraryManager.GetMusicGenres(query);
|
|
|
|
|
|
|
|
|
|
return ToResult(genresResult);
|
|
|
|
|
return ToResult(query.StartIndex, genresResult);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -963,7 +959,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
query.AncestorIds = new[] { parent.Id };
|
|
|
|
|
var artists = _libraryManager.GetAlbumArtists(query);
|
|
|
|
|
|
|
|
|
|
return ToResult(artists);
|
|
|
|
|
return ToResult(query.StartIndex, artists);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -978,7 +974,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
query.OrderBy = Array.Empty<(string, SortOrder)>();
|
|
|
|
|
query.AncestorIds = new[] { parent.Id };
|
|
|
|
|
var artists = _libraryManager.GetArtists(query);
|
|
|
|
|
return ToResult(artists);
|
|
|
|
|
return ToResult(query.StartIndex, artists);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -994,7 +990,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
query.AncestorIds = new[] { parent.Id };
|
|
|
|
|
query.IsFavorite = true;
|
|
|
|
|
var artists = _libraryManager.GetArtists(query);
|
|
|
|
|
return ToResult(artists);
|
|
|
|
|
return ToResult(query.StartIndex, artists);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -1010,7 +1006,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
|
|
|
|
|
var result = _libraryManager.GetItemsResult(query);
|
|
|
|
|
|
|
|
|
|
return ToResult(result);
|
|
|
|
|
return ToResult(query.StartIndex, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -1034,7 +1030,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
new[] { parent },
|
|
|
|
|
query.DtoOptions);
|
|
|
|
|
|
|
|
|
|
return ToResult(result);
|
|
|
|
|
return ToResult(query.StartIndex, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -1060,7 +1056,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
},
|
|
|
|
|
query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();
|
|
|
|
|
|
|
|
|
|
return ToResult(items);
|
|
|
|
|
return ToResult(query.StartIndex, items);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -1087,7 +1083,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
|
|
|
|
|
var result = _libraryManager.GetItemsResult(query);
|
|
|
|
|
|
|
|
|
|
return ToResult(result);
|
|
|
|
|
return ToResult(startIndex, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -1118,7 +1114,7 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
|
|
|
|
|
var result = _libraryManager.GetItemsResult(query);
|
|
|
|
|
|
|
|
|
|
return ToResult(result);
|
|
|
|
|
return ToResult(startIndex, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -1145,33 +1141,34 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
|
|
|
|
|
var result = _libraryManager.GetItemsResult(query);
|
|
|
|
|
|
|
|
|
|
return ToResult(result);
|
|
|
|
|
return ToResult(startIndex, result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Converts <see cref="IReadOnlyCollection{BaseItem}"/> into a <see cref="QueryResult{ServerItem}"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="startIndex">The start index.</param>
|
|
|
|
|
/// <param name="result">An array of <see cref="BaseItem"/>.</param>
|
|
|
|
|
/// <returns>A <see cref="QueryResult{ServerItem}"/>.</returns>
|
|
|
|
|
private static QueryResult<ServerItem> ToResult(IReadOnlyCollection<BaseItem> result)
|
|
|
|
|
private static QueryResult<ServerItem> ToResult(int? startIndex, IReadOnlyCollection<BaseItem> result)
|
|
|
|
|
{
|
|
|
|
|
var serverItems = result
|
|
|
|
|
.Select(i => new ServerItem(i, null))
|
|
|
|
|
.ToArray();
|
|
|
|
|
|
|
|
|
|
return new QueryResult<ServerItem>
|
|
|
|
|
{
|
|
|
|
|
TotalRecordCount = result.Count,
|
|
|
|
|
Items = serverItems
|
|
|
|
|
};
|
|
|
|
|
return new QueryResult<ServerItem>(
|
|
|
|
|
startIndex,
|
|
|
|
|
result.Count,
|
|
|
|
|
serverItems);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Converts a <see cref="QueryResult{BaseItem}"/> to a <see cref="QueryResult{ServerItem}"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="startIndex">The index the result started at.</param>
|
|
|
|
|
/// <param name="result">A <see cref="QueryResult{BaseItem}"/>.</param>
|
|
|
|
|
/// <returns>The <see cref="QueryResult{ServerItem}"/>.</returns>
|
|
|
|
|
private static QueryResult<ServerItem> ToResult(QueryResult<BaseItem> result)
|
|
|
|
|
private static QueryResult<ServerItem> ToResult(int? startIndex, QueryResult<BaseItem> result)
|
|
|
|
|
{
|
|
|
|
|
var length = result.Items.Count;
|
|
|
|
|
var serverItems = new ServerItem[length];
|
|
|
|
@ -1180,19 +1177,19 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
serverItems[i] = new ServerItem(result.Items[i], null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new QueryResult<ServerItem>
|
|
|
|
|
{
|
|
|
|
|
TotalRecordCount = result.TotalRecordCount,
|
|
|
|
|
Items = serverItems
|
|
|
|
|
};
|
|
|
|
|
return new QueryResult<ServerItem>(
|
|
|
|
|
startIndex,
|
|
|
|
|
result.TotalRecordCount,
|
|
|
|
|
serverItems);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Converts a query result to a <see cref="QueryResult{ServerItem}"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="startIndex">The start index.</param>
|
|
|
|
|
/// <param name="result">A <see cref="QueryResult{BaseItem}"/>.</param>
|
|
|
|
|
/// <returns>The <see cref="QueryResult{ServerItem}"/>.</returns>
|
|
|
|
|
private static QueryResult<ServerItem> ToResult(QueryResult<(BaseItem Item, ItemCounts ItemCounts)> result)
|
|
|
|
|
private static QueryResult<ServerItem> ToResult(int? startIndex, QueryResult<(BaseItem Item, ItemCounts ItemCounts)> result)
|
|
|
|
|
{
|
|
|
|
|
var length = result.Items.Count;
|
|
|
|
|
var serverItems = new ServerItem[length];
|
|
|
|
@ -1201,11 +1198,10 @@ namespace Emby.Dlna.ContentDirectory
|
|
|
|
|
serverItems[i] = new ServerItem(result.Items[i].Item, null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return new QueryResult<ServerItem>
|
|
|
|
|
{
|
|
|
|
|
TotalRecordCount = result.TotalRecordCount,
|
|
|
|
|
Items = serverItems
|
|
|
|
|
};
|
|
|
|
|
return new QueryResult<ServerItem>(
|
|
|
|
|
startIndex,
|
|
|
|
|
result.TotalRecordCount,
|
|
|
|
|
serverItems);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|