Update StyleCop

This commit is contained in:
Bond_009 2021-12-24 18:28:27 +01:00
parent 2e7d173188
commit cbfa355e31
103 changed files with 550 additions and 465 deletions

View File

@ -6,7 +6,7 @@
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)/jellyfin.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)/jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup> </PropertyGroup>

View File

@ -690,16 +690,16 @@ namespace Emby.Dlna.ContentDirectory
var serverItems = new ServerItem[] var serverItems = new ServerItem[]
{ {
new (item, StubType.Latest), new(item, StubType.Latest),
new (item, StubType.Playlists), new(item, StubType.Playlists),
new (item, StubType.Albums), new(item, StubType.Albums),
new (item, StubType.AlbumArtists), new(item, StubType.AlbumArtists),
new (item, StubType.Artists), new(item, StubType.Artists),
new (item, StubType.Songs), new(item, StubType.Songs),
new (item, StubType.Genres), new(item, StubType.Genres),
new (item, StubType.FavoriteArtists), new(item, StubType.FavoriteArtists),
new (item, StubType.FavoriteAlbums), new(item, StubType.FavoriteAlbums),
new (item, StubType.FavoriteSongs) new(item, StubType.FavoriteSongs)
}; };
if (limit < serverItems.Length) if (limit < serverItems.Length)
@ -751,12 +751,12 @@ namespace Emby.Dlna.ContentDirectory
var array = new ServerItem[] var array = new ServerItem[]
{ {
new (item, StubType.ContinueWatching), new(item, StubType.ContinueWatching),
new (item, StubType.Latest), new(item, StubType.Latest),
new (item, StubType.Movies), new(item, StubType.Movies),
new (item, StubType.Collections), new(item, StubType.Collections),
new (item, StubType.Favorites), new(item, StubType.Favorites),
new (item, StubType.Genres) new(item, StubType.Genres)
}; };
if (limit < array.Length) if (limit < array.Length)
@ -836,13 +836,13 @@ namespace Emby.Dlna.ContentDirectory
var serverItems = new ServerItem[] var serverItems = new ServerItem[]
{ {
new (item, StubType.ContinueWatching), new(item, StubType.ContinueWatching),
new (item, StubType.NextUp), new(item, StubType.NextUp),
new (item, StubType.Latest), new(item, StubType.Latest),
new (item, StubType.Series), new(item, StubType.Series),
new (item, StubType.FavoriteSeries), new(item, StubType.FavoriteSeries),
new (item, StubType.FavoriteEpisodes), new(item, StubType.FavoriteEpisodes),
new (item, StubType.Genres) new(item, StubType.Genres)
}; };
if (limit < serverItems.Length) if (limit < serverItems.Length)

View File

@ -22,10 +22,14 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -11,6 +11,10 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" /> <ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" /> <ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
@ -24,7 +28,7 @@
<!-- Code analysers--> <!-- Code analysers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -101,8 +101,7 @@ namespace Emby.Drawing
public async Task ProcessImage(ImageProcessingOptions options, Stream toStream) public async Task ProcessImage(ImageProcessingOptions options, Stream toStream)
{ {
var file = await ProcessImage(options).ConfigureAwait(false); var file = await ProcessImage(options).ConfigureAwait(false);
using (var fileStream = AsyncFile.OpenRead(file.path))
using (var fileStream = AsyncFile.OpenRead(file.Item1))
{ {
await fileStream.CopyToAsync(toStream).ConfigureAwait(false); await fileStream.CopyToAsync(toStream).ConfigureAwait(false);
} }

View File

@ -33,7 +33,6 @@ namespace Emby.Naming.AudioBook
/// <returns>Returns IEnumerable of <see cref="AudioBookInfo"/>.</returns> /// <returns>Returns IEnumerable of <see cref="AudioBookInfo"/>.</returns>
public IEnumerable<AudioBookInfo> Resolve(IEnumerable<FileSystemMetadata> files) public IEnumerable<AudioBookInfo> Resolve(IEnumerable<FileSystemMetadata> files)
{ {
// File with empty fullname will be sorted out here. // File with empty fullname will be sorted out here.
var audiobookFileInfos = files var audiobookFileInfos = files
.Select(i => _audioBookResolver.Resolve(i.FullName)) .Select(i => _audioBookResolver.Resolve(i.FullName))

View File

@ -15,6 +15,10 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat> <SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Stability)'=='Unstable'"> <PropertyGroup Condition=" '$(Stability)'=='Unstable'">
<!-- Include all symbols in the main nupkg until Azure Artifact Feed starts supporting ingesting NuGet symbol packages. --> <!-- Include all symbols in the main nupkg until Azure Artifact Feed starts supporting ingesting NuGet symbol packages. -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder> <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
@ -44,7 +48,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -9,7 +9,7 @@ namespace Emby.Naming.Video
public static class Format3DParser public static class Format3DParser
{ {
// Static default result to save on allocation costs. // Static default result to save on allocation costs.
private static readonly Format3DResult _defaultResult = new (false, null); private static readonly Format3DResult _defaultResult = new(false, null);
/// <summary> /// <summary>
/// Parse 3D format related flags. /// Parse 3D format related flags.

View File

@ -24,7 +24,7 @@
<!-- Code analyzers--> <!-- Code analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -26,7 +26,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -120,7 +120,7 @@ namespace Emby.Server.Implementations
/// <summary> /// <summary>
/// The disposable parts. /// The disposable parts.
/// </summary> /// </summary>
private readonly ConcurrentDictionary<IDisposable, byte> _disposableParts = new (); private readonly ConcurrentDictionary<IDisposable, byte> _disposableParts = new();
private readonly IFileSystem _fileSystemManager; private readonly IFileSystem _fileSystemManager;
private readonly IConfiguration _startupConfig; private readonly IConfiguration _startupConfig;

View File

@ -160,21 +160,22 @@ namespace Emby.Server.Implementations.Data
protected bool TableExists(ManagedConnection connection, string name) protected bool TableExists(ManagedConnection connection, string name)
{ {
return connection.RunInTransaction( return connection.RunInTransaction(
db => db =>
{
using (var statement = PrepareStatement(db, "select DISTINCT tbl_name from sqlite_master"))
{ {
foreach (var row in statement.ExecuteQuery()) using (var statement = PrepareStatement(db, "select DISTINCT tbl_name from sqlite_master"))
{ {
if (string.Equals(name, row.GetString(0), StringComparison.OrdinalIgnoreCase)) foreach (var row in statement.ExecuteQuery())
{ {
return true; if (string.Equals(name, row.GetString(0), StringComparison.OrdinalIgnoreCase))
{
return true;
}
} }
} }
}
return false; return false;
}, ReadTransactionMode); },
ReadTransactionMode);
} }
protected List<string> GetColumnNames(IDatabaseConnection connection, string table) protected List<string> GetColumnNames(IDatabaseConnection connection, string table)

View File

@ -498,109 +498,110 @@ namespace Emby.Server.Implementations.Data
connection.RunQueries(queries); connection.RunQueries(queries);
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{ {
var existingColumnNames = GetColumnNames(db, "AncestorIds"); var existingColumnNames = GetColumnNames(db, "AncestorIds");
AddColumn(db, "AncestorIds", "AncestorIdText", "Text", existingColumnNames); AddColumn(db, "AncestorIds", "AncestorIdText", "Text", existingColumnNames);
existingColumnNames = GetColumnNames(db, "TypedBaseItems"); existingColumnNames = GetColumnNames(db, "TypedBaseItems");
AddColumn(db, "TypedBaseItems", "Path", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Path", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "StartDate", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "StartDate", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "EndDate", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "EndDate", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ChannelId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ChannelId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsMovie", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsMovie", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "CommunityRating", "Float", existingColumnNames); AddColumn(db, "TypedBaseItems", "CommunityRating", "Float", existingColumnNames);
AddColumn(db, "TypedBaseItems", "CustomRating", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "CustomRating", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IndexNumber", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IndexNumber", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsLocked", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsLocked", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Name", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Name", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "OfficialRating", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "OfficialRating", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "MediaType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "MediaType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Overview", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Overview", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ParentIndexNumber", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "ParentIndexNumber", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "PremiereDate", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "PremiereDate", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ProductionYear", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "ProductionYear", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ParentId", "GUID", existingColumnNames); AddColumn(db, "TypedBaseItems", "ParentId", "GUID", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Genres", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Genres", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SortName", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "SortName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ForcedSortName", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ForcedSortName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "RunTimeTicks", "BIGINT", existingColumnNames); AddColumn(db, "TypedBaseItems", "RunTimeTicks", "BIGINT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DateCreated", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "DateCreated", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DateModified", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "DateModified", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsSeries", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsSeries", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "EpisodeTitle", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "EpisodeTitle", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsRepeat", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsRepeat", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "PreferredMetadataLanguage", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "PreferredMetadataLanguage", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "PreferredMetadataCountryCode", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "PreferredMetadataCountryCode", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DateLastRefreshed", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "DateLastRefreshed", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DateLastSaved", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "DateLastSaved", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsInMixedFolder", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsInMixedFolder", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "LockedFields", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "LockedFields", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Studios", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Studios", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Audio", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Audio", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ExternalServiceId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ExternalServiceId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Tags", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Tags", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsFolder", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsFolder", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "InheritedParentalRatingValue", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "InheritedParentalRatingValue", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "UnratedType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "UnratedType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "TopParentId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "TopParentId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "TrailerTypes", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "TrailerTypes", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "CriticRating", "Float", existingColumnNames); AddColumn(db, "TypedBaseItems", "CriticRating", "Float", existingColumnNames);
AddColumn(db, "TypedBaseItems", "CleanName", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "CleanName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "PresentationUniqueKey", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "PresentationUniqueKey", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "OriginalTitle", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "OriginalTitle", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "PrimaryVersionId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "PrimaryVersionId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "DateLastMediaAdded", "DATETIME", existingColumnNames); AddColumn(db, "TypedBaseItems", "DateLastMediaAdded", "DATETIME", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Album", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Album", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "IsVirtualItem", "BIT", existingColumnNames); AddColumn(db, "TypedBaseItems", "IsVirtualItem", "BIT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SeriesName", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "SeriesName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "UserDataKey", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "UserDataKey", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SeasonName", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "SeasonName", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SeasonId", "GUID", existingColumnNames); AddColumn(db, "TypedBaseItems", "SeasonId", "GUID", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SeriesId", "GUID", existingColumnNames); AddColumn(db, "TypedBaseItems", "SeriesId", "GUID", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ExternalSeriesId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ExternalSeriesId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Tagline", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Tagline", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ProviderIds", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ProviderIds", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Images", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Images", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ProductionLocations", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ProductionLocations", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ExtraIds", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ExtraIds", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "TotalBitrate", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "TotalBitrate", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ExtraType", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ExtraType", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Artists", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "Artists", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "AlbumArtists", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "AlbumArtists", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ExternalId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ExternalId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "SeriesPresentationUniqueKey", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "SeriesPresentationUniqueKey", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "ShowId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "ShowId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "OwnerId", "Text", existingColumnNames); AddColumn(db, "TypedBaseItems", "OwnerId", "Text", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Width", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "Width", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Height", "INT", existingColumnNames); AddColumn(db, "TypedBaseItems", "Height", "INT", existingColumnNames);
AddColumn(db, "TypedBaseItems", "Size", "BIGINT", existingColumnNames); AddColumn(db, "TypedBaseItems", "Size", "BIGINT", existingColumnNames);
existingColumnNames = GetColumnNames(db, "ItemValues"); existingColumnNames = GetColumnNames(db, "ItemValues");
AddColumn(db, "ItemValues", "CleanValue", "Text", existingColumnNames); AddColumn(db, "ItemValues", "CleanValue", "Text", existingColumnNames);
existingColumnNames = GetColumnNames(db, ChaptersTableName); existingColumnNames = GetColumnNames(db, ChaptersTableName);
AddColumn(db, ChaptersTableName, "ImageDateModified", "DATETIME", existingColumnNames); AddColumn(db, ChaptersTableName, "ImageDateModified", "DATETIME", existingColumnNames);
existingColumnNames = GetColumnNames(db, "MediaStreams"); existingColumnNames = GetColumnNames(db, "MediaStreams");
AddColumn(db, "MediaStreams", "IsAvc", "BIT", existingColumnNames); AddColumn(db, "MediaStreams", "IsAvc", "BIT", existingColumnNames);
AddColumn(db, "MediaStreams", "TimeBase", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "TimeBase", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "CodecTimeBase", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "CodecTimeBase", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "Title", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "Title", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "NalLengthSize", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "NalLengthSize", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "Comment", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "Comment", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "CodecTag", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "CodecTag", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "PixelFormat", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "PixelFormat", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "BitDepth", "INT", existingColumnNames); AddColumn(db, "MediaStreams", "BitDepth", "INT", existingColumnNames);
AddColumn(db, "MediaStreams", "RefFrames", "INT", existingColumnNames); AddColumn(db, "MediaStreams", "RefFrames", "INT", existingColumnNames);
AddColumn(db, "MediaStreams", "KeyFrames", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "KeyFrames", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "IsAnamorphic", "BIT", existingColumnNames); AddColumn(db, "MediaStreams", "IsAnamorphic", "BIT", existingColumnNames);
AddColumn(db, "MediaStreams", "ColorPrimaries", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "ColorPrimaries", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "ColorSpace", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "ColorSpace", "TEXT", existingColumnNames);
AddColumn(db, "MediaStreams", "ColorTransfer", "TEXT", existingColumnNames); AddColumn(db, "MediaStreams", "ColorTransfer", "TEXT", existingColumnNames);
}, TransactionMode); },
TransactionMode);
connection.RunQueries(postQueries); connection.RunQueries(postQueries);
} }
@ -636,16 +637,17 @@ namespace Emby.Server.Implementations.Data
using (var connection = GetConnection()) using (var connection = GetConnection())
{ {
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{
using (var saveImagesStatement = PrepareStatement(db, "Update TypedBaseItems set Images=@Images where guid=@Id"))
{ {
saveImagesStatement.TryBind("@Id", item.Id.ToByteArray()); using (var saveImagesStatement = PrepareStatement(db, "Update TypedBaseItems set Images=@Images where guid=@Id"))
saveImagesStatement.TryBind("@Images", SerializeImages(item.ImageInfos)); {
saveImagesStatement.TryBind("@Id", item.Id.ToByteArray());
saveImagesStatement.TryBind("@Images", SerializeImages(item.ImageInfos));
saveImagesStatement.MoveNext(); saveImagesStatement.MoveNext();
} }
}, TransactionMode); },
TransactionMode);
} }
} }
@ -686,10 +688,11 @@ namespace Emby.Server.Implementations.Data
using (var connection = GetConnection()) using (var connection = GetConnection())
{ {
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{ {
SaveItemsInTranscation(db, tuples); SaveItemsInTranscation(db, tuples);
}, TransactionMode); },
TransactionMode);
} }
} }
@ -2134,13 +2137,14 @@ namespace Emby.Server.Implementations.Data
using (var connection = GetConnection()) using (var connection = GetConnection())
{ {
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{ {
// First delete chapters // First delete chapters
db.Execute("delete from " + ChaptersTableName + " where ItemId=@ItemId", idBlob); db.Execute("delete from " + ChaptersTableName + " where ItemId=@ItemId", idBlob);
InsertChapters(idBlob, chapters, db); InsertChapters(idBlob, chapters, db);
}, TransactionMode); },
TransactionMode);
} }
} }
@ -2944,69 +2948,70 @@ namespace Emby.Server.Implementations.Data
using (var connection = GetConnection(true)) using (var connection = GetConnection(true))
{ {
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{
var itemQueryStatement = PrepareStatement(db, itemQuery);
var totalRecordCountQueryStatement = PrepareStatement(db, totalRecordCountQuery);
if (!isReturningZeroItems)
{ {
using (var statement = itemQueryStatement) var itemQueryStatement = PrepareStatement(db, itemQuery);
var totalRecordCountQueryStatement = PrepareStatement(db, totalRecordCountQuery);
if (!isReturningZeroItems)
{ {
if (EnableJoinUserData(query)) using (var statement = itemQueryStatement)
{ {
statement.TryBind("@UserId", query.User.InternalId); if (EnableJoinUserData(query))
}
BindSimilarParams(query, statement);
BindSearchParams(query, statement);
// Running this again will bind the params
GetWhereClauses(query, statement);
var hasEpisodeAttributes = HasEpisodeAttributes(query);
var hasServiceName = HasServiceName(query);
var hasProgramAttributes = HasProgramAttributes(query);
var hasStartDate = HasStartDate(query);
var hasTrailerTypes = HasTrailerTypes(query);
var hasArtistFields = HasArtistFields(query);
var hasSeriesFields = HasSeriesFields(query);
foreach (var row in statement.ExecuteQuery())
{
var item = GetItem(row, query, hasProgramAttributes, hasEpisodeAttributes, hasServiceName, hasStartDate, hasTrailerTypes, hasArtistFields, hasSeriesFields);
if (item != null)
{ {
list.Add(item); statement.TryBind("@UserId", query.User.InternalId);
}
BindSimilarParams(query, statement);
BindSearchParams(query, statement);
// Running this again will bind the params
GetWhereClauses(query, statement);
var hasEpisodeAttributes = HasEpisodeAttributes(query);
var hasServiceName = HasServiceName(query);
var hasProgramAttributes = HasProgramAttributes(query);
var hasStartDate = HasStartDate(query);
var hasTrailerTypes = HasTrailerTypes(query);
var hasArtistFields = HasArtistFields(query);
var hasSeriesFields = HasSeriesFields(query);
foreach (var row in statement.ExecuteQuery())
{
var item = GetItem(row, query, hasProgramAttributes, hasEpisodeAttributes, hasServiceName, hasStartDate, hasTrailerTypes, hasArtistFields, hasSeriesFields);
if (item != null)
{
list.Add(item);
}
} }
} }
LogQueryTime("GetItems.ItemQuery", itemQuery, now);
} }
LogQueryTime("GetItems.ItemQuery", itemQuery, now); now = DateTime.UtcNow;
} if (query.EnableTotalRecordCount)
now = DateTime.UtcNow;
if (query.EnableTotalRecordCount)
{
using (var statement = totalRecordCountQueryStatement)
{ {
if (EnableJoinUserData(query)) using (var statement = totalRecordCountQueryStatement)
{ {
statement.TryBind("@UserId", query.User.InternalId); if (EnableJoinUserData(query))
{
statement.TryBind("@UserId", query.User.InternalId);
}
BindSimilarParams(query, statement);
BindSearchParams(query, statement);
// Running this again will bind the params
GetWhereClauses(query, statement);
result.TotalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
} }
BindSimilarParams(query, statement); LogQueryTime("GetItems.TotalRecordCount", totalRecordCountQuery, now);
BindSearchParams(query, statement);
// Running this again will bind the params
GetWhereClauses(query, statement);
result.TotalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
} }
},
LogQueryTime("GetItems.TotalRecordCount", totalRecordCountQuery, now); ReadTransactionMode);
}
}, ReadTransactionMode);
} }
result.Items = list; result.Items = list;
@ -3363,51 +3368,52 @@ namespace Emby.Server.Implementations.Data
using (var connection = GetConnection(true)) using (var connection = GetConnection(true))
{ {
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{
var statements = PrepareAll(db, statementTexts);
if (!isReturningZeroItems)
{ {
using (var statement = statements[0]) var statements = PrepareAll(db, statementTexts);
if (!isReturningZeroItems)
{ {
if (EnableJoinUserData(query)) using (var statement = statements[0])
{ {
statement.TryBind("@UserId", query.User.InternalId); if (EnableJoinUserData(query))
} {
statement.TryBind("@UserId", query.User.InternalId);
}
BindSimilarParams(query, statement); BindSimilarParams(query, statement);
BindSearchParams(query, statement); BindSearchParams(query, statement);
// Running this again will bind the params // Running this again will bind the params
GetWhereClauses(query, statement); GetWhereClauses(query, statement);
foreach (var row in statement.ExecuteQuery()) foreach (var row in statement.ExecuteQuery())
{ {
list.Add(row[0].ReadGuidFromBlob()); list.Add(row[0].ReadGuidFromBlob());
}
} }
} }
}
if (query.EnableTotalRecordCount) if (query.EnableTotalRecordCount)
{
using (var statement = statements[statements.Length - 1])
{ {
if (EnableJoinUserData(query)) using (var statement = statements[statements.Length - 1])
{ {
statement.TryBind("@UserId", query.User.InternalId); if (EnableJoinUserData(query))
{
statement.TryBind("@UserId", query.User.InternalId);
}
BindSimilarParams(query, statement);
BindSearchParams(query, statement);
// Running this again will bind the params
GetWhereClauses(query, statement);
result.TotalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
} }
BindSimilarParams(query, statement);
BindSearchParams(query, statement);
// Running this again will bind the params
GetWhereClauses(query, statement);
result.TotalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();
} }
} },
}, ReadTransactionMode); ReadTransactionMode);
} }
LogQueryTime("GetItemIds", commandText, now); LogQueryTime("GetItemIds", commandText, now);
@ -4954,10 +4960,11 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
using (var connection = GetConnection()) using (var connection = GetConnection())
{ {
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{ {
connection.ExecuteAll(sql); connection.ExecuteAll(sql);
}, TransactionMode); },
TransactionMode);
} }
} }
@ -4988,28 +4995,29 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
using (var connection = GetConnection()) using (var connection = GetConnection())
{ {
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{ {
var idBlob = id.ToByteArray(); var idBlob = id.ToByteArray();
// Delete people // Delete people
ExecuteWithSingleParam(db, "delete from People where ItemId=@Id", idBlob); ExecuteWithSingleParam(db, "delete from People where ItemId=@Id", idBlob);
// Delete chapters // Delete chapters
ExecuteWithSingleParam(db, "delete from " + ChaptersTableName + " where ItemId=@Id", idBlob); ExecuteWithSingleParam(db, "delete from " + ChaptersTableName + " where ItemId=@Id", idBlob);
// Delete media streams // Delete media streams
ExecuteWithSingleParam(db, "delete from mediastreams where ItemId=@Id", idBlob); ExecuteWithSingleParam(db, "delete from mediastreams where ItemId=@Id", idBlob);
// Delete ancestors // Delete ancestors
ExecuteWithSingleParam(db, "delete from AncestorIds where ItemId=@Id", idBlob); ExecuteWithSingleParam(db, "delete from AncestorIds where ItemId=@Id", idBlob);
// Delete item values // Delete item values
ExecuteWithSingleParam(db, "delete from ItemValues where ItemId=@Id", idBlob); ExecuteWithSingleParam(db, "delete from ItemValues where ItemId=@Id", idBlob);
// Delete the item // Delete the item
ExecuteWithSingleParam(db, "delete from TypedBaseItems where guid=@Id", idBlob); ExecuteWithSingleParam(db, "delete from TypedBaseItems where guid=@Id", idBlob);
}, TransactionMode); },
TransactionMode);
} }
} }
@ -5808,15 +5816,16 @@ AND Type = @InternalPersonType)");
using (var connection = GetConnection()) using (var connection = GetConnection())
{ {
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{ {
var itemIdBlob = itemId.ToByteArray(); var itemIdBlob = itemId.ToByteArray();
// First delete chapters // First delete chapters
db.Execute("delete from People where ItemId=@ItemId", itemIdBlob); db.Execute("delete from People where ItemId=@ItemId", itemIdBlob);
InsertPeople(itemIdBlob, people, db); InsertPeople(itemIdBlob, people, db);
}, TransactionMode); },
TransactionMode);
} }
} }
@ -5974,7 +5983,8 @@ AND Type = @InternalPersonType)");
db.Execute("delete from mediastreams where ItemId=@ItemId", itemIdBlob); db.Execute("delete from mediastreams where ItemId=@ItemId", itemIdBlob);
InsertMediaStreams(itemIdBlob, streams, db); InsertMediaStreams(itemIdBlob, streams, db);
}, TransactionMode); },
TransactionMode);
} }
} }
@ -6308,7 +6318,8 @@ AND Type = @InternalPersonType)");
db.Execute("delete from mediaattachments where ItemId=@ItemId", itemIdBlob); db.Execute("delete from mediaattachments where ItemId=@ItemId", itemIdBlob);
InsertMediaAttachments(itemIdBlob, attachments, db, cancellationToken); InsertMediaAttachments(itemIdBlob, attachments, db, cancellationToken);
}, TransactionMode); },
TransactionMode);
} }
} }

View File

@ -50,41 +50,42 @@ namespace Emby.Server.Implementations.Data
var users = userDatasTableExists ? null : userManager.Users; var users = userDatasTableExists ? null : userManager.Users;
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{
db.ExecuteAll(string.Join(';', new[]
{ {
"create table if not exists UserDatas (key nvarchar not null, userId INT not null, rating float null, played bit not null, playCount int not null, isFavorite bit not null, playbackPositionTicks bigint not null, lastPlayedDate datetime null, AudioStreamIndex INT, SubtitleStreamIndex INT)", db.ExecuteAll(string.Join(';', new[]
"drop index if exists idx_userdata",
"drop index if exists idx_userdata1",
"drop index if exists idx_userdata2",
"drop index if exists userdataindex1",
"drop index if exists userdataindex",
"drop index if exists userdataindex3",
"drop index if exists userdataindex4",
"create unique index if not exists UserDatasIndex1 on UserDatas (key, userId)",
"create index if not exists UserDatasIndex2 on UserDatas (key, userId, played)",
"create index if not exists UserDatasIndex3 on UserDatas (key, userId, playbackPositionTicks)",
"create index if not exists UserDatasIndex4 on UserDatas (key, userId, isFavorite)"
}));
if (userDataTableExists)
{
var existingColumnNames = GetColumnNames(db, "userdata");
AddColumn(db, "userdata", "InternalUserId", "int", existingColumnNames);
AddColumn(db, "userdata", "AudioStreamIndex", "int", existingColumnNames);
AddColumn(db, "userdata", "SubtitleStreamIndex", "int", existingColumnNames);
if (!userDatasTableExists)
{ {
ImportUserIds(db, users); "create table if not exists UserDatas (key nvarchar not null, userId INT not null, rating float null, played bit not null, playCount int not null, isFavorite bit not null, playbackPositionTicks bigint not null, lastPlayedDate datetime null, AudioStreamIndex INT, SubtitleStreamIndex INT)",
db.ExecuteAll("INSERT INTO UserDatas (key, userId, rating, played, playCount, isFavorite, playbackPositionTicks, lastPlayedDate, AudioStreamIndex, SubtitleStreamIndex) SELECT key, InternalUserId, rating, played, playCount, isFavorite, playbackPositionTicks, lastPlayedDate, AudioStreamIndex, SubtitleStreamIndex from userdata where InternalUserId not null"); "drop index if exists idx_userdata",
"drop index if exists idx_userdata1",
"drop index if exists idx_userdata2",
"drop index if exists userdataindex1",
"drop index if exists userdataindex",
"drop index if exists userdataindex3",
"drop index if exists userdataindex4",
"create unique index if not exists UserDatasIndex1 on UserDatas (key, userId)",
"create index if not exists UserDatasIndex2 on UserDatas (key, userId, played)",
"create index if not exists UserDatasIndex3 on UserDatas (key, userId, playbackPositionTicks)",
"create index if not exists UserDatasIndex4 on UserDatas (key, userId, isFavorite)"
}));
if (userDataTableExists)
{
var existingColumnNames = GetColumnNames(db, "userdata");
AddColumn(db, "userdata", "InternalUserId", "int", existingColumnNames);
AddColumn(db, "userdata", "AudioStreamIndex", "int", existingColumnNames);
AddColumn(db, "userdata", "SubtitleStreamIndex", "int", existingColumnNames);
if (!userDatasTableExists)
{
ImportUserIds(db, users);
db.ExecuteAll("INSERT INTO UserDatas (key, userId, rating, played, playCount, isFavorite, playbackPositionTicks, lastPlayedDate, AudioStreamIndex, SubtitleStreamIndex) SELECT key, InternalUserId, rating, played, playCount, isFavorite, playbackPositionTicks, lastPlayedDate, AudioStreamIndex, SubtitleStreamIndex from userdata where InternalUserId not null");
}
} }
} },
}, TransactionMode); TransactionMode);
} }
} }
@ -183,10 +184,11 @@ namespace Emby.Server.Implementations.Data
using (var connection = GetConnection()) using (var connection = GetConnection())
{ {
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{ {
SaveUserData(db, internalUserId, key, userData); SaveUserData(db, internalUserId, key, userData);
}, TransactionMode); },
TransactionMode);
} }
} }
@ -252,13 +254,14 @@ namespace Emby.Server.Implementations.Data
using (var connection = GetConnection()) using (var connection = GetConnection())
{ {
connection.RunInTransaction( connection.RunInTransaction(
db => db =>
{
foreach (var userItemData in userDataList)
{ {
SaveUserData(db, internalUserId, userItemData.Key, userItemData); foreach (var userItemData in userDataList)
} {
}, TransactionMode); SaveUserData(db, internalUserId, userItemData.Key, userItemData);
}
},
TransactionMode);
} }
} }

View File

@ -49,10 +49,14 @@
<NoWarn>AD0001</NoWarn> <NoWarn>AD0001</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -236,7 +236,8 @@ namespace Emby.Server.Implementations.HttpServer
{ {
MessageId = Guid.NewGuid(), MessageId = Guid.NewGuid(),
MessageType = SessionMessageType.KeepAlive MessageType = SessionMessageType.KeepAlive
}, CancellationToken.None); },
CancellationToken.None);
} }
/// <inheritdoc /> /// <inheritdoc />

View File

@ -34,7 +34,6 @@ namespace Emby.Server.Implementations.Library.Resolvers
"default" "default"
}; };
public PhotoResolver(IImageProcessor imageProcessor, NamingOptions namingOptions) public PhotoResolver(IImageProcessor imageProcessor, NamingOptions namingOptions)
{ {
_imageProcessor = imageProcessor; _imageProcessor = imageProcessor;

View File

@ -1,16 +1,16 @@
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Collections.Generic; using Jellyfin.Data.Enums;
using MediaBrowser.Controller.Collections; using MediaBrowser.Controller.Collections;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Querying;
using Jellyfin.Data.Enums;
using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library.Validators namespace Emby.Server.Implementations.Library.Validators
{ {

View File

@ -30,8 +30,8 @@ namespace Emby.Server.Implementations.QuickConnect
/// </summary> /// </summary>
private const int Timeout = 10; private const int Timeout = 10;
private readonly ConcurrentDictionary<string, QuickConnectResult> _currentRequests = new (); private readonly ConcurrentDictionary<string, QuickConnectResult> _currentRequests = new();
private readonly ConcurrentDictionary<string, (DateTime Timestamp, AuthenticationResult AuthenticationResult)> _authorizedSecrets = new (); private readonly ConcurrentDictionary<string, (DateTime Timestamp, AuthenticationResult AuthenticationResult)> _authorizedSecrets = new();
private readonly IServerConfigurationManager _config; private readonly IServerConfigurationManager _config;
private readonly ILogger<QuickConnectManager> _logger; private readonly ILogger<QuickConnectManager> _logger;

View File

@ -60,7 +60,7 @@ namespace Emby.Server.Implementations.Session
/// <summary> /// <summary>
/// The active connections. /// The active connections.
/// </summary> /// </summary>
private readonly ConcurrentDictionary<string, SessionInfo> _activeConnections = new (StringComparer.OrdinalIgnoreCase); private readonly ConcurrentDictionary<string, SessionInfo> _activeConnections = new(StringComparer.OrdinalIgnoreCase);
private Timer _idleTimer; private Timer _idleTimer;

View File

@ -122,7 +122,8 @@ namespace Emby.Server.Implementations.TV
Limit = limit, Limit = limit,
DtoOptions = new DtoOptions { Fields = new[] { ItemFields.SeriesPresentationUniqueKey }, EnableImages = false }, DtoOptions = new DtoOptions { Fields = new[] { ItemFields.SeriesPresentationUniqueKey }, EnableImages = false },
GroupBySeriesPresentationUniqueKey = true GroupBySeriesPresentationUniqueKey = true
}, parentsFolders.ToList()) },
parentsFolders.ToList())
.Cast<Episode>() .Cast<Episode>()
.Where(episode => !string.IsNullOrEmpty(episode.SeriesPresentationUniqueKey)) .Where(episode => !string.IsNullOrEmpty(episode.SeriesPresentationUniqueKey))
.Select(GetUniqueSeriesKey); .Select(GetUniqueSeriesKey);

View File

@ -264,7 +264,8 @@ namespace Jellyfin.Api.Controllers
ReplaceAllMetadata = true, ReplaceAllMetadata = true,
ReplaceAllImages = replaceAllImages, ReplaceAllImages = replaceAllImages,
SearchResult = searchResult SearchResult = searchResult
}, CancellationToken.None).ConfigureAwait(false); },
CancellationToken.None).ConfigureAwait(false);
return NoContent(); return NoContent();
} }

View File

@ -278,25 +278,26 @@ namespace Jellyfin.Api.Controllers
return _liveTvManager.GetRecordings( return _liveTvManager.GetRecordings(
new RecordingQuery new RecordingQuery
{ {
ChannelId = channelId, ChannelId = channelId,
UserId = userId ?? Guid.Empty, UserId = userId ?? Guid.Empty,
StartIndex = startIndex, StartIndex = startIndex,
Limit = limit, Limit = limit,
Status = status, Status = status,
SeriesTimerId = seriesTimerId, SeriesTimerId = seriesTimerId,
IsInProgress = isInProgress, IsInProgress = isInProgress,
EnableTotalRecordCount = enableTotalRecordCount, EnableTotalRecordCount = enableTotalRecordCount,
IsMovie = isMovie, IsMovie = isMovie,
IsNews = isNews, IsNews = isNews,
IsSeries = isSeries, IsSeries = isSeries,
IsKids = isKids, IsKids = isKids,
IsSports = isSports, IsSports = isSports,
IsLibraryItem = isLibraryItem, IsLibraryItem = isLibraryItem,
Fields = fields, Fields = fields,
ImageTypeLimit = imageTypeLimit, ImageTypeLimit = imageTypeLimit,
EnableImages = enableImages EnableImages = enableImages
}, dtoOptions); },
dtoOptions);
} }
/// <summary> /// <summary>
@ -489,14 +490,14 @@ namespace Jellyfin.Api.Controllers
[FromQuery] bool? isScheduled) [FromQuery] bool? isScheduled)
{ {
return await _liveTvManager.GetTimers( return await _liveTvManager.GetTimers(
new TimerQuery new TimerQuery
{ {
ChannelId = channelId, ChannelId = channelId,
SeriesTimerId = seriesTimerId, SeriesTimerId = seriesTimerId,
IsActive = isActive, IsActive = isActive,
IsScheduled = isScheduled IsScheduled = isScheduled
}, CancellationToken.None) },
.ConfigureAwait(false); CancellationToken.None).ConfigureAwait(false);
} }
/// <summary> /// <summary>
@ -867,7 +868,8 @@ namespace Jellyfin.Api.Controllers
{ {
SortOrder = sortOrder ?? SortOrder.Ascending, SortOrder = sortOrder ?? SortOrder.Ascending,
SortBy = sortBy SortBy = sortBy
}, CancellationToken.None).ConfigureAwait(false); },
CancellationToken.None).ConfigureAwait(false);
} }
/// <summary> /// <summary>

View File

@ -80,7 +80,8 @@ namespace Jellyfin.Api.Controllers
IncludeAllLanguages = includeAllLanguages, IncludeAllLanguages = includeAllLanguages,
IncludeDisabledProviders = true, IncludeDisabledProviders = true,
ImageType = type ImageType = type
}, CancellationToken.None) },
CancellationToken.None)
.ConfigureAwait(false); .ConfigureAwait(false);
var imageArray = images.ToArray(); var imageArray = images.ToArray();

View File

@ -301,7 +301,8 @@ namespace Jellyfin.Api.Controllers
Limit = limit, Limit = limit,
ParentId = parentId ?? Guid.Empty, ParentId = parentId ?? Guid.Empty,
UserId = userId, UserId = userId,
}, dtoOptions); },
dtoOptions);
var dtos = list.Select(i => var dtos = list.Select(i =>
{ {

View File

@ -218,7 +218,8 @@ namespace Jellyfin.Api.Helpers
return KillTranscodingJobs( return KillTranscodingJobs(
j => string.IsNullOrWhiteSpace(playSessionId) j => string.IsNullOrWhiteSpace(playSessionId)
? string.Equals(deviceId, j.DeviceId, StringComparison.OrdinalIgnoreCase) ? string.Equals(deviceId, j.DeviceId, StringComparison.OrdinalIgnoreCase)
: string.Equals(playSessionId, j.PlaySessionId, StringComparison.OrdinalIgnoreCase), deleteFiles); : string.Equals(playSessionId, j.PlaySessionId, StringComparison.OrdinalIgnoreCase),
deleteFiles);
} }
/// <summary> /// <summary>

View File

@ -12,6 +12,10 @@
<NoWarn>AD0001</NoWarn> <NoWarn>AD0001</NoWarn>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="6.0.1" /> <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
@ -27,7 +31,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -24,4 +24,4 @@ namespace Jellyfin.Api.ModelBinders
return new NullableEnumModelBinder(logger); return new NullableEnumModelBinder(logger);
} }
} }
} }

View File

@ -24,4 +24,4 @@ namespace Jellyfin.Api.Models.LibraryStructureDto
/// </summary> /// </summary>
public MediaPathInfo? PathInfo { get; set; } public MediaPathInfo? PathInfo { get; set; }
} }
} }

View File

@ -25,4 +25,4 @@ namespace Jellyfin.Api.Models.LiveTvDtos
[Required] [Required]
public string ProviderChannelId { get; set; } = string.Empty; public string ProviderChannelId { get; set; } = string.Empty;
} }
} }

View File

@ -83,4 +83,4 @@ namespace Jellyfin.Api.Models.MediaInfoDtos
/// </summary> /// </summary>
public bool? AutoOpenLiveStream { get; set; } public bool? AutoOpenLiveStream { get; set; }
} }
} }

View File

@ -31,4 +31,4 @@ namespace Jellyfin.Api.Models.SubtitleDtos
[Required] [Required]
public string Data { get; set; } = string.Empty; public string Data { get; set; } = string.Empty;
} }
} }

View File

@ -134,7 +134,7 @@
PlaylistsFolder, PlaylistsFolder,
/// <summary> /// <summary>
/// Item is program /// Item is program.
/// </summary> /// </summary>
Program, Program,

View File

@ -31,7 +31,7 @@ namespace Jellyfin.Data.Enums
Book = 4, Book = 4,
/// <summary> /// <summary>
/// A live TV channel /// A live TV channel.
/// </summary> /// </summary>
LiveTvChannel = 5, LiveTvChannel = 5,

View File

@ -30,7 +30,7 @@
<!-- Code analysers--> <!-- Code analysers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -31,7 +31,7 @@
<!-- Code analysers--> <!-- Code analysers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -12,7 +12,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -24,7 +24,7 @@ namespace Jellyfin.Server.Implementations.Devices
{ {
private readonly JellyfinDbProvider _dbProvider; private readonly JellyfinDbProvider _dbProvider;
private readonly IUserManager _userManager; private readonly IUserManager _userManager;
private readonly ConcurrentDictionary<string, ClientCapabilities> _capabilitiesMap = new (); private readonly ConcurrentDictionary<string, ClientCapabilities> _capabilitiesMap = new();
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="DeviceManager"/> class. /// Initializes a new instance of the <see cref="DeviceManager"/> class.

View File

@ -6,10 +6,14 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<!-- Code analysers--> <!-- Code analysers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -45,4 +45,4 @@ namespace Jellyfin.Server.Implementations
modelBuilder.UseValueConverterForType<DateTime?>(new DateTimeKindValueConverter(kind)); modelBuilder.UseValueConverterForType<DateTime?>(new DateTimeKindValueConverter(kind));
} }
} }
} }

View File

@ -75,4 +75,4 @@ namespace Jellyfin.Server.Filters
} }
} }
} }
} }

View File

@ -14,6 +14,10 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\SharedVersion.cs" /> <Compile Include="..\SharedVersion.cs" />
</ItemGroup> </ItemGroup>
@ -25,7 +29,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -51,4 +51,4 @@ namespace Jellyfin.Server.Middleware
await _next(httpContext).ConfigureAwait(false); await _next(httpContext).ConfigureAwait(false);
} }
} }
} }

View File

@ -44,4 +44,4 @@ namespace Jellyfin.Server.Middleware
await _next(httpContext).ConfigureAwait(false); await _next(httpContext).ConfigureAwait(false);
} }
} }
} }

View File

@ -38,6 +38,10 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat> <SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Stability)'=='Unstable'"> <PropertyGroup Condition=" '$(Stability)'=='Unstable'">
<!-- Include all symbols in the main nupkg until Azure Artifact Feed starts supporting ingesting NuGet symbol packages. --> <!-- Include all symbols in the main nupkg until Azure Artifact Feed starts supporting ingesting NuGet symbol packages. -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder> <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
@ -46,7 +50,7 @@
<!-- Code analyzers--> <!-- Code analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -8,4 +8,4 @@ namespace MediaBrowser.Controller.Channels
{ {
public string UserId { get; set; } public string UserId { get; set; }
} }
} }

View File

@ -6,4 +6,4 @@ namespace MediaBrowser.Controller.Channels
{ {
string[] Attributes { get; } string[] Attributes { get; }
} }
} }

View File

@ -12,4 +12,4 @@ namespace MediaBrowser.Controller.Channels
Task DeleteItem(string id, CancellationToken cancellationToken); Task DeleteItem(string id, CancellationToken cancellationToken);
} }
} }

View File

@ -18,4 +18,4 @@ namespace MediaBrowser.Controller.Channels
/// <returns>The latest media.</returns> /// <returns>The latest media.</returns>
Task<IEnumerable<ChannelItemInfo>> GetLatestMedia(ChannelLatestMediaSearch request, CancellationToken cancellationToken); Task<IEnumerable<ChannelItemInfo>> GetLatestMedia(ChannelLatestMediaSearch request, CancellationToken cancellationToken);
} }
} }

View File

@ -21,4 +21,4 @@ namespace MediaBrowser.Controller.Collections
/// <value>The options.</value> /// <value>The options.</value>
public CollectionCreationOptions Options { get; set; } public CollectionCreationOptions Options { get; set; }
} }
} }

View File

@ -2592,9 +2592,9 @@ namespace MediaBrowser.Controller.Entities
.Select(i => i.OfficialRating) .Select(i => i.OfficialRating)
.Where(i => !string.IsNullOrEmpty(i)) .Where(i => !string.IsNullOrEmpty(i))
.Distinct(StringComparer.OrdinalIgnoreCase) .Distinct(StringComparer.OrdinalIgnoreCase)
.Select(i => (i, LocalizationManager.GetRatingLevel(i))) .Select(rating => (rating, LocalizationManager.GetRatingLevel(rating)))
.OrderBy(i => i.Item2 ?? 1000) .OrderBy(i => i.Item2 ?? 1000)
.Select(i => i.Item1); .Select(i => i.rating);
OfficialRating = ratings.FirstOrDefault() ?? currentOfficialRating; OfficialRating = ratings.FirstOrDefault() ?? currentOfficialRating;

View File

@ -47,11 +47,12 @@ namespace MediaBrowser.Controller.Entities
if (file.StartsWith("http", StringComparison.OrdinalIgnoreCase)) if (file.StartsWith("http", StringComparison.OrdinalIgnoreCase))
{ {
item.SetImage( item.SetImage(
new ItemImageInfo new ItemImageInfo
{ {
Path = file, Path = file,
Type = imageType Type = imageType
}, 0); },
0);
} }
else else
{ {

View File

@ -8,4 +8,4 @@ namespace MediaBrowser.Controller.Entities
{ {
Share[] Shares { get; set; } Share[] Shares { get; set; }
} }
} }

View File

@ -32,4 +32,4 @@ namespace MediaBrowser.Controller.Entities
return ((obj.Path ?? string.Empty) + (obj.LibraryItemId ?? string.Empty) + obj.Type).GetHashCode(StringComparison.Ordinal); return ((obj.Path ?? string.Empty) + (obj.LibraryItemId ?? string.Empty) + obj.Type).GetHashCode(StringComparison.Ordinal);
} }
} }
} }

View File

@ -15,4 +15,4 @@
/// </summary> /// </summary>
Shortcut = 1 Shortcut = 1
} }
} }

View File

@ -16,4 +16,4 @@ namespace MediaBrowser.Controller.LiveTv
public CancellationTokenSource CancellationTokenSource { get; set; } public CancellationTokenSource CancellationTokenSource { get; set; }
} }
} }

View File

@ -13,6 +13,10 @@
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression> <PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Diacritics" Version="3.3.10" /> <PackageReference Include="Diacritics" Version="3.3.10" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" />
@ -49,7 +53,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -201,4 +201,4 @@ namespace MediaBrowser.Controller.MediaEncoding
return null; return null;
} }
} }
} }

View File

@ -20,4 +20,4 @@
/// </summary> /// </summary>
Dash Dash
} }
} }

View File

@ -14,4 +14,4 @@ namespace MediaBrowser.Controller.Net
public long IntervalMs { get; set; } public long IntervalMs { get; set; }
} }
} }

View File

@ -12,11 +12,11 @@ namespace MediaBrowser.Controller.Providers
{ {
private readonly IFileSystem _fileSystem; private readonly IFileSystem _fileSystem;
private readonly ConcurrentDictionary<string, FileSystemMetadata[]> _cache = new (StringComparer.Ordinal); private readonly ConcurrentDictionary<string, FileSystemMetadata[]> _cache = new(StringComparer.Ordinal);
private readonly ConcurrentDictionary<string, FileSystemMetadata> _fileCache = new (StringComparer.Ordinal); private readonly ConcurrentDictionary<string, FileSystemMetadata> _fileCache = new(StringComparer.Ordinal);
private readonly ConcurrentDictionary<string, List<string>> _filePathCache = new (StringComparer.Ordinal); private readonly ConcurrentDictionary<string, List<string>> _filePathCache = new(StringComparer.Ordinal);
public DirectoryService(IFileSystem fileSystem) public DirectoryService(IFileSystem fileSystem)
{ {

View File

@ -20,4 +20,4 @@
/// </summary> /// </summary>
Low = 2 Low = 2
} }
} }

View File

@ -23,7 +23,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -11,6 +11,10 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\SharedVersion.cs" /> <Compile Include="..\SharedVersion.cs" />
</ItemGroup> </ItemGroup>
@ -32,7 +36,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -28,7 +28,7 @@ namespace MediaBrowser.MediaEncoding.Probing
private readonly char[] _nameDelimiters = { '/', '|', ';', '\\' }; private readonly char[] _nameDelimiters = { '/', '|', ';', '\\' };
private static readonly Regex _performerPattern = new (@"(?<name>.*) \((?<instrument>.*)\)"); private static readonly Regex _performerPattern = new(@"(?<name>.*) \((?<instrument>.*)\)");
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly ILocalizationManager _localization; private readonly ILocalizationManager _localization;

View File

@ -679,8 +679,8 @@ namespace MediaBrowser.Model.Dlna
// TODO: This doesn't account for situations where the device is able to handle the media's bitrate, but the connection isn't fast enough // TODO: This doesn't account for situations where the device is able to handle the media's bitrate, but the connection isn't fast enough
var directPlayEligibilityResult = IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options, true) ?? 0, subtitleStream, audioStream, options, PlayMethod.DirectPlay); var directPlayEligibilityResult = IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options, true) ?? 0, subtitleStream, audioStream, options, PlayMethod.DirectPlay);
var directStreamEligibilityResult = IsEligibleForDirectPlay(item, options.GetMaxBitrate(false) ?? 0, subtitleStream, audioStream, options, PlayMethod.DirectStream); var directStreamEligibilityResult = IsEligibleForDirectPlay(item, options.GetMaxBitrate(false) ?? 0, subtitleStream, audioStream, options, PlayMethod.DirectStream);
bool isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || directPlayEligibilityResult.Item1); bool isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || directPlayEligibilityResult.directPlay);
bool isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || directStreamEligibilityResult.Item1); bool isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || directStreamEligibilityResult.directPlay);
_logger.LogDebug( _logger.LogDebug(
"Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}", "Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}",
@ -695,7 +695,7 @@ namespace MediaBrowser.Model.Dlna
{ {
// See if it can be direct played // See if it can be direct played
var directPlayInfo = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectStream); var directPlayInfo = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectStream);
var directPlay = directPlayInfo.Item1; var directPlay = directPlayInfo.playMethod;
if (directPlay != null) if (directPlay != null)
{ {
@ -713,17 +713,17 @@ namespace MediaBrowser.Model.Dlna
return playlistItem; return playlistItem;
} }
transcodeReasons.AddRange(directPlayInfo.Item2); transcodeReasons.AddRange(directPlayInfo.transcodeReasons);
} }
if (directPlayEligibilityResult.Item2.HasValue) if (directPlayEligibilityResult.reason.HasValue)
{ {
transcodeReasons.Add(directPlayEligibilityResult.Item2.Value); transcodeReasons.Add(directPlayEligibilityResult.reason.Value);
} }
if (directStreamEligibilityResult.Item2.HasValue) if (directStreamEligibilityResult.reason.HasValue)
{ {
transcodeReasons.Add(directStreamEligibilityResult.Item2.Value); transcodeReasons.Add(directStreamEligibilityResult.reason.Value);
} }
// Can't direct play, find the transcoding profile // Can't direct play, find the transcoding profile
@ -1000,7 +1000,7 @@ namespace MediaBrowser.Model.Dlna
return 7168000; return 7168000;
} }
private (PlayMethod?, List<TranscodeReason>) GetVideoDirectPlayProfile( private (PlayMethod? playMethod, List<TranscodeReason> transcodeReasons) GetVideoDirectPlayProfile(
VideoOptions options, VideoOptions options,
MediaSourceInfo mediaSource, MediaSourceInfo mediaSource,
MediaStream videoStream, MediaStream videoStream,

View File

@ -23,6 +23,10 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat> <SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Stability)'=='Unstable'"> <PropertyGroup Condition=" '$(Stability)'=='Unstable'">
<!-- Include all symbols in the main nupkg until Azure Artifact Feed starts supporting ingesting NuGet symbol packages. --> <!-- Include all symbols in the main nupkg until Azure Artifact Feed starts supporting ingesting NuGet symbol packages. -->
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder> <AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
@ -46,7 +50,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -29,7 +29,7 @@ namespace MediaBrowser.Model.Plugins
NotSupported = -2, NotSupported = -2,
/// <summary> /// <summary>
/// This plugin caused an error when instantiated. (Either DI loop, or exception) /// This plugin caused an error when instantiated (either DI loop, or exception).
/// </summary> /// </summary>
Malfunctioned = -3, Malfunctioned = -3,

View File

@ -6,42 +6,42 @@
public enum HardwareEncodingType public enum HardwareEncodingType
{ {
/// <summary> /// <summary>
/// AMD AMF /// AMD AMF.
/// </summary> /// </summary>
AMF = 0, AMF = 0,
/// <summary> /// <summary>
/// Intel Quick Sync Video /// Intel Quick Sync Video.
/// </summary> /// </summary>
QSV = 1, QSV = 1,
/// <summary> /// <summary>
/// NVIDIA NVENC /// NVIDIA NVENC.
/// </summary> /// </summary>
NVENC = 2, NVENC = 2,
/// <summary> /// <summary>
/// OpenMax OMX /// OpenMax OMX.
/// </summary> /// </summary>
OMX = 3, OMX = 3,
/// <summary> /// <summary>
/// Exynos V4L2 MFC /// Exynos V4L2 MFC.
/// </summary> /// </summary>
V4L2M2M = 4, V4L2M2M = 4,
/// <summary> /// <summary>
/// MediaCodec Android /// MediaCodec Android.
/// </summary> /// </summary>
MediaCodec = 5, MediaCodec = 5,
/// <summary> /// <summary>
/// Video Acceleration API (VAAPI) /// Video Acceleration API (VAAPI).
/// </summary> /// </summary>
VAAPI = 6, VAAPI = 6,
/// <summary> /// <summary>
/// Video ToolBox /// Video ToolBox.
/// </summary> /// </summary>
VideoToolBox = 7 VideoToolBox = 7
} }

View File

@ -32,10 +32,14 @@
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -27,7 +27,7 @@ namespace MediaBrowser.Providers.Studios
private readonly IServerConfigurationManager _config; private readonly IServerConfigurationManager _config;
private readonly IHttpClientFactory _httpClientFactory; private readonly IHttpClientFactory _httpClientFactory;
private readonly IFileSystem _fileSystem; private readonly IFileSystem _fileSystem;
private readonly String repositoryUrl; private readonly string repositoryUrl;
public StudiosImageProvider(IServerConfigurationManager config, IHttpClientFactory httpClientFactory, IFileSystem fileSystem) public StudiosImageProvider(IServerConfigurationManager config, IHttpClientFactory httpClientFactory, IFileSystem fileSystem)
{ {

View File

@ -11,7 +11,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
/// </summary> /// </summary>
public static class TmdbUtils public static class TmdbUtils
{ {
private static readonly Regex _nonWords = new (@"[\W_]+", RegexOptions.Compiled); private static readonly Regex _nonWords = new(@"[\W_]+", RegexOptions.Compiled);
/// <summary> /// <summary>
/// URL of the TMDB instance to use. /// URL of the TMDB instance to use.

View File

@ -23,7 +23,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -1,6 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Rules for Jellyfin.Server" Description="Code analysis rules for Jellyfin.Server.csproj" ToolsVersion="14.0"> <RuleSet Name="Rules for Jellyfin.Server" Description="Code analysis rules for Jellyfin.Server.csproj" ToolsVersion="14.0">
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers"> <Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<!-- error on SA1000: The keyword 'new' should be followed by a space -->
<Rule Id="SA1000" Action="Error" />
<!-- error on SA1001: Commas should not be preceded by whitespace -->
<Rule Id="SA1001" Action="Error" />
<!-- error on SA1117: The parameters should all be placed on the same line or each parameter should be placed on its own line -->
<Rule Id="SA1117" Action="Error" />
<!-- error on SA1142: Refer to tuple fields by name -->
<Rule Id="SA1142" Action="Error" />
<!-- error on SA1210: Using directives should be ordered alphabetically by the namespaces -->
<Rule Id="SA1210" Action="Error" />
<!-- error on SA1518: File is required to end with a single newline character -->
<Rule Id="SA1518" Action="Error" />
<!-- error on SA1629: Documentation text should end with a period -->
<Rule Id="SA1629" Action="Error" />
<!-- disable warning SA1009: Closing parenthesis should be followed by a space. --> <!-- disable warning SA1009: Closing parenthesis should be followed by a space. -->
<Rule Id="SA1009" Action="None" /> <Rule Id="SA1009" Action="None" />
<!-- disable warning SA1011: Closing square bracket should be followed by a space. --> <!-- disable warning SA1011: Closing square bracket should be followed by a space. -->

View File

@ -30,7 +30,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup> <ItemGroup>
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -25,7 +25,7 @@ namespace Jellyfin.Extensions.Json
/// -> AddJellyfinApi /// -> AddJellyfinApi
/// -> AddJsonOptions. /// -> AddJsonOptions.
/// </summary> /// </summary>
private static readonly JsonSerializerOptions _jsonSerializerOptions = new () private static readonly JsonSerializerOptions _jsonSerializerOptions = new()
{ {
ReadCommentHandling = JsonCommentHandling.Disallow, ReadCommentHandling = JsonCommentHandling.Disallow,
WriteIndented = false, WriteIndented = false,
@ -44,12 +44,12 @@ namespace Jellyfin.Extensions.Json
} }
}; };
private static readonly JsonSerializerOptions _pascalCaseJsonSerializerOptions = new (_jsonSerializerOptions) private static readonly JsonSerializerOptions _pascalCaseJsonSerializerOptions = new(_jsonSerializerOptions)
{ {
PropertyNamingPolicy = null PropertyNamingPolicy = null
}; };
private static readonly JsonSerializerOptions _camelCaseJsonSerializerOptions = new (_jsonSerializerOptions) private static readonly JsonSerializerOptions _camelCaseJsonSerializerOptions = new(_jsonSerializerOptions)
{ {
PropertyNamingPolicy = JsonNamingPolicy.CamelCase PropertyNamingPolicy = JsonNamingPolicy.CamelCase
}; };

View File

@ -43,7 +43,7 @@ namespace Jellyfin.Extensions
/// <param name="separator">The separator to split on.</param> /// <param name="separator">The separator to split on.</param>
/// <returns>The enumerator struct.</returns> /// <returns>The enumerator struct.</returns>
[Pure] [Pure]
public static Enumerator SpanSplit(this string str, char separator) => new (str.AsSpan(), separator); public static Enumerator SpanSplit(this string str, char separator) => new(str.AsSpan(), separator);
/// <summary> /// <summary>
/// Creates a new span split enumerator. /// Creates a new span split enumerator.
@ -52,7 +52,7 @@ namespace Jellyfin.Extensions
/// <param name="separator">The separator to split on.</param> /// <param name="separator">The separator to split on.</param>
/// <returns>The enumerator struct.</returns> /// <returns>The enumerator struct.</returns>
[Pure] [Pure]
public static Enumerator Split(this ReadOnlySpan<char> str, char separator) => new (str, separator); public static Enumerator Split(this ReadOnlySpan<char> str, char separator) => new(str, separator);
/// <summary> /// <summary>
/// Provides an enumerator for the substrings seperated by the separator. /// Provides an enumerator for the substrings seperated by the separator.

View File

@ -27,7 +27,7 @@
<!-- Code Analyzers --> <!-- Code Analyzers -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -22,7 +22,7 @@
<!-- Code Analyzers --> <!-- Code Analyzers -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -13,22 +13,22 @@ namespace Jellyfin.Controller.Tests
private static readonly FileSystemMetadata[] _lowerCaseFileSystemMetadata = private static readonly FileSystemMetadata[] _lowerCaseFileSystemMetadata =
{ {
new () new()
{ {
FullName = LowerCasePath + "/Artwork", FullName = LowerCasePath + "/Artwork",
IsDirectory = true IsDirectory = true
}, },
new () new()
{ {
FullName = LowerCasePath + "/Some Other Folder", FullName = LowerCasePath + "/Some Other Folder",
IsDirectory = true IsDirectory = true
}, },
new () new()
{ {
FullName = LowerCasePath + "/Song 2.mp3", FullName = LowerCasePath + "/Song 2.mp3",
IsDirectory = false IsDirectory = false
}, },
new () new()
{ {
FullName = LowerCasePath + "/Song 3.mp3", FullName = LowerCasePath + "/Song 3.mp3",
IsDirectory = false IsDirectory = false
@ -37,12 +37,12 @@ namespace Jellyfin.Controller.Tests
private static readonly FileSystemMetadata[] _upperCaseFileSystemMetadata = private static readonly FileSystemMetadata[] _upperCaseFileSystemMetadata =
{ {
new () new()
{ {
FullName = UpperCasePath + "/Lyrics", FullName = UpperCasePath + "/Lyrics",
IsDirectory = true IsDirectory = true
}, },
new () new()
{ {
FullName = UpperCasePath + "/Song 1.mp3", FullName = UpperCasePath + "/Song 1.mp3",
IsDirectory = false IsDirectory = false

View File

@ -22,7 +22,7 @@
<!-- Code Analyzers --> <!-- Code Analyzers -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -46,7 +46,7 @@ namespace Jellyfin.Dlna.Tests
ModelDescription = "LG WebOSTV DMRplus", ModelDescription = "LG WebOSTV DMRplus",
ModelName = "LG TV", ModelName = "LG TV",
ModelNumber = "1.0", ModelNumber = "1.0",
Identification = new () Identification = new()
{ {
FriendlyName = "My Device", FriendlyName = "My Device",
Manufacturer = "LG Electronics", Manufacturer = "LG Electronics",
@ -92,7 +92,7 @@ namespace Jellyfin.Dlna.Tests
ModelDescription = "LG WebOSTV DMRplus", ModelDescription = "LG WebOSTV DMRplus",
ModelName = "LG TV", ModelName = "LG TV",
ModelNumber = "1.0", ModelNumber = "1.0",
Identification = new () Identification = new()
{ {
FriendlyName = "My Device", FriendlyName = "My Device",
Manufacturer = "LG Electronics", Manufacturer = "LG Electronics",
@ -120,7 +120,7 @@ namespace Jellyfin.Dlna.Tests
{ {
Name = "Test Profile", Name = "Test Profile",
FriendlyName = "My .*", FriendlyName = "My .*",
Identification = new () Identification = new()
}; };
var deviceMatch = GetManager().IsMatch(device.ToDeviceIdentification(), profile.Identification); var deviceMatch = GetManager().IsMatch(device.ToDeviceIdentification(), profile.Identification);

View File

@ -17,7 +17,7 @@
<!-- Code Analyzers --> <!-- Code Analyzers -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -23,7 +23,7 @@
<!-- Code Analyzers --> <!-- Code Analyzers -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -6,7 +6,7 @@ namespace Jellyfin.Extensions.Tests.Json.Converters
{ {
public class JsonStringConverterTests public class JsonStringConverterTests
{ {
private readonly JsonSerializerOptions _jsonSerializerOptions = new () private readonly JsonSerializerOptions _jsonSerializerOptions = new()
{ {
Converters = Converters =
{ {

View File

@ -31,7 +31,7 @@
<!-- Code Analyzers --> <!-- Code Analyzers -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -17,7 +17,7 @@
<!-- Code Analyzers --> <!-- Code Analyzers -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -25,7 +25,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -23,7 +23,7 @@
<!-- Code Analyzers--> <!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -29,7 +29,7 @@
<!-- Code Analyzers --> <!-- Code Analyzers -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -62,7 +62,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
for (int i = 1; i <= targetIndex; i++) for (int i = 1; i <= targetIndex; i++)
{ {
var name = i == targetIndex ? filename : "unmatched"; var name = i == targetIndex ? filename : "unmatched";
attachments.Add(new () attachments.Add(new()
{ {
FileName = name, FileName = name,
MimeType = mimetype, MimeType = mimetype,
@ -107,7 +107,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
for (int i = 1; i <= targetIndex; i++) for (int i = 1; i <= targetIndex; i++)
{ {
var comment = i == targetIndex ? label : "unmatched"; var comment = i == targetIndex ? label : "unmatched";
streams.Add(new () streams.Add(new()
{ {
Type = MediaStreamType.EmbeddedImage, Type = MediaStreamType.EmbeddedImage,
Index = i, Index = i,

View File

@ -113,7 +113,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
private static MediaStream CreateMediaStream(string path, string codec, string? language, int index, bool isForced = false, bool isDefault = false) private static MediaStream CreateMediaStream(string path, string codec, string? language, int index, bool isForced = false, bool isDefault = false)
{ {
return new () return new()
{ {
Index = index, Index = index,
Codec = codec, Codec = codec,

View File

@ -21,7 +21,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
{ {
private static TheoryData<Video> GetImage_UnsupportedInput_ReturnsNoImage_TestData() private static TheoryData<Video> GetImage_UnsupportedInput_ReturnsNoImage_TestData()
{ {
return new () return new()
{ {
new Movie { IsPlaceHolder = true }, new Movie { IsPlaceHolder = true },
@ -82,7 +82,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
[InlineData(500, 50)] // calculated time [InlineData(500, 50)] // calculated time
public async void GetImage_TimeSpan_SelectsCorrectTime(int? runTimeSeconds, long expectedSeconds) public async void GetImage_TimeSpan_SelectsCorrectTime(int? runTimeSeconds, long expectedSeconds)
{ {
MediaStream targetStream = new () { Type = MediaStreamType.Video, Index = 0 }; MediaStream targetStream = new() { Type = MediaStreamType.Video, Index = 0 };
var input = new Movie var input = new Movie
{ {
DefaultVideoStreamIndex = 0, DefaultVideoStreamIndex = 0,

View File

@ -173,7 +173,7 @@ namespace Jellyfin.Server.Implementations.Tests.Data
"/mnt/series/Family Guy/Season 1/Family Guy - S01E01-thumb.jpg*637452096478512963*Primary*1920*1080*WjQbtJtSO8nhNZ%L_Io#R/oaS6o}-;adXAoIn7j[%hW9s:WGw[nN|test|1234||ss", "/mnt/series/Family Guy/Season 1/Family Guy - S01E01-thumb.jpg*637452096478512963*Primary*1920*1080*WjQbtJtSO8nhNZ%L_Io#R/oaS6o}-;adXAoIn7j[%hW9s:WGw[nN|test|1234||ss",
new ItemImageInfo[] new ItemImageInfo[]
{ {
new () new()
{ {
Path = "/mnt/series/Family Guy/Season 1/Family Guy - S01E01-thumb.jpg", Path = "/mnt/series/Family Guy/Season 1/Family Guy - S01E01-thumb.jpg",
Type = ImageType.Primary, Type = ImageType.Primary,

View File

@ -32,7 +32,7 @@
<!-- Code Analyzers --> <!-- Code Analyzers -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

View File

@ -14,7 +14,7 @@ namespace Jellyfin.Server.Implementations.Tests.Library
{ {
public class EpisodeResolverTest public class EpisodeResolverTest
{ {
private static readonly NamingOptions _namingOptions = new (); private static readonly NamingOptions _namingOptions = new();
[Fact] [Fact]
public void Resolve_GivenVideoInExtrasFolder_DoesNotResolveToEpisode() public void Resolve_GivenVideoInExtrasFolder_DoesNotResolveToEpisode()
@ -65,7 +65,7 @@ namespace Jellyfin.Server.Implementations.Tests.Library
{ {
} }
protected override TVideoType ResolveVideo<TVideoType>(ItemResolveArgs args, bool parseName) => new (); protected override TVideoType ResolveVideo<TVideoType>(ItemResolveArgs args, bool parseName) => new();
} }
} }
} }

View File

@ -97,7 +97,7 @@ public class FindExtrasTests
false)) false))
.Returns(new List<FileSystemMetadata> .Returns(new List<FileSystemMetadata>
{ {
new () new()
{ {
FullName = "/movies/Up/trailers/some trailer.mkv", FullName = "/movies/Up/trailers/some trailer.mkv",
Name = "some trailer.mkv", Name = "some trailer.mkv",
@ -112,7 +112,7 @@ public class FindExtrasTests
false)) false))
.Returns(new List<FileSystemMetadata> .Returns(new List<FileSystemMetadata>
{ {
new () new()
{ {
FullName = "/movies/Up/behind the scenes/the making of Up.mkv", FullName = "/movies/Up/behind the scenes/the making of Up.mkv",
Name = "the making of Up.mkv", Name = "the making of Up.mkv",
@ -127,7 +127,7 @@ public class FindExtrasTests
false)) false))
.Returns(new List<FileSystemMetadata> .Returns(new List<FileSystemMetadata>
{ {
new () new()
{ {
FullName = "/movies/Up/theme-music/theme2.mp3", FullName = "/movies/Up/theme-music/theme2.mp3",
Name = "theme2.mp3", Name = "theme2.mp3",

View File

@ -1,8 +1,8 @@
using System; using System;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Net.Http.Json;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Net.Http.Json;
using System.Text.Json; using System.Text.Json;
using System.Threading.Tasks; using System.Threading.Tasks;
using Jellyfin.Api.Models.StartupDtos; using Jellyfin.Api.Models.StartupDtos;

View File

@ -29,7 +29,7 @@
<!-- Code Analyzers --> <!-- Code Analyzers -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' "> <ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" /> <PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" /> <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.376" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" /> <PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup> </ItemGroup>

Some files were not shown because too many files have changed in this diff Show More