Increase analysis mode to recommended

This commit is contained in:
Bond_009 2022-02-04 22:02:43 +01:00
parent 281de731e8
commit d6321ac41b
5 changed files with 31 additions and 28 deletions

View File

@ -12,7 +12,7 @@ using MediaBrowser.Model.Querying;
namespace Jellyfin.Plugin.Reports.Api.Activities
{
/// <summary> A report activities builder. </summary>
/// <seealso cref="T:MediaBrowser.Api.Reports.ReportBuilderBase"/>
/// <seealso cref="ReportBuilderBase"/>
public class ReportActivitiesBuilder : ReportBuilderBase
{
/// <summary>
@ -64,11 +64,11 @@ namespace Jellyfin.Plugin.Reports.Api.Activities
}
/// <summary> Gets the headers. </summary>
/// <typeparam name="H"> Type of the header. </typeparam>
/// <typeparam name="T"> Type of the header. </typeparam>
/// <param name="request"> The request. </param>
/// <returns> The headers. </returns>
/// <seealso cref="M:MediaBrowser.Api.Reports.ReportBuilderBase.GetHeaders{H}(H)"/>
protected internal override List<ReportHeader> GetHeaders<H>(H request)
/// <seealso cref="ReportBuilderBase.GetHeaders"/>
protected internal override List<ReportHeader> GetHeaders<T>(T request)
{
return this.GetHeaders<ActivityLogEntry>(request, () => this.GetDefaultHeaderMetadata(), (hm) => this.GetOption(hm));
}

View File

@ -26,15 +26,15 @@ namespace Jellyfin.Plugin.Reports.Api.Common
}
/// <summary> Manager for library. </summary>
protected readonly ILibraryManager _libraryManager;
private readonly ILibraryManager _libraryManager;
protected Func<bool, string> GetBoolString = s => s == true ? "x" : string.Empty;
protected Func<bool, string> GetBoolString => s => s == true ? "x" : string.Empty;
/// <summary> Gets the headers. </summary>
/// <typeparam name="H"> Type of the header. </typeparam>
/// <typeparam name="T"> Type of the header. </typeparam>
/// <param name="request"> The request. </param>
/// <returns> The headers. </returns>
protected internal abstract List<ReportHeader> GetHeaders<H>(H request) where H : IReportsHeader;
protected internal abstract List<ReportHeader> GetHeaders<T>(T request) where T : IReportsHeader;
/// <summary> Gets active headers. </summary>
/// <typeparam name="T"> Generic type parameter. </typeparam>
@ -57,11 +57,14 @@ namespace Jellyfin.Plugin.Reports.Api.Common
protected string GetAudioStream(BaseItem item)
{
var stream = GetStream(item, MediaStreamType.Audio);
if (stream != null)
return stream.Codec.ToUpper() == "DCA" ? stream.Profile : stream.Codec.
ToUpper();
if (stream == null)
{
return string.Empty;
}
return string.Empty;
return string.Equals(stream.Codec, "DCA", StringComparison.OrdinalIgnoreCase)
? stream.Profile
: stream.Codec.ToUpperInvariant();
}
/// <summary> Gets an episode. </summary>
@ -163,16 +166,16 @@ namespace Jellyfin.Plugin.Reports.Api.Common
}
/// <summary> Gets an object. </summary>
/// <typeparam name="T"> Generic type parameter. </typeparam>
/// <typeparam name="R"> Type of the r. </typeparam>
/// <typeparam name="TItem"> Generic type parameter. </typeparam>
/// <typeparam name="TReturn"> Type of the r. </typeparam>
/// <param name="item"> The item. </param>
/// <param name="function"> The function. </param>
/// <param name="defaultValue"> The default value. </param>
/// <returns> The object. </returns>
protected R GetObject<T, R>(BaseItem item, Func<T, R> function, R defaultValue = default(R)) where T : class
protected TReturn GetObject<TItem, TReturn>(BaseItem item, Func<TItem, TReturn> function, TReturn defaultValue = default)
where TItem : class
{
var value = item as T;
if (value != null && function != null)
if (item is TItem value && function != null)
return function(value);
else
return defaultValue;
@ -327,7 +330,7 @@ namespace Jellyfin.Plugin.Reports.Api.Common
{
var stream = GetStream(item, MediaStreamType.Video);
if (stream != null)
return stream.Codec.ToUpper();
return stream.Codec.ToUpperInvariant();
return string.Empty;
}

View File

@ -11,7 +11,7 @@ using Jellyfin.Plugin.Reports.Api.Model;
namespace Jellyfin.Plugin.Reports.Api.Data
{
/// <summary> A report builder. </summary>
/// <seealso cref="T:MediaBrowser.Api.Reports.ReportBuilderBase"/>
/// <seealso cref="ReportBuilderBase"/>
public class ReportBuilder : ReportBuilderBase
{
/// <summary>
@ -61,11 +61,11 @@ namespace Jellyfin.Plugin.Reports.Api.Data
}
/// <summary> Gets the headers. </summary>
/// <typeparam name="H"> Type of the header. </typeparam>
/// <typeparam name="T"> Type of the header. </typeparam>
/// <param name="request"> The request. </param>
/// <returns> The headers. </returns>
/// <seealso cref="M:MediaBrowser.Api.Reports.ReportBuilderBase.GetHeaders{H}(H)"/>
protected internal override List<ReportHeader> GetHeaders<H>(H request)
/// <seealso cref="ReportBuilderBase.GetHeaders"/>
protected internal override List<ReportHeader> GetHeaders<T>(T request)
{
ReportIncludeItemTypes reportRowType = ReportHelper.GetRowType(request.IncludeItemTypes);
return this.GetHeaders<BaseItem>(request, () => this.GetDefaultHeaderMetadata(reportRowType), (hm) => this.GetOption(hm));

View File

@ -5,7 +5,7 @@ namespace Jellyfin.Plugin.Reports.Api.Data
{
/// <summary> A report options. </summary>
public class ReportOptions<I>
public class ReportOptions<T>
{
/// <summary> Initializes a new instance of the ReportOptions class. </summary>
public ReportOptions()
@ -15,7 +15,7 @@ namespace Jellyfin.Plugin.Reports.Api.Data
/// <summary> Initializes a new instance of the ReportOptions class. </summary>
/// <param name="header"> . </param>
/// <param name="row"> . </param>
public ReportOptions(ReportHeader header, Func<I, ReportRow, object> column)
public ReportOptions(ReportHeader header, Func<T, ReportRow, object> column)
{
Header = header;
Column = column;
@ -27,7 +27,7 @@ namespace Jellyfin.Plugin.Reports.Api.Data
/// <param name="header"></param>
/// <param name="column"></param>
/// <param name="itemID"></param>
public ReportOptions(ReportHeader header, Func<I, ReportRow, object> column, Func<I, object> itemID)
public ReportOptions(ReportHeader header, Func<T, ReportRow, object> column, Func<T, object> itemID)
{
Header = header;
Column = column;
@ -40,10 +40,10 @@ namespace Jellyfin.Plugin.Reports.Api.Data
/// <summary> Gets or sets the column. </summary>
/// <value> The column. </value>
public Func<I, ReportRow, object> Column { get; set; }
public Func<T, ReportRow, object> Column { get; set; }
/// <summary> Gets or sets the identifier of the item. </summary>
/// <value> The identifier of the item. </value>
public Func<I, object> ItemID { get; set; }
public Func<T, object> ItemID { get; set; }
}
}

View File

@ -10,7 +10,7 @@
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<AnalysisMode>Minimum</AnalysisMode>
<AnalysisMode>Recommended</AnalysisMode>
</PropertyGroup>
<ItemGroup>