Minor fixes

This commit is contained in:
Bond_009 2020-07-04 22:06:27 +02:00
parent 46f67c9ea4
commit ae6eaa7f02
4 changed files with 20 additions and 24 deletions

View File

@ -43,9 +43,9 @@ using Emby.Server.Implementations.Security;
using Emby.Server.Implementations.Serialization;
using Emby.Server.Implementations.Services;
using Emby.Server.Implementations.Session;
using Emby.Server.Implementations.SyncPlay;
using Emby.Server.Implementations.TV;
using Emby.Server.Implementations.Updates;
using Emby.Server.Implementations.SyncPlay;
using MediaBrowser.Api;
using MediaBrowser.Common;
using MediaBrowser.Common.Configuration;
@ -78,8 +78,8 @@ using MediaBrowser.Controller.Security;
using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Controller.Subtitles;
using MediaBrowser.Controller.TV;
using MediaBrowser.Controller.SyncPlay;
using MediaBrowser.Controller.TV;
using MediaBrowser.LocalMetadata.Savers;
using MediaBrowser.MediaEncoding.BdInfo;
using MediaBrowser.Model.Configuration;
@ -484,12 +484,10 @@ namespace Emby.Server.Implementations
foreach (var plugin in Plugins)
{
pluginBuilder.AppendLine(
string.Format(
CultureInfo.InvariantCulture,
"{0} {1}",
plugin.Name,
plugin.Version));
pluginBuilder.Append(plugin.Name)
.Append(' ')
.Append(plugin.Version)
.AppendLine();
}
Logger.LogInformation("Plugins: {Plugins}", pluginBuilder.ToString());
@ -1153,7 +1151,7 @@ namespace Emby.Server.Implementations
return null;
}
return GetLocalApiUrl(addresses.First());
return GetLocalApiUrl(addresses[0]);
}
catch (Exception ex)
{
@ -1226,7 +1224,7 @@ namespace Emby.Server.Implementations
var addresses = ServerConfigurationManager
.Configuration
.LocalNetworkAddresses
.Select(NormalizeConfiguredLocalAddress)
.Select(x => NormalizeConfiguredLocalAddress(x))
.Where(i => i != null)
.ToList();
@ -1247,8 +1245,7 @@ namespace Emby.Server.Implementations
}
}
var valid = await IsLocalIpAddressValidAsync(address, cancellationToken).ConfigureAwait(false);
if (valid)
if (await IsLocalIpAddressValidAsync(address, cancellationToken).ConfigureAwait(false))
{
resultList.Add(address);
@ -1262,13 +1259,12 @@ namespace Emby.Server.Implementations
return resultList;
}
public IPAddress NormalizeConfiguredLocalAddress(string address)
public IPAddress NormalizeConfiguredLocalAddress(ReadOnlySpan<char> address)
{
var index = address.Trim('/').IndexOf('/');
if (index != -1)
{
address = address.Substring(index + 1);
address = address.Slice(index + 1);
}
if (IPAddress.TryParse(address.Trim('/'), out IPAddress result))

View File

@ -274,10 +274,10 @@ namespace Jellyfin.Server
var addresses = appHost.ServerConfigurationManager
.Configuration
.LocalNetworkAddresses
.Select(appHost.NormalizeConfiguredLocalAddress)
.Select(x => appHost.NormalizeConfiguredLocalAddress(x))
.Where(i => i != null)
.ToHashSet();
if (addresses.Any() && !addresses.Contains(IPAddress.Any))
if (addresses.Count > 0 && !addresses.Contains(IPAddress.Any))
{
if (!addresses.Contains(IPAddress.Loopback))
{

View File

@ -144,7 +144,7 @@ namespace MediaBrowser.Model.Dlna
public Dictionary<string, string> StreamOptions { get; private set; }
public string MediaSourceId => MediaSource == null ? null : MediaSource.Id;
public string MediaSourceId => MediaSource?.Id;
public bool IsDirectStream =>
PlayMethod == PlayMethod.DirectStream ||

View File

@ -148,7 +148,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
using (HttpResponseInfo response = await GetMovieDbResponse(new HttpRequestOptions
{
Url = string.Format(TmdbConfigUrl, TmdbUtils.ApiKey),
Url = string.Format(CultureInfo.InvariantCulture, TmdbConfigUrl, TmdbUtils.ApiKey),
CancellationToken = cancellationToken,
AcceptHeader = TmdbUtils.AcceptHeader
}).ConfigureAwait(false))
@ -245,7 +245,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
preferredLanguage = "alllang";
}
var filename = string.Format("all-{0}.json", preferredLanguage);
var filename = string.Format(CultureInfo.InvariantCulture, "all-{0}.json", preferredLanguage);
return Path.Combine(path, filename);
}
@ -276,7 +276,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
languages.Add("en");
}
return string.Join(",", languages.ToArray());
return string.Join(",", languages);
}
public static string NormalizeLanguage(string language)
@ -321,11 +321,11 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
/// <returns>Task{CompleteMovieData}.</returns>
internal async Task<MovieResult> FetchMainResult(string id, bool isTmdbId, string language, CancellationToken cancellationToken)
{
var url = string.Format(GetMovieInfo3, id, TmdbUtils.ApiKey);
var url = string.Format(CultureInfo.InvariantCulture, GetMovieInfo3, id, TmdbUtils.ApiKey);
if (!string.IsNullOrEmpty(language))
{
url += string.Format("&language={0}", NormalizeLanguage(language));
url += string.Format(CultureInfo.InvariantCulture, "&language={0}", NormalizeLanguage(language));
// Get images in english and with no language
url += "&include_image_language=" + GetImageLanguagesParam(language);
@ -377,7 +377,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb.Movies
{
_logger.LogInformation("MovieDbProvider couldn't find meta for language " + language + ". Trying English...");
url = string.Format(GetMovieInfo3, id, TmdbUtils.ApiKey) + "&language=en";
url = string.Format(CultureInfo.InvariantCulture,GetMovieInfo3, id, TmdbUtils.ApiKey) + "&language=en";
if (!string.IsNullOrEmpty(language))
{