diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index 06db1de745..10f9ec0223 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -68,6 +68,7 @@ namespace MediaBrowser.Api _config.Configuration.EnableLocalizedGuids = true; _config.Configuration.EnableCustomPathSubFolders = true; _config.Configuration.EnableDateLastRefresh = true; + _config.Configuration.EnableStandaloneMusicKeys = true; _config.SaveConfiguration(); } diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 766f1e5ed8..dc37dcceab 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -153,6 +153,31 @@ namespace MediaBrowser.Controller.Entities.Audio /// System.String. 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) diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index c5ce6a2f7b..e6178c183b 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -34,7 +34,17 @@ namespace MediaBrowser.Controller.Entities.Audio { get { - return GetParents().OfType().FirstOrDefault(); + var artist = GetParents().OfType().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().FirstOrDefault(); + var artist = MusicArtist; if (artist != null) { diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 749d562ac1..6f99e77ec4 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -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 /// The name of the TMDB collection. public string TmdbCollectionName { get; set; } + [IgnoreDataMember] + public string CollectionName + { + get { return TmdbCollectionName; } + set { TmdbCollectionName = value; } + } + /// /// Gets the trailer ids. /// diff --git a/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs index 0b434231fd..1c1bbe71e1 100644 --- a/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/MovieXmlParser.cs @@ -35,7 +35,7 @@ namespace MediaBrowser.LocalMetadata.Parsers if (!string.IsNullOrWhiteSpace(val) && movie != null) { - movie.TmdbCollectionName = val; + movie.CollectionName = val; } break; diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 64edbdea9c..009068deae 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -207,7 +207,8 @@ namespace MediaBrowser.Model.Configuration public bool DownloadImagesInAdvance { get; set; } public bool EnableAnonymousUsageReporting { get; set; } - + public bool EnableStandaloneMusicKeys { get; set; } + /// /// Initializes a new instance of the class. /// diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index ef2de5d789..8e3284152b 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -206,12 +206,6 @@ namespace MediaBrowser.Model.Dto /// The short overview. public string ShortOverview { get; set; } - /// - /// Gets or sets the name of the TMDB collection. - /// - /// The name of the TMDB collection. - public string TmdbCollectionName { get; set; } - /// /// Gets or sets the taglines. /// diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs index 97fec8fdd3..1540f178a4 100644 --- a/MediaBrowser.Model/Querying/ItemFields.cs +++ b/MediaBrowser.Model/Querying/ItemFields.cs @@ -235,11 +235,6 @@ /// VoteCount, - /// - /// The TMDB collection name - /// - TmdbCollectionName, - /// /// The trailer url of the item /// diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.cs index b0d3f63812..a83a40bc34 100644 --- a/MediaBrowser.Providers/Manager/ProviderManager.cs +++ b/MediaBrowser.Providers/Manager/ProviderManager.cs @@ -1022,8 +1022,8 @@ namespace MediaBrowser.Providers.Manager .ToList(); var musicArtists = albums - .Select(i => i.GetParent()) - .OfType() + .Select(i => i.MusicArtist) + .Where(i => i != null) .ToList(); var musicArtistRefreshTasks = musicArtists.Select(i => i.ValidateChildren(new Progress(), cancellationToken, options, true)); diff --git a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs index c98a67bbdb..f9108b9fda 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs @@ -107,11 +107,21 @@ namespace MediaBrowser.Providers.MediaInfo private string GetAudioImagePath(Audio item) { - var album = item.AlbumEntity; - var filename = item.Album ?? string.Empty; filename += string.Join(",", item.Artists.ToArray()); - filename += album == null ? item.Id.ToString("N") + "_primary" + item.DateModified.Ticks : album.Id.ToString("N") + album.DateModified.Ticks + "_primary"; + + if (!string.IsNullOrWhiteSpace(item.Album)) + { + filename += "_" + item.Album; + } + else if (!string.IsNullOrWhiteSpace(item.Name)) + { + filename += "_" + item.Name; + } + else + { + filename += "_" + item.Id.ToString("N"); + } filename = filename.GetMD5() + ".jpg"; diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs index abd4a62029..157704240a 100644 --- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs +++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs @@ -179,7 +179,7 @@ namespace MediaBrowser.Providers.Movies if (movieItem != null) { - movieItem.TmdbCollectionName = movieData.belongs_to_collection.name; + movieItem.CollectionName = movieData.belongs_to_collection.name; } } diff --git a/MediaBrowser.Providers/Movies/MovieMetadataService.cs b/MediaBrowser.Providers/Movies/MovieMetadataService.cs index 8757bdd0db..f4cad837a1 100644 --- a/MediaBrowser.Providers/Movies/MovieMetadataService.cs +++ b/MediaBrowser.Providers/Movies/MovieMetadataService.cs @@ -37,9 +37,9 @@ namespace MediaBrowser.Providers.Movies var sourceItem = source.Item; var targetItem = target.Item; - if (replaceData || string.IsNullOrEmpty(targetItem.TmdbCollectionName)) + if (replaceData || string.IsNullOrEmpty(targetItem.CollectionName)) { - targetItem.TmdbCollectionName = sourceItem.TmdbCollectionName; + targetItem.CollectionName = sourceItem.CollectionName; } } } diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs index a19a122c38..fb202b7980 100644 --- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs +++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs @@ -1378,16 +1378,6 @@ namespace MediaBrowser.Server.Implementations.Dto } } - // Add MovieInfo - var movie = item as Movie; - if (movie != null) - { - if (fields.Contains(ItemFields.TmdbCollectionName)) - { - dto.TmdbCollectionName = movie.TmdbCollectionName; - } - } - var hasSpecialFeatures = item as IHasSpecialFeatures; if (hasSpecialFeatures != null) { diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 721603efec..3c56af9e6a 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -1044,11 +1044,6 @@ namespace MediaBrowser.Server.Implementations.Library return names; } - private void SetPropertiesFromSongs(MusicArtist artist, IEnumerable items) - { - - } - /// /// Validate and refresh the People sub-set of the IBN. /// The items are stored in the db but not loaded into memory until actually requested by an operation. diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index 7362ee58f7..cb74d4dd77 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -180,7 +180,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers } catch (XmlException) { - + } } } @@ -661,7 +661,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers if (!string.IsNullOrWhiteSpace(val)) { val = val.Replace("plugin://plugin.video.youtube/?action=play_video&videoid=", "http://www.youtube.com/watch?v=", StringComparison.OrdinalIgnoreCase); - + hasTrailer.AddTrailerUrl(val, false); } } @@ -860,6 +860,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers break; case "collectionnumber": + case "tmdbcolid": var tmdbCollection = reader.ReadElementContentAsString(); if (!string.IsNullOrWhiteSpace(tmdbCollection)) { diff --git a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs index 8d5c2bf20e..14c214f043 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs @@ -11,7 +11,8 @@ namespace MediaBrowser.XbmcMetadata.Parsers { class MovieNfoParser : BaseNfoParser