Merge pull request #3418 from Bond-009/minor3

Minor changes
This commit is contained in:
dkanada 2020-06-23 16:56:44 +09:00 committed by GitHub
commit 4e08876028
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 32 deletions

View file

@ -1,7 +1,6 @@
#pragma warning disable CS1591 #pragma warning disable CS1591
using System; using System;
using System.Collections;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -17,12 +16,10 @@ using MediaBrowser.Common.Net;
using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Plugins;
using MediaBrowser.Common.Updates; using MediaBrowser.Common.Updates;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.IO; using MediaBrowser.Model.IO;
using MediaBrowser.Model.Net; using MediaBrowser.Model.Net;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Updates; using MediaBrowser.Model.Updates;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Updates namespace Emby.Server.Implementations.Updates
@ -49,7 +46,6 @@ namespace Emby.Server.Implementations.Updates
private readonly IApplicationHost _applicationHost; private readonly IApplicationHost _applicationHost;
private readonly IZipClient _zipClient; private readonly IZipClient _zipClient;
private readonly IConfiguration _appConfig;
private readonly object _currentInstallationsLock = new object(); private readonly object _currentInstallationsLock = new object();
@ -71,8 +67,7 @@ namespace Emby.Server.Implementations.Updates
IJsonSerializer jsonSerializer, IJsonSerializer jsonSerializer,
IServerConfigurationManager config, IServerConfigurationManager config,
IFileSystem fileSystem, IFileSystem fileSystem,
IZipClient zipClient, IZipClient zipClient)
IConfiguration appConfig)
{ {
if (logger == null) if (logger == null)
{ {
@ -90,7 +85,6 @@ namespace Emby.Server.Implementations.Updates
_config = config; _config = config;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_zipClient = zipClient; _zipClient = zipClient;
_appConfig = appConfig;
} }
/// <inheritdoc /> /// <inheritdoc />
@ -118,7 +112,7 @@ namespace Emby.Server.Implementations.Updates
public IEnumerable<InstallationInfo> CompletedInstallations => _completedInstallationsInternal; public IEnumerable<InstallationInfo> CompletedInstallations => _completedInstallationsInternal;
/// <inheritdoc /> /// <inheritdoc />
public async Task<IEnumerable<PackageInfo>> GetPackages(string manifest, CancellationToken cancellationToken = default) public async Task<IReadOnlyList<PackageInfo>> GetPackages(string manifest, CancellationToken cancellationToken = default)
{ {
try try
{ {
@ -140,19 +134,19 @@ namespace Emby.Server.Implementations.Updates
catch (SerializationException ex) catch (SerializationException ex)
{ {
_logger.LogError(ex, "Failed to deserialize the plugin manifest retrieved from {Manifest}", manifest); _logger.LogError(ex, "Failed to deserialize the plugin manifest retrieved from {Manifest}", manifest);
return Enumerable.Empty<PackageInfo>(); return Array.Empty<PackageInfo>();
} }
} }
} }
catch (UriFormatException ex) catch (UriFormatException ex)
{ {
_logger.LogError(ex, "The URL configured for the plugin repository manifest URL is not valid: {Manifest}", manifest); _logger.LogError(ex, "The URL configured for the plugin repository manifest URL is not valid: {Manifest}", manifest);
return Enumerable.Empty<PackageInfo>(); return Array.Empty<PackageInfo>();
} }
catch (HttpException ex) catch (HttpException ex)
{ {
_logger.LogError(ex, "An error occurred while accessing the plugin manifest: {Manifest}", manifest); _logger.LogError(ex, "An error occurred while accessing the plugin manifest: {Manifest}", manifest);
return Enumerable.Empty<PackageInfo>(); return Array.Empty<PackageInfo>();
} }
} }
@ -165,7 +159,7 @@ namespace Emby.Server.Implementations.Updates
result.AddRange(await GetPackages(repository.Url, cancellationToken).ConfigureAwait(true)); result.AddRange(await GetPackages(repository.Url, cancellationToken).ConfigureAwait(true));
} }
return result.AsReadOnly(); return result;
} }
/// <inheritdoc /> /// <inheritdoc />

View file

@ -5,7 +5,6 @@ using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Updates; using MediaBrowser.Model.Updates;
namespace MediaBrowser.Common.Updates namespace MediaBrowser.Common.Updates
@ -46,7 +45,7 @@ namespace MediaBrowser.Common.Updates
/// <param name="manifest">The URL to query.</param> /// <param name="manifest">The URL to query.</param>
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{IReadOnlyList{PackageInfo}}.</returns> /// <returns>Task{IReadOnlyList{PackageInfo}}.</returns>
Task<IEnumerable<PackageInfo>> GetPackages(string manifest, CancellationToken cancellationToken = default); Task<IReadOnlyList<PackageInfo>> GetPackages(string manifest, CancellationToken cancellationToken = default);
/// <summary> /// <summary>
/// Gets all available packages. /// Gets all available packages.

View file

@ -12,7 +12,15 @@ namespace MediaBrowser.Model.Configuration
public class BaseApplicationConfiguration public class BaseApplicationConfiguration
{ {
/// <summary> /// <summary>
/// The number of days we should retain log files. /// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.
/// </summary>
public BaseApplicationConfiguration()
{
LogFileRetentionDays = 3;
}
/// <summary>
/// Gets or sets the number of days we should retain log files.
/// </summary> /// </summary>
/// <value>The log file retention days.</value> /// <value>The log file retention days.</value>
public int LogFileRetentionDays { get; set; } public int LogFileRetentionDays { get; set; }
@ -30,29 +38,21 @@ namespace MediaBrowser.Model.Configuration
public string CachePath { get; set; } public string CachePath { get; set; }
/// <summary> /// <summary>
/// Last known version that was ran using the configuration. /// Gets or sets the last known version that was ran using the configuration.
/// </summary> /// </summary>
/// <value>The version from previous run.</value> /// <value>The version from previous run.</value>
[XmlIgnore] [XmlIgnore]
public Version PreviousVersion { get; set; } public Version PreviousVersion { get; set; }
/// <summary> /// <summary>
/// Stringified PreviousVersion to be stored/loaded, /// Gets or sets the stringified PreviousVersion to be stored/loaded,
/// because System.Version itself isn't xml-serializable /// because System.Version itself isn't xml-serializable.
/// </summary> /// </summary>
/// <value>String value of PreviousVersion</value> /// <value>String value of PreviousVersion.</value>
public string PreviousVersionStr public string PreviousVersionStr
{ {
get => PreviousVersion?.ToString(); get => PreviousVersion?.ToString();
set => PreviousVersion = Version.Parse(value); set => PreviousVersion = Version.Parse(value);
} }
/// <summary>
/// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.
/// </summary>
public BaseApplicationConfiguration()
{
LogFileRetentionDays = 3;
}
} }
} }

View file

@ -1,6 +1,3 @@
#nullable disable
using System;
namespace MediaBrowser.Model.Updates namespace MediaBrowser.Model.Updates
{ {
/// <summary> /// <summary>
@ -12,12 +9,12 @@ namespace MediaBrowser.Model.Updates
/// Gets or sets the name. /// Gets or sets the name.
/// </summary> /// </summary>
/// <value>The name.</value> /// <value>The name.</value>
public string Name { get; set; } public string? Name { get; set; }
/// <summary> /// <summary>
/// Gets or sets the URL. /// Gets or sets the URL.
/// </summary> /// </summary>
/// <value>The URL.</value> /// <value>The URL.</value>
public string Url { get; set; } public string? Url { get; set; }
} }
} }