mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 11:57:55 +02:00
Add Argument*Exceptions now use proper nameof operators. Added exception messages to quite a few Argument*Exceptions. Fixed rethorwing to be proper syntax. Added a ton of null checkes. (This is only a start, there are about 500 places that need proper null handling) Added some TODOs to log certain exceptions. Fix sln again. Fixed all AssemblyInfo's and added proper copyright (where I could find them) We live in *current year*. Fixed the use of braces. Fixed a ton of properties, and made a fair amount of functions static that should be and can be static. Made more Methods that should be static static. You can now use static to find bad functions! Removed unused variable. And added one more proper XML comment.
75 lines
2.2 KiB
C#
75 lines
2.2 KiB
C#
using System;
|
|
using MediaBrowser.Controller.Library;
|
|
using System.Threading;
|
|
using MediaBrowser.Model.Tasks;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using MediaBrowser.Controller.Providers;
|
|
using MediaBrowser.Model.IO;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Emby.Server.Implementations.EntryPoints
|
|
{
|
|
/// <summary>
|
|
/// Class RefreshUsersMetadata
|
|
/// </summary>
|
|
public class RefreshUsersMetadata : IScheduledTask, IConfigurableScheduledTask
|
|
{
|
|
private readonly ILogger _logger;
|
|
/// <summary>
|
|
/// The _user manager
|
|
/// </summary>
|
|
private readonly IUserManager _userManager;
|
|
|
|
private IFileSystem _fileSystem;
|
|
|
|
public string Name => "Refresh Users";
|
|
|
|
public string Key => "RefreshUsers";
|
|
|
|
public string Description => "Refresh user infos";
|
|
|
|
public string Category => "Library";
|
|
|
|
public bool IsHidden => true;
|
|
|
|
public bool IsEnabled => true;
|
|
|
|
public bool IsLogged => true;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="RefreshUsersMetadata" /> class.
|
|
/// </summary>
|
|
public RefreshUsersMetadata(ILogger logger, IUserManager userManager, IFileSystem fileSystem)
|
|
{
|
|
_logger = logger;
|
|
_userManager = userManager;
|
|
_fileSystem = fileSystem;
|
|
}
|
|
|
|
public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
|
|
{
|
|
var users = _userManager.Users.ToList();
|
|
|
|
foreach (var user in users)
|
|
{
|
|
cancellationToken.ThrowIfCancellationRequested();
|
|
|
|
await user.RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(_logger, _fileSystem)), cancellationToken).ConfigureAwait(false);
|
|
}
|
|
}
|
|
|
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
|
{
|
|
return new List<TaskTriggerInfo>
|
|
{
|
|
new TaskTriggerInfo
|
|
{
|
|
IntervalTicks = TimeSpan.FromDays(1).Ticks,
|
|
Type = TaskTriggerInfo.TriggerInterval
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|