diff options
| author | Stepan Goremykin <goremukin@gmail.com> | 2023-04-06 19:27:57 +0200 |
|---|---|---|
| committer | Stepan Goremykin <goremukin@gmail.com> | 2023-04-06 19:27:57 +0200 |
| commit | 19e65269a24714469bb6a2b3e15602b73327e5d3 (patch) | |
| tree | 1ad146c95d6042a3d83ba0a1ef681273141011cf | |
| parent | dabdc86a1bacfd55de3c38b04adbe9fe3643e27e (diff) | |
Simplify linq expressions (use All)
| -rw-r--r-- | Emby.Server.Implementations/Library/MediaSourceManager.cs | 4 | ||||
| -rw-r--r-- | Emby.Server.Implementations/Localization/LocalizationManager.cs | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs index eadfa5dfe..c9a26a30f 100644 --- a/Emby.Server.Implementations/Library/MediaSourceManager.cs +++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs @@ -154,8 +154,8 @@ namespace Emby.Server.Implementations.Library // If file is strm or main media stream is missing, force a metadata refresh with remote probing if (allowMediaProbe && mediaSources[0].Type != MediaSourceType.Placeholder && (item.Path.EndsWith(".strm", StringComparison.OrdinalIgnoreCase) - || (item.MediaType == MediaType.Video && !mediaSources[0].MediaStreams.Any(i => i.Type == MediaStreamType.Video)) - || (item.MediaType == MediaType.Audio && !mediaSources[0].MediaStreams.Any(i => i.Type == MediaStreamType.Audio)))) + || (item.MediaType == MediaType.Video && mediaSources[0].MediaStreams.All(i => i.Type != MediaStreamType.Video)) + || (item.MediaType == MediaType.Audio && mediaSources[0].MediaStreams.All(i => i.Type != MediaStreamType.Audio)))) { await item.RefreshMetadata( new MetadataRefreshOptions(_directoryService) diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.cs index 166b71b4a..96f435399 100644 --- a/Emby.Server.Implementations/Localization/LocalizationManager.cs +++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs @@ -198,25 +198,25 @@ namespace Emby.Server.Implementations.Localization } // Minimum rating possible - if (!ratings.Any(x => x.Value == 0)) + if (ratings.All(x => x.Value != 0)) { ratings.Add(new ParentalRating("Approved", 0)); } // Matches PG (this has different age restrictions depending on country) - if (!ratings.Any(x => x.Value == 10)) + if (ratings.All(x => x.Value != 10)) { ratings.Add(new ParentalRating("10", 10)); } // Matches PG-13 - if (!ratings.Any(x => x.Value == 13)) + if (ratings.All(x => x.Value != 13)) { ratings.Add(new ParentalRating("13", 13)); } // Matches TV-14 - if (!ratings.Any(x => x.Value == 14)) + if (ratings.All(x => x.Value != 14)) { ratings.Add(new ParentalRating("14", 14)); } @@ -229,13 +229,13 @@ namespace Emby.Server.Implementations.Localization } // A lot of countries don't excplicitly have a seperate rating for adult content - if (!ratings.Any(x => x.Value == 1000)) + if (ratings.All(x => x.Value != 1000)) { ratings.Add(new ParentalRating("XXX", 1000)); } // A lot of countries don't excplicitly have a seperate rating for banned content - if (!ratings.Any(x => x.Value == 1001)) + if (ratings.All(x => x.Value != 1001)) { ratings.Add(new ParentalRating("Banned", 1001)); } |
