commit
6afd990986
|
@ -1346,8 +1346,8 @@ namespace Emby.Dlna.ContentDirectory
|
||||||
{
|
{
|
||||||
if (id.StartsWith(name + "_", StringComparison.OrdinalIgnoreCase))
|
if (id.StartsWith(name + "_", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
stubType = (StubType)Enum.Parse(typeof(StubType), name, true);
|
stubType = Enum.Parse<StubType>(name, true);
|
||||||
id = id.Split(new[] { '_' }, 2)[1];
|
id = id.Split('_', 2)[1];
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,7 +123,7 @@ namespace Emby.Dlna.Didl
|
||||||
{
|
{
|
||||||
foreach (var att in profile.XmlRootAttributes)
|
foreach (var att in profile.XmlRootAttributes)
|
||||||
{
|
{
|
||||||
var parts = att.Name.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
|
var parts = att.Name.Split(':', StringSplitOptions.RemoveEmptyEntries);
|
||||||
if (parts.Length == 2)
|
if (parts.Length == 2)
|
||||||
{
|
{
|
||||||
writer.WriteAttributeString(parts[0], parts[1], null, att.Value);
|
writer.WriteAttributeString(parts[0], parts[1], null, att.Value);
|
||||||
|
|
|
@ -383,9 +383,9 @@ namespace Emby.Dlna
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var filename = Path.GetFileName(name).Substring(namespaceName.Length);
|
var path = Path.Join(
|
||||||
|
systemProfilesPath,
|
||||||
var path = Path.Combine(systemProfilesPath, filename);
|
Path.GetFileName(name.AsSpan()).Slice(namespaceName.Length));
|
||||||
|
|
||||||
using (var stream = _assembly.GetManifestResourceStream(name))
|
using (var stream = _assembly.GetManifestResourceStream(name))
|
||||||
{
|
{
|
||||||
|
|
|
@ -168,7 +168,7 @@ namespace Emby.Dlna.Eventing
|
||||||
|
|
||||||
builder.Append("</e:propertyset>");
|
builder.Append("</e:propertyset>");
|
||||||
|
|
||||||
using var options = new HttpRequestMessage(new HttpMethod("NOTIFY"), subscription.CallbackUrl);
|
using var options = new HttpRequestMessage(new HttpMethod("NOTIFY"), subscription.CallbackUrl);
|
||||||
options.Content = new StringContent(builder.ToString(), Encoding.UTF8, MediaTypeNames.Text.Xml);
|
options.Content = new StringContent(builder.ToString(), Encoding.UTF8, MediaTypeNames.Text.Xml);
|
||||||
options.Headers.TryAddWithoutValidation("NT", subscription.NotificationType);
|
options.Headers.TryAddWithoutValidation("NT", subscription.NotificationType);
|
||||||
options.Headers.TryAddWithoutValidation("NTS", "upnp:propchange");
|
options.Headers.TryAddWithoutValidation("NTS", "upnp:propchange");
|
||||||
|
|
|
@ -257,9 +257,10 @@ namespace Emby.Dlna.Main
|
||||||
|
|
||||||
private async Task RegisterServerEndpoints()
|
private async Task RegisterServerEndpoints()
|
||||||
{
|
{
|
||||||
var addresses = await _appHost.GetLocalIpAddresses(CancellationToken.None).ConfigureAwait(false);
|
var addresses = await _appHost.GetLocalIpAddresses().ConfigureAwait(false);
|
||||||
|
|
||||||
var udn = CreateUuid(_appHost.SystemId);
|
var udn = CreateUuid(_appHost.SystemId);
|
||||||
|
var descriptorUri = "/dlna/" + udn + "/description.xml";
|
||||||
|
|
||||||
foreach (var address in addresses)
|
foreach (var address in addresses)
|
||||||
{
|
{
|
||||||
|
@ -279,7 +280,6 @@ namespace Emby.Dlna.Main
|
||||||
|
|
||||||
_logger.LogInformation("Registering publisher for {0} on {1}", fullService, address);
|
_logger.LogInformation("Registering publisher for {0} on {1}", fullService, address);
|
||||||
|
|
||||||
var descriptorUri = "/dlna/" + udn + "/description.xml";
|
|
||||||
var uri = new Uri(_appHost.GetLocalApiUrl(address) + descriptorUri);
|
var uri = new Uri(_appHost.GetLocalApiUrl(address) + descriptorUri);
|
||||||
|
|
||||||
var device = new SsdpRootDevice
|
var device = new SsdpRootDevice
|
||||||
|
|
|
@ -326,7 +326,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
|
|
||||||
public Task SendPlayCommand(PlayRequest command, CancellationToken cancellationToken)
|
public Task SendPlayCommand(PlayRequest command, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
_logger.LogDebug("{0} - Received PlayRequest: {1}", this._session.DeviceName, command.PlayCommand);
|
_logger.LogDebug("{0} - Received PlayRequest: {1}", _session.DeviceName, command.PlayCommand);
|
||||||
|
|
||||||
var user = command.ControllingUserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(command.ControllingUserId);
|
var user = command.ControllingUserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(command.ControllingUserId);
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@ namespace Emby.Dlna.PlayTo
|
||||||
var startIndex = command.StartIndex ?? 0;
|
var startIndex = command.StartIndex ?? 0;
|
||||||
if (startIndex > 0)
|
if (startIndex > 0)
|
||||||
{
|
{
|
||||||
items = items.Skip(startIndex).ToList();
|
items = items.GetRange(startIndex, items.Count - startIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
var playlist = new List<PlaylistItem>();
|
var playlist = new List<PlaylistItem>();
|
||||||
|
|
|
@ -209,7 +209,10 @@ namespace Emby.Notifications
|
||||||
_libraryUpdateTimer = null;
|
_libraryUpdateTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
items = items.Take(10).ToList();
|
if (items.Count > 10)
|
||||||
|
{
|
||||||
|
items = items.GetRange(0, 10);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var item in items)
|
foreach (var item in items)
|
||||||
{
|
{
|
||||||
|
|
|
@ -250,21 +250,16 @@ namespace Emby.Server.Implementations.Channels
|
||||||
var all = channels;
|
var all = channels;
|
||||||
var totalCount = all.Count;
|
var totalCount = all.Count;
|
||||||
|
|
||||||
if (query.StartIndex.HasValue)
|
if (query.StartIndex.HasValue || query.Limit.HasValue)
|
||||||
{
|
{
|
||||||
all = all.Skip(query.StartIndex.Value).ToList();
|
int startIndex = query.StartIndex ?? 0;
|
||||||
|
int count = query.Limit == null ? totalCount - startIndex : Math.Min(query.Limit.Value, totalCount - startIndex);
|
||||||
|
all = all.GetRange(startIndex, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.Limit.HasValue)
|
|
||||||
{
|
|
||||||
all = all.Take(query.Limit.Value).ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
var returnItems = all.ToArray();
|
|
||||||
|
|
||||||
if (query.RefreshLatestChannelItems)
|
if (query.RefreshLatestChannelItems)
|
||||||
{
|
{
|
||||||
foreach (var item in returnItems)
|
foreach (var item in all)
|
||||||
{
|
{
|
||||||
RefreshLatestChannelItems(GetChannelProvider(item), CancellationToken.None).GetAwaiter().GetResult();
|
RefreshLatestChannelItems(GetChannelProvider(item), CancellationToken.None).GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
@ -272,7 +267,7 @@ namespace Emby.Server.Implementations.Channels
|
||||||
|
|
||||||
return new QueryResult<Channel>
|
return new QueryResult<Channel>
|
||||||
{
|
{
|
||||||
Items = returnItems,
|
Items = all,
|
||||||
TotalRecordCount = totalCount
|
TotalRecordCount = totalCount
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,9 +316,9 @@ namespace Jellyfin.Api.Controllers
|
||||||
TotalRecordCount = list.Count
|
TotalRecordCount = list.Count
|
||||||
};
|
};
|
||||||
|
|
||||||
if (limit.HasValue)
|
if (limit.HasValue && limit < list.Count)
|
||||||
{
|
{
|
||||||
list = list.Take(limit.Value).ToList();
|
list = list.GetRange(0, limit.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
var returnList = _dtoService.GetBaseItemDtos(list, dtoOptions, user);
|
var returnList = _dtoService.GetBaseItemDtos(list, dtoOptions, user);
|
||||||
|
|
|
@ -268,20 +268,24 @@ namespace Jellyfin.Api.Controllers
|
||||||
{
|
{
|
||||||
var deviceProfile = new DeviceProfile();
|
var deviceProfile = new DeviceProfile();
|
||||||
|
|
||||||
var directPlayProfiles = new List<DirectPlayProfile>();
|
|
||||||
|
|
||||||
var containers = RequestHelpers.Split(container, ',', true);
|
var containers = RequestHelpers.Split(container, ',', true);
|
||||||
|
int len = containers.Length;
|
||||||
foreach (var cont in containers)
|
var directPlayProfiles = new DirectPlayProfile[len];
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
var parts = RequestHelpers.Split(cont, '|', true);
|
var parts = RequestHelpers.Split(containers[i], '|', true);
|
||||||
|
|
||||||
var audioCodecs = parts.Length == 1 ? null : string.Join(",", parts.Skip(1).ToArray());
|
var audioCodecs = parts.Length == 1 ? null : string.Join(',', parts.Skip(1));
|
||||||
|
|
||||||
directPlayProfiles.Add(new DirectPlayProfile { Type = DlnaProfileType.Audio, Container = parts[0], AudioCodec = audioCodecs });
|
directPlayProfiles[i] = new DirectPlayProfile
|
||||||
|
{
|
||||||
|
Type = DlnaProfileType.Audio,
|
||||||
|
Container = parts[0],
|
||||||
|
AudioCodec = audioCodecs
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
deviceProfile.DirectPlayProfiles = directPlayProfiles.ToArray();
|
deviceProfile.DirectPlayProfiles = directPlayProfiles;
|
||||||
|
|
||||||
deviceProfile.TranscodingProfiles = new[]
|
deviceProfile.TranscodingProfiles = new[]
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,9 +50,9 @@ namespace Jellyfin.Api.Helpers
|
||||||
|
|
||||||
var returnItems = items;
|
var returnItems = items;
|
||||||
|
|
||||||
if (limit.HasValue)
|
if (limit.HasValue && limit < returnItems.Count)
|
||||||
{
|
{
|
||||||
returnItems = returnItems.Take(limit.Value).ToList();
|
returnItems = returnItems.GetRange(0, limit.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
var dtos = dtoService.GetBaseItemDtos(returnItems, dtoOptions, user);
|
var dtos = dtoService.GetBaseItemDtos(returnItems, dtoOptions, user);
|
||||||
|
|
|
@ -56,10 +56,11 @@ namespace MediaBrowser.Controller
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the system info.
|
/// Gets the system info.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="cancellationToken">A cancellation token that can be used to cancel the task.</param>
|
||||||
/// <returns>SystemInfo.</returns>
|
/// <returns>SystemInfo.</returns>
|
||||||
Task<SystemInfo> GetSystemInfo(CancellationToken cancellationToken);
|
Task<SystemInfo> GetSystemInfo(CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
Task<PublicSystemInfo> GetPublicSystemInfo(CancellationToken cancellationToken);
|
Task<PublicSystemInfo> GetPublicSystemInfo(CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets all the local IP addresses of this API instance. Each address is validated by sending a 'ping' request
|
/// Gets all the local IP addresses of this API instance. Each address is validated by sending a 'ping' request
|
||||||
|
@ -67,7 +68,7 @@ namespace MediaBrowser.Controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cancellationToken">A cancellation token that can be used to cancel the task.</param>
|
/// <param name="cancellationToken">A cancellation token that can be used to cancel the task.</param>
|
||||||
/// <returns>A list containing all the local IP addresses of the server.</returns>
|
/// <returns>A list containing all the local IP addresses of the server.</returns>
|
||||||
Task<List<IPAddress>> GetLocalIpAddresses(CancellationToken cancellationToken);
|
Task<List<IPAddress>> GetLocalIpAddresses(CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a local (LAN) URL that can be used to access the API. The hostname used is the first valid configured
|
/// Gets a local (LAN) URL that can be used to access the API. The hostname used is the first valid configured
|
||||||
|
@ -75,7 +76,7 @@ namespace MediaBrowser.Controller
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cancellationToken">A cancellation token that can be used to cancel the task.</param>
|
/// <param name="cancellationToken">A cancellation token that can be used to cancel the task.</param>
|
||||||
/// <returns>The server URL.</returns>
|
/// <returns>The server URL.</returns>
|
||||||
Task<string> GetLocalApiUrl(CancellationToken cancellationToken);
|
Task<string> GetLocalApiUrl(CancellationToken cancellationToken = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a localhost URL that can be used to access the API using the loop-back IP address (127.0.0.1)
|
/// Gets a localhost URL that can be used to access the API using the loop-back IP address (127.0.0.1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user