diff options
Diffstat (limited to 'Emby.Server.Implementations')
8 files changed, 34 insertions, 68 deletions
diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs index 47f9dfbc8..aef02ce6b 100644 --- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs @@ -133,7 +133,8 @@ namespace Emby.Server.Implementations.EntryPoints private UserDataChangeInfo GetUserDataChangeInfo(Guid userId, List<BaseItem> changedItems) { - var user = _userManager.GetUserById(userId); + var user = _userManager.GetUserById(userId) + ?? throw new ArgumentException("Invalid user ID", nameof(userId)); return new UserDataChangeInfo { diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index 6d71e99a1..48d24385e 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -669,7 +669,7 @@ namespace Emby.Server.Implementations.Library if (parent is not null) { - var multiItemResolvers = resolvers is null ? MultiItemResolvers : resolvers.OfType<IMultiItemResolver>().ToArray(); + var multiItemResolvers = resolvers is null ? MultiItemResolvers : resolvers.OfType<IMultiItemResolver>(); foreach (var resolver in multiItemResolvers) { diff --git a/Emby.Server.Implementations/Library/UserDataManager.cs b/Emby.Server.Implementations/Library/UserDataManager.cs index 8beeb8041..62d22b23f 100644 --- a/Emby.Server.Implementations/Library/UserDataManager.cs +++ b/Emby.Server.Implementations/Library/UserDataManager.cs @@ -1,10 +1,7 @@ -#nullable disable - -#pragma warning disable CS1591 - using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using System.Threading; using Jellyfin.Data.Entities; @@ -32,6 +29,12 @@ namespace Emby.Server.Implementations.Library private readonly IUserManager _userManager; private readonly IUserDataRepository _repository; + /// <summary> + /// Initializes a new instance of the <see cref="UserDataManager"/> class. + /// </summary> + /// <param name="config">Instance of the <see cref="IServerConfigurationManager"/> interface.</param> + /// <param name="userManager">Instance of the <see cref="IUserManager"/> interface.</param> + /// <param name="repository">Instance of the <see cref="IUserDataRepository"/> interface.</param> public UserDataManager( IServerConfigurationManager config, IUserManager userManager, @@ -42,15 +45,10 @@ namespace Emby.Server.Implementations.Library _repository = repository; } - public event EventHandler<UserDataSaveEventArgs> UserDataSaved; - - public void SaveUserData(Guid userId, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken) - { - var user = _userManager.GetUserById(userId); - - SaveUserData(user, item, userData, reason, cancellationToken); - } + /// <inheritdoc /> + public event EventHandler<UserDataSaveEventArgs>? UserDataSaved; + /// <inheritdoc /> public void SaveUserData(User user, BaseItem item, UserItemData userData, UserDataSaveReason reason, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(userData); @@ -81,6 +79,7 @@ namespace Emby.Server.Implementations.Library }); } + /// <inheritdoc /> public void SaveUserData(User user, BaseItem item, UpdateUserItemDataDto userDataDto, UserDataSaveReason reason) { ArgumentNullException.ThrowIfNull(user); @@ -128,39 +127,7 @@ namespace Emby.Server.Implementations.Library SaveUserData(user, item, userData, reason, CancellationToken.None); } - /// <summary> - /// Save the provided user data for the given user. Batch operation. Does not fire any events or update the cache. - /// </summary> - /// <param name="userId">The user id.</param> - /// <param name="userData">The user item data.</param> - /// <param name="cancellationToken">The cancellation token.</param> - public void SaveAllUserData(Guid userId, UserItemData[] userData, CancellationToken cancellationToken) - { - var user = _userManager.GetUserById(userId); - - _repository.SaveAllUserData(user.InternalId, userData, cancellationToken); - } - - /// <summary> - /// Retrieve all user data for the given user. - /// </summary> - /// <param name="userId">The user id.</param> - /// <returns>A <see cref="List{UserItemData}"/> containing all of the user's item data.</returns> - public List<UserItemData> GetAllUserData(Guid userId) - { - var user = _userManager.GetUserById(userId); - - return _repository.GetAllUserData(user.InternalId); - } - - public UserItemData GetUserData(Guid userId, Guid itemId, List<string> keys) - { - var user = _userManager.GetUserById(userId); - - return GetUserData(user, itemId, keys); - } - - public UserItemData GetUserData(User user, Guid itemId, List<string> keys) + private UserItemData GetUserData(User user, Guid itemId, List<string> keys) { var userId = user.InternalId; @@ -186,7 +153,7 @@ namespace Emby.Server.Implementations.Library }; } - return null; + throw new UnreachableException(); } /// <summary> @@ -198,27 +165,18 @@ namespace Emby.Server.Implementations.Library return internalUserId.ToString(CultureInfo.InvariantCulture) + "-" + itemId.ToString("N", CultureInfo.InvariantCulture); } + /// <inheritdoc /> public UserItemData GetUserData(User user, BaseItem item) { return GetUserData(user, item.Id, item.GetUserDataKeys()); } - public UserItemData GetUserData(Guid userId, BaseItem item) - { - return GetUserData(userId, item.Id, item.GetUserDataKeys()); - } - + /// <inheritdoc /> public UserItemDataDto GetUserDataDto(BaseItem item, User user) - { - var userData = GetUserData(user, item); - var dto = GetUserItemDataDto(userData); - - item.FillUserDataDtoValues(dto, userData, null, user, new DtoOptions()); - return dto; - } + => GetUserDataDto(item, null, user, new DtoOptions()); /// <inheritdoc /> - public UserItemDataDto GetUserDataDto(BaseItem item, BaseItemDto itemDto, User user, DtoOptions options) + public UserItemDataDto GetUserDataDto(BaseItem item, BaseItemDto? itemDto, User user, DtoOptions options) { var userData = GetUserData(user, item); var dto = GetUserItemDataDto(userData); diff --git a/Emby.Server.Implementations/Localization/Core/da.json b/Emby.Server.Implementations/Localization/Core/da.json index e871a4362..69217dba0 100644 --- a/Emby.Server.Implementations/Localization/Core/da.json +++ b/Emby.Server.Implementations/Localization/Core/da.json @@ -93,7 +93,7 @@ "ValueSpecialEpisodeName": "Special - {0}", "VersionNumber": "Version {0}", "TaskDownloadMissingSubtitlesDescription": "Søger på internettet efter manglende undertekster baseret på metadata-konfigurationen.", - "TaskDownloadMissingSubtitles": "Hent manglende undertekster", + "TaskDownloadMissingSubtitles": "Hentede medie mangler undertekster", "TaskUpdatePluginsDescription": "Henter og installerer opdateringer for plugins, som er konfigurerede til at blive opdateret automatisk.", "TaskUpdatePlugins": "Opdater Plugins", "TaskCleanLogsDescription": "Sletter log-filer som er mere end {0} dage gamle.", @@ -130,5 +130,7 @@ "TaskCleanCollectionsAndPlaylists": "Ryd op i samlinger og afspilningslister", "TaskCleanCollectionsAndPlaylistsDescription": "Fjerner elementer fra samlinger og afspilningslister der ikke eksisterer længere.", "TaskAudioNormalizationDescription": "Skanner filer for data vedrørende audio-normalisering.", - "TaskAudioNormalization": "Audio-normalisering" + "TaskAudioNormalization": "Audio-normalisering", + "TaskDownloadMissingLyricsDescription": "Hentede sange mangler sangtekster", + "TaskDownloadMissingLyrics": "Hentede medie mangler sangtekster" } diff --git a/Emby.Server.Implementations/Localization/Core/de.json b/Emby.Server.Implementations/Localization/Core/de.json index 865a1ef95..bbb162c77 100644 --- a/Emby.Server.Implementations/Localization/Core/de.json +++ b/Emby.Server.Implementations/Localization/Core/de.json @@ -131,6 +131,6 @@ "TaskCleanCollectionsAndPlaylistsDescription": "Lösche nicht mehr vorhandene Einträge aus den Sammlungen und Playlisten.", "TaskAudioNormalization": "Audio Normalisierung", "TaskAudioNormalizationDescription": "Durchsucht Dateien nach Audionormalisierungsdaten.", - "TaskDownloadMissingLyricsDescription": "Lädt Liedtexte herunter", - "TaskDownloadMissingLyrics": "Fehlende Liedtexte herunterladen" + "TaskDownloadMissingLyricsDescription": "Lädt Songtexte herunter", + "TaskDownloadMissingLyrics": "Fehlende Songtexte herunterladen" } diff --git a/Emby.Server.Implementations/Localization/Core/fa.json b/Emby.Server.Implementations/Localization/Core/fa.json index ce5177d1f..b0ddec104 100644 --- a/Emby.Server.Implementations/Localization/Core/fa.json +++ b/Emby.Server.Implementations/Localization/Core/fa.json @@ -128,5 +128,9 @@ "TaskRefreshTrickplayImages": "تولید تصاویر Trickplay", "TaskRefreshTrickplayImagesDescription": "تولید پیشنمایش های trickplay برای ویدیو های فعال شده در کتابخانه.", "TaskCleanCollectionsAndPlaylists": "پاکسازی مجموعه ها و لیست پخش", - "TaskCleanCollectionsAndPlaylistsDescription": "موارد را از مجموعه ها و لیست پخش هایی که دیگر وجود ندارند حذف میکند." + "TaskCleanCollectionsAndPlaylistsDescription": "موارد را از مجموعه ها و لیست پخش هایی که دیگر وجود ندارند حذف میکند.", + "TaskAudioNormalizationDescription": "بررسی فایل برای دادههای نرمال کردن صدا.", + "TaskDownloadMissingLyrics": "دانلود متنهای ناموجود", + "TaskDownloadMissingLyricsDescription": "دانلود متن شعرها", + "TaskAudioNormalization": "نرمال کردن صدا" } diff --git a/Emby.Server.Implementations/Localization/Core/it.json b/Emby.Server.Implementations/Localization/Core/it.json index 0e694af02..961d1a0df 100644 --- a/Emby.Server.Implementations/Localization/Core/it.json +++ b/Emby.Server.Implementations/Localization/Core/it.json @@ -130,5 +130,7 @@ "TaskCleanCollectionsAndPlaylists": "Ripulire le collezioni e le playlist", "TaskCleanCollectionsAndPlaylistsDescription": "Rimuove gli elementi dalle collezioni e dalle playlist che non esistono più.", "TaskAudioNormalization": "Normalizzazione dell'audio", - "TaskAudioNormalizationDescription": "Scansiona i file alla ricerca dei dati per la normalizzazione dell'audio." + "TaskAudioNormalizationDescription": "Scansiona i file alla ricerca dei dati per la normalizzazione dell'audio.", + "TaskDownloadMissingLyricsDescription": "Scarica testi per le canzoni", + "TaskDownloadMissingLyrics": "Scarica testi mancanti" } diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 681c252b6..72e164b52 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -1468,7 +1468,6 @@ namespace Emby.Server.Implementations.Session user = await _userManager.AuthenticateUser( request.Username, request.Password, - null, request.RemoteEndPoint, true).ConfigureAwait(false); } |
