mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-23 10:36:43 +00:00
More warning fixes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
@@ -19,15 +20,13 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
IHasLookupInfo<SongInfo>,
|
||||
IHasMediaSources
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the artist.
|
||||
/// </summary>
|
||||
/// <value>The artist.</value>
|
||||
/// <inheritdoc />
|
||||
[IgnoreDataMember]
|
||||
public string[] Artists { get; set; }
|
||||
public IReadOnlyList<string> Artists { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
[IgnoreDataMember]
|
||||
public string[] AlbumArtists { get; set; }
|
||||
public IReadOnlyList<string> AlbumArtists { get; set; }
|
||||
|
||||
public Audio()
|
||||
{
|
||||
@@ -63,30 +62,6 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
return IsFileProtocol;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public string[] AllArtists
|
||||
{
|
||||
get
|
||||
{
|
||||
var list = new string[AlbumArtists.Length + Artists.Length];
|
||||
|
||||
var index = 0;
|
||||
foreach (var artist in AlbumArtists)
|
||||
{
|
||||
list[index] = artist;
|
||||
index++;
|
||||
}
|
||||
foreach (var artist in Artists)
|
||||
{
|
||||
list[index] = artist;
|
||||
index++;
|
||||
}
|
||||
|
||||
return list;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public MusicAlbum AlbumEntity => FindParent<MusicAlbum>();
|
||||
|
||||
@@ -125,7 +100,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
songKey = Album + "-" + songKey;
|
||||
}
|
||||
|
||||
var albumArtist = AlbumArtists.Length == 0 ? null : AlbumArtists[0];
|
||||
var albumArtist = AlbumArtists.FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(albumArtist))
|
||||
{
|
||||
songKey = albumArtist + "-" + songKey;
|
||||
|
||||
@@ -1,14 +1,35 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities.Audio
|
||||
{
|
||||
public interface IHasAlbumArtist
|
||||
{
|
||||
string[] AlbumArtists { get; set; }
|
||||
IReadOnlyList<string> AlbumArtists { get; set; }
|
||||
}
|
||||
|
||||
public interface IHasArtist
|
||||
{
|
||||
string[] AllArtists { get; }
|
||||
/// <summary>
|
||||
/// Gets or sets the artists.
|
||||
/// </summary>
|
||||
/// <value>The artists.</value>
|
||||
IReadOnlyList<string> Artists { get; set; }
|
||||
}
|
||||
|
||||
string[] Artists { get; set; }
|
||||
public static class Extentions
|
||||
{
|
||||
public static IEnumerable<string> GetAllArtists<T>(this T item)
|
||||
where T : IHasArtist, IHasAlbumArtist
|
||||
{
|
||||
foreach (var i in item.AlbumArtists)
|
||||
{
|
||||
yield return i;
|
||||
}
|
||||
|
||||
foreach (var i in item.Artists)
|
||||
{
|
||||
yield return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,11 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
/// </summary>
|
||||
public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo<AlbumInfo>, IMetadataContainer
|
||||
{
|
||||
public string[] AlbumArtists { get; set; }
|
||||
public string[] Artists { get; set; }
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<string> AlbumArtists { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IReadOnlyList<string> Artists { get; set; }
|
||||
|
||||
public MusicAlbum()
|
||||
{
|
||||
@@ -41,8 +44,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
var parents = GetParents();
|
||||
foreach (var parent in parents)
|
||||
{
|
||||
var artist = parent as MusicArtist;
|
||||
if (artist != null)
|
||||
if (parent is MusicArtist artist)
|
||||
{
|
||||
return artist;
|
||||
}
|
||||
@@ -63,30 +65,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
public override bool SupportsCumulativeRunTimeTicks => true;
|
||||
|
||||
[IgnoreDataMember]
|
||||
public string[] AllArtists
|
||||
{
|
||||
get
|
||||
{
|
||||
var list = new string[AlbumArtists.Length + Artists.Length];
|
||||
|
||||
var index = 0;
|
||||
foreach (var artist in AlbumArtists)
|
||||
{
|
||||
list[index] = artist;
|
||||
index++;
|
||||
}
|
||||
foreach (var artist in Artists)
|
||||
{
|
||||
list[index] = artist;
|
||||
index++;
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public string AlbumArtist => AlbumArtists.Length == 0 ? null : AlbumArtists[0];
|
||||
public string AlbumArtist => AlbumArtists.FirstOrDefault();
|
||||
|
||||
[IgnoreDataMember]
|
||||
public override bool SupportsPeople => false;
|
||||
@@ -216,8 +195,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
|
||||
private async Task RefreshArtists(MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
|
||||
{
|
||||
var all = AllArtists;
|
||||
foreach (var i in all)
|
||||
foreach (var i in this.GetAllArtists())
|
||||
{
|
||||
// This should not be necessary but we're seeing some cases of it
|
||||
if (string.IsNullOrEmpty(i))
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
@@ -8,17 +9,15 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasLookupInfo<MusicVideoInfo>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[IgnoreDataMember]
|
||||
public string[] Artists { get; set; }
|
||||
public IReadOnlyList<string> Artists { get; set; }
|
||||
|
||||
public MusicVideo()
|
||||
{
|
||||
Artists = Array.Empty<string>();
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
public string[] AllArtists => Artists;
|
||||
|
||||
public override UnratedItem GetBlockUnratedType()
|
||||
{
|
||||
return UnratedItem.Music;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.Providers
|
||||
/// Gets or sets the album artist.
|
||||
/// </summary>
|
||||
/// <value>The album artist.</value>
|
||||
public string[] AlbumArtists { get; set; }
|
||||
public IReadOnlyList<string> AlbumArtists { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the artist provider ids.
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
public class MusicVideoInfo : ItemLookupInfo
|
||||
{
|
||||
public string[] Artists { get; set; }
|
||||
public IReadOnlyList<string> Artists { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
public class SongInfo : ItemLookupInfo
|
||||
{
|
||||
public string[] AlbumArtists { get; set; }
|
||||
public IReadOnlyList<string> AlbumArtists { get; set; }
|
||||
|
||||
public string Album { get; set; }
|
||||
public string[] Artists { get; set; }
|
||||
|
||||
public IReadOnlyList<string> Artists { get; set; }
|
||||
|
||||
public SongInfo()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user