mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Merge pull request #9641 from Daaiid/fix_compiler_warnings
Fix compiler warnings for Emby.Server.Implementations
This commit is contained in:
commit
d6355261e3
@ -205,7 +205,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
private static readonly string _mediaAttachmentSaveColumnsSelectQuery =
|
private static readonly string _mediaAttachmentSaveColumnsSelectQuery =
|
||||||
$"select {string.Join(',', _mediaAttachmentSaveColumns)} from mediaattachments where ItemId=@ItemId";
|
$"select {string.Join(',', _mediaAttachmentSaveColumns)} from mediaattachments where ItemId=@ItemId";
|
||||||
|
|
||||||
private static readonly string _mediaAttachmentInsertPrefix;
|
private static readonly string _mediaAttachmentInsertPrefix = BuildMediaAttachmentInsertPrefix();
|
||||||
|
|
||||||
private static readonly BaseItemKind[] _programTypes = new[]
|
private static readonly BaseItemKind[] _programTypes = new[]
|
||||||
{
|
{
|
||||||
@ -296,21 +296,6 @@ namespace Emby.Server.Implementations.Data
|
|||||||
{ BaseItemKind.Year, typeof(Year).FullName }
|
{ BaseItemKind.Year, typeof(Year).FullName }
|
||||||
};
|
};
|
||||||
|
|
||||||
static SqliteItemRepository()
|
|
||||||
{
|
|
||||||
var queryPrefixText = new StringBuilder();
|
|
||||||
queryPrefixText.Append("insert into mediaattachments (");
|
|
||||||
foreach (var column in _mediaAttachmentSaveColumns)
|
|
||||||
{
|
|
||||||
queryPrefixText.Append(column)
|
|
||||||
.Append(',');
|
|
||||||
}
|
|
||||||
|
|
||||||
queryPrefixText.Length -= 1;
|
|
||||||
queryPrefixText.Append(") values ");
|
|
||||||
_mediaAttachmentInsertPrefix = queryPrefixText.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -5879,6 +5864,21 @@ AND Type = @InternalPersonType)");
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string BuildMediaAttachmentInsertPrefix()
|
||||||
|
{
|
||||||
|
var queryPrefixText = new StringBuilder();
|
||||||
|
queryPrefixText.Append("insert into mediaattachments (");
|
||||||
|
foreach (var column in _mediaAttachmentSaveColumns)
|
||||||
|
{
|
||||||
|
queryPrefixText.Append(column)
|
||||||
|
.Append(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
queryPrefixText.Length -= 1;
|
||||||
|
queryPrefixText.Append(") values ");
|
||||||
|
return queryPrefixText.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
private readonly struct QueryTimeLogger : IDisposable
|
private readonly struct QueryTimeLogger : IDisposable
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using Jellyfin.Data.Enums;
|
using Jellyfin.Data.Enums;
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
using MediaBrowser.Controller.Entities.Audio;
|
||||||
@ -9,37 +8,35 @@ using MediaBrowser.Model.Querying;
|
|||||||
namespace Emby.Server.Implementations.Sorting
|
namespace Emby.Server.Implementations.Sorting
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class AlbumArtistComparer.
|
/// Allows comparing artists of albums. Only the first artist of each album is considered.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AlbumArtistComparer : IBaseItemComparer
|
public class AlbumArtistComparer : IBaseItemComparer
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name.
|
/// Gets the item type this comparer compares.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
|
||||||
public ItemSortBy Type => ItemSortBy.AlbumArtist;
|
public ItemSortBy Type => ItemSortBy.AlbumArtist;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compares the specified x.
|
/// Compares the specified arguments on their primary artist.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="x">The x.</param>
|
/// <param name="x">First item to compare.</param>
|
||||||
/// <param name="y">The y.</param>
|
/// <param name="y">Second item to compare.</param>
|
||||||
/// <returns>System.Int32.</returns>
|
/// <returns>Zero if equal, else negative or positive number to indicate order.</returns>
|
||||||
public int Compare(BaseItem? x, BaseItem? y)
|
public int Compare(BaseItem? x, BaseItem? y)
|
||||||
{
|
{
|
||||||
return string.Compare(GetValue(x), GetValue(y), StringComparison.OrdinalIgnoreCase);
|
return string.Compare(GetFirstAlbumArtist(x), GetFirstAlbumArtist(y), StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
private static string? GetFirstAlbumArtist(BaseItem? x)
|
||||||
/// Gets the value.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="x">The x.</param>
|
|
||||||
/// <returns>System.String.</returns>
|
|
||||||
private static string? GetValue(BaseItem? x)
|
|
||||||
{
|
{
|
||||||
var audio = x as IHasAlbumArtist;
|
if (x is IHasAlbumArtist audio
|
||||||
|
&& audio.AlbumArtists.Count != 0)
|
||||||
|
{
|
||||||
|
return audio.AlbumArtists[0];
|
||||||
|
}
|
||||||
|
|
||||||
return audio?.AlbumArtists.FirstOrDefault();
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user