diff options
Diffstat (limited to 'Emby.Server.Implementations')
7 files changed, 56 insertions, 42 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs index 634eaf85e..bfdcc08f4 100644 --- a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs @@ -333,10 +333,10 @@ namespace Emby.Server.Implementations.Data /// <returns>The user item data.</returns> private UserItemData ReadRow(SqliteDataReader reader) { - var userData = new UserItemData(); - - userData.Key = reader[0].ToString(); - // userData.UserId = reader[1].ReadGuidFromBlob(); + var userData = new UserItemData + { + Key = reader.GetString(0) + }; if (reader.TryGetDouble(2, out var rating)) { diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 19902b26a..0c0ba7453 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -1,5 +1,3 @@ -#nullable disable - #pragma warning disable CS1591 using System; @@ -83,12 +81,12 @@ namespace Emby.Server.Implementations.Dto private ILiveTvManager LivetvManager => _livetvManagerFactory.Value; /// <inheritdoc /> - public IReadOnlyList<BaseItemDto> GetBaseItemDtos(IReadOnlyList<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null) + public IReadOnlyList<BaseItemDto> GetBaseItemDtos(IReadOnlyList<BaseItem> items, DtoOptions options, User? user = null, BaseItem? owner = null) { var accessibleItems = user is null ? items : items.Where(x => x.IsVisible(user)).ToList(); var returnItems = new BaseItemDto[accessibleItems.Count]; - List<(BaseItem, BaseItemDto)> programTuples = null; - List<(BaseItemDto, LiveTvChannel)> channelTuples = null; + List<(BaseItem, BaseItemDto)>? programTuples = null; + List<(BaseItemDto, LiveTvChannel)>? channelTuples = null; for (int index = 0; index < accessibleItems.Count; index++) { @@ -137,7 +135,7 @@ namespace Emby.Server.Implementations.Dto return returnItems; } - public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null) + public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User? user = null, BaseItem? owner = null) { var dto = GetBaseItemDtoInternal(item, options, user, owner); if (item is LiveTvChannel tvChannel) @@ -167,7 +165,7 @@ namespace Emby.Server.Implementations.Dto return dto; } - private static IList<BaseItem> GetTaggedItems(IItemByName byName, User user, DtoOptions options) + private static IList<BaseItem> GetTaggedItems(IItemByName byName, User? user, DtoOptions options) { return byName.GetTaggedItems( new InternalItemsQuery(user) @@ -177,7 +175,7 @@ namespace Emby.Server.Implementations.Dto }); } - private BaseItemDto GetBaseItemDtoInternal(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null) + private BaseItemDto GetBaseItemDtoInternal(BaseItem item, DtoOptions options, User? user = null, BaseItem? owner = null) { var dto = new BaseItemDto { @@ -292,7 +290,7 @@ namespace Emby.Server.Implementations.Dto } var path = mediaSource.Path; - string fileExtensionContainer = null; + string? fileExtensionContainer = null; if (!string.IsNullOrEmpty(path)) { @@ -316,7 +314,8 @@ namespace Emby.Server.Implementations.Dto } } - public BaseItemDto GetItemByNameDto(BaseItem item, DtoOptions options, List<BaseItem> taggedItems, User user = null) + /// <inheritdoc /> + public BaseItemDto GetItemByNameDto(BaseItem item, DtoOptions options, List<BaseItem>? taggedItems, User? user = null) { var dto = GetBaseItemDtoInternal(item, options, user); @@ -486,10 +485,10 @@ namespace Emby.Server.Implementations.Dto return images .Select(p => GetImageCacheTag(item, p)) .Where(i => i is not null) - .ToArray(); + .ToArray()!; // null values got filtered out } - private string GetImageCacheTag(BaseItem item, ItemImageInfo image) + private string? GetImageCacheTag(BaseItem item, ItemImageInfo image) { try { @@ -508,7 +507,7 @@ namespace Emby.Server.Implementations.Dto /// <param name="dto">The dto.</param> /// <param name="item">The item.</param> /// <param name="user">The requesting user.</param> - private void AttachPeople(BaseItemDto dto, BaseItem item, User user = null) + private void AttachPeople(BaseItemDto dto, BaseItem item, User? user = null) { // Ordering by person type to ensure actors and artists are at the front. // This is taking advantage of the fact that they both begin with A @@ -552,7 +551,7 @@ namespace Emby.Server.Implementations.Dto var list = new List<BaseItemPerson>(); - var dictionary = people.Select(p => p.Name) + Dictionary<string, Person> dictionary = people.Select(p => p.Name) .Distinct(StringComparer.OrdinalIgnoreCase).Select(c => { try @@ -565,9 +564,9 @@ namespace Emby.Server.Implementations.Dto return null; } }).Where(i => i is not null) - .Where(i => user is null || i.IsVisible(user)) - .DistinctBy(x => x.Name, StringComparer.OrdinalIgnoreCase) - .ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase); + .Where(i => user is null || i!.IsVisible(user)) + .DistinctBy(x => x!.Name, StringComparer.OrdinalIgnoreCase) + .ToDictionary(i => i!.Name, StringComparer.OrdinalIgnoreCase)!; // null values got filtered out for (var i = 0; i < people.Count; i++) { @@ -580,7 +579,7 @@ namespace Emby.Server.Implementations.Dto Type = person.Type }; - if (dictionary.TryGetValue(person.Name, out Person entity)) + if (dictionary.TryGetValue(person.Name, out Person? entity)) { baseItemPerson.PrimaryImageTag = GetTagAndFillBlurhash(dto, entity, ImageType.Primary); baseItemPerson.Id = entity.Id; @@ -650,7 +649,7 @@ namespace Emby.Server.Implementations.Dto return _libraryManager.GetGenreId(name); } - private string GetTagAndFillBlurhash(BaseItemDto dto, BaseItem item, ImageType imageType, int imageIndex = 0) + private string? GetTagAndFillBlurhash(BaseItemDto dto, BaseItem item, ImageType imageType, int imageIndex = 0) { var image = item.GetImageInfo(imageType, imageIndex); if (image is not null) @@ -661,9 +660,14 @@ namespace Emby.Server.Implementations.Dto return null; } - private string GetTagAndFillBlurhash(BaseItemDto dto, BaseItem item, ItemImageInfo image) + private string? GetTagAndFillBlurhash(BaseItemDto dto, BaseItem item, ItemImageInfo image) { var tag = GetImageCacheTag(item, image); + if (tag is null) + { + return null; + } + if (!string.IsNullOrEmpty(image.BlurHash)) { dto.ImageBlurHashes ??= new Dictionary<ImageType, Dictionary<string, string>>(); @@ -716,7 +720,7 @@ namespace Emby.Server.Implementations.Dto /// <param name="item">The item.</param> /// <param name="owner">The owner.</param> /// <param name="options">The options.</param> - private void AttachBasicFields(BaseItemDto dto, BaseItem item, BaseItem owner, DtoOptions options) + private void AttachBasicFields(BaseItemDto dto, BaseItem item, BaseItem? owner, DtoOptions options) { if (options.ContainsField(ItemFields.DateCreated)) { @@ -1097,7 +1101,7 @@ namespace Emby.Server.Implementations.Dto } } - BaseItem[] allExtras = null; + BaseItem[]? allExtras = null; if (options.ContainsField(ItemFields.SpecialFeatureCount)) { @@ -1134,7 +1138,7 @@ namespace Emby.Server.Implementations.Dto dto.SeasonId = episode.SeasonId; dto.SeriesId = episode.SeriesId; - Series episodeSeries = null; + Series? episodeSeries = null; // this block will add the series poster for episodes without a poster // TODO maybe remove the if statement entirely @@ -1162,8 +1166,10 @@ namespace Emby.Server.Implementations.Dto } // Add SeriesInfo - if (item is Series series) + Series? series; + if (item is Series tmp) { + series = tmp; dto.AirDays = series.AirDays; dto.AirTime = series.AirTime; dto.Status = series.Status?.ToString(); @@ -1264,7 +1270,7 @@ namespace Emby.Server.Implementations.Dto } } - private BaseItem GetImageDisplayParent(BaseItem currentItem, BaseItem originalItem) + private BaseItem? GetImageDisplayParent(BaseItem currentItem, BaseItem originalItem) { if (currentItem is MusicAlbum musicAlbum) { @@ -1285,7 +1291,7 @@ namespace Emby.Server.Implementations.Dto return parent; } - private void AddInheritedImages(BaseItemDto dto, BaseItem item, DtoOptions options, BaseItem owner) + private void AddInheritedImages(BaseItemDto dto, BaseItem item, DtoOptions options, BaseItem? owner) { if (!item.SupportsInheritedParentImages) { @@ -1305,7 +1311,7 @@ namespace Emby.Server.Implementations.Dto return; } - BaseItem parent = null; + BaseItem? parent = null; var isFirst = true; var imageTags = dto.ImageTags; @@ -1378,7 +1384,7 @@ namespace Emby.Server.Implementations.Dto } } - private string GetMappedPath(BaseItem item, BaseItem ownerItem) + private string GetMappedPath(BaseItem item, BaseItem? ownerItem) { var path = item.Path; diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs index 957ad9c01..47f9dfbc8 100644 --- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs +++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -138,13 +137,13 @@ namespace Emby.Server.Implementations.EntryPoints return new UserDataChangeInfo { - UserId = userId.ToString("N", CultureInfo.InvariantCulture), + UserId = userId, UserDataList = changedItems .DistinctBy(x => x.Id) .Select(i => { var dto = _userDataManager.GetUserDataDto(i, user); - dto.ItemId = i.Id.ToString("N", CultureInfo.InvariantCulture); + dto.ItemId = i.Id; return dto; }) .ToArray() diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs index bb22ca82f..90a01c052 100644 --- a/Emby.Server.Implementations/Library/MediaSourceManager.cs +++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs @@ -379,7 +379,8 @@ namespace Emby.Server.Implementations.Library private void SetDefaultSubtitleStreamIndex(MediaSourceInfo source, UserItemData userData, User user, bool allowRememberingSelection) { - if (userData.SubtitleStreamIndex.HasValue + if (userData is not null + && userData.SubtitleStreamIndex.HasValue && user.RememberSubtitleSelections && user.SubtitleMode != SubtitlePlaybackMode.None && allowRememberingSelection) @@ -411,7 +412,7 @@ namespace Emby.Server.Implementations.Library private void SetDefaultAudioStreamIndex(MediaSourceInfo source, UserItemData userData, User user, bool allowRememberingSelection) { - if (userData.AudioStreamIndex.HasValue && user.RememberAudioSelections && allowRememberingSelection) + if (userData is not null && userData.AudioStreamIndex.HasValue && user.RememberAudioSelections && allowRememberingSelection) { var index = userData.AudioStreamIndex.Value; // Make sure the saved index is still valid @@ -434,7 +435,7 @@ namespace Emby.Server.Implementations.Library if (mediaType == MediaType.Video) { - var userData = item is null ? new UserItemData() : _userDataManager.GetUserData(user, item); + var userData = item is null ? null : _userDataManager.GetUserData(user, item); var allowRememberingSelection = item is null || item.EnableRememberingTrackSelections; diff --git a/Emby.Server.Implementations/Localization/Core/fil.json b/Emby.Server.Implementations/Localization/Core/fil.json index 55ee1abaa..28c1d2be5 100644 --- a/Emby.Server.Implementations/Localization/Core/fil.json +++ b/Emby.Server.Implementations/Localization/Core/fil.json @@ -69,7 +69,7 @@ "HeaderLiveTV": "Live TV", "HeaderFavoriteSongs": "Mga Paboritong Kanta", "HeaderFavoriteShows": "Mga Paboritong Pelikula", - "HeaderFavoriteEpisodes": "Mga Paboritong Episode", + "HeaderFavoriteEpisodes": "Mga Paboritong Yugto", "HeaderFavoriteArtists": "Mga Paboritong Artista", "HeaderFavoriteAlbums": "Mga Paboritong Album", "HeaderContinueWatching": "Magpatuloy sa Panonood", diff --git a/Emby.Server.Implementations/Localization/Core/hr.json b/Emby.Server.Implementations/Localization/Core/hr.json index 6a5b8c561..a7dabaa19 100644 --- a/Emby.Server.Implementations/Localization/Core/hr.json +++ b/Emby.Server.Implementations/Localization/Core/hr.json @@ -11,7 +11,7 @@ "Collections": "Kolekcije", "DeviceOfflineWithName": "{0} je prekinuo vezu", "DeviceOnlineWithName": "{0} je povezan", - "FailedLoginAttemptWithUserName": "Neuspjeli pokušaj prijave od {0}", + "FailedLoginAttemptWithUserName": "Neuspješan pokušaj prijave od {0}", "Favorites": "Favoriti", "Folders": "Mape", "Genres": "Žanrovi", @@ -127,5 +127,8 @@ "HearingImpaired": "Oštećen sluh", "TaskRefreshTrickplayImages": "Generiraj Trickplay Slike", "TaskRefreshTrickplayImagesDescription": "Kreira trickplay pretpreglede za videe u omogućenim knjižnicama.", - "TaskAudioNormalization": "Normalizacija zvuka" + "TaskAudioNormalization": "Normalizacija zvuka", + "TaskAudioNormalizationDescription": "Skenira datoteke u potrazi za podacima o normalizaciji zvuka.", + "TaskCleanCollectionsAndPlaylistsDescription": "Uklanja stavke iz zbirki i popisa za reprodukciju koje više ne postoje.", + "TaskCleanCollectionsAndPlaylists": "Očisti zbirke i popise za reprodukciju" } diff --git a/Emby.Server.Implementations/Localization/Core/ko.json b/Emby.Server.Implementations/Localization/Core/ko.json index b91889594..a739cba35 100644 --- a/Emby.Server.Implementations/Localization/Core/ko.json +++ b/Emby.Server.Implementations/Localization/Core/ko.json @@ -125,5 +125,10 @@ "TaskKeyframeExtractor": "키프레임 추출", "External": "외부", "HearingImpaired": "청각 장애", - "TaskCleanCollectionsAndPlaylists": "컬렉션과 재생목록 정리" + "TaskCleanCollectionsAndPlaylists": "컬렉션과 재생목록 정리", + "TaskAudioNormalization": "오디오의 볼륨 수준을 일정하게 조정", + "TaskAudioNormalizationDescription": "오디오의 볼륨 수준을 일정하게 조정하기 위해 파일을 스캔합니다.", + "TaskRefreshTrickplayImages": "비디오 탐색용 미리보기 썸네일 생성", + "TaskRefreshTrickplayImagesDescription": "활성화된 라이브러리에서 비디오의 트릭플레이 미리보기를 생성합니다.", + "TaskCleanCollectionsAndPlaylistsDescription": "더 이상 존재하지 않는 컬렉션 및 재생 목록에서 항목을 제거합니다." } |
