Update /Device endpoint to return CustomName
This commit is contained in:
parent
6fce863146
commit
259fe4522c
|
@ -177,7 +177,7 @@ namespace Jellyfin.Server.Implementations.Devices
|
||||||
.OrderByDescending(d => d.DateLastActivity)
|
.OrderByDescending(d => d.DateLastActivity)
|
||||||
.ThenBy(d => d.DeviceId)
|
.ThenBy(d => d.DeviceId)
|
||||||
.AsAsyncEnumerable();
|
.AsAsyncEnumerable();
|
||||||
|
IAsyncEnumerable<DeviceOptions> deviceOptions = dbContext.DeviceOptions.AsAsyncEnumerable();
|
||||||
if (supportsSync.HasValue)
|
if (supportsSync.HasValue)
|
||||||
{
|
{
|
||||||
sessions = sessions.Where(i => GetCapabilities(i.DeviceId).SupportsSync == supportsSync.Value);
|
sessions = sessions.Where(i => GetCapabilities(i.DeviceId).SupportsSync == supportsSync.Value);
|
||||||
|
@ -195,6 +195,14 @@ namespace Jellyfin.Server.Implementations.Devices
|
||||||
}
|
}
|
||||||
|
|
||||||
var array = await sessions.Select(device => ToDeviceInfo(device)).ToArrayAsync().ConfigureAwait(false);
|
var array = await sessions.Select(device => ToDeviceInfo(device)).ToArrayAsync().ConfigureAwait(false);
|
||||||
|
await foreach (var deviceOption in deviceOptions)
|
||||||
|
{
|
||||||
|
var deviceInfo = array.FirstOrDefault(d => d.Id.Equals(deviceOption.DeviceId, StringComparison.OrdinalIgnoreCase));
|
||||||
|
if (deviceInfo != null)
|
||||||
|
{
|
||||||
|
deviceInfo.CustomName = deviceOption.CustomName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new QueryResult<DeviceInfo>(array);
|
return new QueryResult<DeviceInfo>(array);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ namespace MediaBrowser.Model.Devices
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
public string CustomName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the access token.
|
/// Gets or sets the access token.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user