update music user data key

This commit is contained in:
Luke Pulverenti
2016-03-13 21:34:24 -04:00
parent 749037eb4a
commit d683f30619
17 changed files with 91 additions and 45 deletions

View File

@@ -153,6 +153,31 @@ namespace MediaBrowser.Controller.Entities.Audio
/// <returns>System.String.</returns>
protected override string CreateUserDataKey()
{
if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys)
{
var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty;
if (ParentIndexNumber.HasValue)
{
songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey;
}
songKey+= Name;
if (!string.IsNullOrWhiteSpace(Album))
{
songKey = Album + "-" + songKey;
}
var albumArtist = AlbumArtists.FirstOrDefault();
if (!string.IsNullOrWhiteSpace(albumArtist))
{
songKey = albumArtist + "-" + songKey;
}
return songKey;
}
var parent = AlbumEntity;
if (parent != null)

View File

@@ -34,7 +34,17 @@ namespace MediaBrowser.Controller.Entities.Audio
{
get
{
return GetParents().OfType<MusicArtist>().FirstOrDefault();
var artist = GetParents().OfType<MusicArtist>().FirstOrDefault();
if (artist == null)
{
var name = AlbumArtist;
if (!string.IsNullOrWhiteSpace(name))
{
artist = LibraryManager.GetArtist(name);
}
}
return artist;
}
}
@@ -106,6 +116,15 @@ namespace MediaBrowser.Controller.Entities.Audio
return "MusicAlbum-Musicbrainz-" + id;
}
if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys)
{
var albumArtist = AlbumArtist;
if (!string.IsNullOrWhiteSpace(albumArtist))
{
return albumArtist + "-" + Name;
}
}
return base.CreateUserDataKey();
}
@@ -125,7 +144,7 @@ namespace MediaBrowser.Controller.Entities.Audio
id.AlbumArtists = AlbumArtists;
var artist = GetParents().OfType<MusicArtist>().FirstOrDefault();
var artist = MusicArtist;
if (artist != null)
{

View File

@@ -6,6 +6,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using CommonIO;
@@ -85,6 +86,13 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <value>The name of the TMDB collection.</value>
public string TmdbCollectionName { get; set; }
[IgnoreDataMember]
public string CollectionName
{
get { return TmdbCollectionName; }
set { TmdbCollectionName = value; }
}
/// <summary>
/// Gets the trailer ids.
/// </summary>