diff options
| author | Bond_009 <bond.009@outlook.com> | 2019-10-09 17:10:16 +0200 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2019-10-09 17:14:15 +0200 |
| commit | 9d4ce82ab9e85a89aa2463e051f805113d952ac5 (patch) | |
| tree | 27ca4a6f450dd1959be04fb534f93881d4718627 /Emby.Photos | |
| parent | d8d2e52e3ffaa59a32cc2cbb4997022b979f9ca0 (diff) | |
Enable `TreatWarningsAsErrors` for MediaBrowser.Common and Emby.Photos
Adds `#pragma warning disable CS1591` to all files in
MediaBrowser.Common containing undocumented members.
Diffstat (limited to 'Emby.Photos')
| -rw-r--r-- | Emby.Photos/Emby.Photos.csproj | 12 | ||||
| -rw-r--r-- | Emby.Photos/PhotoProvider.cs | 30 |
2 files changed, 29 insertions, 13 deletions
diff --git a/Emby.Photos/Emby.Photos.csproj b/Emby.Photos/Emby.Photos.csproj index db73cb521..b57b93a8c 100644 --- a/Emby.Photos/Emby.Photos.csproj +++ b/Emby.Photos/Emby.Photos.csproj @@ -17,6 +17,18 @@ <TargetFramework>netstandard2.0</TargetFramework> <GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateDocumentationFile>true</GenerateDocumentationFile> + <TreatWarningsAsErrors>true</TreatWarningsAsErrors> + </PropertyGroup> + + <!-- Code analysers--> + <ItemGroup Condition=" '$(Configuration)' == 'Debug' "> + <PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.4" /> + <PackageReference Include="StyleCop.Analyzers" Version="1.1.118" /> + <PackageReference Include="SerilogAnalyzer" Version="0.15.0" /> + </ItemGroup> + + <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> + <CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet> </PropertyGroup> </Project> diff --git a/Emby.Photos/PhotoProvider.cs b/Emby.Photos/PhotoProvider.cs index 1591609ab..63631e512 100644 --- a/Emby.Photos/PhotoProvider.cs +++ b/Emby.Photos/PhotoProvider.cs @@ -17,39 +17,50 @@ using TagLib.IFD.Tags; namespace Emby.Photos { + /// <summary> + /// Metadata provider for photos. + /// </summary> public class PhotoProvider : ICustomMetadataProvider<Photo>, IForcedProvider, IHasItemChangeMonitor { private readonly ILogger _logger; private readonly IImageProcessor _imageProcessor; // These are causing taglib to hang - private string[] _includextensions = new string[] { ".jpg", ".jpeg", ".png", ".tiff", ".cr2" }; - - public PhotoProvider(ILogger logger, IImageProcessor imageProcessor) + private readonly string[] _includeExtensions = new string[] { ".jpg", ".jpeg", ".png", ".tiff", ".cr2" }; + + /// <summary> + /// Initializes a new instance of the <see cref="PhotoProvider" /> class. + /// </summary> + /// <param name="logger">The logger.</param> + /// <param name="imageProcessor">The image processor.</param> + public PhotoProvider(ILogger<PhotoProvider> logger, IImageProcessor imageProcessor) { _logger = logger; _imageProcessor = imageProcessor; } + /// <inheritdoc /> public string Name => "Embedded Information"; + /// <inheritdoc /> public bool HasChanged(BaseItem item, IDirectoryService directoryService) { if (item.IsFileProtocol) { var file = directoryService.GetFile(item.Path); - return (file != null && file.LastWriteTimeUtc != item.DateModified); + return file != null && file.LastWriteTimeUtc != item.DateModified; } return false; } + /// <inheritdoc /> public Task<ItemUpdateType> FetchAsync(Photo item, MetadataRefreshOptions options, CancellationToken cancellationToken) { item.SetImagePath(ImageType.Primary, item.Path); // Examples: https://github.com/mono/taglib-sharp/blob/a5f6949a53d09ce63ee7495580d6802921a21f14/tests/fixtures/TagLib.Tests.Images/NullOrientationTest.cs - if (_includextensions.Contains(Path.GetExtension(item.Path), StringComparer.OrdinalIgnoreCase)) + if (_includeExtensions.Contains(Path.GetExtension(item.Path), StringComparer.OrdinalIgnoreCase)) { try { @@ -88,14 +99,7 @@ namespace Emby.Photos item.Height = image.Properties.PhotoHeight; var rating = image.ImageTag.Rating; - if (rating.HasValue) - { - item.CommunityRating = rating; - } - else - { - item.CommunityRating = null; - } + item.CommunityRating = rating.HasValue ? rating : null; item.Overview = image.ImageTag.Comment; |
