Merge branch 'master' into network-rewrite
This commit is contained in:
commit
2c86bd1875
|
@ -7,7 +7,7 @@ parameters:
|
|||
default: "ubuntu-latest"
|
||||
- name: DotNetSdkVersion
|
||||
type: string
|
||||
default: 6.0.x
|
||||
default: 7.0.x
|
||||
|
||||
jobs:
|
||||
- job: CompatibilityCheck
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
parameters:
|
||||
LinuxImage: 'ubuntu-latest'
|
||||
RestoreBuildProjects: 'Jellyfin.Server/Jellyfin.Server.csproj'
|
||||
DotNetSdkVersion: 6.0.x
|
||||
DotNetSdkVersion: 7.0.x
|
||||
|
||||
jobs:
|
||||
- job: Build
|
||||
|
@ -20,35 +20,6 @@ jobs:
|
|||
submodules: true
|
||||
persistCredentials: true
|
||||
|
||||
- task: DownloadPipelineArtifact@2
|
||||
displayName: 'Download Web Branch'
|
||||
condition: in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI', 'BuildCompletion')
|
||||
inputs:
|
||||
path: '$(Agent.TempDirectory)'
|
||||
artifact: 'jellyfin-web-production'
|
||||
source: 'specific'
|
||||
project: 'jellyfin'
|
||||
pipeline: 'Jellyfin Web'
|
||||
runBranch: variables['Build.SourceBranch']
|
||||
|
||||
- task: DownloadPipelineArtifact@2
|
||||
displayName: 'Download Web Target'
|
||||
condition: eq(variables['Build.Reason'], 'PullRequest')
|
||||
inputs:
|
||||
path: '$(Agent.TempDirectory)'
|
||||
artifact: 'jellyfin-web-production'
|
||||
source: 'specific'
|
||||
project: 'jellyfin'
|
||||
pipeline: 'Jellyfin Web'
|
||||
runBranch: variables['System.PullRequest.TargetBranch']
|
||||
|
||||
- task: ExtractFiles@1
|
||||
displayName: 'Extract Web Client'
|
||||
inputs:
|
||||
archiveFilePatterns: '$(Agent.TempDirectory)/*.zip'
|
||||
destinationFolder: '$(Build.SourcesDirectory)/MediaBrowser.WebDashboard'
|
||||
cleanDestinationFolder: false
|
||||
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Update DotNet'
|
||||
inputs:
|
||||
|
|
|
@ -205,10 +205,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
- task: UseDotNet@2
|
||||
displayName: 'Use .NET 6.0 sdk'
|
||||
displayName: 'Use .NET 7.0 sdk'
|
||||
inputs:
|
||||
packageType: 'sdk'
|
||||
version: '6.0.x'
|
||||
version: '7.0.x'
|
||||
|
||||
- task: DotNetCoreCLI@2
|
||||
displayName: 'Build Stable Nuget packages'
|
||||
|
|
|
@ -10,7 +10,7 @@ parameters:
|
|||
default: "tests/**/*Tests.csproj"
|
||||
- name: DotNetSdkVersion
|
||||
type: string
|
||||
default: 6.0.x
|
||||
default: 7.0.x
|
||||
|
||||
jobs:
|
||||
- job: Test
|
||||
|
@ -94,5 +94,5 @@ jobs:
|
|||
displayName: 'Publish OpenAPI Artifact'
|
||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
|
||||
inputs:
|
||||
targetPath: "tests/Jellyfin.Server.Integration.Tests/bin/Release/net6.0/openapi.json"
|
||||
targetPath: "tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json"
|
||||
artifactName: 'OpenAPI Spec'
|
||||
|
|
1
.github/workflows/automation.yml
vendored
1
.github/workflows/automation.yml
vendored
|
@ -7,6 +7,7 @@ on:
|
|||
pull_request_target:
|
||||
issue_comment:
|
||||
|
||||
permissions: {}
|
||||
jobs:
|
||||
label:
|
||||
name: Labeling
|
||||
|
|
10
.github/workflows/codeql-analysis.yml
vendored
10
.github/workflows/codeql-analysis.yml
vendored
|
@ -21,17 +21,17 @@ jobs:
|
|||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
|
||||
- name: Setup .NET Core
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # tag=v3
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
dotnet-version: '7.0.x'
|
||||
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@312e093a1892bd801f026f1090904ee8e460b9b6 # v2
|
||||
uses: github/codeql-action/init@b2a92eb56d8cb930006a1c6ed86b0782dd8a4297 # v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
queries: +security-extended
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@312e093a1892bd801f026f1090904ee8e460b9b6 # v2
|
||||
uses: github/codeql-action/autobuild@b2a92eb56d8cb930006a1c6ed86b0782dd8a4297 # v2
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@312e093a1892bd801f026f1090904ee8e460b9b6 # v2
|
||||
uses: github/codeql-action/analyze@b2a92eb56d8cb930006a1c6ed86b0782dd8a4297 # v2
|
||||
|
|
4
.github/workflows/commands.yml
vendored
4
.github/workflows/commands.yml
vendored
|
@ -9,6 +9,7 @@ on:
|
|||
- labeled
|
||||
- synchronize
|
||||
|
||||
permissions: {}
|
||||
jobs:
|
||||
rebase:
|
||||
name: Rebase
|
||||
|
@ -34,6 +35,9 @@ jobs:
|
|||
GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }}
|
||||
|
||||
check-backport:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
name: Check Backport
|
||||
if: ${{ ( github.event.issue.pull_request && contains(github.event.comment.body, '@jellyfin-bot check backport') ) || github.event.label.name == 'stable backport' || contains(github.event.pull_request.labels.*.name, 'stable backport' ) }}
|
||||
runs-on: ubuntu-latest
|
||||
|
|
17
.github/workflows/openapi.yml
vendored
17
.github/workflows/openapi.yml
vendored
|
@ -5,6 +5,8 @@ on:
|
|||
- master
|
||||
pull_request_target:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
openapi-head:
|
||||
name: OpenAPI - HEAD
|
||||
|
@ -16,10 +18,10 @@ jobs:
|
|||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
- name: Setup .NET Core
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # tag=v3
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
dotnet-version: '7.0.x'
|
||||
- name: Generate openapi.json
|
||||
run: dotnet test tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj -c Release --filter "Jellyfin.Server.Integration.Tests.OpenApiSpecTests"
|
||||
- name: Upload openapi.json
|
||||
|
@ -28,7 +30,7 @@ jobs:
|
|||
name: openapi-head
|
||||
retention-days: 14
|
||||
if-no-files-found: error
|
||||
path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net6.0/openapi.json
|
||||
path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json
|
||||
|
||||
openapi-base:
|
||||
name: OpenAPI - BASE
|
||||
|
@ -40,10 +42,10 @@ jobs:
|
|||
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # tag=v3
|
||||
with:
|
||||
ref: ${{ github.base_ref }}
|
||||
- name: Setup .NET Core
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a # tag=v3
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
dotnet-version: '7.0.x'
|
||||
- name: Generate openapi.json
|
||||
run: dotnet test tests/Jellyfin.Server.Integration.Tests/Jellyfin.Server.Integration.Tests.csproj -c Release --filter "Jellyfin.Server.Integration.Tests.OpenApiSpecTests"
|
||||
- name: Upload openapi.json
|
||||
|
@ -52,9 +54,12 @@ jobs:
|
|||
name: openapi-base
|
||||
retention-days: 14
|
||||
if-no-files-found: error
|
||||
path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net6.0/openapi.json
|
||||
path: tests/Jellyfin.Server.Integration.Tests/bin/Release/net7.0/openapi.json
|
||||
|
||||
openapi-diff:
|
||||
permissions:
|
||||
pull-requests: write # to create or update comment (peter-evans/create-or-update-comment)
|
||||
|
||||
name: OpenAPI - Difference
|
||||
if: ${{ github.event_name == 'pull_request_target' }}
|
||||
runs-on: ubuntu-latest
|
||||
|
|
1
.github/workflows/repo-stale.yaml
vendored
1
.github/workflows/repo-stale.yaml
vendored
|
@ -5,6 +5,7 @@ on:
|
|||
- cron: '30 1 * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions: {}
|
||||
jobs:
|
||||
stale:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -273,7 +273,6 @@ BenchmarkDotNet.Artifacts
|
|||
# Ignore web artifacts from native builds
|
||||
web/
|
||||
web-src.*
|
||||
MediaBrowser.WebDashboard/jellyfin-web
|
||||
apiclient/generated
|
||||
|
||||
# Omnisharp crash logs
|
||||
|
|
10
.vscode/launch.json
vendored
10
.vscode/launch.json
vendored
|
@ -2,11 +2,11 @@
|
|||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": ".NET Core Launch (console)",
|
||||
"name": ".NET Launch (console)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/Jellyfin.Server/bin/Debug/net6.0/jellyfin.dll",
|
||||
"program": "${workspaceFolder}/Jellyfin.Server/bin/Debug/net7.0/jellyfin.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/Jellyfin.Server",
|
||||
"console": "internalConsole",
|
||||
|
@ -18,11 +18,11 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Launch (nowebclient)",
|
||||
"name": ".NET Launch (nowebclient)",
|
||||
"type": "coreclr",
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
"program": "${workspaceFolder}/Jellyfin.Server/bin/Debug/net6.0/jellyfin.dll",
|
||||
"program": "${workspaceFolder}/Jellyfin.Server/bin/Debug/net7.0/jellyfin.dll",
|
||||
"args": ["--nowebclient"],
|
||||
"cwd": "${workspaceFolder}/Jellyfin.Server",
|
||||
"console": "internalConsole",
|
||||
|
@ -30,7 +30,7 @@
|
|||
"internalConsoleOptions": "openOnSessionStart"
|
||||
},
|
||||
{
|
||||
"name": ".NET Core Attach",
|
||||
"name": ".NET Attach",
|
||||
"type": "coreclr",
|
||||
"request": "attach",
|
||||
"processId": "${command:pickProcess}"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<AnalysisMode>AllDisabledByDefault</AnalysisMode>
|
||||
|
|
|
@ -141,7 +141,7 @@ namespace Emby.Dlna.ContentDirectory
|
|||
{
|
||||
var user = _userManager.GetUserById(Guid.Parse(profile.UserId));
|
||||
|
||||
if (user != null)
|
||||
if (user is not null)
|
||||
{
|
||||
return user;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ namespace Emby.Dlna.ContentDirectory
|
|||
{
|
||||
var user = _userManager.GetUserById(Guid.Parse(userId));
|
||||
|
||||
if (user != null)
|
||||
if (user is not null)
|
||||
{
|
||||
return user;
|
||||
}
|
||||
|
|
|
@ -1048,7 +1048,7 @@ namespace Emby.Dlna.ContentDirectory
|
|||
ParentId = parent?.Id ?? Guid.Empty,
|
||||
GroupItems = true
|
||||
},
|
||||
query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i != null).ToArray();
|
||||
query.DtoOptions).Select(i => i.Item1 ?? i.Item2.FirstOrDefault()).Where(i => i is not null).ToArray();
|
||||
|
||||
return ToResult(query.StartIndex, items);
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace Emby.Dlna.Didl
|
|||
writer.WriteAttributeString("restricted", "1");
|
||||
writer.WriteAttributeString("id", clientId);
|
||||
|
||||
if (context != null)
|
||||
if (context is not null)
|
||||
{
|
||||
writer.WriteAttributeString("parentID", GetClientId(context, contextStubType));
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ namespace Emby.Dlna.Didl
|
|||
|
||||
private void AddVideoResource(XmlWriter writer, BaseItem video, string deviceId, Filter filter, StreamInfo streamInfo = null)
|
||||
{
|
||||
if (streamInfo == null)
|
||||
if (streamInfo is null)
|
||||
{
|
||||
var sources = _mediaSourceManager.GetStaticMediaSources(video, true, _user);
|
||||
|
||||
|
@ -263,7 +263,7 @@ namespace Emby.Dlna.Didl
|
|||
.FirstOrDefault(i => string.Equals(info.Format, i.Format, StringComparison.OrdinalIgnoreCase)
|
||||
&& i.Method == SubtitleDeliveryMethod.External);
|
||||
|
||||
if (subtitleProfile == null)
|
||||
if (subtitleProfile is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ namespace Emby.Dlna.Didl
|
|||
|
||||
var filename = url.Substring(0, url.IndexOf('?', StringComparison.Ordinal));
|
||||
|
||||
var mimeType = mediaProfile == null || string.IsNullOrEmpty(mediaProfile.MimeType)
|
||||
var mimeType = mediaProfile is null || string.IsNullOrEmpty(mediaProfile.MimeType)
|
||||
? MimeTypes.GetMimeType(filename)
|
||||
: mediaProfile.MimeType;
|
||||
|
||||
|
@ -533,7 +533,7 @@ namespace Emby.Dlna.Didl
|
|||
{
|
||||
writer.WriteStartElement(string.Empty, "res", NsDidl);
|
||||
|
||||
if (streamInfo == null)
|
||||
if (streamInfo is null)
|
||||
{
|
||||
var sources = _mediaSourceManager.GetStaticMediaSources(audio, true, _user);
|
||||
|
||||
|
@ -598,7 +598,7 @@ namespace Emby.Dlna.Didl
|
|||
|
||||
var filename = url.Substring(0, url.IndexOf('?', StringComparison.Ordinal));
|
||||
|
||||
var mimeType = mediaProfile == null || string.IsNullOrEmpty(mediaProfile.MimeType)
|
||||
var mimeType = mediaProfile is null || string.IsNullOrEmpty(mediaProfile.MimeType)
|
||||
? MimeTypes.GetMimeType(filename)
|
||||
: mediaProfile.MimeType;
|
||||
|
||||
|
@ -652,7 +652,7 @@ namespace Emby.Dlna.Didl
|
|||
{
|
||||
writer.WriteAttributeString("id", clientId);
|
||||
|
||||
if (context != null)
|
||||
if (context is not null)
|
||||
{
|
||||
writer.WriteAttributeString("parentID", GetClientId(context, null));
|
||||
}
|
||||
|
@ -695,13 +695,13 @@ namespace Emby.Dlna.Didl
|
|||
}
|
||||
|
||||
// Not a samsung device
|
||||
if (secAttribute == null)
|
||||
if (secAttribute is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var userdata = _userDataManager.GetUserData(user, item);
|
||||
var playbackPositionTicks = (streamInfo != null && streamInfo.StartPositionTicks > 0) ? streamInfo.StartPositionTicks : userdata.PlaybackPositionTicks;
|
||||
var playbackPositionTicks = (streamInfo is not null && streamInfo.StartPositionTicks > 0) ? streamInfo.StartPositionTicks : userdata.PlaybackPositionTicks;
|
||||
|
||||
if (playbackPositionTicks > 0)
|
||||
{
|
||||
|
@ -909,14 +909,14 @@ namespace Emby.Dlna.Didl
|
|||
AddValue(writer, "dc", "creator", artist, NsDc);
|
||||
|
||||
// If it doesn't support album artists (musicvideo), then tag as both
|
||||
if (hasAlbumArtists == null)
|
||||
if (hasAlbumArtists is null)
|
||||
{
|
||||
AddAlbumArtist(writer, artist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasAlbumArtists != null)
|
||||
if (hasAlbumArtists is not null)
|
||||
{
|
||||
foreach (var albumArtist in hasAlbumArtists.AlbumArtists)
|
||||
{
|
||||
|
@ -973,7 +973,7 @@ namespace Emby.Dlna.Didl
|
|||
{
|
||||
ImageDownloadInfo imageInfo = GetImageInfo(item);
|
||||
|
||||
if (imageInfo == null)
|
||||
if (imageInfo is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1036,7 +1036,7 @@ namespace Emby.Dlna.Didl
|
|||
{
|
||||
var imageInfo = GetImageInfo(item);
|
||||
|
||||
if (imageInfo == null)
|
||||
if (imageInfo is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1093,7 +1093,7 @@ namespace Emby.Dlna.Didl
|
|||
if (item is Audio audioItem)
|
||||
{
|
||||
var album = audioItem.AlbumEntity;
|
||||
return album != null && album.HasImage(ImageType.Primary)
|
||||
return album is not null && album.HasImage(ImageType.Primary)
|
||||
? GetImageInfo(album, ImageType.Primary)
|
||||
: null;
|
||||
}
|
||||
|
@ -1106,7 +1106,7 @@ namespace Emby.Dlna.Didl
|
|||
|
||||
// For other item types check parents, but be aware that image retrieved from a parent may be not suitable for this media item.
|
||||
var parentWithImage = GetFirstParentWithImageBelowUserRoot(item);
|
||||
if (parentWithImage != null)
|
||||
if (parentWithImage is not null)
|
||||
{
|
||||
return GetImageInfo(parentWithImage, ImageType.Primary);
|
||||
}
|
||||
|
@ -1116,7 +1116,7 @@ namespace Emby.Dlna.Didl
|
|||
|
||||
private BaseItem GetFirstParentWithImageBelowUserRoot(BaseItem item)
|
||||
{
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -105,9 +105,9 @@ namespace Emby.Dlna
|
|||
ArgumentNullException.ThrowIfNull(deviceInfo);
|
||||
|
||||
var profile = GetProfiles()
|
||||
.FirstOrDefault(i => i.Identification != null && IsMatch(deviceInfo, i.Identification));
|
||||
.FirstOrDefault(i => i.Identification is not null && IsMatch(deviceInfo, i.Identification));
|
||||
|
||||
if (profile == null)
|
||||
if (profile is null)
|
||||
{
|
||||
_logger.LogInformation("No matching device profile found. The default will need to be used. \n{@Profile}", deviceInfo);
|
||||
}
|
||||
|
@ -171,8 +171,8 @@ namespace Emby.Dlna
|
|||
{
|
||||
ArgumentNullException.ThrowIfNull(headers);
|
||||
|
||||
var profile = GetProfiles().FirstOrDefault(i => i.Identification != null && IsMatch(headers, i.Identification));
|
||||
if (profile == null)
|
||||
var profile = GetProfiles().FirstOrDefault(i => i.Identification is not null && IsMatch(headers, i.Identification));
|
||||
if (profile is null)
|
||||
{
|
||||
_logger.LogDebug("No matching device profile found. {@Headers}", headers);
|
||||
}
|
||||
|
@ -199,6 +199,11 @@ namespace Emby.Dlna
|
|||
|
||||
if (headers.TryGetValue(header.Name, out StringValues value))
|
||||
{
|
||||
if (StringValues.IsNullOrEmpty(value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (header.Match)
|
||||
{
|
||||
case HeaderMatchType.Equals:
|
||||
|
@ -208,7 +213,8 @@ namespace Emby.Dlna
|
|||
// _logger.LogDebug("IsMatch-Substring value: {0} testValue: {1} isMatch: {2}", value, header.Value, isMatch);
|
||||
return isMatch;
|
||||
case HeaderMatchType.Regex:
|
||||
return Regex.IsMatch(value, header.Value, RegexOptions.IgnoreCase);
|
||||
// Can't be null, we checked above the switch statement
|
||||
return Regex.IsMatch(value!, header.Value, RegexOptions.IgnoreCase);
|
||||
default:
|
||||
throw new ArgumentException("Unrecognized HeaderMatchType");
|
||||
}
|
||||
|
@ -224,7 +230,7 @@ namespace Emby.Dlna
|
|||
return _fileSystem.GetFilePaths(path)
|
||||
.Where(i => string.Equals(Path.GetExtension(i), ".xml", StringComparison.OrdinalIgnoreCase))
|
||||
.Select(i => ParseProfileFile(i, type))
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.ToList()!; // We just filtered out all the nulls
|
||||
}
|
||||
catch (IOException)
|
||||
|
@ -265,14 +271,11 @@ namespace Emby.Dlna
|
|||
/// <inheritdoc />
|
||||
public DeviceProfile? GetProfile(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(id);
|
||||
|
||||
var info = GetProfileInfosInternal().FirstOrDefault(i => string.Equals(i.Info.Id, id, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (info == null)
|
||||
if (info is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -371,10 +374,7 @@ namespace Emby.Dlna
|
|||
{
|
||||
profile = ReserializeProfile(profile);
|
||||
|
||||
if (string.IsNullOrEmpty(profile.Name))
|
||||
{
|
||||
throw new ArgumentException("Profile is missing Name");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(profile.Name);
|
||||
|
||||
var newFilename = _fileSystem.GetValidFilename(profile.Name) + ".xml";
|
||||
var path = Path.Combine(UserProfilesPath, newFilename);
|
||||
|
@ -387,15 +387,9 @@ namespace Emby.Dlna
|
|||
{
|
||||
profile = ReserializeProfile(profile);
|
||||
|
||||
if (string.IsNullOrEmpty(profile.Id))
|
||||
{
|
||||
throw new ArgumentException("Profile is missing Id");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(profile.Id);
|
||||
|
||||
if (string.IsNullOrEmpty(profile.Name))
|
||||
{
|
||||
throw new ArgumentException("Profile is missing Name");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(profile.Name);
|
||||
|
||||
var current = GetProfileInfosInternal().First(i => string.Equals(i.Info.Id, profileId, StringComparison.OrdinalIgnoreCase));
|
||||
if (current.Info.Type == DeviceProfileType.System)
|
||||
|
@ -470,7 +464,7 @@ namespace Emby.Dlna
|
|||
|
||||
var resource = GetType().Namespace + ".Images." + filename.ToLowerInvariant();
|
||||
var stream = _assembly.GetManifestResourceStream(resource);
|
||||
if (stream == null)
|
||||
if (stream is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<CodeAnalysisTreatWarningsAsErrors>false</CodeAnalysisTreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Code Analyzers-->
|
||||
|
@ -80,7 +80,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -35,7 +35,7 @@ namespace Emby.Dlna.Eventing
|
|||
public EventSubscriptionResponse RenewEventSubscription(string subscriptionId, string notificationType, string requestedTimeoutString, string callbackUrl)
|
||||
{
|
||||
var subscription = GetSubscription(subscriptionId, false);
|
||||
if (subscription != null)
|
||||
if (subscription is not null)
|
||||
{
|
||||
subscription.TimeoutSeconds = ParseTimeout(requestedTimeoutString) ?? 300;
|
||||
int timeoutSeconds = subscription.TimeoutSeconds;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#nullable disable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
namespace Emby.Dlna
|
||||
|
|
|
@ -198,7 +198,7 @@ namespace Emby.Dlna.Main
|
|||
{
|
||||
try
|
||||
{
|
||||
if (_communicationsServer == null)
|
||||
if (_communicationsServer is null)
|
||||
{
|
||||
var enableMultiSocketBinding = OperatingSystem.IsWindows() ||
|
||||
OperatingSystem.IsLinux();
|
||||
|
@ -221,7 +221,7 @@ namespace Emby.Dlna.Main
|
|||
{
|
||||
try
|
||||
{
|
||||
if (communicationsServer != null)
|
||||
if (communicationsServer is not null)
|
||||
{
|
||||
((DeviceDiscovery)_deviceDiscovery).Start(communicationsServer);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ namespace Emby.Dlna.Main
|
|||
return;
|
||||
}
|
||||
|
||||
if (_publisher != null)
|
||||
if (_publisher is not null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ namespace Emby.Dlna.Main
|
|||
{
|
||||
lock (_syncLock)
|
||||
{
|
||||
if (_manager != null)
|
||||
if (_manager is not null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ namespace Emby.Dlna.Main
|
|||
{
|
||||
lock (_syncLock)
|
||||
{
|
||||
if (_manager != null)
|
||||
if (_manager is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -432,7 +432,7 @@ namespace Emby.Dlna.Main
|
|||
|
||||
public void DisposeDevicePublisher()
|
||||
{
|
||||
if (_publisher != null)
|
||||
if (_publisher is not null)
|
||||
{
|
||||
_logger.LogInformation("Disposing SsdpDevicePublisher");
|
||||
_publisher.Dispose();
|
||||
|
@ -452,7 +452,7 @@ namespace Emby.Dlna.Main
|
|||
DisposePlayToManager();
|
||||
DisposeDeviceDiscovery();
|
||||
|
||||
if (_communicationsServer != null)
|
||||
if (_communicationsServer is not null)
|
||||
{
|
||||
_logger.LogInformation("Disposing SsdpCommunicationsServer");
|
||||
_communicationsServer.Dispose();
|
||||
|
|
|
@ -220,14 +220,14 @@ namespace Emby.Dlna.PlayTo
|
|||
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "SetMute");
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var service = GetServiceRenderingControl();
|
||||
|
||||
if (service == null)
|
||||
if (service is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -260,14 +260,14 @@ namespace Emby.Dlna.PlayTo
|
|||
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "SetVolume");
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var service = GetServiceRenderingControl();
|
||||
|
||||
if (service == null)
|
||||
if (service is null)
|
||||
{
|
||||
throw new InvalidOperationException("Unable to find service");
|
||||
}
|
||||
|
@ -291,14 +291,14 @@ namespace Emby.Dlna.PlayTo
|
|||
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "Seek");
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var service = GetAvTransportService();
|
||||
|
||||
if (service == null)
|
||||
if (service is null)
|
||||
{
|
||||
throw new InvalidOperationException("Unable to find service");
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ namespace Emby.Dlna.PlayTo
|
|||
_logger.LogDebug("{0} - SetAvTransport Uri: {1} DlnaHeaders: {2}", Properties.Name, url, header);
|
||||
|
||||
var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "SetAVTransportURI");
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -337,7 +337,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var service = GetAvTransportService();
|
||||
|
||||
if (service == null)
|
||||
if (service is null)
|
||||
{
|
||||
throw new InvalidOperationException("Unable to find service");
|
||||
}
|
||||
|
@ -381,7 +381,7 @@ namespace Emby.Dlna.PlayTo
|
|||
_logger.LogDebug("{PropertyName} - SetNextAvTransport Uri: {Url} DlnaHeaders: {Header}", Properties.Name, url, header);
|
||||
|
||||
var command = avCommands.ServiceActions.FirstOrDefault(c => string.Equals(c.Name, "SetNextAVTransportURI", StringComparison.OrdinalIgnoreCase));
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var service = GetAvTransportService();
|
||||
|
||||
if (service == null)
|
||||
if (service is null)
|
||||
{
|
||||
throw new InvalidOperationException("Unable to find service");
|
||||
}
|
||||
|
@ -418,13 +418,13 @@ namespace Emby.Dlna.PlayTo
|
|||
private Task SetPlay(TransportCommands avCommands, CancellationToken cancellationToken)
|
||||
{
|
||||
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "Play");
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
var service = GetAvTransportService();
|
||||
if (service == null)
|
||||
if (service is null)
|
||||
{
|
||||
throw new InvalidOperationException("Unable to find service");
|
||||
}
|
||||
|
@ -440,7 +440,7 @@ namespace Emby.Dlna.PlayTo
|
|||
public async Task SetPlay(CancellationToken cancellationToken)
|
||||
{
|
||||
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||
if (avCommands == null)
|
||||
if (avCommands is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ namespace Emby.Dlna.PlayTo
|
|||
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "Stop");
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ namespace Emby.Dlna.PlayTo
|
|||
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var command = avCommands?.ServiceActions.FirstOrDefault(c => c.Name == "Pause");
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var avCommands = await GetAVProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (avCommands == null)
|
||||
if (avCommands is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -538,12 +538,12 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var currentObject = tuple.Track;
|
||||
|
||||
if (tuple.Success && currentObject == null)
|
||||
if (tuple.Success && currentObject is null)
|
||||
{
|
||||
currentObject = await GetMediaInfo(avCommands, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
if (currentObject != null)
|
||||
if (currentObject is not null)
|
||||
{
|
||||
UpdateMediaInfo(currentObject, transportState.Value);
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ namespace Emby.Dlna.PlayTo
|
|||
if (_connectFailureCount >= 3)
|
||||
{
|
||||
var action = OnDeviceUnavailable;
|
||||
if (action != null)
|
||||
if (action is not null)
|
||||
{
|
||||
_logger.LogDebug("Disposing device due to loss of connection");
|
||||
action();
|
||||
|
@ -607,14 +607,14 @@ namespace Emby.Dlna.PlayTo
|
|||
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "GetVolume");
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var service = GetServiceRenderingControl();
|
||||
|
||||
if (service == null)
|
||||
if (service is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -626,12 +626,12 @@ namespace Emby.Dlna.PlayTo
|
|||
rendererCommands.BuildPost(command, service.ServiceType),
|
||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result == null || result.Document == null)
|
||||
if (result is null || result.Document is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var volume = result.Document.Descendants(UPnpNamespaces.RenderingControl + "GetVolumeResponse").Select(i => i.Element("CurrentVolume")).FirstOrDefault(i => i != null);
|
||||
var volume = result.Document.Descendants(UPnpNamespaces.RenderingControl + "GetVolumeResponse").Select(i => i.Element("CurrentVolume")).FirstOrDefault(i => i is not null);
|
||||
var volumeValue = volume?.Value;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(volumeValue))
|
||||
|
@ -657,14 +657,14 @@ namespace Emby.Dlna.PlayTo
|
|||
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var command = rendererCommands?.ServiceActions.FirstOrDefault(c => c.Name == "GetMute");
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var service = GetServiceRenderingControl();
|
||||
|
||||
if (service == null)
|
||||
if (service is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -676,14 +676,14 @@ namespace Emby.Dlna.PlayTo
|
|||
rendererCommands.BuildPost(command, service.ServiceType),
|
||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result == null || result.Document == null)
|
||||
if (result is null || result.Document is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var valueNode = result.Document.Descendants(UPnpNamespaces.RenderingControl + "GetMuteResponse")
|
||||
.Select(i => i.Element("CurrentMute"))
|
||||
.FirstOrDefault(i => i != null);
|
||||
.FirstOrDefault(i => i is not null);
|
||||
|
||||
IsMuted = string.Equals(valueNode?.Value, "1", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
@ -691,13 +691,13 @@ namespace Emby.Dlna.PlayTo
|
|||
private async Task<TransportState?> GetTransportInfo(TransportCommands avCommands, CancellationToken cancellationToken)
|
||||
{
|
||||
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetTransportInfo");
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var service = GetAvTransportService();
|
||||
if (service == null)
|
||||
if (service is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -709,17 +709,17 @@ namespace Emby.Dlna.PlayTo
|
|||
avCommands.BuildPost(command, service.ServiceType),
|
||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result == null || result.Document == null)
|
||||
if (result is null || result.Document is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var transportState =
|
||||
result.Document.Descendants(UPnpNamespaces.AvTransport + "GetTransportInfoResponse").Select(i => i.Element("CurrentTransportState")).FirstOrDefault(i => i != null);
|
||||
result.Document.Descendants(UPnpNamespaces.AvTransport + "GetTransportInfoResponse").Select(i => i.Element("CurrentTransportState")).FirstOrDefault(i => i is not null);
|
||||
|
||||
var transportStateValue = transportState?.Value;
|
||||
|
||||
if (transportStateValue != null
|
||||
if (transportStateValue is not null
|
||||
&& Enum.TryParse(transportStateValue, true, out TransportState state))
|
||||
{
|
||||
return state;
|
||||
|
@ -731,19 +731,19 @@ namespace Emby.Dlna.PlayTo
|
|||
private async Task<UBaseObject> GetMediaInfo(TransportCommands avCommands, CancellationToken cancellationToken)
|
||||
{
|
||||
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetMediaInfo");
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var service = GetAvTransportService();
|
||||
if (service == null)
|
||||
if (service is null)
|
||||
{
|
||||
throw new InvalidOperationException("Unable to find service");
|
||||
}
|
||||
|
||||
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||
if (rendererCommands == null)
|
||||
if (rendererCommands is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -755,14 +755,14 @@ namespace Emby.Dlna.PlayTo
|
|||
rendererCommands.BuildPost(command, service.ServiceType),
|
||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result == null || result.Document == null)
|
||||
if (result is null || result.Document is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var track = result.Document.Descendants("CurrentURIMetaData").FirstOrDefault();
|
||||
|
||||
if (track == null)
|
||||
if (track is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -778,7 +778,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
track = result.Document.Descendants("CurrentURI").FirstOrDefault();
|
||||
|
||||
if (track == null)
|
||||
if (track is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -801,21 +801,21 @@ namespace Emby.Dlna.PlayTo
|
|||
private async Task<(bool Success, UBaseObject Track)> GetPositionInfo(TransportCommands avCommands, CancellationToken cancellationToken)
|
||||
{
|
||||
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "GetPositionInfo");
|
||||
if (command == null)
|
||||
if (command is null)
|
||||
{
|
||||
return (false, null);
|
||||
}
|
||||
|
||||
var service = GetAvTransportService();
|
||||
|
||||
if (service == null)
|
||||
if (service is null)
|
||||
{
|
||||
throw new InvalidOperationException("Unable to find service");
|
||||
}
|
||||
|
||||
var rendererCommands = await GetRenderingProtocolAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (rendererCommands == null)
|
||||
if (rendererCommands is null)
|
||||
{
|
||||
return (false, null);
|
||||
}
|
||||
|
@ -827,15 +827,15 @@ namespace Emby.Dlna.PlayTo
|
|||
rendererCommands.BuildPost(command, service.ServiceType),
|
||||
cancellationToken: cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result == null || result.Document == null)
|
||||
if (result is null || result.Document is null)
|
||||
{
|
||||
return (false, null);
|
||||
}
|
||||
|
||||
var trackUriElem = result.Document.Descendants(UPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("TrackURI")).FirstOrDefault(i => i != null);
|
||||
var trackUriElem = result.Document.Descendants(UPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("TrackURI")).FirstOrDefault(i => i is not null);
|
||||
var trackUri = trackUriElem?.Value;
|
||||
|
||||
var durationElem = result.Document.Descendants(UPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("TrackDuration")).FirstOrDefault(i => i != null);
|
||||
var durationElem = result.Document.Descendants(UPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("TrackDuration")).FirstOrDefault(i => i is not null);
|
||||
var duration = durationElem?.Value;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(duration)
|
||||
|
@ -848,7 +848,7 @@ namespace Emby.Dlna.PlayTo
|
|||
Duration = null;
|
||||
}
|
||||
|
||||
var positionElem = result.Document.Descendants(UPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("RelTime")).FirstOrDefault(i => i != null);
|
||||
var positionElem = result.Document.Descendants(UPnpNamespaces.AvTransport + "GetPositionInfoResponse").Select(i => i.Element("RelTime")).FirstOrDefault(i => i is not null);
|
||||
var position = positionElem?.Value;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(position) && !string.Equals(position, "NOT_IMPLEMENTED", StringComparison.OrdinalIgnoreCase))
|
||||
|
@ -858,7 +858,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var track = result.Document.Descendants("TrackMetaData").FirstOrDefault();
|
||||
|
||||
if (track == null)
|
||||
if (track is null)
|
||||
{
|
||||
// If track is null, some vendors do this, use GetMediaInfo instead.
|
||||
return (true, null);
|
||||
|
@ -882,7 +882,7 @@ namespace Emby.Dlna.PlayTo
|
|||
_logger.LogError(ex, "Uncaught exception while parsing xml");
|
||||
}
|
||||
|
||||
if (uPnpResponse == null)
|
||||
if (uPnpResponse is null)
|
||||
{
|
||||
_logger.LogError("Failed to parse xml: \n {Xml}", trackString);
|
||||
return (true, null);
|
||||
|
@ -959,11 +959,11 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var resElement = container.Element(UPnpNamespaces.Res);
|
||||
|
||||
if (resElement != null)
|
||||
if (resElement is not null)
|
||||
{
|
||||
var info = resElement.Attribute(UPnpNamespaces.ProtocolInfo);
|
||||
|
||||
if (info != null && !string.IsNullOrWhiteSpace(info.Value))
|
||||
if (info is not null && !string.IsNullOrWhiteSpace(info.Value))
|
||||
{
|
||||
return info.Value.Split(':');
|
||||
}
|
||||
|
@ -974,7 +974,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
private async Task<TransportCommands> GetAVProtocolAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
if (AvCommands != null)
|
||||
if (AvCommands is not null)
|
||||
{
|
||||
return AvCommands;
|
||||
}
|
||||
|
@ -985,7 +985,7 @@ namespace Emby.Dlna.PlayTo
|
|||
}
|
||||
|
||||
var avService = GetAvTransportService();
|
||||
if (avService == null)
|
||||
if (avService is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -995,7 +995,7 @@ namespace Emby.Dlna.PlayTo
|
|||
var httpClient = new DlnaHttpClient(_logger, _httpClientFactory);
|
||||
|
||||
var document = await httpClient.GetDataAsync(url, cancellationToken).ConfigureAwait(false);
|
||||
if (document == null)
|
||||
if (document is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -1006,7 +1006,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
private async Task<TransportCommands> GetRenderingProtocolAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
if (RendererCommands != null)
|
||||
if (RendererCommands is not null)
|
||||
{
|
||||
return RendererCommands;
|
||||
}
|
||||
|
@ -1017,17 +1017,14 @@ namespace Emby.Dlna.PlayTo
|
|||
}
|
||||
|
||||
var avService = GetServiceRenderingControl();
|
||||
if (avService == null)
|
||||
{
|
||||
throw new ArgumentException("Device AvService is null");
|
||||
}
|
||||
ArgumentNullException.ThrowIfNull(avService);
|
||||
|
||||
string url = NormalizeUrl(Properties.BaseUrl, avService.ScpdUrl);
|
||||
|
||||
var httpClient = new DlnaHttpClient(_logger, _httpClientFactory);
|
||||
_logger.LogDebug("Dlna Device.GetRenderingProtocolAsync");
|
||||
var document = await httpClient.GetDataAsync(url, cancellationToken).ConfigureAwait(false);
|
||||
if (document == null)
|
||||
if (document is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -1062,7 +1059,7 @@ namespace Emby.Dlna.PlayTo
|
|||
var ssdpHttpClient = new DlnaHttpClient(logger, httpClientFactory);
|
||||
|
||||
var document = await ssdpHttpClient.GetDataAsync(url.ToString(), cancellationToken).ConfigureAwait(false);
|
||||
if (document == null)
|
||||
if (document is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -1070,13 +1067,13 @@ namespace Emby.Dlna.PlayTo
|
|||
var friendlyNames = new List<string>();
|
||||
|
||||
var name = document.Descendants(UPnpNamespaces.Ud.GetName("friendlyName")).FirstOrDefault();
|
||||
if (name != null && !string.IsNullOrWhiteSpace(name.Value))
|
||||
if (name is not null && !string.IsNullOrWhiteSpace(name.Value))
|
||||
{
|
||||
friendlyNames.Add(name.Value);
|
||||
}
|
||||
|
||||
var room = document.Descendants(UPnpNamespaces.Ud.GetName("roomName")).FirstOrDefault();
|
||||
if (room != null && !string.IsNullOrWhiteSpace(room.Value))
|
||||
if (room is not null && !string.IsNullOrWhiteSpace(room.Value))
|
||||
{
|
||||
friendlyNames.Add(room.Value);
|
||||
}
|
||||
|
@ -1088,74 +1085,74 @@ namespace Emby.Dlna.PlayTo
|
|||
};
|
||||
|
||||
var model = document.Descendants(UPnpNamespaces.Ud.GetName("modelName")).FirstOrDefault();
|
||||
if (model != null)
|
||||
if (model is not null)
|
||||
{
|
||||
deviceProperties.ModelName = model.Value;
|
||||
}
|
||||
|
||||
var modelNumber = document.Descendants(UPnpNamespaces.Ud.GetName("modelNumber")).FirstOrDefault();
|
||||
if (modelNumber != null)
|
||||
if (modelNumber is not null)
|
||||
{
|
||||
deviceProperties.ModelNumber = modelNumber.Value;
|
||||
}
|
||||
|
||||
var uuid = document.Descendants(UPnpNamespaces.Ud.GetName("UDN")).FirstOrDefault();
|
||||
if (uuid != null)
|
||||
if (uuid is not null)
|
||||
{
|
||||
deviceProperties.UUID = uuid.Value;
|
||||
}
|
||||
|
||||
var manufacturer = document.Descendants(UPnpNamespaces.Ud.GetName("manufacturer")).FirstOrDefault();
|
||||
if (manufacturer != null)
|
||||
if (manufacturer is not null)
|
||||
{
|
||||
deviceProperties.Manufacturer = manufacturer.Value;
|
||||
}
|
||||
|
||||
var manufacturerUrl = document.Descendants(UPnpNamespaces.Ud.GetName("manufacturerURL")).FirstOrDefault();
|
||||
if (manufacturerUrl != null)
|
||||
if (manufacturerUrl is not null)
|
||||
{
|
||||
deviceProperties.ManufacturerUrl = manufacturerUrl.Value;
|
||||
}
|
||||
|
||||
var presentationUrl = document.Descendants(UPnpNamespaces.Ud.GetName("presentationURL")).FirstOrDefault();
|
||||
if (presentationUrl != null)
|
||||
if (presentationUrl is not null)
|
||||
{
|
||||
deviceProperties.PresentationUrl = presentationUrl.Value;
|
||||
}
|
||||
|
||||
var modelUrl = document.Descendants(UPnpNamespaces.Ud.GetName("modelURL")).FirstOrDefault();
|
||||
if (modelUrl != null)
|
||||
if (modelUrl is not null)
|
||||
{
|
||||
deviceProperties.ModelUrl = modelUrl.Value;
|
||||
}
|
||||
|
||||
var serialNumber = document.Descendants(UPnpNamespaces.Ud.GetName("serialNumber")).FirstOrDefault();
|
||||
if (serialNumber != null)
|
||||
if (serialNumber is not null)
|
||||
{
|
||||
deviceProperties.SerialNumber = serialNumber.Value;
|
||||
}
|
||||
|
||||
var modelDescription = document.Descendants(UPnpNamespaces.Ud.GetName("modelDescription")).FirstOrDefault();
|
||||
if (modelDescription != null)
|
||||
if (modelDescription is not null)
|
||||
{
|
||||
deviceProperties.ModelDescription = modelDescription.Value;
|
||||
}
|
||||
|
||||
var icon = document.Descendants(UPnpNamespaces.Ud.GetName("icon")).FirstOrDefault();
|
||||
if (icon != null)
|
||||
if (icon is not null)
|
||||
{
|
||||
deviceProperties.Icon = CreateIcon(icon);
|
||||
}
|
||||
|
||||
foreach (var services in document.Descendants(UPnpNamespaces.Ud.GetName("serviceList")))
|
||||
{
|
||||
if (services == null)
|
||||
if (services is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var servicesList = services.Descendants(UPnpNamespaces.Ud.GetName("service"));
|
||||
if (servicesList == null)
|
||||
if (servicesList is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -1164,7 +1161,7 @@ namespace Emby.Dlna.PlayTo
|
|||
{
|
||||
var service = Create(element);
|
||||
|
||||
if (service != null)
|
||||
if (service is not null)
|
||||
{
|
||||
deviceProperties.Services.Add(service);
|
||||
}
|
||||
|
@ -1212,14 +1209,14 @@ namespace Emby.Dlna.PlayTo
|
|||
var previousMediaInfo = CurrentMediaInfo;
|
||||
CurrentMediaInfo = mediaInfo;
|
||||
|
||||
if (mediaInfo == null)
|
||||
if (mediaInfo is null)
|
||||
{
|
||||
if (previousMediaInfo != null)
|
||||
if (previousMediaInfo is not null)
|
||||
{
|
||||
OnPlaybackStop(previousMediaInfo);
|
||||
}
|
||||
}
|
||||
else if (previousMediaInfo == null)
|
||||
else if (previousMediaInfo is null)
|
||||
{
|
||||
if (state != TransportState.STOPPED)
|
||||
{
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace Emby.Dlna.PlayTo
|
|||
_mediaEncoder = mediaEncoder;
|
||||
}
|
||||
|
||||
public bool IsSessionActive => !_disposed && _device != null;
|
||||
public bool IsSessionActive => !_disposed && _device is not null;
|
||||
|
||||
public bool SupportsMediaControl => IsSessionActive;
|
||||
|
||||
|
@ -156,7 +156,7 @@ namespace Emby.Dlna.PlayTo
|
|||
try
|
||||
{
|
||||
var streamInfo = StreamParams.ParseFromUrl(e.OldMediaInfo.Url, _libraryManager, _mediaSourceManager);
|
||||
if (streamInfo.Item != null)
|
||||
if (streamInfo.Item is not null)
|
||||
{
|
||||
var positionTicks = GetProgressPositionTicks(streamInfo);
|
||||
|
||||
|
@ -164,7 +164,7 @@ namespace Emby.Dlna.PlayTo
|
|||
}
|
||||
|
||||
streamInfo = StreamParams.ParseFromUrl(e.NewMediaInfo.Url, _libraryManager, _mediaSourceManager);
|
||||
if (streamInfo.Item == null)
|
||||
if (streamInfo.Item is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ namespace Emby.Dlna.PlayTo
|
|||
{
|
||||
var streamInfo = StreamParams.ParseFromUrl(e.MediaInfo.Url, _libraryManager, _mediaSourceManager);
|
||||
|
||||
if (streamInfo.Item == null)
|
||||
if (streamInfo.Item is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var mediaSource = await streamInfo.GetMediaSource(CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
var duration = mediaSource == null
|
||||
var duration = mediaSource is null
|
||||
? _device.Duration?.Ticks
|
||||
: mediaSource.RunTimeTicks;
|
||||
|
||||
|
@ -268,7 +268,7 @@ namespace Emby.Dlna.PlayTo
|
|||
{
|
||||
var info = StreamParams.ParseFromUrl(e.MediaInfo.Url, _libraryManager, _mediaSourceManager);
|
||||
|
||||
if (info.Item != null)
|
||||
if (info.Item is not null)
|
||||
{
|
||||
var progress = GetProgressInfo(info);
|
||||
|
||||
|
@ -299,7 +299,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var info = StreamParams.ParseFromUrl(mediaUrl, _libraryManager, _mediaSourceManager);
|
||||
|
||||
if (info.Item != null)
|
||||
if (info.Item is not null)
|
||||
{
|
||||
var progress = GetProgressInfo(info);
|
||||
|
||||
|
@ -441,11 +441,11 @@ namespace Emby.Dlna.PlayTo
|
|||
{
|
||||
var media = _device.CurrentMediaInfo;
|
||||
|
||||
if (media != null)
|
||||
if (media is not null)
|
||||
{
|
||||
var info = StreamParams.ParseFromUrl(media.Url, _libraryManager, _mediaSourceManager);
|
||||
|
||||
if (info.Item != null && !EnableClientSideSeek(info))
|
||||
if (info.Item is not null && !EnableClientSideSeek(info))
|
||||
{
|
||||
var user = _session.UserId.Equals(default)
|
||||
? null
|
||||
|
@ -760,11 +760,11 @@ namespace Emby.Dlna.PlayTo
|
|||
{
|
||||
var media = _device.CurrentMediaInfo;
|
||||
|
||||
if (media != null)
|
||||
if (media is not null)
|
||||
{
|
||||
var info = StreamParams.ParseFromUrl(media.Url, _libraryManager, _mediaSourceManager);
|
||||
|
||||
if (info.Item != null)
|
||||
if (info.Item is not null)
|
||||
{
|
||||
var newPosition = GetProgressPositionTicks(info) ?? 0;
|
||||
|
||||
|
@ -791,11 +791,11 @@ namespace Emby.Dlna.PlayTo
|
|||
{
|
||||
var media = _device.CurrentMediaInfo;
|
||||
|
||||
if (media != null)
|
||||
if (media is not null)
|
||||
{
|
||||
var info = StreamParams.ParseFromUrl(media.Url, _libraryManager, _mediaSourceManager);
|
||||
|
||||
if (info.Item != null)
|
||||
if (info.Item is not null)
|
||||
{
|
||||
var newPosition = GetProgressPositionTicks(info) ?? 0;
|
||||
|
||||
|
@ -865,7 +865,7 @@ namespace Emby.Dlna.PlayTo
|
|||
throw new ObjectDisposedException(GetType().Name);
|
||||
}
|
||||
|
||||
if (_device == null)
|
||||
if (_device is null)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
@ -916,7 +916,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
public async Task<MediaSourceInfo> GetMediaSource(CancellationToken cancellationToken)
|
||||
{
|
||||
if (_mediaSource != null)
|
||||
if (_mediaSource is not null)
|
||||
{
|
||||
return _mediaSource;
|
||||
}
|
||||
|
@ -926,7 +926,7 @@ namespace Emby.Dlna.PlayTo
|
|||
return null;
|
||||
}
|
||||
|
||||
if (_mediaSourceManager != null)
|
||||
if (_mediaSourceManager is not null)
|
||||
{
|
||||
_mediaSource = await _mediaSourceManager.GetMediaSource(Item, MediaSourceId, LiveStreamId, false, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
@ -936,10 +936,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
private static Guid GetItemId(string url)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(url));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(url);
|
||||
|
||||
var parts = url.Split('/');
|
||||
|
||||
|
@ -962,10 +959,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
public static StreamParams ParseFromUrl(string url, ILibraryManager libraryManager, IMediaSourceManager mediaSourceManager)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(url));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(url);
|
||||
|
||||
var request = new StreamParams
|
||||
{
|
||||
|
|
|
@ -176,10 +176,10 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var controller = sessionInfo.SessionControllers.OfType<PlayToController>().FirstOrDefault();
|
||||
|
||||
if (controller == null)
|
||||
if (controller is null)
|
||||
{
|
||||
var device = await Device.CreateuPnpDeviceAsync(uri, _httpClientFactory, _logger, cancellationToken).ConfigureAwait(false);
|
||||
if (device == null)
|
||||
if (device is null)
|
||||
{
|
||||
_logger.LogError("Ignoring device as xml response is invalid.");
|
||||
return;
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Emby.Dlna.PlayTo
|
|||
var directPlay = profile.DirectPlayProfiles
|
||||
.FirstOrDefault(i => i.Type == DlnaProfileType.Photo && IsSupported(i, item));
|
||||
|
||||
if (directPlay != null)
|
||||
if (directPlay is not null)
|
||||
{
|
||||
playlistItem.StreamInfo.PlayMethod = PlayMethod.DirectStream;
|
||||
playlistItem.StreamInfo.Container = Path.GetExtension(item.Path);
|
||||
|
@ -40,7 +40,7 @@ namespace Emby.Dlna.PlayTo
|
|||
var transcodingProfile = profile.TranscodingProfiles
|
||||
.FirstOrDefault(i => i.Type == DlnaProfileType.Photo);
|
||||
|
||||
if (transcodingProfile != null)
|
||||
if (transcodingProfile is not null)
|
||||
{
|
||||
playlistItem.StreamInfo.PlayMethod = PlayMethod.Transcode;
|
||||
playlistItem.StreamInfo.Container = "." + transcodingProfile.Container.TrimStart('.');
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
var stateValues = document.Descendants(UPnpNamespaces.ServiceStateTable).FirstOrDefault();
|
||||
|
||||
if (stateValues != null)
|
||||
if (stateValues is not null)
|
||||
{
|
||||
foreach (var container in stateValues.Elements(UPnpNamespaces.Svc + "stateVariable"))
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ namespace Emby.Dlna.PlayTo
|
|||
var element = container.Descendants(UPnpNamespaces.Svc + "allowedValueList")
|
||||
.FirstOrDefault();
|
||||
|
||||
if (element != null)
|
||||
if (element is not null)
|
||||
{
|
||||
var values = element.Descendants(UPnpNamespaces.Svc + "allowedValue");
|
||||
|
||||
|
@ -167,7 +167,7 @@ namespace Emby.Dlna.PlayTo
|
|||
{
|
||||
var state = StateVariables.FirstOrDefault(a => string.Equals(a.Name, argument.RelatedStateVariable, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (state != null)
|
||||
if (state is not null)
|
||||
{
|
||||
var sendValue = state.AllowedValues.FirstOrDefault(a => string.Equals(a, commandParameter, StringComparison.OrdinalIgnoreCase)) ??
|
||||
(state.AllowedValues.Count > 0 ? state.AllowedValues[0] : value);
|
||||
|
|
|
@ -22,15 +22,8 @@ namespace Emby.Dlna.Server
|
|||
|
||||
public DescriptionXmlBuilder(DeviceProfile profile, string serverUdn, string serverAddress, string serverName, string serverId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(serverUdn))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(serverUdn));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(serverAddress))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(serverAddress));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(serverUdn);
|
||||
ArgumentException.ThrowIfNullOrEmpty(serverAddress);
|
||||
|
||||
_profile = profile;
|
||||
_serverUdn = serverUdn;
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace Emby.Dlna.Service
|
|||
}
|
||||
}
|
||||
|
||||
if (localName != null && namespaceURI != null)
|
||||
if (localName is not null && namespaceURI is not null)
|
||||
{
|
||||
return new ControlRequestInfo(localName, namespaceURI);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#nullable disable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System.Net.Http;
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace Emby.Dlna.Ssdp
|
|||
{
|
||||
lock (_syncLock)
|
||||
{
|
||||
if (_listenerCount > 0 && _deviceLocator == null && _commsServer != null)
|
||||
if (_listenerCount > 0 && _deviceLocator is null && _commsServer is not null)
|
||||
{
|
||||
_deviceLocator = new SsdpDeviceLocator(_commsServer);
|
||||
|
||||
|
@ -97,7 +97,7 @@ namespace Emby.Dlna.Ssdp
|
|||
{
|
||||
var originalHeaders = e.DiscoveredDevice.ResponseHeaders;
|
||||
|
||||
var headerDict = originalHeaders == null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase);
|
||||
var headerDict = originalHeaders is null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
|
@ -116,7 +116,7 @@ namespace Emby.Dlna.Ssdp
|
|||
{
|
||||
var originalHeaders = e.DiscoveredDevice.ResponseHeaders;
|
||||
|
||||
var headerDict = originalHeaders == null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase);
|
||||
var headerDict = originalHeaders is null ? new Dictionary<string, KeyValuePair<string, IEnumerable<string>>>() : originalHeaders.ToDictionary(i => i.Key, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
var headers = headerDict.ToDictionary(i => i.Key, i => i.Value.Value.FirstOrDefault(), StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
|
@ -136,7 +136,7 @@ namespace Emby.Dlna.Ssdp
|
|||
if (!_disposed)
|
||||
{
|
||||
_disposed = true;
|
||||
if (_deviceLocator != null)
|
||||
if (_deviceLocator is not null)
|
||||
{
|
||||
_deviceLocator.Dispose();
|
||||
_deviceLocator = null;
|
||||
|
|
|
@ -6,15 +6,11 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
|
||||
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
|
||||
|
|
|
@ -436,7 +436,7 @@ namespace Emby.Drawing
|
|||
/// <inheritdoc />
|
||||
public string? GetImageCacheTag(User user)
|
||||
{
|
||||
if (user.ProfileImage == null)
|
||||
if (user.ProfileImage is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -503,20 +503,9 @@ namespace Emby.Drawing
|
|||
/// </exception>
|
||||
public string GetCachePath(string path, string uniqueName, string fileExtension)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(uniqueName))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(uniqueName));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(fileExtension))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(fileExtension));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
ArgumentException.ThrowIfNullOrEmpty(uniqueName);
|
||||
ArgumentException.ThrowIfNullOrEmpty(fileExtension);
|
||||
|
||||
var filename = uniqueName.GetMD5() + fileExtension;
|
||||
|
||||
|
|
|
@ -69,13 +69,13 @@ namespace Emby.Naming.AudioBook
|
|||
extras = new List<AudioBookFileInfo>();
|
||||
alternativeVersions = new List<AudioBookFileInfo>();
|
||||
|
||||
var haveChaptersOrPages = stackFiles.Any(x => x.ChapterNumber != null || x.PartNumber != null);
|
||||
var haveChaptersOrPages = stackFiles.Any(x => x.ChapterNumber is not null || x.PartNumber is not null);
|
||||
var groupedBy = stackFiles.GroupBy(file => new { file.ChapterNumber, file.PartNumber });
|
||||
var nameWithReplacedDots = nameParserResult.Name.Replace(' ', '.');
|
||||
|
||||
foreach (var group in groupedBy)
|
||||
{
|
||||
if (group.Key.ChapterNumber == null && group.Key.PartNumber == null)
|
||||
if (group.Key.ChapterNumber is null && group.Key.PartNumber is null)
|
||||
{
|
||||
if (group.Count() > 1 || haveChaptersOrPages)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace Emby.Naming.AudioBook
|
|||
var match = new Regex(expression, RegexOptions.IgnoreCase).Match(name);
|
||||
if (match.Success)
|
||||
{
|
||||
if (result.Name == null)
|
||||
if (result.Name is null)
|
||||
{
|
||||
var value = match.Groups["name"];
|
||||
if (value.Success)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
|
@ -16,7 +16,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<CodeAnalysisTreatWarningsAsErrors>false</CodeAnalysisTreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Stability)'=='Unstable'">
|
||||
|
|
|
@ -94,12 +94,12 @@ namespace Emby.Naming.ExternalFiles
|
|||
// Try to translate to three character code
|
||||
var culture = _localizationManager.FindLanguageInfo(currentSliceWithoutSeparator);
|
||||
|
||||
if (culture != null && pathInfo.Language == null)
|
||||
if (culture is not null && pathInfo.Language is null)
|
||||
{
|
||||
pathInfo.Language = culture.ThreeLetterISOLanguageName;
|
||||
extraString = extraString.Replace(currentSlice, string.Empty, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
else if (culture != null && pathInfo.Language == "hin")
|
||||
else if (culture is not null && pathInfo.Language == "hin")
|
||||
{
|
||||
// Hindi language code "hi" collides with a hearing impaired flag - use as Hindi only if no other language is set
|
||||
pathInfo.IsHearingImpaired = true;
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace Emby.Naming.TV
|
|||
}
|
||||
}
|
||||
|
||||
if (result != null && fillExtendedInfo)
|
||||
if (result is not null && fillExtendedInfo)
|
||||
{
|
||||
FillAdditional(path, result);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Emby.Naming.TV
|
|||
}
|
||||
}
|
||||
|
||||
if (result != null)
|
||||
if (result is not null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(result.SeriesName))
|
||||
{
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace Emby.Naming.Video
|
|||
}
|
||||
}
|
||||
|
||||
if (result.ExtraType != null)
|
||||
if (result.ExtraType is not null)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace Emby.Naming.Video
|
|||
// Filter out all extras, otherwise they could cause stacks to not be resolved
|
||||
// See the unit test TestStackedWithTrailer
|
||||
var nonExtras = videoInfos
|
||||
.Where(i => i.ExtraType == null)
|
||||
.Where(i => i.ExtraType is null)
|
||||
.Select(i => new FileSystemMetadata { FullName = i.Path, IsDirectory = i.IsDirectory });
|
||||
|
||||
var stackResult = StackResolver.Resolve(nonExtras, namingOptions).ToList();
|
||||
|
@ -42,7 +42,7 @@ namespace Emby.Naming.Video
|
|||
continue;
|
||||
}
|
||||
|
||||
if (current.ExtraType == null)
|
||||
if (current.ExtraType is null)
|
||||
{
|
||||
standaloneMedia.Add(current);
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ namespace Emby.Naming.Video
|
|||
for (var i = 0; i < videos.Count; i++)
|
||||
{
|
||||
var video = videos[i];
|
||||
if (video.ExtraType != null)
|
||||
if (video.ExtraType is not null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ namespace Emby.Naming.Video
|
|||
name = cleanDateTimeResult.Name;
|
||||
year = cleanDateTimeResult.Year;
|
||||
|
||||
if (extraResult.ExtraType == null
|
||||
if (extraResult.ExtraType is null
|
||||
&& TryCleanString(name, namingOptions, out var newName))
|
||||
{
|
||||
name = newName;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -141,7 +141,7 @@ namespace Emby.Notifications
|
|||
|
||||
lock (_libraryChangedSyncLock)
|
||||
{
|
||||
if (_libraryUpdateTimer == null)
|
||||
if (_libraryUpdateTimer is null)
|
||||
{
|
||||
_libraryUpdateTimer = new Timer(
|
||||
LibraryUpdateTimerCallback,
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace Emby.Notifications
|
|||
|
||||
var users = GetUserIds(request, options)
|
||||
.Select(i => _userManager.GetUserById(i))
|
||||
.Where(i => relatedItem == null || relatedItem.IsVisibleStandalone(i))
|
||||
.Where(i => relatedItem is null || relatedItem.IsVisibleStandalone(i))
|
||||
.ToArray();
|
||||
|
||||
var title = request.Name;
|
||||
|
@ -113,7 +113,7 @@ namespace Emby.Notifications
|
|||
}
|
||||
}
|
||||
|
||||
if (options != null && !string.IsNullOrEmpty(request.NotificationType))
|
||||
if (options is not null && !string.IsNullOrEmpty(request.NotificationType))
|
||||
{
|
||||
var config = GetConfiguration();
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace Emby.Photos
|
|||
private readonly IImageProcessor _imageProcessor;
|
||||
|
||||
// These are causing taglib to hang
|
||||
private readonly string[] _includeExtensions = new string[] { ".jpg", ".jpeg", ".png", ".tiff", ".cr2" };
|
||||
private readonly string[] _includeExtensions = new string[] { ".jpg", ".jpeg", ".png", ".tiff", ".cr2", ".webp", ".avif" };
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PhotoProvider" /> class.
|
||||
|
@ -49,7 +49,7 @@ namespace Emby.Photos
|
|||
if (item.IsFileProtocol)
|
||||
{
|
||||
var file = directoryService.GetFile(item.Path);
|
||||
return file != null && file.LastWriteTimeUtc != item.DateModified;
|
||||
return file is not null && file.LastWriteTimeUtc != item.DateModified;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -70,20 +70,20 @@ namespace Emby.Photos
|
|||
if (file.GetTag(TagTypes.TiffIFD) is IFDTag tag)
|
||||
{
|
||||
var structure = tag.Structure;
|
||||
if (structure != null
|
||||
if (structure is not null
|
||||
&& structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD) is SubIFDEntry exif)
|
||||
{
|
||||
var exifStructure = exif.Structure;
|
||||
if (exifStructure != null)
|
||||
if (exifStructure is not null)
|
||||
{
|
||||
var entry = exifStructure.GetEntry(0, (ushort)ExifEntryTag.ApertureValue) as RationalIFDEntry;
|
||||
if (entry != null)
|
||||
if (entry is not null)
|
||||
{
|
||||
item.Aperture = (double)entry.Value.Numerator / entry.Value.Denominator;
|
||||
}
|
||||
|
||||
entry = exifStructure.GetEntry(0, (ushort)ExifEntryTag.ShutterSpeedValue) as RationalIFDEntry;
|
||||
if (entry != null)
|
||||
if (entry is not null)
|
||||
{
|
||||
item.ShutterSpeed = (double)entry.Value.Numerator / entry.Value.Denominator;
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace Emby.Server.Implementations.AppBase
|
|||
{
|
||||
_configuration = value;
|
||||
|
||||
_configurationLoaded = value != null;
|
||||
_configurationLoaded = value is not null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ namespace Emby.Server.Implementations.AppBase
|
|||
{
|
||||
IConfigurationFactory factory = Activator.CreateInstance<T>();
|
||||
|
||||
if (_configurationFactories == null)
|
||||
if (_configurationFactories is null)
|
||||
{
|
||||
_configurationFactories = new[] { factory };
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ namespace Emby.Server.Implementations.AppBase
|
|||
configurationManager._configurationStores,
|
||||
i => string.Equals(i.Key, k, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (configurationInfo == null)
|
||||
if (configurationInfo is null)
|
||||
{
|
||||
throw new ResourceNotFoundException("Configuration with key " + k + " not found.");
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace Emby.Server.Implementations.AppBase
|
|||
Span<byte> newBytes = stream.GetBuffer().AsSpan(0, (int)stream.Length);
|
||||
|
||||
// If the file didn't exist before, or if something has changed, re-save
|
||||
if (buffer == null || !newBytes.SequenceEqual(buffer))
|
||||
if (buffer is null || !newBytes.SequenceEqual(buffer))
|
||||
{
|
||||
var directory = Path.GetDirectoryName(path) ?? throw new ArgumentException($"Provided path ({path}) is not valid.", nameof(path));
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ namespace Emby.Server.Implementations
|
|||
/// <summary>
|
||||
/// Gets a value indicating whether this instance can self restart.
|
||||
/// </summary>
|
||||
public bool CanSelfRestart => _startupOptions.RestartPath != null;
|
||||
public bool CanSelfRestart => _startupOptions.RestartPath is not null;
|
||||
|
||||
public bool CoreStartupHasCompleted { get; private set; }
|
||||
|
||||
|
@ -311,7 +311,7 @@ namespace Emby.Server.Implementations
|
|||
public X509Certificate2 Certificate { get; private set; }
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool ListenWithHttps => Certificate != null && ConfigurationManager.GetNetworkConfiguration().EnableHttps;
|
||||
public bool ListenWithHttps => Certificate is not null && ConfigurationManager.GetNetworkConfiguration().EnableHttps;
|
||||
|
||||
public string FriendlyName =>
|
||||
string.IsNullOrEmpty(ConfigurationManager.Configuration.ServerName)
|
||||
|
@ -403,7 +403,7 @@ namespace Emby.Server.Implementations
|
|||
// Convert to list so this isn't executed for each iteration
|
||||
var parts = GetExportTypes<T>()
|
||||
.Select(CreateInstanceSafe)
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.Cast<T>()
|
||||
.ToList();
|
||||
|
||||
|
@ -424,7 +424,7 @@ namespace Emby.Server.Implementations
|
|||
// Convert to list so this isn't executed for each iteration
|
||||
var parts = GetExportTypes<T>()
|
||||
.Select(i => defaultFunc(i))
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.Cast<T>()
|
||||
.ToList();
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
public Task DeleteItem(BaseItem item)
|
||||
{
|
||||
var internalChannel = _libraryManager.GetItemById(item.ChannelId);
|
||||
if (internalChannel == null)
|
||||
if (internalChannel is null)
|
||||
{
|
||||
throw new ArgumentException(nameof(item.ChannelId));
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
.ToList();
|
||||
}
|
||||
|
||||
if (user != null)
|
||||
if (user is not null)
|
||||
{
|
||||
channels = channels.Where(i =>
|
||||
{
|
||||
|
@ -253,7 +253,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
if (query.StartIndex.HasValue || query.Limit.HasValue)
|
||||
{
|
||||
int startIndex = query.StartIndex ?? 0;
|
||||
int count = query.Limit == null ? totalCount - startIndex : Math.Min(query.Limit.Value, totalCount - startIndex);
|
||||
int count = query.Limit is null ? totalCount - startIndex : Math.Min(query.Limit.Value, totalCount - startIndex);
|
||||
all = all.GetRange(startIndex, count);
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
{
|
||||
var path = Path.Combine(item.GetInternalMetadataPath(), "channelmediasourceinfos.json");
|
||||
|
||||
if (mediaSources == null || mediaSources.Count == 0)
|
||||
if (mediaSources is null || mediaSources.Count == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -447,7 +447,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
|
||||
var item = _libraryManager.GetItemById(id) as Channel;
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
item = new Channel
|
||||
{
|
||||
|
@ -601,10 +601,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
|
||||
private Guid GetInternalChannelId(string name)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(name);
|
||||
|
||||
return _libraryManager.GetNewItemId("Channel " + name, typeof(Channel));
|
||||
}
|
||||
|
@ -739,7 +736,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
query.GroupByPresentationUniqueKey = false;
|
||||
|
||||
// null if came from cache
|
||||
if (itemsResult != null)
|
||||
if (itemsResult is not null)
|
||||
{
|
||||
var items = itemsResult.Items;
|
||||
var itemsLen = items.Count;
|
||||
|
@ -761,7 +758,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
foreach (var deadId in deadIds)
|
||||
{
|
||||
var deadItem = _libraryManager.GetItemById(deadId);
|
||||
if (deadItem != null)
|
||||
if (deadItem is not null)
|
||||
{
|
||||
_libraryManager.DeleteItem(
|
||||
deadItem,
|
||||
|
@ -813,7 +810,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
{
|
||||
await using FileStream jsonStream = AsyncFile.OpenRead(cachePath);
|
||||
var cachedResult = await JsonSerializer.DeserializeAsync<ChannelItemResult>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||
if (cachedResult != null)
|
||||
if (cachedResult is not null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -836,7 +833,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
{
|
||||
await using FileStream jsonStream = AsyncFile.OpenRead(cachePath);
|
||||
var cachedResult = await JsonSerializer.DeserializeAsync<ChannelItemResult>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||
if (cachedResult != null)
|
||||
if (cachedResult is not null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -861,7 +858,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
|
||||
var result = await channel.GetChannelItems(query, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result == null)
|
||||
if (result is null)
|
||||
{
|
||||
throw new InvalidOperationException("Channel returned a null result from GetChannelItems");
|
||||
}
|
||||
|
@ -955,7 +952,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
_logger.LogError(ex, "Error retrieving channel item from database");
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
item = new T();
|
||||
isNew = true;
|
||||
|
@ -1156,7 +1153,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
{
|
||||
_libraryManager.CreateItem(item, parentFolder);
|
||||
|
||||
if (info.People != null && info.People.Count > 0)
|
||||
if (info.People is not null && info.People.Count > 0)
|
||||
{
|
||||
_libraryManager.UpdatePeople(item, info.People);
|
||||
}
|
||||
|
@ -1193,7 +1190,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
var result = GetAllChannels()
|
||||
.FirstOrDefault(i => GetInternalChannelId(i.Name).Equals(channel.ChannelId) || string.Equals(i.Name, channel.Name, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (result == null)
|
||||
if (result is null)
|
||||
{
|
||||
throw new ResourceNotFoundException("No channel provider found for channel " + channel.Name);
|
||||
}
|
||||
|
@ -1206,7 +1203,7 @@ namespace Emby.Server.Implementations.Channels
|
|||
var result = GetAllChannels()
|
||||
.FirstOrDefault(i => internalChannelId.Equals(GetInternalChannelId(i.Name)));
|
||||
|
||||
if (result == null)
|
||||
if (result is null)
|
||||
{
|
||||
throw new ResourceNotFoundException("No channel provider found for channel id " + internalChannelId);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace Emby.Server.Implementations.Collections
|
|||
var episode = subItem as Episode;
|
||||
|
||||
var series = episode?.Series;
|
||||
if (series != null && series.HasImage(ImageType.Primary))
|
||||
if (series is not null && series.HasImage(ImageType.Primary))
|
||||
{
|
||||
return series;
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ namespace Emby.Server.Implementations.Collections
|
|||
|
||||
var parent = subItem.GetOwner() ?? subItem.GetParent();
|
||||
|
||||
if (parent != null && parent.HasImage(ImageType.Primary))
|
||||
if (parent is not null && parent.HasImage(ImageType.Primary))
|
||||
{
|
||||
if (parent is MusicAlbum)
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.Collections
|
|||
|
||||
return null;
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.GroupBy(x => x!.Id) // We removed the null values
|
||||
.Select(x => x.First())
|
||||
.ToList()!; // Again... the list doesn't contain any null values
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.Collections
|
|||
internal async Task<Folder?> EnsureLibraryFolder(string path, bool createIfNeeded)
|
||||
{
|
||||
var existingFolder = FindFolders(path).FirstOrDefault();
|
||||
if (existingFolder != null)
|
||||
if (existingFolder is not null)
|
||||
{
|
||||
return existingFolder;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ namespace Emby.Server.Implementations.Collections
|
|||
{
|
||||
var folder = GetCollectionsFolder(false).GetAwaiter().GetResult();
|
||||
|
||||
return folder == null
|
||||
return folder is null
|
||||
? Enumerable.Empty<BoxSet>()
|
||||
: folder.GetChildren(user, true).OfType<BoxSet>();
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ namespace Emby.Server.Implementations.Collections
|
|||
|
||||
var parentFolder = await GetCollectionsFolder(true).ConfigureAwait(false);
|
||||
|
||||
if (parentFolder == null)
|
||||
if (parentFolder is null)
|
||||
{
|
||||
throw new ArgumentException(nameof(parentFolder));
|
||||
}
|
||||
|
@ -216,7 +216,7 @@ namespace Emby.Server.Implementations.Collections
|
|||
{
|
||||
var item = _libraryManager.GetItemById(id);
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
throw new ArgumentException("No item exists with the supplied Id");
|
||||
}
|
||||
|
@ -265,9 +265,9 @@ namespace Emby.Server.Implementations.Collections
|
|||
{
|
||||
var childItem = _libraryManager.GetItemById(guidId);
|
||||
|
||||
var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value.Equals(guidId)) || (childItem != null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));
|
||||
var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value.Equals(guidId)) || (childItem is not null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));
|
||||
|
||||
if (child == null)
|
||||
if (child is null)
|
||||
{
|
||||
_logger.LogWarning("No collection title exists with the supplied Id");
|
||||
continue;
|
||||
|
@ -275,7 +275,7 @@ namespace Emby.Server.Implementations.Collections
|
|||
|
||||
list.Add(child);
|
||||
|
||||
if (childItem != null)
|
||||
if (childItem is not null)
|
||||
{
|
||||
itemList.Add(childItem);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Emby.Server.Implementations
|
|||
/// <summary>
|
||||
/// Gets a new copy of the default configuration options.
|
||||
/// </summary>
|
||||
public static Dictionary<string, string> DefaultConfiguration => new Dictionary<string, string>
|
||||
public static Dictionary<string, string?> DefaultConfiguration => new Dictionary<string, string?>
|
||||
{
|
||||
{ HostWebClientKey, bool.TrueString },
|
||||
{ DefaultRedirectKey, "web/index.html" },
|
||||
|
|
|
@ -2,8 +2,6 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Model.Cryptography;
|
||||
using static MediaBrowser.Model.Cryptography.Constants;
|
||||
|
||||
|
@ -14,25 +12,6 @@ namespace Emby.Server.Implementations.Cryptography
|
|||
/// </summary>
|
||||
public class CryptographyProvider : ICryptoProvider
|
||||
{
|
||||
// TODO: remove when not needed for backwards compat
|
||||
private static readonly HashSet<string> _supportedHashMethods = new HashSet<string>()
|
||||
{
|
||||
"MD5",
|
||||
"System.Security.Cryptography.MD5",
|
||||
"SHA",
|
||||
"SHA1",
|
||||
"System.Security.Cryptography.SHA1",
|
||||
"SHA256",
|
||||
"SHA-256",
|
||||
"System.Security.Cryptography.SHA256",
|
||||
"SHA384",
|
||||
"SHA-384",
|
||||
"System.Security.Cryptography.SHA384",
|
||||
"SHA512",
|
||||
"SHA-512",
|
||||
"System.Security.Cryptography.SHA512"
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
public string DefaultHashMethod => "PBKDF2-SHA512";
|
||||
|
||||
|
@ -80,22 +59,7 @@ namespace Emby.Server.Implementations.Cryptography
|
|||
DefaultOutputLength));
|
||||
}
|
||||
|
||||
if (!_supportedHashMethods.Contains(hash.Id))
|
||||
{
|
||||
throw new CryptographicException($"Requested hash method is not supported: {hash.Id}");
|
||||
}
|
||||
|
||||
using var h = HashAlgorithm.Create(hash.Id) ?? throw new ResourceNotFoundException($"Unknown hash method: {hash.Id}.");
|
||||
var bytes = Encoding.UTF8.GetBytes(password.ToArray());
|
||||
if (hash.Salt.Length == 0)
|
||||
{
|
||||
return hash.Hash.SequenceEqual(h.ComputeHash(bytes));
|
||||
}
|
||||
|
||||
byte[] salted = new byte[bytes.Length + hash.Salt.Length];
|
||||
Array.Copy(bytes, salted, bytes.Length);
|
||||
hash.Salt.CopyTo(salted.AsSpan(bytes.Length));
|
||||
return hash.Hash.SequenceEqual(h.ComputeHash(salted));
|
||||
throw new NotSupportedException($"Can't verify hash with id: {hash.Id}");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
@ -101,7 +101,7 @@ namespace Emby.Server.Implementations.Data
|
|||
protected ManagedConnection GetConnection(bool readOnly = false)
|
||||
{
|
||||
WriteLock.Wait();
|
||||
if (WriteConnection != null)
|
||||
if (WriteConnection is not null)
|
||||
{
|
||||
return new ManagedConnection(WriteConnection, WriteLock);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
var item = _libraryManager.GetItemById(itemId);
|
||||
|
||||
if (item != null)
|
||||
if (item is not null)
|
||||
{
|
||||
_logger.LogInformation("Cleaning item {0} type: {1} path: {2}", item.Name, item.GetType().Name, item.Path ?? string.Empty);
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ namespace Emby.Server.Implementations.Data
|
|||
{
|
||||
if (statement.BindParameters.TryGetValue(name, out IBindParameter bindParam))
|
||||
{
|
||||
if (value == null)
|
||||
if (value is null)
|
||||
{
|
||||
bindParam.BindNull();
|
||||
}
|
||||
|
|
|
@ -691,7 +691,7 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
private string GetPathToSave(string path)
|
||||
{
|
||||
if (path == null)
|
||||
if (path is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -890,7 +890,7 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
saveItemStatement.TryBind("@UnratedType", item.GetBlockUnratedType().ToString());
|
||||
|
||||
if (topParent == null)
|
||||
if (topParent is null)
|
||||
{
|
||||
saveItemStatement.TryBindNull("@TopParentId");
|
||||
}
|
||||
|
@ -1146,7 +1146,7 @@ namespace Emby.Server.Implementations.Data
|
|||
{
|
||||
var image = ItemImageInfoFromValueString(part);
|
||||
|
||||
if (image != null)
|
||||
if (image is not null)
|
||||
{
|
||||
result[position++] = image;
|
||||
}
|
||||
|
@ -1414,7 +1414,7 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
var type = _typeMapper.GetType(typeString);
|
||||
|
||||
if (type == null)
|
||||
if (type is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -1433,7 +1433,7 @@ namespace Emby.Server.Implementations.Data
|
|||
}
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1444,7 +1444,7 @@ namespace Emby.Server.Implementations.Data
|
|||
}
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -1825,7 +1825,7 @@ namespace Emby.Server.Implementations.Data
|
|||
var hasSeries = item as IHasSeries;
|
||||
if (hasSeriesFields)
|
||||
{
|
||||
if (hasSeries != null)
|
||||
if (hasSeries is not null)
|
||||
{
|
||||
if (reader.TryGetGuid(index, out var seriesId))
|
||||
{
|
||||
|
@ -1938,7 +1938,7 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
if (HasField(query, ItemFields.SeriesPresentationUniqueKey))
|
||||
{
|
||||
if (hasSeries != null)
|
||||
if (hasSeries is not null)
|
||||
{
|
||||
if (reader.TryGetString(index, out var seriesPresentationUniqueKey))
|
||||
{
|
||||
|
@ -2151,7 +2151,7 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
private static bool EnableJoinUserData(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User == null)
|
||||
if (query.User is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -2205,7 +2205,7 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
private bool HasProgramAttributes(InternalItemsQuery query)
|
||||
{
|
||||
if (query.ParentType != null && _programExcludeParentTypes.Contains(query.ParentType.Value))
|
||||
if (query.ParentType is not null && _programExcludeParentTypes.Contains(query.ParentType.Value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -2220,7 +2220,7 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
private bool HasServiceName(InternalItemsQuery query)
|
||||
{
|
||||
if (query.ParentType != null && _programExcludeParentTypes.Contains(query.ParentType.Value))
|
||||
if (query.ParentType is not null && _programExcludeParentTypes.Contains(query.ParentType.Value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -2235,7 +2235,7 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
private bool HasStartDate(InternalItemsQuery query)
|
||||
{
|
||||
if (query.ParentType != null && _programExcludeParentTypes.Contains(query.ParentType.Value))
|
||||
if (query.ParentType is not null && _programExcludeParentTypes.Contains(query.ParentType.Value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -2270,7 +2270,7 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
private bool HasArtistFields(InternalItemsQuery query)
|
||||
{
|
||||
if (query.ParentType != null && _artistExcludeParentTypes.Contains(query.ParentType.Value))
|
||||
if (query.ParentType is not null && _artistExcludeParentTypes.Contains(query.ParentType.Value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -2392,7 +2392,7 @@ namespace Emby.Server.Implementations.Data
|
|||
columns.Add("UserDatas.rating");
|
||||
}
|
||||
|
||||
if (query.SimilarTo != null)
|
||||
if (query.SimilarTo is not null)
|
||||
{
|
||||
var item = query.SimilarTo;
|
||||
|
||||
|
@ -2458,7 +2458,6 @@ namespace Emby.Server.Implementations.Data
|
|||
builder.Append("((CleanName like @SearchTermStartsWith or (OriginalTitle not null and OriginalTitle like @SearchTermStartsWith)) * 10)");
|
||||
builder.Append("+ ((CleanName = @SearchTermStartsWith COLLATE NOCASE or (OriginalTitle not null and OriginalTitle = @SearchTermStartsWith COLLATE NOCASE)) * 10)");
|
||||
|
||||
|
||||
if (query.SearchTerm.Length > 1)
|
||||
{
|
||||
builder.Append("+ ((CleanName like @SearchTermContains or (OriginalTitle not null and OriginalTitle like @SearchTermContains)) * 10)");
|
||||
|
@ -2498,7 +2497,7 @@ namespace Emby.Server.Implementations.Data
|
|||
{
|
||||
var item = query.SimilarTo;
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -2682,7 +2681,7 @@ namespace Emby.Server.Implementations.Data
|
|||
foreach (var row in statement.ExecuteQuery())
|
||||
{
|
||||
var item = GetItem(row, query, hasProgramAttributes, hasEpisodeAttributes, hasServiceName, hasStartDate, hasTrailerTypes, hasArtistFields, hasSeriesFields);
|
||||
if (item != null)
|
||||
if (item is not null)
|
||||
{
|
||||
items.Add(item);
|
||||
}
|
||||
|
@ -2924,7 +2923,7 @@ namespace Emby.Server.Implementations.Data
|
|||
foreach (var row in statement.ExecuteQuery())
|
||||
{
|
||||
var item = GetItem(row, query, hasProgramAttributes, hasEpisodeAttributes, hasServiceName, hasStartDate, hasTrailerTypes, hasArtistFields, hasSeriesFields);
|
||||
if (item != null)
|
||||
if (item is not null)
|
||||
{
|
||||
list.Add(item);
|
||||
}
|
||||
|
@ -2967,7 +2966,7 @@ namespace Emby.Server.Implementations.Data
|
|||
private string GetOrderByText(InternalItemsQuery query)
|
||||
{
|
||||
var orderBy = query.OrderBy;
|
||||
bool hasSimilar = query.SimilarTo != null;
|
||||
bool hasSimilar = query.SimilarTo is not null;
|
||||
bool hasSearch = !string.IsNullOrEmpty(query.SearchTerm);
|
||||
|
||||
if (hasSimilar || hasSearch)
|
||||
|
@ -3397,7 +3396,7 @@ namespace Emby.Server.Implementations.Data
|
|||
}
|
||||
}
|
||||
|
||||
if (query.SimilarTo != null && query.MinSimilarityScore > 0)
|
||||
if (query.SimilarTo is not null && query.MinSimilarityScore > 0)
|
||||
{
|
||||
whereClauses.Add("SimilarityScore > " + (query.MinSimilarityScore - 1).ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
@ -3684,7 +3683,7 @@ namespace Emby.Server.Implementations.Data
|
|||
.Append(paramName)
|
||||
.Append("))) OR ");
|
||||
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
query.PersonIds[i].TryWriteBytes(idBytes);
|
||||
statement.TryBind(paramName, idBytes);
|
||||
|
@ -3735,7 +3734,7 @@ namespace Emby.Server.Implementations.Data
|
|||
if (!string.IsNullOrWhiteSpace(nameContains))
|
||||
{
|
||||
whereClauses.Add("(CleanName like @NameContains or OriginalTitle like @NameContains)");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
nameContains = FixUnicodeChars(nameContains);
|
||||
|
||||
|
@ -3866,7 +3865,7 @@ namespace Emby.Server.Implementations.Data
|
|||
var paramName = "@ArtistIds" + index;
|
||||
|
||||
clauses.Add("(guid in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type<=1))");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind(paramName, artistId);
|
||||
}
|
||||
|
@ -3887,7 +3886,7 @@ namespace Emby.Server.Implementations.Data
|
|||
var paramName = "@ArtistIds" + index;
|
||||
|
||||
clauses.Add("(guid in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=1))");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind(paramName, artistId);
|
||||
}
|
||||
|
@ -3908,7 +3907,7 @@ namespace Emby.Server.Implementations.Data
|
|||
var paramName = "@ArtistIds" + index;
|
||||
|
||||
clauses.Add("((select CleanName from TypedBaseItems where guid=" + paramName + ") in (select CleanValue from ItemValues where ItemId=Guid and Type=0) AND (select CleanName from TypedBaseItems where guid=" + paramName + ") not in (select CleanValue from ItemValues where ItemId=Guid and Type=1))");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind(paramName, artistId);
|
||||
}
|
||||
|
@ -3929,7 +3928,7 @@ namespace Emby.Server.Implementations.Data
|
|||
var paramName = "@AlbumIds" + index;
|
||||
|
||||
clauses.Add("Album in (select Name from typedbaseitems where guid=" + paramName + ")");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind(paramName, albumId);
|
||||
}
|
||||
|
@ -3950,7 +3949,7 @@ namespace Emby.Server.Implementations.Data
|
|||
var paramName = "@ExcludeArtistId" + index;
|
||||
|
||||
clauses.Add("(guid not in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type<=1))");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind(paramName, artistId);
|
||||
}
|
||||
|
@ -3971,7 +3970,7 @@ namespace Emby.Server.Implementations.Data
|
|||
var paramName = "@GenreId" + index;
|
||||
|
||||
clauses.Add("(guid in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=2))");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind(paramName, genreId);
|
||||
}
|
||||
|
@ -3990,7 +3989,7 @@ namespace Emby.Server.Implementations.Data
|
|||
foreach (var item in query.Genres)
|
||||
{
|
||||
clauses.Add("@Genre" + index + " in (select CleanValue from ItemValues where ItemId=Guid and Type=2)");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@Genre" + index, GetCleanValue(item));
|
||||
}
|
||||
|
@ -4009,7 +4008,7 @@ namespace Emby.Server.Implementations.Data
|
|||
foreach (var item in tags)
|
||||
{
|
||||
clauses.Add("@Tag" + index + " in (select CleanValue from ItemValues where ItemId=Guid and Type=4)");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@Tag" + index, GetCleanValue(item));
|
||||
}
|
||||
|
@ -4028,7 +4027,7 @@ namespace Emby.Server.Implementations.Data
|
|||
foreach (var item in excludeTags)
|
||||
{
|
||||
clauses.Add("@ExcludeTag" + index + " not in (select CleanValue from ItemValues where ItemId=Guid and Type=4)");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@ExcludeTag" + index, GetCleanValue(item));
|
||||
}
|
||||
|
@ -4050,7 +4049,7 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
clauses.Add("(guid in (select itemid from ItemValues where CleanValue = (select CleanName from TypedBaseItems where guid=" + paramName + ") and Type=3))");
|
||||
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind(paramName, studioId);
|
||||
}
|
||||
|
@ -4069,7 +4068,7 @@ namespace Emby.Server.Implementations.Data
|
|||
foreach (var item in query.OfficialRatings)
|
||||
{
|
||||
clauses.Add("OfficialRating=@OfficialRating" + index);
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@OfficialRating" + index, item);
|
||||
}
|
||||
|
@ -4084,7 +4083,7 @@ namespace Emby.Server.Implementations.Data
|
|||
if (query.MinParentalRating.HasValue)
|
||||
{
|
||||
whereClauses.Add("InheritedParentalRatingValue>=@MinParentalRating");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@MinParentalRating", query.MinParentalRating.Value);
|
||||
}
|
||||
|
@ -4093,7 +4092,7 @@ namespace Emby.Server.Implementations.Data
|
|||
if (query.MaxParentalRating.HasValue)
|
||||
{
|
||||
whereClauses.Add("InheritedParentalRatingValue<=@MaxParentalRating");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@MaxParentalRating", query.MaxParentalRating.Value);
|
||||
}
|
||||
|
@ -4150,7 +4149,7 @@ namespace Emby.Server.Implementations.Data
|
|||
if (!string.IsNullOrWhiteSpace(query.HasNoAudioTrackWithLanguage))
|
||||
{
|
||||
whereClauses.Add("((select language from MediaStreams where MediaStreams.ItemId=A.Guid and MediaStreams.StreamType='Audio' and MediaStreams.Language=@HasNoAudioTrackWithLanguage limit 1) is null)");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@HasNoAudioTrackWithLanguage", query.HasNoAudioTrackWithLanguage);
|
||||
}
|
||||
|
@ -4159,7 +4158,7 @@ namespace Emby.Server.Implementations.Data
|
|||
if (!string.IsNullOrWhiteSpace(query.HasNoInternalSubtitleTrackWithLanguage))
|
||||
{
|
||||
whereClauses.Add("((select language from MediaStreams where MediaStreams.ItemId=A.Guid and MediaStreams.StreamType='Subtitle' and MediaStreams.IsExternal=0 and MediaStreams.Language=@HasNoInternalSubtitleTrackWithLanguage limit 1) is null)");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@HasNoInternalSubtitleTrackWithLanguage", query.HasNoInternalSubtitleTrackWithLanguage);
|
||||
}
|
||||
|
@ -4168,7 +4167,7 @@ namespace Emby.Server.Implementations.Data
|
|||
if (!string.IsNullOrWhiteSpace(query.HasNoExternalSubtitleTrackWithLanguage))
|
||||
{
|
||||
whereClauses.Add("((select language from MediaStreams where MediaStreams.ItemId=A.Guid and MediaStreams.StreamType='Subtitle' and MediaStreams.IsExternal=1 and MediaStreams.Language=@HasNoExternalSubtitleTrackWithLanguage limit 1) is null)");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@HasNoExternalSubtitleTrackWithLanguage", query.HasNoExternalSubtitleTrackWithLanguage);
|
||||
}
|
||||
|
@ -4177,7 +4176,7 @@ namespace Emby.Server.Implementations.Data
|
|||
if (!string.IsNullOrWhiteSpace(query.HasNoSubtitleTrackWithLanguage))
|
||||
{
|
||||
whereClauses.Add("((select language from MediaStreams where MediaStreams.ItemId=A.Guid and MediaStreams.StreamType='Subtitle' and MediaStreams.Language=@HasNoSubtitleTrackWithLanguage limit 1) is null)");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@HasNoSubtitleTrackWithLanguage", query.HasNoSubtitleTrackWithLanguage);
|
||||
}
|
||||
|
@ -4230,7 +4229,7 @@ namespace Emby.Server.Implementations.Data
|
|||
if (query.Years.Length == 1)
|
||||
{
|
||||
whereClauses.Add("ProductionYear=@Years");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@Years", query.Years[0].ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
@ -4246,7 +4245,7 @@ namespace Emby.Server.Implementations.Data
|
|||
if (isVirtualItem.HasValue)
|
||||
{
|
||||
whereClauses.Add("IsVirtualItem=@IsVirtualItem");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@IsVirtualItem", isVirtualItem.Value);
|
||||
}
|
||||
|
@ -4280,7 +4279,7 @@ namespace Emby.Server.Implementations.Data
|
|||
if (queryMediaTypes.Length == 1)
|
||||
{
|
||||
whereClauses.Add("MediaType=@MediaTypes");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@MediaTypes", queryMediaTypes[0]);
|
||||
}
|
||||
|
@ -4300,7 +4299,7 @@ namespace Emby.Server.Implementations.Data
|
|||
foreach (var id in query.ItemIds)
|
||||
{
|
||||
includeIds.Add("Guid = @IncludeId" + index);
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@IncludeId" + index, id);
|
||||
}
|
||||
|
@ -4319,7 +4318,7 @@ namespace Emby.Server.Implementations.Data
|
|||
foreach (var id in query.ExcludeItemIds)
|
||||
{
|
||||
excludeIds.Add("Guid <> @ExcludeId" + index);
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@ExcludeId" + index, id);
|
||||
}
|
||||
|
@ -4330,7 +4329,7 @@ namespace Emby.Server.Implementations.Data
|
|||
whereClauses.Add(string.Join(" AND ", excludeIds));
|
||||
}
|
||||
|
||||
if (query.ExcludeProviderIds != null && query.ExcludeProviderIds.Count > 0)
|
||||
if (query.ExcludeProviderIds is not null && query.ExcludeProviderIds.Count > 0)
|
||||
{
|
||||
var excludeIds = new List<string>();
|
||||
|
||||
|
@ -4344,7 +4343,7 @@ namespace Emby.Server.Implementations.Data
|
|||
|
||||
var paramName = "@ExcludeProviderId" + index;
|
||||
excludeIds.Add("(ProviderIds is null or ProviderIds not like " + paramName + ")");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind(paramName, "%" + pair.Key + "=" + pair.Value + "%");
|
||||
}
|
||||
|
@ -4360,7 +4359,7 @@ namespace Emby.Server.Implementations.Data
|
|||
}
|
||||
}
|
||||
|
||||
if (query.HasAnyProviderId != null && query.HasAnyProviderId.Count > 0)
|
||||
if (query.HasAnyProviderId is not null && query.HasAnyProviderId.Count > 0)
|
||||
{
|
||||
var hasProviderIds = new List<string>();
|
||||
|
||||
|
@ -4387,7 +4386,7 @@ namespace Emby.Server.Implementations.Data
|
|||
hasProviderIds.Add("ProviderIds like " + paramName);
|
||||
|
||||
// this replaces the placeholder with a value, here: %key=val%
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind(paramName, "%" + pair.Key + "=" + pair.Value + "%");
|
||||
}
|
||||
|
@ -4469,7 +4468,7 @@ namespace Emby.Server.Implementations.Data
|
|||
{
|
||||
whereClauses.Add("Guid in (select itemId from AncestorIds where AncestorId=@AncestorId)");
|
||||
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@AncestorId", query.AncestorIds[0]);
|
||||
}
|
||||
|
@ -4485,7 +4484,7 @@ namespace Emby.Server.Implementations.Data
|
|||
{
|
||||
var inClause = "select guid from TypedBaseItems where PresentationUniqueKey=@AncestorWithPresentationUniqueKey";
|
||||
whereClauses.Add(string.Format(CultureInfo.InvariantCulture, "Guid in (select itemId from AncestorIds where AncestorId in ({0}))", inClause));
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@AncestorWithPresentationUniqueKey", query.AncestorWithPresentationUniqueKey);
|
||||
}
|
||||
|
@ -4495,7 +4494,7 @@ namespace Emby.Server.Implementations.Data
|
|||
{
|
||||
whereClauses.Add("SeriesPresentationUniqueKey=@SeriesPresentationUniqueKey");
|
||||
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@SeriesPresentationUniqueKey", query.SeriesPresentationUniqueKey);
|
||||
}
|
||||
|
@ -4504,7 +4503,7 @@ namespace Emby.Server.Implementations.Data
|
|||
if (query.BlockUnratedItems.Length == 1)
|
||||
{
|
||||
whereClauses.Add("(InheritedParentalRatingValue > 0 or UnratedType <> @UnratedType)");
|
||||
if (statement != null)
|
||||
if (statement is not null)
|
||||
{
|
||||
statement.TryBind("@UnratedType", query.BlockUnratedItems[0].ToString());
|
||||
}
|
||||
|
@ -4523,7 +4522,7 @@ namespace Emby.Server.Implementations.Data
|
|||
if (query.ExcludeInheritedTags.Length > 0)
|
||||
{
|
||||
var paramName = "@ExcludeInheritedTags";
|
||||
if (statement == null)
|
||||
if (statement is null)
|
||||
{
|
||||
int index = 0;
|
||||
string excludedTags = string.Join(',', query.ExcludeInheritedTags.Select(_ => paramName + index++));
|
||||
|
@ -4733,7 +4732,7 @@ namespace Emby.Server.Implementations.Data
|
|||
return false;
|
||||
}
|
||||
|
||||
if (query.User == null)
|
||||
if (query.User is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -4917,7 +4916,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||
{
|
||||
var whereClauses = new List<string>();
|
||||
|
||||
if (query.User != null && query.IsFavorite.HasValue)
|
||||
if (query.User is not null && query.IsFavorite.HasValue)
|
||||
{
|
||||
whereClauses.Add(@"p.Name IN (
|
||||
SELECT Name FROM TypedBaseItems WHERE UserDataKey IN (
|
||||
|
@ -5294,7 +5293,7 @@ AND Type = @InternalPersonType)");
|
|||
.Append(" group by PresentationUniqueKey");
|
||||
|
||||
if (query.OrderBy.Count != 0
|
||||
|| query.SimilarTo != null
|
||||
|| query.SimilarTo is not null
|
||||
|| !string.IsNullOrEmpty(query.SearchTerm))
|
||||
{
|
||||
stringBuilder.Append(GetOrderByText(query));
|
||||
|
@ -5362,7 +5361,7 @@ AND Type = @InternalPersonType)");
|
|||
statement.TryBind("@UserId", query.User.InternalId);
|
||||
}
|
||||
|
||||
if (typeSubQuery != null)
|
||||
if (typeSubQuery is not null)
|
||||
{
|
||||
GetWhereClauses(typeSubQuery, null);
|
||||
}
|
||||
|
@ -5383,7 +5382,7 @@ AND Type = @InternalPersonType)");
|
|||
foreach (var row in statement.ExecuteQuery())
|
||||
{
|
||||
var item = GetItem(row, query, hasProgramAttributes, hasEpisodeAttributes, hasServiceName, hasStartDate, hasTrailerTypes, hasArtistFields, hasSeriesFields);
|
||||
if (item != null)
|
||||
if (item is not null)
|
||||
{
|
||||
var countStartColumn = columns.Count - 1;
|
||||
|
||||
|
@ -5403,7 +5402,7 @@ AND Type = @InternalPersonType)");
|
|||
statement.TryBind("@UserId", query.User.InternalId);
|
||||
}
|
||||
|
||||
if (typeSubQuery != null)
|
||||
if (typeSubQuery is not null)
|
||||
{
|
||||
GetWhereClauses(typeSubQuery, null);
|
||||
}
|
||||
|
|
|
@ -140,10 +140,7 @@ namespace Emby.Server.Implementations.Data
|
|||
throw new ArgumentNullException(nameof(userId));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(key);
|
||||
|
||||
PersistUserData(userId, key, userData, cancellationToken);
|
||||
}
|
||||
|
@ -274,10 +271,7 @@ namespace Emby.Server.Implementations.Data
|
|||
throw new ArgumentNullException(nameof(userId));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(key);
|
||||
|
||||
using (var connection = GetConnection(true))
|
||||
{
|
||||
|
|
|
@ -23,14 +23,11 @@ namespace Emby.Server.Implementations.Data
|
|||
/// <exception cref="ArgumentNullException"><c>typeName</c> is null.</exception>
|
||||
public Type? GetType(string typeName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(typeName))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(typeName));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(typeName);
|
||||
|
||||
return _typeMap.GetOrAdd(typeName, k => AppDomain.CurrentDomain.GetAssemblies()
|
||||
.Select(a => a.GetType(k))
|
||||
.FirstOrDefault(t => t != null));
|
||||
.FirstOrDefault(t => t is not null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -213,7 +213,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
dto.DisplayPreferencesId = item.DisplayPreferencesId.ToString("N", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
if (user != null)
|
||||
if (user is not null)
|
||||
{
|
||||
AttachUserSpecificInfo(dto, item, user, options);
|
||||
}
|
||||
|
@ -235,14 +235,14 @@ namespace Emby.Server.Implementations.Dto
|
|||
|
||||
if (options.ContainsField(ItemFields.CanDelete))
|
||||
{
|
||||
dto.CanDelete = user == null
|
||||
dto.CanDelete = user is null
|
||||
? item.CanDelete()
|
||||
: item.CanDelete(user);
|
||||
}
|
||||
|
||||
if (options.ContainsField(ItemFields.CanDownload))
|
||||
{
|
||||
dto.CanDownload = user == null
|
||||
dto.CanDownload = user is null
|
||||
? item.CanDownload()
|
||||
: item.CanDownload(user);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
|
||||
var liveTvManager = LivetvManager;
|
||||
var activeRecording = liveTvManager.GetActiveRecordingInfo(item.Path);
|
||||
if (activeRecording != null)
|
||||
if (activeRecording is not null)
|
||||
{
|
||||
dto.Type = BaseItemKind.Recording;
|
||||
dto.CanDownload = false;
|
||||
|
@ -317,7 +317,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
{
|
||||
var dto = GetBaseItemDtoInternal(item, options, user);
|
||||
|
||||
if (taggedItems != null && options.ContainsField(ItemFields.ItemCounts))
|
||||
if (taggedItems is not null && options.ContainsField(ItemFields.ItemCounts))
|
||||
{
|
||||
SetItemByNameInfo(item, dto, taggedItems);
|
||||
}
|
||||
|
@ -417,7 +417,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
|
||||
if (options.ContainsField(ItemFields.BasicSyncInfo))
|
||||
{
|
||||
var userCanSync = user != null && user.HasPermission(PermissionKind.EnableContentDownloading);
|
||||
var userCanSync = user is not null && user.HasPermission(PermissionKind.EnableContentDownloading);
|
||||
if (userCanSync && item.SupportsExternalTransfer)
|
||||
{
|
||||
dto.SupportsSync = true;
|
||||
|
@ -460,7 +460,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
|
||||
var album = item.AlbumEntity;
|
||||
|
||||
if (album != null)
|
||||
if (album is not null)
|
||||
{
|
||||
dto.Album = album.Name;
|
||||
dto.AlbumId = album.Id;
|
||||
|
@ -491,7 +491,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
{
|
||||
return images
|
||||
.Select(p => GetImageCacheTag(item, p))
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
|
@ -570,8 +570,8 @@ namespace Emby.Server.Implementations.Dto
|
|||
_logger.LogError(ex, "Error getting person {Name}", c);
|
||||
return null;
|
||||
}
|
||||
}).Where(i => i != null)
|
||||
.Where(i => user == null ?
|
||||
}).Where(i => i is not null)
|
||||
.Where(i => user is null ?
|
||||
true :
|
||||
i.IsVisible(user))
|
||||
.GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
|
||||
|
@ -593,13 +593,13 @@ namespace Emby.Server.Implementations.Dto
|
|||
{
|
||||
baseItemPerson.PrimaryImageTag = GetTagAndFillBlurhash(dto, entity, ImageType.Primary);
|
||||
baseItemPerson.Id = entity.Id;
|
||||
if (dto.ImageBlurHashes != null)
|
||||
if (dto.ImageBlurHashes is not null)
|
||||
{
|
||||
// Only add BlurHash for the person's image.
|
||||
baseItemPerson.ImageBlurHashes = new Dictionary<ImageType, Dictionary<string, string>>();
|
||||
foreach (var (imageType, blurHash) in dto.ImageBlurHashes)
|
||||
{
|
||||
if (blurHash != null)
|
||||
if (blurHash is not null)
|
||||
{
|
||||
baseItemPerson.ImageBlurHashes[imageType] = new Dictionary<string, string>();
|
||||
foreach (var (imageId, blurHashValue) in blurHash)
|
||||
|
@ -662,7 +662,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
private string GetTagAndFillBlurhash(BaseItemDto dto, BaseItem item, ImageType imageType, int imageIndex = 0)
|
||||
{
|
||||
var image = item.GetImageInfo(imageType, imageIndex);
|
||||
if (image != null)
|
||||
if (image is not null)
|
||||
{
|
||||
return GetTagAndFillBlurhash(dto, item, image);
|
||||
}
|
||||
|
@ -782,7 +782,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
{
|
||||
var tag = GetTagAndFillBlurhash(dto, item, image);
|
||||
|
||||
if (tag != null)
|
||||
if (tag is not null)
|
||||
{
|
||||
dto.ImageTags[image.Type] = tag;
|
||||
}
|
||||
|
@ -917,7 +917,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
|
||||
var albumParent = audio.AlbumEntity;
|
||||
|
||||
if (albumParent != null)
|
||||
if (albumParent is not null)
|
||||
{
|
||||
dto.AlbumId = albumParent.Id;
|
||||
dto.AlbumPrimaryImageTag = GetTagAndFillBlurhash(dto, albumParent, ImageType.Primary);
|
||||
|
@ -967,7 +967,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
{
|
||||
EnableImages = false
|
||||
});
|
||||
if (artist != null)
|
||||
if (artist is not null)
|
||||
{
|
||||
return new NameGuidPair
|
||||
{
|
||||
|
@ -977,7 +977,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
}
|
||||
|
||||
return null;
|
||||
}).Where(i => i != null).ToArray();
|
||||
}).Where(i => i is not null).ToArray();
|
||||
}
|
||||
|
||||
if (item is IHasAlbumArtist hasAlbumArtist)
|
||||
|
@ -1016,7 +1016,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
{
|
||||
EnableImages = false
|
||||
});
|
||||
if (artist != null)
|
||||
if (artist is not null)
|
||||
{
|
||||
return new NameGuidPair
|
||||
{
|
||||
|
@ -1026,7 +1026,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
}
|
||||
|
||||
return null;
|
||||
}).Where(i => i != null).ToArray();
|
||||
}).Where(i => i is not null).ToArray();
|
||||
}
|
||||
|
||||
// Add video info
|
||||
|
@ -1073,7 +1073,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
{
|
||||
MediaStream[] mediaStreams;
|
||||
|
||||
if (dto.MediaSources != null && dto.MediaSources.Length > 0)
|
||||
if (dto.MediaSources is not null && dto.MediaSources.Length > 0)
|
||||
{
|
||||
if (item.SourceType == SourceType.Channel)
|
||||
{
|
||||
|
@ -1140,10 +1140,10 @@ namespace Emby.Server.Implementations.Dto
|
|||
// if (options.ContainsField(ItemFields.SeriesPrimaryImage))
|
||||
{
|
||||
episodeSeries ??= episode.Series;
|
||||
if (episodeSeries != null)
|
||||
if (episodeSeries is not null)
|
||||
{
|
||||
dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, episodeSeries, ImageType.Primary);
|
||||
if (dto.ImageTags == null || !dto.ImageTags.ContainsKey(ImageType.Primary))
|
||||
if (dto.ImageTags is null || !dto.ImageTags.ContainsKey(ImageType.Primary))
|
||||
{
|
||||
AttachPrimaryImageAspectRatio(dto, episodeSeries);
|
||||
}
|
||||
|
@ -1153,7 +1153,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
if (options.ContainsField(ItemFields.SeriesStudio))
|
||||
{
|
||||
episodeSeries ??= episode.Series;
|
||||
if (episodeSeries != null)
|
||||
if (episodeSeries is not null)
|
||||
{
|
||||
dto.SeriesStudio = episodeSeries.Studios.FirstOrDefault();
|
||||
}
|
||||
|
@ -1179,7 +1179,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
if (options.ContainsField(ItemFields.SeriesStudio))
|
||||
{
|
||||
series ??= season.Series;
|
||||
if (series != null)
|
||||
if (series is not null)
|
||||
{
|
||||
dto.SeriesStudio = series.Studios.FirstOrDefault();
|
||||
}
|
||||
|
@ -1190,10 +1190,10 @@ namespace Emby.Server.Implementations.Dto
|
|||
// if (options.ContainsField(ItemFields.SeriesPrimaryImage))
|
||||
{
|
||||
series ??= season.Series;
|
||||
if (series != null)
|
||||
if (series is not null)
|
||||
{
|
||||
dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, series, ImageType.Primary);
|
||||
if (dto.ImageTags == null || !dto.ImageTags.ContainsKey(ImageType.Primary))
|
||||
if (dto.ImageTags is null || !dto.ImageTags.ContainsKey(ImageType.Primary))
|
||||
{
|
||||
AttachPrimaryImageAspectRatio(dto, series);
|
||||
}
|
||||
|
@ -1256,7 +1256,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
if (item.SourceType == SourceType.Channel)
|
||||
{
|
||||
var channel = _libraryManager.GetItemById(item.ChannelId);
|
||||
if (channel != null)
|
||||
if (channel is not null)
|
||||
{
|
||||
dto.ChannelName = channel.Name;
|
||||
}
|
||||
|
@ -1268,7 +1268,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
if (currentItem is MusicAlbum musicAlbum)
|
||||
{
|
||||
var artist = musicAlbum.GetMusicArtist(new DtoOptions(false));
|
||||
if (artist != null)
|
||||
if (artist is not null)
|
||||
{
|
||||
return artist;
|
||||
}
|
||||
|
@ -1276,7 +1276,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
|
||||
var parent = currentItem.DisplayParent ?? currentItem.GetOwner() ?? currentItem.GetParent();
|
||||
|
||||
if (parent == null && originalItem is not UserRootFolder && originalItem is not UserView && originalItem is not AggregateFolder && originalItem is not ICollectionFolder && originalItem is not Channel)
|
||||
if (parent is null && originalItem is not UserRootFolder && originalItem is not UserView && originalItem is not AggregateFolder && originalItem is not ICollectionFolder && originalItem is not Channel)
|
||||
{
|
||||
parent = _libraryManager.GetCollectionFolders(originalItem).FirstOrDefault();
|
||||
}
|
||||
|
@ -1309,53 +1309,53 @@ namespace Emby.Server.Implementations.Dto
|
|||
|
||||
var imageTags = dto.ImageTags;
|
||||
|
||||
while ((!(imageTags != null && imageTags.ContainsKey(ImageType.Logo)) && logoLimit > 0)
|
||||
|| (!(imageTags != null && imageTags.ContainsKey(ImageType.Art)) && artLimit > 0)
|
||||
|| (!(imageTags != null && imageTags.ContainsKey(ImageType.Thumb)) && thumbLimit > 0)
|
||||
while ((!(imageTags is not null && imageTags.ContainsKey(ImageType.Logo)) && logoLimit > 0)
|
||||
|| (!(imageTags is not null && imageTags.ContainsKey(ImageType.Art)) && artLimit > 0)
|
||||
|| (!(imageTags is not null && imageTags.ContainsKey(ImageType.Thumb)) && thumbLimit > 0)
|
||||
|| parent is Series)
|
||||
{
|
||||
parent ??= isFirst ? GetImageDisplayParent(item, item) ?? owner : parent;
|
||||
if (parent == null)
|
||||
if (parent is null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
var allImages = parent.ImageInfos;
|
||||
|
||||
if (logoLimit > 0 && !(imageTags != null && imageTags.ContainsKey(ImageType.Logo)) && dto.ParentLogoItemId is null)
|
||||
if (logoLimit > 0 && !(imageTags is not null && imageTags.ContainsKey(ImageType.Logo)) && dto.ParentLogoItemId is null)
|
||||
{
|
||||
var image = allImages.FirstOrDefault(i => i.Type == ImageType.Logo);
|
||||
|
||||
if (image != null)
|
||||
if (image is not null)
|
||||
{
|
||||
dto.ParentLogoItemId = parent.Id;
|
||||
dto.ParentLogoImageTag = GetTagAndFillBlurhash(dto, parent, image);
|
||||
}
|
||||
}
|
||||
|
||||
if (artLimit > 0 && !(imageTags != null && imageTags.ContainsKey(ImageType.Art)) && dto.ParentArtItemId is null)
|
||||
if (artLimit > 0 && !(imageTags is not null && imageTags.ContainsKey(ImageType.Art)) && dto.ParentArtItemId is null)
|
||||
{
|
||||
var image = allImages.FirstOrDefault(i => i.Type == ImageType.Art);
|
||||
|
||||
if (image != null)
|
||||
if (image is not null)
|
||||
{
|
||||
dto.ParentArtItemId = parent.Id;
|
||||
dto.ParentArtImageTag = GetTagAndFillBlurhash(dto, parent, image);
|
||||
}
|
||||
}
|
||||
|
||||
if (thumbLimit > 0 && !(imageTags != null && imageTags.ContainsKey(ImageType.Thumb)) && (dto.ParentThumbItemId is null || parent is Series) && parent is not ICollectionFolder && parent is not UserView)
|
||||
if (thumbLimit > 0 && !(imageTags is not null && imageTags.ContainsKey(ImageType.Thumb)) && (dto.ParentThumbItemId is null || parent is Series) && parent is not ICollectionFolder && parent is not UserView)
|
||||
{
|
||||
var image = allImages.FirstOrDefault(i => i.Type == ImageType.Thumb);
|
||||
|
||||
if (image != null)
|
||||
if (image is not null)
|
||||
{
|
||||
dto.ParentThumbItemId = parent.Id;
|
||||
dto.ParentThumbImageTag = GetTagAndFillBlurhash(dto, parent, image);
|
||||
}
|
||||
}
|
||||
|
||||
if (backdropLimit > 0 && !((dto.BackdropImageTags != null && dto.BackdropImageTags.Length > 0) || (dto.ParentBackdropImageTags != null && dto.ParentBackdropImageTags.Length > 0)))
|
||||
if (backdropLimit > 0 && !((dto.BackdropImageTags is not null && dto.BackdropImageTags.Length > 0) || (dto.ParentBackdropImageTags is not null && dto.ParentBackdropImageTags.Length > 0)))
|
||||
{
|
||||
var images = allImages.Where(i => i.Type == ImageType.Backdrop).Take(backdropLimit).ToList();
|
||||
|
||||
|
@ -1403,7 +1403,7 @@ namespace Emby.Server.Implementations.Dto
|
|||
{
|
||||
var imageInfo = item.GetImageInfo(ImageType.Primary, 0);
|
||||
|
||||
if (imageInfo == null)
|
||||
if (imageInfo is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="DiscUtils.Udf" Version="0.16.13" />
|
||||
<PackageReference Include="Jellyfin.XmlTv" Version="10.8.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.11" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.0" />
|
||||
<PackageReference Include="Mono.Nat" Version="3.0.4" />
|
||||
<PackageReference Include="prometheus-net.DotNetRuntime" Version="4.4.0" />
|
||||
<PackageReference Include="SQLitePCL.pretty.netstandard" Version="3.1.0" />
|
||||
|
@ -41,7 +41,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<!-- https://github.com/microsoft/ApplicationInsights-dotnet/issues/2047 -->
|
||||
|
@ -49,7 +49,7 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<CodeAnalysisTreatWarningsAsErrors>false</CodeAnalysisTreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Code Analyzers-->
|
||||
|
|
|
@ -191,7 +191,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||
|
||||
lock (_libraryChangedSyncLock)
|
||||
{
|
||||
if (LibraryUpdateTimer == null)
|
||||
if (LibraryUpdateTimer is null)
|
||||
{
|
||||
LibraryUpdateTimer = new Timer(
|
||||
LibraryUpdateTimerCallback,
|
||||
|
@ -227,7 +227,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||
|
||||
lock (_libraryChangedSyncLock)
|
||||
{
|
||||
if (LibraryUpdateTimer == null)
|
||||
if (LibraryUpdateTimer is null)
|
||||
{
|
||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite);
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||
|
||||
lock (_libraryChangedSyncLock)
|
||||
{
|
||||
if (LibraryUpdateTimer == null)
|
||||
if (LibraryUpdateTimer is null)
|
||||
{
|
||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration, Timeout.Infinite);
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||
|
||||
SendChangeNotifications(_itemsAdded.ToList(), itemsUpdated, _itemsRemoved.ToList(), foldersAddedTo, foldersRemovedFrom, CancellationToken.None).GetAwaiter().GetResult();
|
||||
|
||||
if (LibraryUpdateTimer != null)
|
||||
if (LibraryUpdateTimer is not null)
|
||||
{
|
||||
LibraryUpdateTimer.Dispose();
|
||||
LibraryUpdateTimer = null;
|
||||
|
@ -475,7 +475,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||
{
|
||||
if (dispose)
|
||||
{
|
||||
if (LibraryUpdateTimer != null)
|
||||
if (LibraryUpdateTimer is not null)
|
||||
{
|
||||
LibraryUpdateTimer.Dispose();
|
||||
LibraryUpdateTimer = null;
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||
|
||||
lock (_syncLock)
|
||||
{
|
||||
if (_updateTimer == null)
|
||||
if (_updateTimer is null)
|
||||
{
|
||||
_updateTimer = new Timer(
|
||||
UpdateTimerCallback,
|
||||
|
@ -75,11 +75,11 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||
var baseItem = e.Item;
|
||||
|
||||
// Go up one level for indicators
|
||||
if (baseItem != null)
|
||||
if (baseItem is not null)
|
||||
{
|
||||
var parent = baseItem.GetOwner() ?? baseItem.GetParent();
|
||||
|
||||
if (parent != null)
|
||||
if (parent is not null)
|
||||
{
|
||||
keys.Add(parent);
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||
|
||||
SendNotifications(changes, CancellationToken.None).GetAwaiter().GetResult();
|
||||
|
||||
if (_updateTimer != null)
|
||||
if (_updateTimer is not null)
|
||||
{
|
||||
_updateTimer.Dispose();
|
||||
_updateTimer = null;
|
||||
|
@ -145,7 +145,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_updateTimer != null)
|
||||
if (_updateTimer is not null)
|
||||
{
|
||||
_updateTimer.Dispose();
|
||||
_updateTimer = null;
|
||||
|
|
|
@ -164,7 +164,7 @@ namespace Emby.Server.Implementations.HttpServer
|
|||
ReadResult result = await reader.ReadAsync().ConfigureAwait(false);
|
||||
ReadOnlySequence<byte> buffer = result.Buffer;
|
||||
|
||||
if (OnReceive == null)
|
||||
if (OnReceive is null)
|
||||
{
|
||||
// Tell the PipeReader how much of the buffer we have consumed
|
||||
reader.AdvanceTo(buffer.End);
|
||||
|
@ -185,7 +185,7 @@ namespace Emby.Server.Implementations.HttpServer
|
|||
return;
|
||||
}
|
||||
|
||||
if (stub == null)
|
||||
if (stub is null)
|
||||
{
|
||||
_logger.LogError("Error processing web socket message");
|
||||
return;
|
||||
|
|
|
@ -40,10 +40,7 @@ namespace Emby.Server.Implementations.IO
|
|||
|
||||
private void AddAffectedPath(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
|
||||
if (!_affectedPaths.Contains(path, StringComparer.Ordinal))
|
||||
{
|
||||
|
@ -53,10 +50,7 @@ namespace Emby.Server.Implementations.IO
|
|||
|
||||
public void AddPath(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
|
||||
lock (_timerLock)
|
||||
{
|
||||
|
@ -80,7 +74,7 @@ namespace Emby.Server.Implementations.IO
|
|||
return;
|
||||
}
|
||||
|
||||
if (_timer == null)
|
||||
if (_timer is null)
|
||||
{
|
||||
_timer = new Timer(OnTimerCallback, null, TimeSpan.FromSeconds(_configurationManager.Configuration.LibraryMonitorDelay), TimeSpan.FromMilliseconds(-1));
|
||||
}
|
||||
|
@ -138,7 +132,7 @@ namespace Emby.Server.Implementations.IO
|
|||
IEnumerable<BaseItem> itemsToRefresh = paths
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.Select(GetAffectedBaseItem)
|
||||
.Where(item => item != null)
|
||||
.Where(item => item is not null)
|
||||
.GroupBy(x => x!.Id) // Removed null values in the previous .Where()
|
||||
.Select(x => x.First())!;
|
||||
|
||||
|
@ -178,21 +172,21 @@ namespace Emby.Server.Implementations.IO
|
|||
{
|
||||
BaseItem? item = null;
|
||||
|
||||
while (item == null && !string.IsNullOrEmpty(path))
|
||||
while (item is null && !string.IsNullOrEmpty(path))
|
||||
{
|
||||
item = _libraryManager.FindByPath(path, null);
|
||||
|
||||
path = System.IO.Path.GetDirectoryName(path) ?? string.Empty;
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
if (item is not null)
|
||||
{
|
||||
// If the item has been deleted find the first valid parent that still exists
|
||||
while (!Directory.Exists(item.Path) && !File.Exists(item.Path))
|
||||
{
|
||||
item = item.GetOwner() ?? item.GetParent();
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -206,7 +200,7 @@ namespace Emby.Server.Implementations.IO
|
|||
{
|
||||
lock (_timerLock)
|
||||
{
|
||||
if (_timer != null)
|
||||
if (_timer is not null)
|
||||
{
|
||||
_timer.Dispose();
|
||||
_timer = null;
|
||||
|
|
|
@ -71,20 +71,14 @@ namespace Emby.Server.Implementations.IO
|
|||
|
||||
public void ReportFileSystemChangeBeginning(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
|
||||
TemporarilyIgnore(path);
|
||||
}
|
||||
|
||||
public async void ReportFileSystemChangeComplete(string path, bool refreshPath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
|
||||
// This is an arbitrary amount of time, but delay it because file system writes often trigger events long after the file was actually written to.
|
||||
// Seeing long delays in some situations, especially over the network, sometimes up to 45 seconds
|
||||
|
@ -115,7 +109,7 @@ namespace Emby.Server.Implementations.IO
|
|||
|
||||
var options = _libraryManager.GetLibraryOptions(item);
|
||||
|
||||
if (options != null)
|
||||
if (options is not null)
|
||||
{
|
||||
return options.EnableRealtimeMonitor;
|
||||
}
|
||||
|
@ -197,10 +191,7 @@ namespace Emby.Server.Implementations.IO
|
|||
/// <exception cref="ArgumentNullException"><paramref name="path"/> is <c>null</c>.</exception>
|
||||
private static bool ContainsParentFolder(IEnumerable<string> lst, string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
|
||||
path = path.TrimEnd(Path.DirectorySeparatorChar);
|
||||
|
||||
|
@ -356,10 +347,7 @@ namespace Emby.Server.Implementations.IO
|
|||
|
||||
public void ReportFileSystemChanged(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
|
||||
var monitorPath = !IgnorePatterns.ShouldIgnore(path);
|
||||
|
||||
|
|
|
@ -48,10 +48,7 @@ namespace Emby.Server.Implementations.IO
|
|||
/// <exception cref="ArgumentNullException"><paramref name="filename"/> is <c>null</c>.</exception>
|
||||
public virtual bool IsShortcut(string filename)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filename));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(filename);
|
||||
|
||||
var extension = Path.GetExtension(filename);
|
||||
return _shortcutHandlers.Any(i => string.Equals(extension, i.Extension, StringComparison.OrdinalIgnoreCase));
|
||||
|
@ -65,10 +62,7 @@ namespace Emby.Server.Implementations.IO
|
|||
/// <exception cref="ArgumentNullException"><paramref name="filename"/> is <c>null</c>.</exception>
|
||||
public virtual string? ResolveShortcut(string filename)
|
||||
{
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filename));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(filename);
|
||||
|
||||
var extension = Path.GetExtension(filename);
|
||||
var handler = _shortcutHandlers.Find(i => string.Equals(extension, i.Extension, StringComparison.OrdinalIgnoreCase));
|
||||
|
@ -136,20 +130,13 @@ namespace Emby.Server.Implementations.IO
|
|||
/// <exception cref="ArgumentNullException">The shortcutPath or target is null.</exception>
|
||||
public virtual void CreateShortcut(string shortcutPath, string target)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shortcutPath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(shortcutPath));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(target))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(target));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(shortcutPath);
|
||||
ArgumentException.ThrowIfNullOrEmpty(target);
|
||||
|
||||
var extension = Path.GetExtension(shortcutPath);
|
||||
var handler = _shortcutHandlers.Find(i => string.Equals(extension, i.Extension, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (handler != null)
|
||||
if (handler is not null)
|
||||
{
|
||||
handler.Create(shortcutPath, target);
|
||||
}
|
||||
|
@ -488,15 +475,8 @@ namespace Emby.Server.Implementations.IO
|
|||
/// <param name="file2">The file2.</param>
|
||||
public virtual void SwapFiles(string file1, string file2)
|
||||
{
|
||||
if (string.IsNullOrEmpty(file1))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(file1));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(file2))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(file2));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(file1);
|
||||
ArgumentException.ThrowIfNullOrEmpty(file2);
|
||||
|
||||
var temp1 = Path.Combine(_tempPath, Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture));
|
||||
|
||||
|
@ -514,15 +494,8 @@ namespace Emby.Server.Implementations.IO
|
|||
/// <inheritdoc />
|
||||
public virtual bool ContainsSubPath(string parentPath, string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(parentPath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(parentPath));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(parentPath);
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
|
||||
return path.Contains(
|
||||
Path.TrimEndingDirectorySeparator(parentPath) + Path.DirectorySeparatorChar,
|
||||
|
@ -532,10 +505,7 @@ namespace Emby.Server.Implementations.IO
|
|||
/// <inheritdoc />
|
||||
public virtual string NormalizePath(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
|
||||
if (path.EndsWith(":\\", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -621,14 +591,14 @@ namespace Emby.Server.Implementations.IO
|
|||
|
||||
// On linux and osx the search pattern is case sensitive
|
||||
// If we're OK with case-sensitivity, and we're only filtering for one extension, then use the native method
|
||||
if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions != null && extensions.Count == 1)
|
||||
if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions is not null && extensions.Count == 1)
|
||||
{
|
||||
return ToMetadata(new DirectoryInfo(path).EnumerateFiles("*" + extensions[0], enumerationOptions));
|
||||
}
|
||||
|
||||
var files = new DirectoryInfo(path).EnumerateFiles("*", enumerationOptions);
|
||||
|
||||
if (extensions != null && extensions.Count > 0)
|
||||
if (extensions is not null && extensions.Count > 0)
|
||||
{
|
||||
files = files.Where(i =>
|
||||
{
|
||||
|
@ -678,14 +648,14 @@ namespace Emby.Server.Implementations.IO
|
|||
|
||||
// On linux and osx the search pattern is case sensitive
|
||||
// If we're OK with case-sensitivity, and we're only filtering for one extension, then use the native method
|
||||
if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions != null && extensions.Length == 1)
|
||||
if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions is not null && extensions.Length == 1)
|
||||
{
|
||||
return Directory.EnumerateFiles(path, "*" + extensions[0], enumerationOptions);
|
||||
}
|
||||
|
||||
var files = Directory.EnumerateFiles(path, "*", enumerationOptions);
|
||||
|
||||
if (extensions != null && extensions.Length > 0)
|
||||
if (extensions is not null && extensions.Length > 0)
|
||||
{
|
||||
files = files.Where(i =>
|
||||
{
|
||||
|
|
|
@ -19,10 +19,7 @@ namespace Emby.Server.Implementations.IO
|
|||
|
||||
public string? Resolve(string shortcutPath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shortcutPath))
|
||||
{
|
||||
throw new ArgumentException("Shortcut path is empty or null.", nameof(shortcutPath));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(shortcutPath);
|
||||
|
||||
if (string.Equals(Path.GetExtension(shortcutPath), ".mblink", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -36,15 +33,8 @@ namespace Emby.Server.Implementations.IO
|
|||
|
||||
public void Create(string shortcutPath, string targetPath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shortcutPath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(shortcutPath));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(targetPath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(targetPath));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(shortcutPath);
|
||||
ArgumentException.ThrowIfNullOrEmpty(targetPath);
|
||||
|
||||
File.WriteAllText(shortcutPath, targetPath);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Emby.Server.Implementations.IO
|
|||
|
||||
await destination.WriteAsync(buffer.AsMemory(0, read), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (onStarted != null)
|
||||
if (onStarted is not null)
|
||||
{
|
||||
onStarted();
|
||||
onStarted = null;
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.Images
|
|||
{
|
||||
var image = item.GetImageInfo(imageType, 0);
|
||||
|
||||
if (image != null)
|
||||
if (image is not null)
|
||||
{
|
||||
if (!image.IsLocalFile)
|
||||
{
|
||||
|
@ -143,20 +143,20 @@ namespace Emby.Server.Implementations.Images
|
|||
if (useBackdrop)
|
||||
{
|
||||
var backdrop = i.GetImageInfo(ImageType.Backdrop, 0);
|
||||
if (backdrop != null && backdrop.IsLocalFile)
|
||||
if (backdrop is not null && backdrop.IsLocalFile)
|
||||
{
|
||||
return backdrop.Path;
|
||||
}
|
||||
}
|
||||
|
||||
var image = i.GetImageInfo(ImageType.Primary, 0);
|
||||
if (image != null && image.IsLocalFile)
|
||||
if (image is not null && image.IsLocalFile)
|
||||
{
|
||||
return image.Path;
|
||||
}
|
||||
|
||||
image = i.GetImageInfo(ImageType.Thumb, 0);
|
||||
if (image != null && image.IsLocalFile)
|
||||
if (image is not null && image.IsLocalFile)
|
||||
{
|
||||
return image.Path;
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ namespace Emby.Server.Implementations.Images
|
|||
{
|
||||
var image = item.GetImageInfo(type, 0);
|
||||
|
||||
if (image != null)
|
||||
if (image is not null)
|
||||
{
|
||||
if (!image.IsLocalFile)
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Emby.Server.Implementations.Images
|
|||
if (i is Episode episode)
|
||||
{
|
||||
var series = episode.Series;
|
||||
if (series != null)
|
||||
if (series is not null)
|
||||
{
|
||||
return series;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.Images
|
|||
if (i is Season season)
|
||||
{
|
||||
var series = season.Series;
|
||||
if (series != null)
|
||||
if (series is not null)
|
||||
{
|
||||
return series;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ namespace Emby.Server.Implementations.Images
|
|||
if (i is Audio audio)
|
||||
{
|
||||
var album = audio.AlbumEntity;
|
||||
if (album != null && album.HasImage(ImageType.Primary))
|
||||
if (album is not null && album.HasImage(ImageType.Primary))
|
||||
{
|
||||
return album;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Images
|
|||
if (subItem is Episode episode)
|
||||
{
|
||||
var series = episode.Series;
|
||||
if (series != null && series.HasImage(ImageType.Primary))
|
||||
if (series is not null && series.HasImage(ImageType.Primary))
|
||||
{
|
||||
return series;
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.Images
|
|||
|
||||
var parent = subItem.GetOwner() ?? subItem.GetParent();
|
||||
|
||||
if (parent != null && parent.HasImage(ImageType.Primary))
|
||||
if (parent is not null && parent.HasImage(ImageType.Primary))
|
||||
{
|
||||
if (parent is MusicAlbum)
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ namespace Emby.Server.Implementations.Images
|
|||
|
||||
return null;
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.GroupBy(x => x.Id)
|
||||
.Select(x => x.First())
|
||||
.ToList();
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
if (fileInfo.IsDirectory)
|
||||
{
|
||||
if (parent != null)
|
||||
if (parent is not null)
|
||||
{
|
||||
// Ignore extras folders but allow it at the collection level
|
||||
if (_namingOptions.AllExtrasTypesFolderNames.ContainsKey(filename)
|
||||
|
@ -65,7 +65,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
else
|
||||
{
|
||||
if (parent != null)
|
||||
if (parent is not null)
|
||||
{
|
||||
// Don't resolve these into audio files
|
||||
if (Path.GetFileNameWithoutExtension(filename.AsSpan()).Equals(BaseItem.ThemeSongFileName, StringComparison.Ordinal)
|
||||
|
|
|
@ -176,7 +176,7 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
get
|
||||
{
|
||||
if (_rootFolder == null)
|
||||
if (_rootFolder is null)
|
||||
{
|
||||
lock (_rootFolderSyncLock)
|
||||
{
|
||||
|
@ -465,9 +465,9 @@ namespace Emby.Server.Implementations.Library
|
|||
private BaseItem ResolveItem(ItemResolveArgs args, IItemResolver[] resolvers)
|
||||
{
|
||||
var item = (resolvers ?? EntityResolvers).Select(r => Resolve(args, r))
|
||||
.FirstOrDefault(i => i != null);
|
||||
.FirstOrDefault(i => i is not null);
|
||||
|
||||
if (item != null)
|
||||
if (item is not null)
|
||||
{
|
||||
ResolverHelper.SetInitialItemValues(item, args, _fileSystem, this);
|
||||
}
|
||||
|
@ -495,11 +495,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
private Guid GetNewItemIdInternal(string key, Type type, bool forceCaseInsensitive)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(key));
|
||||
}
|
||||
|
||||
ArgumentException.ThrowIfNullOrEmpty(key);
|
||||
ArgumentNullException.ThrowIfNull(type);
|
||||
|
||||
string programDataPath = _configurationManager.ApplicationPaths.ProgramDataPath;
|
||||
|
@ -536,7 +532,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
var fullPath = fileInfo.FullName;
|
||||
|
||||
if (string.IsNullOrEmpty(collectionType) && parent != null)
|
||||
if (string.IsNullOrEmpty(collectionType) && parent is not null)
|
||||
{
|
||||
collectionType = GetContentTypeOverride(fullPath, true);
|
||||
}
|
||||
|
@ -572,7 +568,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (parent != null && parent.IsPhysicalRoot)
|
||||
if (parent is not null && parent.IsPhysicalRoot)
|
||||
{
|
||||
_logger.LogError(ex, "Error in GetFilteredFileSystemEntries isPhysicalRoot: {0} IsVf: {1}", isPhysicalRoot, isVf);
|
||||
|
||||
|
@ -654,9 +650,9 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
var fileList = files.Where(i => !IgnoreFile(i, parent)).ToList();
|
||||
|
||||
if (parent != null)
|
||||
if (parent is not null)
|
||||
{
|
||||
var multiItemResolvers = resolvers == null ? MultiItemResolvers : resolvers.OfType<IMultiItemResolver>().ToArray();
|
||||
var multiItemResolvers = resolvers is null ? MultiItemResolvers : resolvers.OfType<IMultiItemResolver>().ToArray();
|
||||
|
||||
foreach (var resolver in multiItemResolvers)
|
||||
{
|
||||
|
@ -697,7 +693,7 @@ namespace Emby.Server.Implementations.Library
|
|||
_logger.LogError(ex, "Error resolving path {Path}", file.FullName);
|
||||
}
|
||||
|
||||
if (result != null)
|
||||
if (result is not null)
|
||||
{
|
||||
yield return result;
|
||||
}
|
||||
|
@ -750,7 +746,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
var dbItem = GetItemById(folder.Id) as BasePluginFolder;
|
||||
|
||||
if (dbItem != null && string.Equals(dbItem.Path, folder.Path, StringComparison.OrdinalIgnoreCase))
|
||||
if (dbItem is not null && string.Equals(dbItem.Path, folder.Path, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
folder = dbItem;
|
||||
}
|
||||
|
@ -770,11 +766,11 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public Folder GetUserRootFolder()
|
||||
{
|
||||
if (_userRootFolder == null)
|
||||
if (_userRootFolder is null)
|
||||
{
|
||||
lock (_userRootFolderSyncLock)
|
||||
{
|
||||
if (_userRootFolder == null)
|
||||
if (_userRootFolder is null)
|
||||
{
|
||||
var userRootPath = _configurationManager.ApplicationPaths.DefaultUserViewsPath;
|
||||
|
||||
|
@ -792,7 +788,7 @@ namespace Emby.Server.Implementations.Library
|
|||
_logger.LogError(ex, "Error creating UserRootFolder {Path}", newItemId);
|
||||
}
|
||||
|
||||
if (tmpItem == null)
|
||||
if (tmpItem is null)
|
||||
{
|
||||
_logger.LogDebug("Creating new userRootFolder with DeepCopy");
|
||||
tmpItem = ((Folder)ResolvePath(_fileSystem.GetDirectoryInfo(userRootPath))).DeepCopy<Folder, UserRootFolder>();
|
||||
|
@ -818,10 +814,7 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
// If this returns multiple items it could be tricky figuring out which one is correct.
|
||||
// In most cases, the newest one will be and the others obsolete but not yet cleaned up
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(path));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||
|
||||
var query = new InternalItemsQuery
|
||||
{
|
||||
|
@ -952,7 +945,7 @@ namespace Emby.Server.Implementations.Library
|
|||
.Cast<T>()
|
||||
.FirstOrDefault();
|
||||
|
||||
if (existing != null)
|
||||
if (existing is not null)
|
||||
{
|
||||
return existing;
|
||||
}
|
||||
|
@ -961,7 +954,7 @@ namespace Emby.Server.Implementations.Library
|
|||
var path = getPathFn(name);
|
||||
var id = GetItemByNameId<T>(path);
|
||||
var item = GetItemById(id) as T;
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
item = new T
|
||||
{
|
||||
|
@ -1181,7 +1174,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return null;
|
||||
}
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.OrderBy(i => i)
|
||||
.ToArray(),
|
||||
|
||||
|
@ -1190,17 +1183,17 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
var libraryFolder = allCollectionFolders.FirstOrDefault(i => string.Equals(i.Path, dir, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (libraryFolder != null && libraryFolder.HasImage(ImageType.Primary))
|
||||
if (libraryFolder is not null && libraryFolder.HasImage(ImageType.Primary))
|
||||
{
|
||||
info.PrimaryImageItemId = libraryFolder.Id.ToString("N", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
if (libraryFolder != null)
|
||||
if (libraryFolder is not null)
|
||||
{
|
||||
info.ItemId = libraryFolder.Id.ToString("N", CultureInfo.InvariantCulture);
|
||||
info.LibraryOptions = GetLibraryOptions(libraryFolder);
|
||||
|
||||
if (refreshQueue != null)
|
||||
if (refreshQueue is not null)
|
||||
{
|
||||
info.RefreshProgress = libraryFolder.GetRefreshProgress();
|
||||
|
||||
|
@ -1245,7 +1238,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
item = RetrieveItem(id);
|
||||
|
||||
if (item != null)
|
||||
if (item is not null)
|
||||
{
|
||||
RegisterItem(item);
|
||||
}
|
||||
|
@ -1258,13 +1251,13 @@ namespace Emby.Server.Implementations.Library
|
|||
if (query.Recursive && !query.ParentId.Equals(default))
|
||||
{
|
||||
var parent = GetItemById(query.ParentId);
|
||||
if (parent != null)
|
||||
if (parent is not null)
|
||||
{
|
||||
SetTopParentIdsOrAncestors(query, new List<BaseItem> { parent });
|
||||
}
|
||||
}
|
||||
|
||||
if (query.User != null)
|
||||
if (query.User is not null)
|
||||
{
|
||||
AddUserToQuery(query, query.User, allowExternalContent);
|
||||
}
|
||||
|
@ -1282,13 +1275,13 @@ namespace Emby.Server.Implementations.Library
|
|||
if (query.Recursive && !query.ParentId.Equals(default))
|
||||
{
|
||||
var parent = GetItemById(query.ParentId);
|
||||
if (parent != null)
|
||||
if (parent is not null)
|
||||
{
|
||||
SetTopParentIdsOrAncestors(query, new List<BaseItem> { parent });
|
||||
}
|
||||
}
|
||||
|
||||
if (query.User != null)
|
||||
if (query.User is not null)
|
||||
{
|
||||
AddUserToQuery(query, query.User);
|
||||
}
|
||||
|
@ -1302,7 +1295,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
if (query.AncestorIds.Length == 0 && query.TopParentIds.Length == 0)
|
||||
{
|
||||
if (query.User != null)
|
||||
if (query.User is not null)
|
||||
{
|
||||
AddUserToQuery(query, query.User);
|
||||
}
|
||||
|
@ -1313,7 +1306,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public QueryResult<BaseItem> QueryItems(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
if (query.User is not null)
|
||||
{
|
||||
AddUserToQuery(query, query.User);
|
||||
}
|
||||
|
@ -1331,7 +1324,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public List<Guid> GetItemIds(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
if (query.User is not null)
|
||||
{
|
||||
AddUserToQuery(query, query.User);
|
||||
}
|
||||
|
@ -1341,7 +1334,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetStudios(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
if (query.User is not null)
|
||||
{
|
||||
AddUserToQuery(query, query.User);
|
||||
}
|
||||
|
@ -1352,7 +1345,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetGenres(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
if (query.User is not null)
|
||||
{
|
||||
AddUserToQuery(query, query.User);
|
||||
}
|
||||
|
@ -1363,7 +1356,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetMusicGenres(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
if (query.User is not null)
|
||||
{
|
||||
AddUserToQuery(query, query.User);
|
||||
}
|
||||
|
@ -1374,7 +1367,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAllArtists(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
if (query.User is not null)
|
||||
{
|
||||
AddUserToQuery(query, query.User);
|
||||
}
|
||||
|
@ -1385,7 +1378,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetArtists(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
if (query.User is not null)
|
||||
{
|
||||
AddUserToQuery(query, query.User);
|
||||
}
|
||||
|
@ -1426,7 +1419,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAlbumArtists(InternalItemsQuery query)
|
||||
{
|
||||
if (query.User != null)
|
||||
if (query.User is not null)
|
||||
{
|
||||
AddUserToQuery(query, query.User);
|
||||
}
|
||||
|
@ -1440,13 +1433,13 @@ namespace Emby.Server.Implementations.Library
|
|||
if (query.Recursive && !query.ParentId.Equals(default))
|
||||
{
|
||||
var parent = GetItemById(query.ParentId);
|
||||
if (parent != null)
|
||||
if (parent is not null)
|
||||
{
|
||||
SetTopParentIdsOrAncestors(query, new List<BaseItem> { parent });
|
||||
}
|
||||
}
|
||||
|
||||
if (query.User != null)
|
||||
if (query.User is not null)
|
||||
{
|
||||
AddUserToQuery(query, query.User);
|
||||
}
|
||||
|
@ -1524,7 +1517,7 @@ namespace Emby.Server.Implementations.Library
|
|||
if (!view.DisplayParentId.Equals(default))
|
||||
{
|
||||
var displayParent = GetItemById(view.DisplayParentId);
|
||||
if (displayParent != null)
|
||||
if (displayParent is not null)
|
||||
{
|
||||
return GetTopParentIdsForQuery(displayParent, user);
|
||||
}
|
||||
|
@ -1535,7 +1528,7 @@ namespace Emby.Server.Implementations.Library
|
|||
if (!view.ParentId.Equals(default))
|
||||
{
|
||||
var displayParent = GetItemById(view.ParentId);
|
||||
if (displayParent != null)
|
||||
if (displayParent is not null)
|
||||
{
|
||||
return GetTopParentIdsForQuery(displayParent, user);
|
||||
}
|
||||
|
@ -1544,7 +1537,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
|
||||
// Handle grouping
|
||||
if (user != null && !string.IsNullOrEmpty(view.ViewType) && UserView.IsEligibleForGrouping(view.ViewType)
|
||||
if (user is not null && !string.IsNullOrEmpty(view.ViewType) && UserView.IsEligibleForGrouping(view.ViewType)
|
||||
&& user.GetPreference(PreferenceKind.GroupedFolders).Length > 0)
|
||||
{
|
||||
return GetUserRootFolder()
|
||||
|
@ -1564,7 +1557,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
|
||||
var topParent = item.GetTopParent();
|
||||
if (topParent != null)
|
||||
if (topParent is not null)
|
||||
{
|
||||
return new[] { topParent.Id };
|
||||
}
|
||||
|
@ -1589,7 +1582,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return items
|
||||
.SelectMany(i => i.ToArray())
|
||||
.Select(ResolveIntro)
|
||||
.Where(i => i != null);
|
||||
.Where(i => i is not null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1627,7 +1620,7 @@ namespace Emby.Server.Implementations.Library
|
|||
// Get an existing item by Id
|
||||
video = GetItemById(info.ItemId.Value) as Video;
|
||||
|
||||
if (video == null)
|
||||
if (video is null)
|
||||
{
|
||||
_logger.LogError("Unable to locate item with Id {ID}.", info.ItemId.Value);
|
||||
}
|
||||
|
@ -1639,7 +1632,7 @@ namespace Emby.Server.Implementations.Library
|
|||
// Try to resolve the path into a video
|
||||
video = ResolvePath(_fileSystem.GetFileSystemInfo(info.Path)) as Video;
|
||||
|
||||
if (video == null)
|
||||
if (video is null)
|
||||
{
|
||||
_logger.LogError("Intro resolver returned null for {Path}.", info.Path);
|
||||
}
|
||||
|
@ -1648,7 +1641,7 @@ namespace Emby.Server.Implementations.Library
|
|||
// Pull the saved db item that will include metadata
|
||||
var dbItem = GetItemById(video.Id) as Video;
|
||||
|
||||
if (dbItem != null)
|
||||
if (dbItem is not null)
|
||||
{
|
||||
video = dbItem;
|
||||
}
|
||||
|
@ -1685,7 +1678,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
IOrderedEnumerable<BaseItem> orderedItems = null;
|
||||
|
||||
foreach (var orderBy in sortBy.Select(o => GetComparer(o, user)).Where(c => c != null))
|
||||
foreach (var orderBy in sortBy.Select(o => GetComparer(o, user)).Where(c => c is not null))
|
||||
{
|
||||
if (isFirst)
|
||||
{
|
||||
|
@ -1711,7 +1704,7 @@ namespace Emby.Server.Implementations.Library
|
|||
foreach (var (name, sortOrder) in orderBy)
|
||||
{
|
||||
var comparer = GetComparer(name, user);
|
||||
if (comparer == null)
|
||||
if (comparer is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -1781,7 +1774,7 @@ namespace Emby.Server.Implementations.Library
|
|||
RegisterItem(item);
|
||||
}
|
||||
|
||||
if (ItemAdded != null)
|
||||
if (ItemAdded is not null)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
|
@ -1811,7 +1804,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
private bool ImageNeedsRefresh(ItemImageInfo image)
|
||||
{
|
||||
if (image.Path != null && image.IsLocalFile)
|
||||
if (image.Path is not null && image.IsLocalFile)
|
||||
{
|
||||
if (image.Width == 0 || image.Height == 0 || string.IsNullOrEmpty(image.BlurHash))
|
||||
{
|
||||
|
@ -1829,7 +1822,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
}
|
||||
|
||||
return image.Path != null && !image.IsLocalFile;
|
||||
return image.Path is not null && !image.IsLocalFile;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
@ -1838,7 +1831,7 @@ namespace Emby.Server.Implementations.Library
|
|||
ArgumentNullException.ThrowIfNull(item);
|
||||
|
||||
var outdated = forceUpdate
|
||||
? item.ImageInfos.Where(i => i.Path != null).ToArray()
|
||||
? item.ImageInfos.Where(i => i.Path is not null).ToArray()
|
||||
: item.ImageInfos.Where(ImageNeedsRefresh).ToArray();
|
||||
// Skip image processing if current or live tv source
|
||||
if (outdated.Length == 0 || item.SourceType != SourceType.Library)
|
||||
|
@ -1923,7 +1916,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
_itemRepository.SaveItems(items, cancellationToken);
|
||||
|
||||
if (ItemUpdated != null)
|
||||
if (ItemUpdated is not null)
|
||||
{
|
||||
foreach (var item in items)
|
||||
{
|
||||
|
@ -1975,7 +1968,7 @@ namespace Emby.Server.Implementations.Library
|
|||
/// <param name="parent">The parent item.</param>
|
||||
public void ReportItemRemoved(BaseItem item, BaseItem parent)
|
||||
{
|
||||
if (ItemRemoved != null)
|
||||
if (ItemRemoved is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -2006,11 +1999,11 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public List<Folder> GetCollectionFolders(BaseItem item)
|
||||
{
|
||||
while (item != null)
|
||||
while (item is not null)
|
||||
{
|
||||
var parent = item.GetParent();
|
||||
|
||||
if (parent == null || parent is AggregateFolder)
|
||||
if (parent is null || parent is AggregateFolder)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -2018,7 +2011,7 @@ namespace Emby.Server.Implementations.Library
|
|||
item = parent;
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return new List<Folder>();
|
||||
}
|
||||
|
@ -2028,11 +2021,11 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public List<Folder> GetCollectionFolders(BaseItem item, List<Folder> allUserRootChildren)
|
||||
{
|
||||
while (item != null)
|
||||
while (item is not null)
|
||||
{
|
||||
var parent = item.GetParent();
|
||||
|
||||
if (parent == null || parent is AggregateFolder)
|
||||
if (parent is null || parent is AggregateFolder)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -2040,7 +2033,7 @@ namespace Emby.Server.Implementations.Library
|
|||
item = parent;
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return new List<Folder>();
|
||||
}
|
||||
|
@ -2064,7 +2057,7 @@ namespace Emby.Server.Implementations.Library
|
|||
.Find(folder => folder is CollectionFolder) as CollectionFolder;
|
||||
}
|
||||
|
||||
return collectionFolder == null ? new LibraryOptions() : collectionFolder.GetLibraryOptions();
|
||||
return collectionFolder is null ? new LibraryOptions() : collectionFolder.GetLibraryOptions();
|
||||
}
|
||||
|
||||
public string GetContentType(BaseItem item)
|
||||
|
@ -2129,7 +2122,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
private string GetTopFolderContentType(BaseItem item)
|
||||
{
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -2137,7 +2130,7 @@ namespace Emby.Server.Implementations.Library
|
|||
while (!item.ParentId.Equals(default))
|
||||
{
|
||||
var parent = item.GetParent();
|
||||
if (parent == null || parent is AggregateFolder)
|
||||
if (parent is null || parent is AggregateFolder)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -2177,7 +2170,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
var refresh = false;
|
||||
|
||||
if (item == null || !string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase))
|
||||
if (item is null || !string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
|
@ -2225,7 +2218,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
var isNew = false;
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
|
@ -2251,7 +2244,7 @@ namespace Emby.Server.Implementations.Library
|
|||
if (!refresh && !item.DisplayParentId.Equals(default))
|
||||
{
|
||||
var displayParent = GetItemById(item.DisplayParentId);
|
||||
refresh = displayParent != null && displayParent.DateLastSaved > item.DateLastRefreshed;
|
||||
refresh = displayParent is not null && displayParent.DateLastSaved > item.DateLastRefreshed;
|
||||
}
|
||||
|
||||
if (refresh)
|
||||
|
@ -2289,7 +2282,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
var isNew = false;
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
|
@ -2315,7 +2308,7 @@ namespace Emby.Server.Implementations.Library
|
|||
if (!refresh && !item.DisplayParentId.Equals(default))
|
||||
{
|
||||
var displayParent = GetItemById(item.DisplayParentId);
|
||||
refresh = displayParent != null && displayParent.DateLastSaved > item.DateLastRefreshed;
|
||||
refresh = displayParent is not null && displayParent.DateLastSaved > item.DateLastRefreshed;
|
||||
}
|
||||
|
||||
if (refresh)
|
||||
|
@ -2340,10 +2333,7 @@ namespace Emby.Server.Implementations.Library
|
|||
string sortName,
|
||||
string uniqueId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(name));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(name);
|
||||
|
||||
var parentIdString = parentId.Equals(default)
|
||||
? null
|
||||
|
@ -2362,7 +2352,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
var isNew = false;
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
|
@ -2394,7 +2384,7 @@ namespace Emby.Server.Implementations.Library
|
|||
if (!refresh && !item.DisplayParentId.Equals(default))
|
||||
{
|
||||
var displayParent = GetItemById(item.DisplayParentId);
|
||||
refresh = displayParent != null && displayParent.DateLastSaved > item.DateLastRefreshed;
|
||||
refresh = displayParent is not null && displayParent.DateLastSaved > item.DateLastRefreshed;
|
||||
}
|
||||
|
||||
if (refresh)
|
||||
|
@ -2441,7 +2431,7 @@ namespace Emby.Server.Implementations.Library
|
|||
public bool FillMissingEpisodeNumbersFromPath(Episode episode, bool forceRefresh)
|
||||
{
|
||||
var series = episode.Series;
|
||||
bool? isAbsoluteNaming = series != null && string.Equals(series.DisplayOrder, "absolute", StringComparison.OrdinalIgnoreCase);
|
||||
bool? isAbsoluteNaming = series is not null && string.Equals(series.DisplayOrder, "absolute", StringComparison.OrdinalIgnoreCase);
|
||||
if (!isAbsoluteNaming.Value)
|
||||
{
|
||||
// In other words, no filter applied
|
||||
|
@ -2459,10 +2449,10 @@ namespace Emby.Server.Implementations.Library
|
|||
episodeInfo = resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming);
|
||||
// Resolve from parent folder if it's not the Season folder
|
||||
var parent = episode.GetParent();
|
||||
if (episodeInfo == null && parent.GetType() == typeof(Folder))
|
||||
if (episodeInfo is null && parent.GetType() == typeof(Folder))
|
||||
{
|
||||
episodeInfo = resolver.Resolve(parent.Path, true, null, null, isAbsoluteNaming);
|
||||
if (episodeInfo != null)
|
||||
if (episodeInfo is not null)
|
||||
{
|
||||
// add the container
|
||||
episodeInfo.Container = Path.GetExtension(episode.Path)?.TrimStart('.');
|
||||
|
@ -2582,7 +2572,7 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
var season = episode.Season;
|
||||
|
||||
if (season != null)
|
||||
if (season is not null)
|
||||
{
|
||||
episode.ParentIndexNumber = season.IndexNumber;
|
||||
}
|
||||
|
@ -2620,7 +2610,7 @@ namespace Emby.Server.Implementations.Library
|
|||
public IEnumerable<BaseItem> FindExtras(BaseItem owner, IReadOnlyList<FileSystemMetadata> fileSystemChildren, IDirectoryService directoryService)
|
||||
{
|
||||
var ownerVideoInfo = VideoResolver.Resolve(owner.Path, owner.IsFolder, _namingOptions);
|
||||
if (ownerVideoInfo == null)
|
||||
if (ownerVideoInfo is null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
|
@ -2640,7 +2630,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
|
||||
var extra = GetExtra(file, extraType.Value);
|
||||
if (extra != null)
|
||||
if (extra is not null)
|
||||
{
|
||||
yield return extra;
|
||||
}
|
||||
|
@ -2649,7 +2639,7 @@ namespace Emby.Server.Implementations.Library
|
|||
else if (!current.IsDirectory && _extraResolver.TryGetExtraTypeForOwner(current.FullName, ownerVideoInfo, out var extraType))
|
||||
{
|
||||
var extra = GetExtra(current, extraType.Value);
|
||||
if (extra != null)
|
||||
if (extra is not null)
|
||||
{
|
||||
yield return extra;
|
||||
}
|
||||
|
@ -2666,7 +2656,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
// Try to retrieve it from the db. If we don't find it, use the resolved version
|
||||
var itemById = GetItemById(extra.Id);
|
||||
if (itemById != null)
|
||||
if (itemById is not null)
|
||||
{
|
||||
extra = itemById;
|
||||
}
|
||||
|
@ -2681,10 +2671,10 @@ namespace Emby.Server.Implementations.Library
|
|||
public string GetPathAfterNetworkSubstitution(string path, BaseItem ownerItem)
|
||||
{
|
||||
string newPath;
|
||||
if (ownerItem != null)
|
||||
if (ownerItem is not null)
|
||||
{
|
||||
var libraryOptions = GetLibraryOptions(ownerItem);
|
||||
if (libraryOptions != null)
|
||||
if (libraryOptions is not null)
|
||||
{
|
||||
foreach (var pathInfo in libraryOptions.PathInfos)
|
||||
{
|
||||
|
@ -2753,8 +2743,8 @@ namespace Emby.Server.Implementations.Library
|
|||
return null;
|
||||
}
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.Where(i => query.User == null ?
|
||||
.Where(i => i is not null)
|
||||
.Where(i => query.User is null ?
|
||||
true :
|
||||
i.IsVisible(query.User))
|
||||
.ToList();
|
||||
|
@ -2838,10 +2828,10 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
|
||||
var mediaPathInfos = options.PathInfos;
|
||||
if (mediaPathInfos != null)
|
||||
if (mediaPathInfos is not null)
|
||||
{
|
||||
var invalidpath = mediaPathInfos.FirstOrDefault(i => !Directory.Exists(i.Path));
|
||||
if (invalidpath != null)
|
||||
if (invalidpath is not null)
|
||||
{
|
||||
throw new ArgumentException("The specified path does not exist: " + invalidpath.Path + ".");
|
||||
}
|
||||
|
@ -2853,7 +2843,7 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
Directory.CreateDirectory(virtualFolderPath);
|
||||
|
||||
if (collectionType != null)
|
||||
if (collectionType is not null)
|
||||
{
|
||||
var path = Path.Combine(virtualFolderPath, collectionType.ToString().ToLowerInvariant() + ".collection");
|
||||
|
||||
|
@ -2862,7 +2852,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
CollectionFolder.SaveLibraryOptions(virtualFolderPath, options);
|
||||
|
||||
if (mediaPathInfos != null)
|
||||
if (mediaPathInfos is not null)
|
||||
{
|
||||
foreach (var path in mediaPathInfos)
|
||||
{
|
||||
|
@ -3125,10 +3115,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public void RemoveMediaPath(string virtualFolderName, string mediaPath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(mediaPath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(mediaPath));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(mediaPath);
|
||||
|
||||
var rootFolderPath = _configurationManager.ApplicationPaths.DefaultUserViewsPath;
|
||||
var virtualFolderPath = Path.Combine(rootFolderPath, virtualFolderName);
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
}
|
||||
|
||||
if (mediaInfo == null)
|
||||
if (mediaInfo is null)
|
||||
{
|
||||
if (addProbeDelay)
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ namespace Emby.Server.Implementations.Library
|
|||
},
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (cacheFilePath != null)
|
||||
if (cacheFilePath is not null)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath));
|
||||
await using FileStream createStream = AsyncFile.OpenWrite(cacheFilePath);
|
||||
|
@ -130,7 +130,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
|
||||
if (audioStream == null || audioStream.Index == -1)
|
||||
if (audioStream is null || audioStream.Index == -1)
|
||||
{
|
||||
mediaSource.DefaultAudioStreamIndex = null;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
|
||||
var videoStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
|
||||
if (videoStream != null)
|
||||
if (videoStream is not null)
|
||||
{
|
||||
if (!videoStream.BitRate.HasValue)
|
||||
{
|
||||
|
|
|
@ -182,7 +182,7 @@ namespace Emby.Server.Implementations.Library
|
|||
source.SupportsDirectStream = SupportsDirectStream(source.Path, source.Protocol);
|
||||
}
|
||||
|
||||
if (user != null)
|
||||
if (user is not null)
|
||||
{
|
||||
SetDefaultAudioAndSubtitleStreamIndexes(item, source, user);
|
||||
|
||||
|
@ -248,7 +248,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
if (protocol == MediaProtocol.Http)
|
||||
{
|
||||
if (path != null)
|
||||
if (path is not null)
|
||||
{
|
||||
if (path.Contains(".m3u", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -328,7 +328,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
var sources = hasMediaSources.GetMediaSources(enablePathSubstitution);
|
||||
|
||||
if (user != null)
|
||||
if (user is not null)
|
||||
{
|
||||
foreach (var source in sources)
|
||||
{
|
||||
|
@ -357,7 +357,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
|
||||
var culture = _localizationManager.FindLanguageInfo(language);
|
||||
if (culture != null)
|
||||
if (culture is not null)
|
||||
{
|
||||
return culture.ThreeLetterISOLanguageNames;
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ namespace Emby.Server.Implementations.Library
|
|||
var preferredSubs = NormalizeLanguage(user.SubtitleLanguagePreference);
|
||||
|
||||
var defaultAudioIndex = source.DefaultAudioStreamIndex;
|
||||
var audioLangage = defaultAudioIndex == null
|
||||
var audioLangage = defaultAudioIndex is null
|
||||
? null
|
||||
: source.MediaStreams.Where(i => i.Type == MediaStreamType.Audio && i.Index == defaultAudioIndex).Select(i => i.Language).FirstOrDefault();
|
||||
|
||||
|
@ -417,13 +417,13 @@ namespace Emby.Server.Implementations.Library
|
|||
public void SetDefaultAudioAndSubtitleStreamIndexes(BaseItem item, MediaSourceInfo source, User user)
|
||||
{
|
||||
// Item would only be null if the app didn't supply ItemId as part of the live stream open request
|
||||
var mediaType = item == null ? MediaType.Video : item.MediaType;
|
||||
var mediaType = item is null ? MediaType.Video : item.MediaType;
|
||||
|
||||
if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var userData = item == null ? new UserItemData() : _userDataManager.GetUserData(user, item);
|
||||
var userData = item is null ? new UserItemData() : _userDataManager.GetUserData(user, item);
|
||||
|
||||
var allowRememberingSelection = item == null || item.EnableRememberingTrackSelections;
|
||||
var allowRememberingSelection = item is null || item.EnableRememberingTrackSelections;
|
||||
|
||||
SetDefaultAudioStreamIndex(source, userData, user, allowRememberingSelection);
|
||||
SetDefaultSubtitleStreamIndex(source, userData, user, allowRememberingSelection);
|
||||
|
@ -432,7 +432,7 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
var audio = source.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
|
||||
if (audio != null)
|
||||
if (audio is not null)
|
||||
{
|
||||
source.DefaultAudioStreamIndex = audio.Index;
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
|
||||
if (audioStream == null || audioStream.Index == -1)
|
||||
if (audioStream is null || audioStream.Index == -1)
|
||||
{
|
||||
mediaSource.DefaultAudioStreamIndex = null;
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
|
||||
var videoStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
|
||||
if (videoStream != null)
|
||||
if (videoStream is not null)
|
||||
{
|
||||
if (!videoStream.BitRate.HasValue)
|
||||
{
|
||||
|
@ -638,7 +638,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
}
|
||||
|
||||
if (mediaInfo == null)
|
||||
if (mediaInfo is null)
|
||||
{
|
||||
if (addProbeDelay)
|
||||
{
|
||||
|
@ -661,7 +661,7 @@ namespace Emby.Server.Implementations.Library
|
|||
},
|
||||
cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (cacheFilePath != null)
|
||||
if (cacheFilePath is not null)
|
||||
{
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath));
|
||||
await using FileStream createStream = File.Create(cacheFilePath);
|
||||
|
@ -713,7 +713,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
|
||||
if (audioStream == null || audioStream.Index == -1)
|
||||
if (audioStream is null || audioStream.Index == -1)
|
||||
{
|
||||
mediaSource.DefaultAudioStreamIndex = null;
|
||||
}
|
||||
|
@ -723,7 +723,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
|
||||
var videoStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
|
||||
if (videoStream != null)
|
||||
if (videoStream is not null)
|
||||
{
|
||||
if (!videoStream.BitRate.HasValue)
|
||||
{
|
||||
|
@ -762,10 +762,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public Task<Tuple<MediaSourceInfo, IDirectStreamProvider>> GetLiveStreamWithDirectStreamProvider(string id, CancellationToken cancellationToken)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(id);
|
||||
|
||||
// TODO probably shouldn't throw here but it is kept for "backwards compatibility"
|
||||
var info = GetLiveStreamInfo(id) ?? throw new ResourceNotFoundException();
|
||||
|
@ -774,10 +771,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public ILiveStream GetLiveStreamInfo(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(id);
|
||||
|
||||
if (_openStreams.TryGetValue(id, out ILiveStream info))
|
||||
{
|
||||
|
@ -801,10 +795,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
public async Task CloseLiveStream(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(id));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(id);
|
||||
|
||||
await _liveStreamSemaphore.WaitAsync().ConfigureAwait(false);
|
||||
|
||||
|
@ -835,10 +826,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
private (IMediaSourceProvider MediaSourceProvider, string KeyId) GetProvider(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
{
|
||||
throw new ArgumentException("Key can't be empty.", nameof(key));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(key);
|
||||
|
||||
var keys = key.Split(LiveStreamIdDelimeter, 2);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
var defaultStream = sortedStreams.FirstOrDefault(i => i.IsDefault);
|
||||
|
||||
if (defaultStream != null)
|
||||
if (defaultStream is not null)
|
||||
{
|
||||
return defaultStream.Index;
|
||||
}
|
||||
|
|
|
@ -25,13 +25,10 @@ namespace Emby.Server.Implementations.Library
|
|||
public static bool SetInitialItemValues(BaseItem item, Folder? parent, ILibraryManager libraryManager, IDirectoryService directoryService)
|
||||
{
|
||||
// This version of the below method has no ItemResolveArgs, so we have to require the path already being set
|
||||
if (string.IsNullOrEmpty(item.Path))
|
||||
{
|
||||
throw new ArgumentException("Item must have a Path");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(item.Path);
|
||||
|
||||
// If the resolver didn't specify this
|
||||
if (parent != null)
|
||||
if (parent is not null)
|
||||
{
|
||||
item.SetParent(parent);
|
||||
}
|
||||
|
@ -43,7 +40,7 @@ namespace Emby.Server.Implementations.Library
|
|||
|
||||
// Make sure DateCreated and DateModified have values
|
||||
var fileInfo = directoryService.GetFile(item.Path);
|
||||
if (fileInfo == null)
|
||||
if (fileInfo is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -71,7 +68,7 @@ namespace Emby.Server.Implementations.Library
|
|||
}
|
||||
|
||||
// If the resolver didn't specify this
|
||||
if (args.Parent != null)
|
||||
if (args.Parent is not null)
|
||||
{
|
||||
item.SetParent(args.Parent);
|
||||
}
|
||||
|
@ -113,7 +110,7 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
var childData = args.IsDirectory ? args.GetFileSystemEntryByPath(item.Path) : null;
|
||||
|
||||
if (childData != null)
|
||||
if (childData is not null)
|
||||
{
|
||||
SetDateCreated(item, childData);
|
||||
}
|
||||
|
@ -140,7 +137,7 @@ namespace Emby.Server.Implementations.Library
|
|||
if (config.UseFileCreationTimeForDateAdded)
|
||||
{
|
||||
// directoryService.getFile may return null
|
||||
if (info != null)
|
||||
if (info is not null)
|
||||
{
|
||||
var dateCreated = info.CreationTimeUtc;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
|||
{
|
||||
var result = ResolveMultipleInternal(parent, files, collectionType);
|
||||
|
||||
if (result != null)
|
||||
if (result is not null)
|
||||
{
|
||||
foreach (var item in result.Items)
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
|||
|
||||
// Use regular audio type for mixed libraries, owned items and music
|
||||
if (isMixedCollectionType ||
|
||||
args.Parent == null ||
|
||||
args.Parent is null ||
|
||||
isMusicCollectionType)
|
||||
{
|
||||
item = new MediaBrowser.Controller.Entities.Audio.Audio();
|
||||
|
@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
|||
item = new AudioBook();
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
if (item is not null)
|
||||
{
|
||||
item.IsShortcut = string.Equals(extension, ".strm", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
|
@ -144,7 +144,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
|||
// TODO: Allow GetMultiDiscMovie in here
|
||||
var result = ResolveMultipleAudio(args.Parent, args.GetActualFileSystemChildren(), parseName);
|
||||
|
||||
if (result == null || result.Items.Count != 1 || result.Items[0] is not AudioBook item)
|
||||
if (result is null || result.Items.Count != 1 || result.Items[0] is not AudioBook item)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
|||
Items = items
|
||||
};
|
||||
|
||||
var isInMixedFolder = resolverResult.Count > 1 || (parent != null && parent.IsTopParent);
|
||||
var isInMixedFolder = resolverResult.Count > 1 || (parent is not null && parent.IsTopParent);
|
||||
|
||||
foreach (var resolvedItem in resolverResult)
|
||||
{
|
||||
|
|
|
@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||
videoType = VideoType.Dvd;
|
||||
}
|
||||
|
||||
if (videoType == null)
|
||||
if (videoType is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||
videoInfo = VideoResolver.Resolve(args.Path, false, NamingOptions, parseName);
|
||||
}
|
||||
|
||||
if (videoInfo == null || (!videoInfo.IsStub && !VideoResolver.IsVideoFile(args.Path, NamingOptions)))
|
||||
if (videoInfo is null || (!videoInfo.IsStub && !VideoResolver.IsVideoFile(args.Path, NamingOptions)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Books
|
|||
|
||||
var extension = Path.GetExtension(args.Path);
|
||||
|
||||
if (extension != null && _validExtensions.Contains(extension, StringComparison.OrdinalIgnoreCase))
|
||||
if (extension is not null && _validExtensions.Contains(extension, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// It's a book
|
||||
return new Book
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||
public bool TryGetExtraTypeForOwner(string path, VideoFileInfo ownerVideoFileInfo, [NotNullWhen(true)] out ExtraType? extraType)
|
||||
{
|
||||
var extraResult = GetExtraInfo(path, _namingOptions);
|
||||
if (extraResult.ExtraType == null)
|
||||
if (extraResult.ExtraType is null)
|
||||
{
|
||||
extraType = null;
|
||||
return false;
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
|||
{
|
||||
base.SetInitialItemValues(item, args);
|
||||
|
||||
item.IsRoot = args.Parent == null;
|
||||
item.IsRoot = args.Parent is null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
|||
{
|
||||
var result = ResolveMultipleInternal(parent, files, collectionType);
|
||||
|
||||
if (result != null)
|
||||
if (result is not null)
|
||||
{
|
||||
foreach (var item in result.Items)
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
|||
if (string.IsNullOrEmpty(collectionType))
|
||||
{
|
||||
// Owned items will be caught by the video extra resolver
|
||||
if (args.Parent == null)
|
||||
if (args.Parent is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -127,10 +127,10 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
|||
}
|
||||
|
||||
// ignore extras
|
||||
return movie?.ExtraType == null ? movie : null;
|
||||
return movie?.ExtraType is null ? movie : null;
|
||||
}
|
||||
|
||||
if (args.Parent == null)
|
||||
if (args.Parent is null)
|
||||
{
|
||||
return base.Resolve(args);
|
||||
}
|
||||
|
@ -168,12 +168,12 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
|||
}
|
||||
|
||||
// Ignore extras
|
||||
if (item?.ExtraType != null)
|
||||
if (item?.ExtraType is not null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
if (item is not null)
|
||||
{
|
||||
item.IsInMixedFolder = true;
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
|||
if (string.IsNullOrEmpty(collectionType))
|
||||
{
|
||||
// Owned items should just use the plain video type
|
||||
if (parent == null)
|
||||
if (parent is null)
|
||||
{
|
||||
return ResolveVideos<Video>(parent, files, false, collectionType, false);
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
|||
|
||||
var videoInfos = files
|
||||
.Select(i => VideoResolver.Resolve(i.FullName, i.IsDirectory, NamingOptions, parseName))
|
||||
.Where(f => f != null)
|
||||
.Where(f => f is not null)
|
||||
.ToList();
|
||||
|
||||
var resolverResult = VideoListResolver.Resolve(videoInfos, NamingOptions, supportMultiEditions, parseName);
|
||||
|
@ -284,7 +284,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
|||
{
|
||||
var firstVideo = video.Files[0];
|
||||
var path = firstVideo.Path;
|
||||
if (video.ExtraType != null)
|
||||
if (video.ExtraType is not null)
|
||||
{
|
||||
result.ExtraFiles.Add(files.Find(f => string.Equals(f.FullName, path, StringComparison.OrdinalIgnoreCase)));
|
||||
continue;
|
||||
|
@ -568,7 +568,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
|||
|
||||
private bool IsInvalid(Folder parent, ReadOnlySpan<char> collectionType)
|
||||
{
|
||||
if (parent != null)
|
||||
if (parent is not null)
|
||||
{
|
||||
if (parent.IsRoot)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||
{
|
||||
var parent = args.Parent;
|
||||
|
||||
if (parent == null)
|
||||
if (parent is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -46,34 +46,34 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||
|
||||
// If the parent is a Season or Series and the parent is not an extras folder, then this is an Episode if the VideoResolver returns something
|
||||
// Also handle flat tv folders
|
||||
if (season != null ||
|
||||
if (season is not null ||
|
||||
string.Equals(args.GetCollectionType(), CollectionType.TvShows, StringComparison.OrdinalIgnoreCase) ||
|
||||
args.HasParent<Series>())
|
||||
{
|
||||
var episode = ResolveVideo<Episode>(args, false);
|
||||
|
||||
// Ignore extras
|
||||
if (episode == null || episode.ExtraType != null)
|
||||
if (episode is null || episode.ExtraType is not null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var series = parent as Series ?? parent.GetParents().OfType<Series>().FirstOrDefault();
|
||||
|
||||
if (series != null)
|
||||
if (series is not null)
|
||||
{
|
||||
episode.SeriesId = series.Id;
|
||||
episode.SeriesName = series.Name;
|
||||
}
|
||||
|
||||
if (season != null)
|
||||
if (season is not null)
|
||||
{
|
||||
episode.SeasonId = season.Id;
|
||||
episode.SeasonName = season.Name;
|
||||
}
|
||||
|
||||
// Assume season 1 if there's no season folder and a season number could not be determined
|
||||
if (season == null && !episode.ParentIndexNumber.HasValue && (episode.IndexNumber.HasValue || episode.PremiereDate.HasValue))
|
||||
if (season is null && !episode.ParentIndexNumber.HasValue && (episode.IndexNumber.HasValue || episode.PremiereDate.HasValue))
|
||||
{
|
||||
episode.ParentIndexNumber = 1;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||
|
||||
var episodeInfo = resolver.Resolve(testPath, true);
|
||||
|
||||
if (episodeInfo?.EpisodeNumber != null && episodeInfo.SeasonNumber.HasValue)
|
||||
if (episodeInfo?.EpisodeNumber is not null && episodeInfo.SeasonNumber.HasValue)
|
||||
{
|
||||
_logger.LogDebug(
|
||||
"Found folder underneath series with episode number: {0}. Season {1}. Episode {2}",
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||
{
|
||||
if (args.ContainsFileSystemEntryByName("tvshow.nfo"))
|
||||
{
|
||||
if (args.Parent != null && args.Parent.IsRoot)
|
||||
if (args.Parent is not null && args.Parent.IsRoot)
|
||||
{
|
||||
// For now, return null, but if we want to allow this in the future then add some additional checks to guard against a misplaced tvshow.nfo
|
||||
return null;
|
||||
|
@ -89,7 +89,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||
};
|
||||
}
|
||||
|
||||
if (args.Parent != null && args.Parent.IsRoot)
|
||||
if (args.Parent is not null && args.Parent.IsRoot)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
|||
var episodeResolver = new Naming.TV.EpisodeResolver(namingOptions);
|
||||
|
||||
var episodeInfo = episodeResolver.Resolve(fullName, false, true, false, fillExtendedInfo: false);
|
||||
if (episodeInfo != null && episodeInfo.EpisodeNumber.HasValue)
|
||||
if (episodeInfo is not null && episodeInfo.EpisodeNumber.HasValue)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -73,10 +73,7 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
var searchTerm = query.SearchTerm;
|
||||
|
||||
if (string.IsNullOrEmpty(searchTerm))
|
||||
{
|
||||
throw new ArgumentException("SearchTerm can't be empty.", nameof(query));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(searchTerm);
|
||||
|
||||
searchTerm = searchTerm.Trim().RemoveDiacritics();
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
var userData = _repository.GetUserData(internalUserId, keys);
|
||||
|
||||
if (userData != null)
|
||||
if (userData is not null)
|
||||
{
|
||||
return userData;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
var user = _userManager.GetUserById(query.UserId);
|
||||
|
||||
if (user == null)
|
||||
if (user is null)
|
||||
{
|
||||
throw new ArgumentException("User Id specified in the query does not exist.", nameof(query));
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ namespace Emby.Server.Implementations.Library
|
|||
continue;
|
||||
}
|
||||
|
||||
if (collectionFolder != null && UserView.IsEligibleForGrouping(folder) && user.IsFolderGrouped(folder.Id))
|
||||
if (collectionFolder is not null && UserView.IsEligibleForGrouping(folder) && user.IsFolderGrouped(folder.Id))
|
||||
{
|
||||
groupedFolders.Add(collectionFolder);
|
||||
continue;
|
||||
|
@ -208,15 +208,15 @@ namespace Emby.Server.Implementations.Library
|
|||
// Only grab the index container for media
|
||||
var container = item.IsFolder || !request.GroupItems ? null : item.LatestItemsIndexContainer;
|
||||
|
||||
if (container == null)
|
||||
if (container is null)
|
||||
{
|
||||
list.Add(new Tuple<BaseItem, List<BaseItem>>(null, new List<BaseItem> { item }));
|
||||
}
|
||||
else
|
||||
{
|
||||
var current = list.FirstOrDefault(i => i.Item1 != null && i.Item1.Id.Equals(container.Id));
|
||||
var current = list.FirstOrDefault(i => i.Item1 is not null && i.Item1.Id.Equals(container.Id));
|
||||
|
||||
if (current != null)
|
||||
if (current is not null)
|
||||
{
|
||||
current.Item2.Add(item);
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
|||
try
|
||||
{
|
||||
var boxSet = boxSets.FirstOrDefault(b => b?.Name == collectionName) as BoxSet;
|
||||
if (boxSet == null)
|
||||
if (boxSet is null)
|
||||
{
|
||||
// won't automatically create collection if only one movie in it
|
||||
if (movieIds.Count >= 2)
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
public Task Record(IDirectStreamProvider? directStreamProvider, MediaSourceInfo mediaSource, string targetFile, TimeSpan duration, Action onStarted, CancellationToken cancellationToken)
|
||||
{
|
||||
if (directStreamProvider != null)
|
||||
if (directStreamProvider is not null)
|
||||
{
|
||||
return RecordFromDirectStreamProvider(directStreamProvider, targetFile, duration, onStarted, cancellationToken);
|
||||
}
|
||||
|
|
|
@ -295,7 +295,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
}
|
||||
|
||||
var program = GetProgramInfoFromCache(timer);
|
||||
if (program == null)
|
||||
if (program is null)
|
||||
{
|
||||
OnTimerOutOfDate(timer);
|
||||
continue;
|
||||
|
@ -367,7 +367,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
var epgChannel = GetEpgChannelFromTunerChannel(info, tunerChannel, epgChannels);
|
||||
|
||||
if (epgChannel != null)
|
||||
if (epgChannel is not null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(epgChannel.Name))
|
||||
{
|
||||
|
@ -450,7 +450,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
var channel = epgChannelData.GetChannelById(mappedTunerChannelId);
|
||||
|
||||
if (channel != null)
|
||||
if (channel is not null)
|
||||
{
|
||||
return channel;
|
||||
}
|
||||
|
@ -473,7 +473,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
var channel = epgChannelData.GetChannelById(mappedTunerChannelId);
|
||||
|
||||
if (channel != null)
|
||||
if (channel is not null)
|
||||
{
|
||||
return channel;
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
var channel = epgChannelData.GetChannelByNumber(tunerChannelNumber);
|
||||
|
||||
if (channel != null)
|
||||
if (channel is not null)
|
||||
{
|
||||
return channel;
|
||||
}
|
||||
|
@ -502,7 +502,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
var channel = epgChannelData.GetChannelByName(normalizedName);
|
||||
|
||||
if (channel != null)
|
||||
if (channel is not null)
|
||||
{
|
||||
return channel;
|
||||
}
|
||||
|
@ -552,7 +552,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
}
|
||||
|
||||
var remove = _seriesTimerProvider.GetAll().FirstOrDefault(r => string.Equals(r.Id, timerId, StringComparison.OrdinalIgnoreCase));
|
||||
if (remove != null)
|
||||
if (remove is not null)
|
||||
{
|
||||
_seriesTimerProvider.Delete(remove);
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
private void CancelTimerInternal(string timerId, bool isSeriesCancelled, bool isManualCancellation)
|
||||
{
|
||||
var timer = _timerProvider.GetTimer(timerId);
|
||||
if (timer != null)
|
||||
if (timer is not null)
|
||||
{
|
||||
var statusChanging = timer.Status != RecordingStatus.Cancelled;
|
||||
timer.Status = RecordingStatus.Cancelled;
|
||||
|
@ -582,7 +582,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
_timerProvider.AddOrUpdate(timer, false);
|
||||
}
|
||||
|
||||
if (statusChanging && TimerCancelled != null)
|
||||
if (statusChanging && TimerCancelled is not null)
|
||||
{
|
||||
TimerCancelled(this, new GenericEventArgs<string>(timerId));
|
||||
}
|
||||
|
@ -617,7 +617,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
null :
|
||||
_timerProvider.GetTimerByProgramId(info.ProgramId);
|
||||
|
||||
if (existingTimer != null)
|
||||
if (existingTimer is not null)
|
||||
{
|
||||
if (existingTimer.Status == RecordingStatus.Cancelled
|
||||
|| existingTimer.Status == RecordingStatus.Completed)
|
||||
|
@ -642,13 +642,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
programInfo = GetProgramInfoFromCache(info);
|
||||
}
|
||||
|
||||
if (programInfo == null)
|
||||
if (programInfo is null)
|
||||
{
|
||||
_logger.LogInformation("Unable to find program with Id {0}. Will search using start date", info.ProgramId);
|
||||
programInfo = GetProgramInfoFromCache(info.ChannelId, info.StartDate);
|
||||
}
|
||||
|
||||
if (programInfo != null)
|
||||
if (programInfo is not null)
|
||||
{
|
||||
CopyProgramInfoToTimerInfo(programInfo, info);
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
// populate info.seriesID
|
||||
var program = GetProgramInfoFromCache(info.ProgramId);
|
||||
|
||||
if (program != null)
|
||||
if (program is not null)
|
||||
{
|
||||
info.SeriesId = program.ExternalSeriesId;
|
||||
}
|
||||
|
@ -714,7 +714,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
var instance = _seriesTimerProvider.GetAll().FirstOrDefault(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (instance != null)
|
||||
if (instance is not null)
|
||||
{
|
||||
instance.ChannelId = info.ChannelId;
|
||||
instance.Days = info.Days;
|
||||
|
@ -744,7 +744,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
var existingTimer = _timerProvider.GetTimer(updatedTimer.Id);
|
||||
|
||||
if (existingTimer == null)
|
||||
if (existingTimer is null)
|
||||
{
|
||||
throw new ResourceNotFoundException();
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
}
|
||||
};
|
||||
|
||||
if (program != null)
|
||||
if (program is not null)
|
||||
{
|
||||
defaults.SeriesId = program.SeriesId;
|
||||
defaults.ProgramId = program.Id;
|
||||
|
@ -912,7 +912,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
var epgChannel = await GetEpgChannelFromTunerChannel(provider.Item1, provider.Item2, channel, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (epgChannel == null)
|
||||
if (epgChannel is null)
|
||||
{
|
||||
_logger.LogDebug("EPG channel not found for tuner channel {0}-{1} from {2}-{3}", channel.Number, channel.Name, provider.Item1.Name, provider.Item2.ListingsId ?? string.Empty);
|
||||
continue;
|
||||
|
@ -945,9 +945,9 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
var provider = _liveTvManager.ListingProviders.FirstOrDefault(l => string.Equals(l.Type, i.Type, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
return provider == null ? null : new Tuple<IListingsProvider, ListingsProviderInfo>(provider, i);
|
||||
return provider is null ? null : new Tuple<IListingsProvider, ListingsProviderInfo>(provider, i);
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
@ -964,7 +964,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
null :
|
||||
currentLiveStreams.FirstOrDefault(i => string.Equals(i.OriginalStreamId, streamId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (result != null && result.EnableStreamSharing)
|
||||
if (result is not null && result.EnableStreamSharing)
|
||||
{
|
||||
result.ConsumerCount++;
|
||||
|
||||
|
@ -1134,7 +1134,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
// trim trailing period from the folder name
|
||||
var folderName = _fileSystem.GetValidFilename(timer.Name).Trim().TrimEnd('.').Trim();
|
||||
|
||||
if (metadata != null && metadata.ProductionYear.HasValue)
|
||||
if (metadata is not null && metadata.ProductionYear.HasValue)
|
||||
{
|
||||
folderName += " (" + metadata.ProductionYear.Value.ToString(CultureInfo.InvariantCulture) + ")";
|
||||
}
|
||||
|
@ -1232,13 +1232,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
programInfo = GetProgramInfoFromCache(timer);
|
||||
}
|
||||
|
||||
if (programInfo == null)
|
||||
if (programInfo is null)
|
||||
{
|
||||
_logger.LogInformation("Unable to find program with Id {0}. Will search using start date", timer.ProgramId);
|
||||
programInfo = GetProgramInfoFromCache(timer.ChannelId, timer.StartDate);
|
||||
}
|
||||
|
||||
if (programInfo != null)
|
||||
if (programInfo is not null)
|
||||
{
|
||||
CopyProgramInfoToTimerInfo(programInfo, timer);
|
||||
}
|
||||
|
@ -1412,7 +1412,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
var item = GetAffectedBaseItem(Path.GetDirectoryName(path));
|
||||
|
||||
if (item != null)
|
||||
if (item is not null)
|
||||
{
|
||||
_logger.LogInformation("Refreshing recording parent {Path}", item.Path);
|
||||
|
||||
|
@ -1437,19 +1437,19 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
var parentPath = Path.GetDirectoryName(path);
|
||||
|
||||
while (item == null && !string.IsNullOrEmpty(path))
|
||||
while (item is null && !string.IsNullOrEmpty(path))
|
||||
{
|
||||
item = _libraryManager.FindByPath(path, null);
|
||||
|
||||
path = Path.GetDirectoryName(path);
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
if (item is not null)
|
||||
{
|
||||
if (item.GetType() == typeof(Folder) && string.Equals(item.Path, parentPath, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var parentItem = item.GetParent();
|
||||
if (parentItem != null && parentItem is not AggregateFolder)
|
||||
if (parentItem is not null && parentItem is not AggregateFolder)
|
||||
{
|
||||
item = parentItem;
|
||||
}
|
||||
|
@ -1474,7 +1474,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
var seriesTimerId = timer.SeriesTimerId;
|
||||
var seriesTimer = _seriesTimerProvider.GetAll().FirstOrDefault(i => string.Equals(i.Id, seriesTimerId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (seriesTimer == null || seriesTimer.KeepUpTo <= 0)
|
||||
if (seriesTimer is null || seriesTimer.KeepUpTo <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1569,7 +1569,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
var libraryItem = _libraryManager.FindByPath(timer.RecordingPath, false);
|
||||
|
||||
if (libraryItem != null)
|
||||
if (libraryItem is not null)
|
||||
{
|
||||
_libraryManager.DeleteItem(
|
||||
libraryItem,
|
||||
|
@ -1695,7 +1695,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
_ => null
|
||||
};
|
||||
|
||||
if (imageSaveFilenameWithoutExtension == null)
|
||||
if (imageSaveFilenameWithoutExtension is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1714,7 +1714,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
(program.GetImageInfo(ImageType.Thumb, 0) ?? program.GetImageInfo(ImageType.Primary, 0)) :
|
||||
(program.GetImageInfo(ImageType.Primary, 0) ?? program.GetImageInfo(ImageType.Thumb, 0));
|
||||
|
||||
if (image != null)
|
||||
if (image is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1729,7 +1729,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
if (!program.IsSeries)
|
||||
{
|
||||
image = program.GetImageInfo(ImageType.Backdrop, 0);
|
||||
if (image != null)
|
||||
if (image is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1742,7 +1742,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
}
|
||||
|
||||
image = program.GetImageInfo(ImageType.Thumb, 0);
|
||||
if (image != null)
|
||||
if (image is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1755,7 +1755,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
}
|
||||
|
||||
image = program.GetImageInfo(ImageType.Logo, 0);
|
||||
if (image != null)
|
||||
if (image is not null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1782,7 +1782,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
}).FirstOrDefault() as LiveTvProgram;
|
||||
|
||||
// dummy this up
|
||||
if (program == null)
|
||||
if (program is null)
|
||||
{
|
||||
program = new LiveTvProgram
|
||||
{
|
||||
|
@ -2240,7 +2240,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
? null
|
||||
: _timerProvider.GetTimerByProgramId(timer.ProgramId));
|
||||
|
||||
if (existingTimer == null)
|
||||
if (existingTimer is null)
|
||||
{
|
||||
if (ShouldCancelTimerForSeriesTimer(seriesTimer, timer))
|
||||
{
|
||||
|
@ -2367,13 +2367,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
DtoOptions = new DtoOptions()
|
||||
}).FirstOrDefault() as LiveTvChannel;
|
||||
|
||||
if (channel != null && !string.IsNullOrWhiteSpace(channel.ExternalId))
|
||||
if (channel is not null && !string.IsNullOrWhiteSpace(channel.ExternalId))
|
||||
{
|
||||
tempChannelCache[parent.ChannelId] = channel;
|
||||
}
|
||||
}
|
||||
|
||||
if (channel != null || tempChannelCache.TryGetValue(parent.ChannelId, out channel))
|
||||
if (channel is not null || tempChannelCache.TryGetValue(parent.ChannelId, out channel))
|
||||
{
|
||||
channelId = channel.ExternalId;
|
||||
}
|
||||
|
@ -2426,13 +2426,13 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
DtoOptions = new DtoOptions()
|
||||
}).FirstOrDefault() as LiveTvChannel;
|
||||
|
||||
if (channel != null && !string.IsNullOrWhiteSpace(channel.ExternalId))
|
||||
if (channel is not null && !string.IsNullOrWhiteSpace(channel.ExternalId))
|
||||
{
|
||||
tempChannelCache[programInfo.ChannelId] = channel;
|
||||
}
|
||||
}
|
||||
|
||||
if (channel != null || tempChannelCache.TryGetValue(programInfo.ChannelId, out channel))
|
||||
if (channel is not null || tempChannelCache.TryGetValue(programInfo.ChannelId, out channel))
|
||||
{
|
||||
channelId = channel.ExternalId;
|
||||
}
|
||||
|
@ -2626,7 +2626,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
var configuredDevice = configuredDevices.FirstOrDefault(i => string.Equals(i.DeviceId, device.DeviceId, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (configuredDevice != null && !string.Equals(device.Url, configuredDevice.Url, StringComparison.OrdinalIgnoreCase))
|
||||
if (configuredDevice is not null && !string.Equals(device.Url, configuredDevice.Url, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
_logger.LogInformation("Tuner url has changed from {PreviousUrl} to {NewUrl}", configuredDevice.Url, device.Url);
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
// var audioChannels = 2;
|
||||
// var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
// if (audioStream != null)
|
||||
// if (audioStream is not null)
|
||||
// {
|
||||
// audioChannels = audioStream.Channels ?? audioChannels;
|
||||
// }
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
[MemberNotNull(nameof(_items))]
|
||||
private void EnsureLoaded()
|
||||
{
|
||||
if (_items != null)
|
||||
if (_items is not null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
{
|
||||
var bytes = File.ReadAllBytes(_dataPath);
|
||||
_items = JsonSerializer.Deserialize<T[]>(bytes, _jsonOptions);
|
||||
if (_items == null)
|
||||
if (_items is null)
|
||||
{
|
||||
Logger.LogError("Error deserializing {Path}, data was null", _dataPath);
|
||||
_items = Array.Empty<T>();
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (info.IsMovie && info.ProductionYear != null)
|
||||
else if (info.IsMovie && info.ProductionYear is not null)
|
||||
{
|
||||
name += " (" + info.ProductionYear + ")";
|
||||
}
|
||||
|
|
|
@ -16,10 +16,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
/// <inheritdoc />
|
||||
public override void Add(SeriesTimerInfo item)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.Id))
|
||||
{
|
||||
throw new ArgumentException("SeriesTimerInfo.Id cannot be null or empty.");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(item.Id);
|
||||
|
||||
base.Add(item);
|
||||
}
|
||||
|
|
|
@ -74,10 +74,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
|
||||
public override void Add(TimerInfo item)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.Id))
|
||||
{
|
||||
throw new ArgumentException("TimerInfo.Id cannot be null or empty.");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(item.Id);
|
||||
|
||||
base.Add(item);
|
||||
AddOrUpdateSystemTimer(item);
|
||||
|
@ -165,7 +162,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
|
|||
var timerId = (string?)state ?? throw new ArgumentNullException(nameof(state));
|
||||
|
||||
var timer = GetAll().FirstOrDefault(i => string.Equals(i.Id, timerId, StringComparison.OrdinalIgnoreCase));
|
||||
if (timer != null)
|
||||
if (timer is not null)
|
||||
{
|
||||
TimerFired?.Invoke(this, new GenericEventArgs<TimerInfo>(timer));
|
||||
}
|
||||
|
|
|
@ -74,10 +74,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
|
||||
public async Task<IEnumerable<ProgramInfo>> GetProgramsAsync(ListingsProviderInfo info, string channelId, DateTime startDateUtc, DateTime endDateUtc, CancellationToken cancellationToken)
|
||||
{
|
||||
if (string.IsNullOrEmpty(channelId))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(channelId));
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(channelId);
|
||||
|
||||
// Normalize incoming input
|
||||
channelId = channelId.Replace(".json.schedulesdirect.org", string.Empty, StringComparison.OrdinalIgnoreCase).TrimStart('I');
|
||||
|
@ -111,7 +108,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
using var response = await Send(options, true, info, cancellationToken).ConfigureAwait(false);
|
||||
await using var responseStream = await response.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
var dailySchedules = await JsonSerializer.DeserializeAsync<IReadOnlyList<DayDto>>(responseStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||
if (dailySchedules == null)
|
||||
if (dailySchedules is null)
|
||||
{
|
||||
return Array.Empty<ProgramInfo>();
|
||||
}
|
||||
|
@ -127,7 +124,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
using var innerResponse = await Send(programRequestOptions, true, info, cancellationToken).ConfigureAwait(false);
|
||||
await using var innerResponseStream = await innerResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
var programDetails = await JsonSerializer.DeserializeAsync<IReadOnlyList<ProgramDetailsDto>>(innerResponseStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||
if (programDetails == null)
|
||||
if (programDetails is null)
|
||||
{
|
||||
return Array.Empty<ProgramInfo>();
|
||||
}
|
||||
|
@ -153,7 +150,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
continue;
|
||||
}
|
||||
|
||||
if (images != null)
|
||||
if (images is not null)
|
||||
{
|
||||
var imageIndex = images.FindIndex(i => i.ProgramId == schedule.ProgramId[..10]);
|
||||
if (imageIndex > -1)
|
||||
|
@ -228,7 +225,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
|
||||
private ProgramInfo GetProgram(string channelId, ProgramDto programInfo, ProgramDetailsDto details)
|
||||
{
|
||||
if (programInfo.AirDateTime == null)
|
||||
if (programInfo.AirDateTime is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -266,7 +263,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
}
|
||||
|
||||
string episodeTitle = null;
|
||||
if (details.EpisodeTitle150 != null)
|
||||
if (details.EpisodeTitle150 is not null)
|
||||
{
|
||||
episodeTitle = details.EpisodeTitle150;
|
||||
}
|
||||
|
@ -283,7 +280,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
EpisodeTitle = episodeTitle,
|
||||
Audio = audioType,
|
||||
// IsNew = programInfo.@new ?? false,
|
||||
IsRepeat = programInfo.New == null,
|
||||
IsRepeat = programInfo.New is null,
|
||||
IsSeries = string.Equals(details.EntityType, "episode", StringComparison.OrdinalIgnoreCase),
|
||||
ImageUrl = details.PrimaryImage,
|
||||
ThumbImageUrl = details.ThumbImage,
|
||||
|
@ -315,13 +312,13 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
|
||||
info.ShowId = showId;
|
||||
|
||||
if (programInfo.VideoProperties != null)
|
||||
if (programInfo.VideoProperties is not null)
|
||||
{
|
||||
info.IsHD = programInfo.VideoProperties.Contains("hdtv", StringComparison.OrdinalIgnoreCase);
|
||||
info.Is3D = programInfo.VideoProperties.Contains("3d", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
if (details.ContentRating != null && details.ContentRating.Count > 0)
|
||||
if (details.ContentRating is not null && details.ContentRating.Count > 0)
|
||||
{
|
||||
info.OfficialRating = details.ContentRating[0].Code.Replace("TV", "TV-", StringComparison.Ordinal)
|
||||
.Replace("--", "-", StringComparison.Ordinal);
|
||||
|
@ -333,13 +330,13 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
}
|
||||
}
|
||||
|
||||
if (details.Descriptions != null)
|
||||
if (details.Descriptions is not null)
|
||||
{
|
||||
if (details.Descriptions.Description1000 != null && details.Descriptions.Description1000.Count > 0)
|
||||
if (details.Descriptions.Description1000 is not null && details.Descriptions.Description1000.Count > 0)
|
||||
{
|
||||
info.Overview = details.Descriptions.Description1000[0].Description;
|
||||
}
|
||||
else if (details.Descriptions.Description100 != null && details.Descriptions.Description100.Count > 0)
|
||||
else if (details.Descriptions.Description100 is not null && details.Descriptions.Description100.Count > 0)
|
||||
{
|
||||
info.Overview = details.Descriptions.Description100[0].Description;
|
||||
}
|
||||
|
@ -351,12 +348,12 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
|
||||
info.SeriesProviderIds[MetadataProvider.Zap2It.ToString()] = info.SeriesId;
|
||||
|
||||
if (details.Metadata != null)
|
||||
if (details.Metadata is not null)
|
||||
{
|
||||
foreach (var metadataProgram in details.Metadata)
|
||||
{
|
||||
var gracenote = metadataProgram.Gracenote;
|
||||
if (gracenote != null)
|
||||
if (gracenote is not null)
|
||||
{
|
||||
info.SeasonNumber = gracenote.Season;
|
||||
|
||||
|
@ -371,13 +368,13 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
}
|
||||
}
|
||||
|
||||
if (details.OriginalAirDate != null)
|
||||
if (details.OriginalAirDate is not null)
|
||||
{
|
||||
info.OriginalAirDate = details.OriginalAirDate;
|
||||
info.ProductionYear = info.OriginalAirDate.Value.Year;
|
||||
}
|
||||
|
||||
if (details.Movie != null)
|
||||
if (details.Movie is not null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(details.Movie.Year)
|
||||
&& int.TryParse(details.Movie.Year, out int year))
|
||||
|
@ -386,7 +383,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
}
|
||||
}
|
||||
|
||||
if (details.Genres != null)
|
||||
if (details.Genres is not null)
|
||||
{
|
||||
info.Genres = details.Genres.Where(g => !string.IsNullOrWhiteSpace(g)).ToList();
|
||||
info.IsNews = details.Genres.Contains("news", StringComparison.OrdinalIgnoreCase);
|
||||
|
@ -407,7 +404,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
.ThenByDescending(i => GetSizeOrder(i))
|
||||
.FirstOrDefault();
|
||||
|
||||
if (match == null)
|
||||
if (match is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -518,7 +515,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
|
||||
var root = await JsonSerializer.DeserializeAsync<IReadOnlyList<HeadendsDto>>(response, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (root != null)
|
||||
if (root is not null)
|
||||
{
|
||||
foreach (HeadendsDto headend in root)
|
||||
{
|
||||
|
@ -670,15 +667,8 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
{
|
||||
var token = await GetToken(info, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
throw new ArgumentException("Authentication required.");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(info.ListingsId))
|
||||
{
|
||||
throw new ArgumentException("Listings Id required");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(token);
|
||||
ArgumentException.ThrowIfNullOrEmpty(info.ListingsId);
|
||||
|
||||
_logger.LogInformation("Adding new LineUp ");
|
||||
|
||||
|
@ -689,17 +679,11 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
|
||||
private async Task<bool> HasLineup(ListingsProviderInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
if (string.IsNullOrEmpty(info.ListingsId))
|
||||
{
|
||||
throw new ArgumentException("Listings Id required");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(info.ListingsId);
|
||||
|
||||
var token = await GetToken(info, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
throw new ArgumentException("token required");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(token);
|
||||
|
||||
_logger.LogInformation("Headends on account ");
|
||||
|
||||
|
@ -732,23 +716,13 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
{
|
||||
if (validateLogin)
|
||||
{
|
||||
if (string.IsNullOrEmpty(info.Username))
|
||||
{
|
||||
throw new ArgumentException("Username is required");
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(info.Password))
|
||||
{
|
||||
throw new ArgumentException("Password is required");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(info.Username);
|
||||
ArgumentException.ThrowIfNullOrEmpty(info.Password);
|
||||
}
|
||||
|
||||
if (validateListings)
|
||||
{
|
||||
if (string.IsNullOrEmpty(info.ListingsId))
|
||||
{
|
||||
throw new ArgumentException("Listings Id required");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(info.ListingsId);
|
||||
|
||||
var hasLineup = await HasLineup(info, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
|
@ -767,17 +741,11 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
public async Task<List<ChannelInfo>> GetChannels(ListingsProviderInfo info, CancellationToken cancellationToken)
|
||||
{
|
||||
var listingsId = info.ListingsId;
|
||||
if (string.IsNullOrEmpty(listingsId))
|
||||
{
|
||||
throw new ArgumentException("ListingsId required");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(listingsId);
|
||||
|
||||
var token = await GetToken(info, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
throw new ArgumentException("token required");
|
||||
}
|
||||
ArgumentException.ThrowIfNullOrEmpty(token);
|
||||
|
||||
using var options = new HttpRequestMessage(HttpMethod.Get, ApiUrl + "/lineups/" + listingsId);
|
||||
options.Headers.TryAddWithoutValidation("token", token);
|
||||
|
@ -785,7 +753,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
using var httpResponse = await Send(options, true, info, cancellationToken).ConfigureAwait(false);
|
||||
await using var stream = await httpResponse.Content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);
|
||||
var root = await JsonSerializer.DeserializeAsync<ChannelDto>(stream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
||||
if (root == null)
|
||||
if (root is null)
|
||||
{
|
||||
return new List<ChannelInfo>();
|
||||
}
|
||||
|
@ -814,7 +782,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
Name = string.IsNullOrWhiteSpace(station.Name) ? channelNumber : station.Name
|
||||
};
|
||||
|
||||
if (station.Logo != null)
|
||||
if (station.Logo is not null)
|
||||
{
|
||||
channelInfo.ImageUrl = station.Logo.Url;
|
||||
}
|
||||
|
|
|
@ -151,9 +151,9 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
Overview = program.Description,
|
||||
ProductionYear = program.CopyrightDate?.Year,
|
||||
SeasonNumber = program.Episode?.Series,
|
||||
IsSeries = program.Episode != null,
|
||||
IsSeries = program.Episode is not null,
|
||||
IsRepeat = program.IsPreviouslyShown && !program.IsNew,
|
||||
IsPremiere = program.Premiere != null,
|
||||
IsPremiere = program.Premiere is not null,
|
||||
IsKids = program.Categories.Any(c => info.KidsCategories.Contains(c, StringComparison.OrdinalIgnoreCase)),
|
||||
IsMovie = program.Categories.Any(c => info.MovieCategories.Contains(c, StringComparison.OrdinalIgnoreCase)),
|
||||
IsNews = program.Categories.Any(c => info.NewsCategories.Contains(c, StringComparison.OrdinalIgnoreCase)),
|
||||
|
@ -162,7 +162,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
HasImage = !string.IsNullOrEmpty(program.Icon?.Source),
|
||||
OfficialRating = string.IsNullOrEmpty(program.Rating?.Value) ? null : program.Rating.Value,
|
||||
CommunityRating = program.StarRating,
|
||||
SeriesId = program.Episode == null ? null : program.Title?.GetMD5().ToString("N", CultureInfo.InvariantCulture)
|
||||
SeriesId = program.Episode is null ? null : program.Title?.GetMD5().ToString("N", CultureInfo.InvariantCulture)
|
||||
};
|
||||
|
||||
if (string.IsNullOrWhiteSpace(program.ProgramId))
|
||||
|
@ -243,7 +243,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
|
|||
{
|
||||
Id = c.Id,
|
||||
Name = c.DisplayName,
|
||||
ImageUrl = c.Icon != null && !string.IsNullOrEmpty(c.Icon.Source) ? c.Icon.Source : null,
|
||||
ImageUrl = string.IsNullOrEmpty(c.Icon.Source) ? null : c.Icon.Source,
|
||||
Number = string.IsNullOrWhiteSpace(c.Number) ? c.Id : c.Number
|
||||
}).ToList();
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user