Minor improvements
This commit is contained in:
parent
6bf0acb854
commit
2dbf73b989
|
@ -126,14 +126,14 @@ namespace Emby.Dlna
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
|
|
||||||
builder.AppendLine("No matching device profile found. The default will need to be used.");
|
builder.AppendLine("No matching device profile found. The default will need to be used.");
|
||||||
builder.AppendFormat(CultureInfo.InvariantCulture, "FriendlyName:{0}", profile.FriendlyName ?? string.Empty).AppendLine();
|
builder.Append("FriendlyName:").AppendLine(profile.FriendlyName);
|
||||||
builder.AppendFormat(CultureInfo.InvariantCulture, "Manufacturer:{0}", profile.Manufacturer ?? string.Empty).AppendLine();
|
builder.Append("Manufacturer:").AppendLine(profile.Manufacturer);
|
||||||
builder.AppendFormat(CultureInfo.InvariantCulture, "ManufacturerUrl:{0}", profile.ManufacturerUrl ?? string.Empty).AppendLine();
|
builder.Append("ManufacturerUrl:").AppendLine(profile.ManufacturerUrl);
|
||||||
builder.AppendFormat(CultureInfo.InvariantCulture, "ModelDescription:{0}", profile.ModelDescription ?? string.Empty).AppendLine();
|
builder.Append("ModelDescription:").AppendLine(profile.ModelDescription);
|
||||||
builder.AppendFormat(CultureInfo.InvariantCulture, "ModelName:{0}", profile.ModelName ?? string.Empty).AppendLine();
|
builder.Append("ModelName:").AppendLine(profile.ModelName);
|
||||||
builder.AppendFormat(CultureInfo.InvariantCulture, "ModelNumber:{0}", profile.ModelNumber ?? string.Empty).AppendLine();
|
builder.Append("ModelNumber:").AppendLine(profile.ModelNumber);
|
||||||
builder.AppendFormat(CultureInfo.InvariantCulture, "ModelUrl:{0}", profile.ModelUrl ?? string.Empty).AppendLine();
|
builder.Append("ModelUrl:").AppendLine(profile.ModelUrl);
|
||||||
builder.AppendFormat(CultureInfo.InvariantCulture, "SerialNumber:{0}", profile.SerialNumber ?? string.Empty).AppendLine();
|
builder.Append("SerialNumber:").AppendLine(profile.SerialNumber);
|
||||||
|
|
||||||
_logger.LogInformation(builder.ToString());
|
_logger.LogInformation(builder.ToString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,7 +234,9 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam))
|
if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam))
|
||||||
{
|
{
|
||||||
bindParam.Bind(value.ToByteArray());
|
Span<byte> byteValue = stackalloc byte[16];
|
||||||
|
value.TryWriteBytes(byteValue);
|
||||||
|
bindParam.Bind(byteValue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -1144,30 +1144,30 @@ namespace Jellyfin.Api.Controllers
|
||||||
|
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
|
|
||||||
builder.AppendLine("#EXTM3U");
|
builder.AppendLine("#EXTM3U")
|
||||||
builder.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD");
|
.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD")
|
||||||
builder.AppendLine("#EXT-X-VERSION:3");
|
.AppendLine("#EXT-X-VERSION:3")
|
||||||
builder.AppendLine("#EXT-X-TARGETDURATION:" + Math.Ceiling(segmentLengths.Length > 0 ? segmentLengths.Max() : state.SegmentLength).ToString(CultureInfo.InvariantCulture));
|
.Append("#EXT-X-TARGETDURATION:")
|
||||||
builder.AppendLine("#EXT-X-MEDIA-SEQUENCE:0");
|
.Append(Math.Ceiling(segmentLengths.Length > 0 ? segmentLengths.Max() : state.SegmentLength))
|
||||||
|
.AppendLine()
|
||||||
|
.AppendLine("#EXT-X-MEDIA-SEQUENCE:0");
|
||||||
|
|
||||||
var queryString = Request.QueryString;
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|
||||||
var segmentExtension = GetSegmentFileExtension(streamingRequest.SegmentContainer);
|
var segmentExtension = GetSegmentFileExtension(streamingRequest.SegmentContainer);
|
||||||
|
var queryString = Request.QueryString;
|
||||||
|
|
||||||
foreach (var length in segmentLengths)
|
foreach (var length in segmentLengths)
|
||||||
{
|
{
|
||||||
builder.AppendLine("#EXTINF:" + length.ToString("0.0000", CultureInfo.InvariantCulture) + ", nodesc");
|
builder.Append("#EXTINF:")
|
||||||
builder.AppendLine(
|
.Append(length.ToString("0.0000", CultureInfo.InvariantCulture))
|
||||||
string.Format(
|
.Append(", nodesc")
|
||||||
CultureInfo.InvariantCulture,
|
.Append("hls1/")
|
||||||
"hls1/{0}/{1}{2}{3}",
|
.Append(name)
|
||||||
name,
|
.Append('/')
|
||||||
index.ToString(CultureInfo.InvariantCulture),
|
.Append(index++)
|
||||||
segmentExtension,
|
.Append(segmentExtension)
|
||||||
queryString));
|
.Append(queryString)
|
||||||
|
.AppendLine();
|
||||||
index++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.AppendLine("#EXT-X-ENDLIST");
|
builder.AppendLine("#EXT-X-ENDLIST");
|
||||||
|
|
|
@ -1017,9 +1017,9 @@ namespace Jellyfin.Api.Controllers
|
||||||
[FromQuery] bool validateListings = false,
|
[FromQuery] bool validateListings = false,
|
||||||
[FromQuery] bool validateLogin = false)
|
[FromQuery] bool validateLogin = false)
|
||||||
{
|
{
|
||||||
using var sha = SHA1.Create();
|
|
||||||
if (!string.IsNullOrEmpty(pw))
|
if (!string.IsNullOrEmpty(pw))
|
||||||
{
|
{
|
||||||
|
using var sha = SHA1.Create();
|
||||||
listingsProviderInfo.Password = Hex.Encode(sha.ComputeHash(Encoding.UTF8.GetBytes(pw)));
|
listingsProviderInfo.Password = Hex.Encode(sha.ComputeHash(Encoding.UTF8.GetBytes(pw)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,8 @@ namespace Jellyfin.Api.Controllers
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
builder.AppendLine("#EXTM3U")
|
builder.AppendLine("#EXTM3U")
|
||||||
.Append("#EXT-X-TARGETDURATION:")
|
.Append("#EXT-X-TARGETDURATION:")
|
||||||
.AppendLine(segmentLength.ToString(CultureInfo.InvariantCulture))
|
.Append(segmentLength)
|
||||||
|
.AppendLine()
|
||||||
.AppendLine("#EXT-X-VERSION:3")
|
.AppendLine("#EXT-X-VERSION:3")
|
||||||
.AppendLine("#EXT-X-MEDIA-SEQUENCE:0")
|
.AppendLine("#EXT-X-MEDIA-SEQUENCE:0")
|
||||||
.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD");
|
.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD");
|
||||||
|
@ -296,8 +297,9 @@ namespace Jellyfin.Api.Controllers
|
||||||
var lengthTicks = Math.Min(remaining, segmentLengthTicks);
|
var lengthTicks = Math.Min(remaining, segmentLengthTicks);
|
||||||
|
|
||||||
builder.Append("#EXTINF:")
|
builder.Append("#EXTINF:")
|
||||||
.Append(TimeSpan.FromTicks(lengthTicks).TotalSeconds.ToString(CultureInfo.InvariantCulture))
|
.Append(TimeSpan.FromTicks(lengthTicks).TotalSeconds)
|
||||||
.AppendLine(",");
|
.Append(',')
|
||||||
|
.AppendLine();
|
||||||
|
|
||||||
var endPositionTicks = Math.Min(runtime, positionTicks + segmentLengthTicks);
|
var endPositionTicks = Math.Min(runtime, positionTicks + segmentLengthTicks);
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ namespace MediaBrowser.Providers.Manager
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Befores the save.
|
/// Before the save.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <param name="isFullRefresh">if set to <c>true</c> [is full refresh].</param>
|
/// <param name="isFullRefresh">if set to <c>true</c> [is full refresh].</param>
|
||||||
|
@ -355,13 +355,12 @@ namespace MediaBrowser.Providers.Manager
|
||||||
|
|
||||||
protected virtual IList<BaseItem> GetChildrenForMetadataUpdates(TItemType item)
|
protected virtual IList<BaseItem> GetChildrenForMetadataUpdates(TItemType item)
|
||||||
{
|
{
|
||||||
var folder = item as Folder;
|
if (item is Folder folder)
|
||||||
if (folder != null)
|
|
||||||
{
|
{
|
||||||
return folder.GetRecursiveChildren();
|
return folder.GetRecursiveChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new List<BaseItem>();
|
return Array.Empty<BaseItem>();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual ItemUpdateType UpdateMetadataFromChildren(TItemType item, IList<BaseItem> children, bool isFullRefresh, ItemUpdateType currentUpdateType)
|
protected virtual ItemUpdateType UpdateMetadataFromChildren(TItemType item, IList<BaseItem> children, bool isFullRefresh, ItemUpdateType currentUpdateType)
|
||||||
|
@ -814,7 +813,7 @@ namespace MediaBrowser.Providers.Manager
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
refreshResult.UpdateType = refreshResult.UpdateType | await provider.FetchAsync(item, options, cancellationToken).ConfigureAwait(false);
|
refreshResult.UpdateType |= await provider.FetchAsync(item, options, cancellationToken).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
|
@ -882,16 +881,6 @@ namespace MediaBrowser.Providers.Manager
|
||||||
return refreshResult;
|
return refreshResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string NormalizeLanguage(string language)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrWhiteSpace(language))
|
|
||||||
{
|
|
||||||
return "en";
|
|
||||||
}
|
|
||||||
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MergeNewData(TItemType source, TIdType lookupInfo)
|
private void MergeNewData(TItemType source, TIdType lookupInfo)
|
||||||
{
|
{
|
||||||
// Copy new provider id's that may have been obtained
|
// Copy new provider id's that may have been obtained
|
||||||
|
|
|
@ -43,13 +43,13 @@ namespace Rssdp.Infrastructure
|
||||||
{
|
{
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
|
|
||||||
const string argFormat = "{0}: {1}\r\n";
|
const string ArgFormat = "{0}: {1}\r\n";
|
||||||
|
|
||||||
builder.AppendFormat("{0}\r\n", header);
|
builder.AppendFormat("{0}\r\n", header);
|
||||||
|
|
||||||
foreach (var pair in values)
|
foreach (var pair in values)
|
||||||
{
|
{
|
||||||
builder.AppendFormat(argFormat, pair.Key, pair.Value);
|
builder.AppendFormat(ArgFormat, pair.Key, pair.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.Append("\r\n");
|
builder.Append("\r\n");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user