mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-02 13:58:29 +01:00
update translations
This commit is contained in:
@@ -906,7 +906,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
// Ensure the location is available.
|
||||
Directory.CreateDirectory(ConfigurationManager.ApplicationPaths.PeoplePath);
|
||||
|
||||
return new PeopleValidator(this, _logger).ValidatePeople(cancellationToken, new MetadataRefreshOptions(), progress);
|
||||
return new PeopleValidator(this, _logger, ConfigurationManager).ValidatePeople(cancellationToken, progress);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
if (user.Configuration.DisplayCollectionsView &&
|
||||
recursiveChildren.OfType<BoxSet>().Any())
|
||||
{
|
||||
list.Add(await GetUserView(CollectionType.BoxSets, user, CollectionType.BoxSets, cancellationToken).ConfigureAwait(false));
|
||||
list.Add(await GetUserView(CollectionType.BoxSets, user, string.Empty, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
if (recursiveChildren.OfType<Playlist>().Any())
|
||||
@@ -101,6 +101,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
list.Add(_playlists.GetPlaylistsFolder(user.Id.ToString("N")));
|
||||
}
|
||||
|
||||
if (user.Configuration.DisplayFoldersView)
|
||||
{
|
||||
list.Add(await GetUserView(CollectionType.Folders, user, "zz_" + CollectionType.Folders, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
if (query.IncludeExternalContent)
|
||||
{
|
||||
var channelResult = await _channelManager.GetChannels(new ChannelQuery
|
||||
@@ -131,7 +136,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
return _libraryManager.Sort(list, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).Cast<Folder>();
|
||||
}
|
||||
|
||||
private Task<UserView> GetUserView(string type, User user, string sortName, CancellationToken cancellationToken)
|
||||
public Task<UserView> GetUserView(string type, User user, string sortName, CancellationToken cancellationToken)
|
||||
{
|
||||
var name = _localizationManager.GetLocalizedString("ViewType" + type);
|
||||
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -23,46 +28,128 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
/// </summary>
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private readonly IServerConfigurationManager _config;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PeopleValidator" /> class.
|
||||
/// </summary>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
public PeopleValidator(ILibraryManager libraryManager, ILogger logger)
|
||||
public PeopleValidator(ILibraryManager libraryManager, ILogger logger, IServerConfigurationManager config)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_logger = logger;
|
||||
_config = config;
|
||||
}
|
||||
|
||||
private bool DownloadMetadata(PersonInfo i, PeopleMetadataOptions options)
|
||||
{
|
||||
if (i.IsType(PersonType.Actor))
|
||||
{
|
||||
return options.DownloadActorMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.Director))
|
||||
{
|
||||
return options.DownloadDirectorMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.Composer))
|
||||
{
|
||||
return options.DownloadComposerMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.Writer))
|
||||
{
|
||||
return options.DownloadWriterMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.Producer))
|
||||
{
|
||||
return options.DownloadProducerMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.GuestStar))
|
||||
{
|
||||
return options.DownloadGuestStarMetadata;
|
||||
}
|
||||
|
||||
return options.DownloadOtherPeopleMetadata;
|
||||
}
|
||||
|
||||
private IEnumerable<PersonInfo> GetPeopleToValidate(BaseItem item, PeopleMetadataOptions options)
|
||||
{
|
||||
return item.People.Where(i =>
|
||||
{
|
||||
if (i.IsType(PersonType.Actor))
|
||||
{
|
||||
return options.DownloadActorMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.Director))
|
||||
{
|
||||
return options.DownloadDirectorMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.Composer))
|
||||
{
|
||||
return options.DownloadComposerMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.Writer))
|
||||
{
|
||||
return options.DownloadWriterMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.Producer))
|
||||
{
|
||||
return options.DownloadProducerMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.GuestStar))
|
||||
{
|
||||
return options.DownloadGuestStarMetadata;
|
||||
}
|
||||
|
||||
return options.DownloadOtherPeopleMetadata;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates the people.
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="progress">The progress.</param>
|
||||
/// <returns>Task.</returns>
|
||||
public async Task ValidatePeople(CancellationToken cancellationToken, MetadataRefreshOptions options, IProgress<double> progress)
|
||||
public async Task ValidatePeople(CancellationToken cancellationToken, IProgress<double> progress)
|
||||
{
|
||||
var innerProgress = new ActionableProgress<double>();
|
||||
|
||||
innerProgress.RegisterAction(pct => progress.Report(pct * .15));
|
||||
|
||||
var peopleOptions = _config.Configuration.PeopleMetadataOptions;
|
||||
|
||||
var people = _libraryManager.RootFolder.GetRecursiveChildren()
|
||||
.SelectMany(c => c.People)
|
||||
.SelectMany(i => i.People)
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i.Name))
|
||||
.Select(i => i.Name)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
|
||||
var dict = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
foreach (var person in people)
|
||||
{
|
||||
bool current;
|
||||
if (!dict.TryGetValue(person.Name, out current) || !current)
|
||||
{
|
||||
dict[person.Name] = DownloadMetadata(person, peopleOptions);
|
||||
}
|
||||
}
|
||||
|
||||
var numComplete = 0;
|
||||
|
||||
foreach (var person in people)
|
||||
foreach (var person in dict)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
try
|
||||
{
|
||||
var item = _libraryManager.GetPerson(person);
|
||||
var item = _libraryManager.GetPerson(person.Key);
|
||||
|
||||
var options = new MetadataRefreshOptions
|
||||
{
|
||||
MetadataRefreshMode = person.Value ? MetadataRefreshMode.Default : MetadataRefreshMode.ValidationOnly,
|
||||
ImageRefreshMode = person.Value ? ImageRefreshMode.Default : ImageRefreshMode.ValidationOnly
|
||||
};
|
||||
|
||||
await item.RefreshMetadata(options, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user