mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-19 20:54:20 +01:00
support multiple user data keys
This commit is contained in:
@@ -26,7 +26,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
IArchivable
|
||||
{
|
||||
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
|
||||
|
||||
|
||||
public long? Size { get; set; }
|
||||
public string Container { get; set; }
|
||||
public int? TotalBitrate { get; set; }
|
||||
@@ -150,12 +150,10 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ") : "") + Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user data key.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
protected override string CreateUserDataKey()
|
||||
public override List<string> GetUserDataKeys()
|
||||
{
|
||||
var list = base.GetUserDataKeys();
|
||||
|
||||
if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys)
|
||||
{
|
||||
var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty;
|
||||
@@ -165,7 +163,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
{
|
||||
songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey;
|
||||
}
|
||||
songKey+= Name;
|
||||
songKey += Name;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(Album))
|
||||
{
|
||||
@@ -178,25 +176,25 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
songKey = albumArtist + "-" + songKey;
|
||||
}
|
||||
|
||||
return songKey;
|
||||
list.Insert(0, songKey);
|
||||
}
|
||||
|
||||
var parent = AlbumEntity;
|
||||
|
||||
if (parent != null)
|
||||
else
|
||||
{
|
||||
var parentKey = parent.GetUserDataKey();
|
||||
var parent = AlbumEntity;
|
||||
|
||||
if (IndexNumber.HasValue)
|
||||
if (parent != null && IndexNumber.HasValue)
|
||||
{
|
||||
var songKey = (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
|
||||
+ IndexNumber.Value.ToString("0000 - ");
|
||||
list.InsertRange(0, parent.GetUserDataKeys().Select(i =>
|
||||
{
|
||||
var songKey = (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
|
||||
+ IndexNumber.Value.ToString("0000 - ");
|
||||
|
||||
return parentKey + songKey;
|
||||
return i + songKey;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
return base.CreateUserDataKey();
|
||||
return list;
|
||||
}
|
||||
|
||||
public override UnratedItem GetBlockUnratedType()
|
||||
|
||||
@@ -96,36 +96,34 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
|
||||
public List<string> Artists { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user data key.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
protected override string CreateUserDataKey()
|
||||
public override List<string> GetUserDataKeys()
|
||||
{
|
||||
var id = this.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
return "MusicAlbum-MusicBrainzReleaseGroup-" + id;
|
||||
}
|
||||
|
||||
id = this.GetProviderId(MetadataProviders.MusicBrainzAlbum);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
return "MusicAlbum-Musicbrainz-" + id;
|
||||
}
|
||||
var list = base.GetUserDataKeys();
|
||||
|
||||
if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys)
|
||||
{
|
||||
var albumArtist = AlbumArtist;
|
||||
if (!string.IsNullOrWhiteSpace(albumArtist))
|
||||
{
|
||||
return albumArtist + "-" + Name;
|
||||
list.Insert(0, albumArtist + "-" + Name);
|
||||
}
|
||||
}
|
||||
|
||||
return base.CreateUserDataKey();
|
||||
var id = this.GetProviderId(MetadataProviders.MusicBrainzAlbum);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
list.Insert(0, "MusicAlbum-Musicbrainz-" + id);
|
||||
}
|
||||
|
||||
id = this.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(id))
|
||||
{
|
||||
list.Insert(0, "MusicAlbum-MusicBrainzReleaseGroup-" + id);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
protected override bool GetBlockUnratedValue(UserPolicy config)
|
||||
|
||||
@@ -80,13 +80,12 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
ProductionLocations = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user data key.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
protected override string CreateUserDataKey()
|
||||
public override List<string> GetUserDataKeys()
|
||||
{
|
||||
return GetUserDataKey(this);
|
||||
var list = base.GetUserDataKeys();
|
||||
|
||||
list.InsertRange(0, GetUserDataKeys(this));
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -121,16 +120,18 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
private static string GetUserDataKey(MusicArtist item)
|
||||
private static List<string> GetUserDataKeys(MusicArtist item)
|
||||
{
|
||||
var list = new List<string>();
|
||||
var id = item.GetProviderId(MetadataProviders.MusicBrainzArtist);
|
||||
|
||||
if (!string.IsNullOrEmpty(id))
|
||||
{
|
||||
return "Artist-Musicbrainz-" + id;
|
||||
list.Add("Artist-Musicbrainz-" + id);
|
||||
}
|
||||
|
||||
return "Artist-" + item.Name;
|
||||
list.Add("Artist-" + item.Name);
|
||||
return list;
|
||||
}
|
||||
|
||||
protected override bool GetBlockUnratedValue(UserPolicy config)
|
||||
|
||||
@@ -10,13 +10,12 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
/// </summary>
|
||||
public class MusicGenre : BaseItem, IItemByName
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the user data key.
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
protected override string CreateUserDataKey()
|
||||
public override List<string> GetUserDataKeys()
|
||||
{
|
||||
return "MusicGenre-" + Name;
|
||||
var list = base.GetUserDataKeys();
|
||||
|
||||
list.Insert(0, "MusicGenre-" + Name);
|
||||
return list;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
|
||||
Reference in New Issue
Block a user