The Free Software Media System - Server Backend & API
support artists tag value
Luke Pulverenti782fe92cf766
diff --git a/MediaBrowser.Api/SearchService.cs b/MediaBrowser.Api/SearchService.csindex 4dcf724076..ee48946d5d 100644--- a/MediaBrowser.Api/SearchService.cs+++ b/MediaBrowser.Api/SearchService.cs@@ -208,17 +208,10 @@ namespace MediaBrowser.Apiif (album != null){- var songs = album.GetRecursiveChildren(i => i is Audio)- .Cast<Audio>()- .ToList();+ result.SongCount = album.Tracks.Count();- result.SongCount = songs.Count;-- result.Artists = songs.SelectMany(i => i.AllArtists)- .Distinct(StringComparer.OrdinalIgnoreCase)- .ToArray();-- result.AlbumArtist = songs.SelectMany(i => i.AlbumArtists).FirstOrDefault(i => !string.IsNullOrEmpty(i));+ result.Artists = album.Artists.ToArray();+ result.AlbumArtist = album.AlbumArtists.FirstOrDefault();}var song = item as Audio;diff --git a/MediaBrowser.Api/VideosService.cs b/MediaBrowser.Api/VideosService.csindex 442bed06ff..d1b0eb05fd 100644--- a/MediaBrowser.Api/VideosService.cs+++ b/MediaBrowser.Api/VideosService.cs@@ -5,7 +5,6 @@ using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Library;using MediaBrowser.Controller.Net;using MediaBrowser.Controller.Persistence;-using MediaBrowser.Model.Dto;using MediaBrowser.Model.Querying;using ServiceStack;using System;diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.csindex 362096b5e3..af2cca5e63 100644--- a/MediaBrowser.Controller/Entities/AggregateFolder.cs+++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs@@ -66,7 +66,7 @@ namespace MediaBrowser.Controller.Entities{var path = ContainingFolderPath;- var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, LibraryManager, directoryService)+ var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths , directoryService){FileInfo = new DirectoryInfo(path),Path = path,diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.csindex b9a38d594e..8f766020e2 100644--- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs+++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs@@ -54,12 +54,6 @@ namespace MediaBrowser.Controller.Entities.Audiopublic List<string> AlbumArtists { get; set; }- [IgnoreDataMember]- public string AlbumArtist- {- get { return AlbumArtists.FirstOrDefault(); }- }-/// <summary>/// Gets the tracks./// </summary>diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.csindex 5452c63a4d..f82934a51b 100644--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs@@ -86,7 +86,7 @@ namespace MediaBrowser.Controller.Entities{var path = ContainingFolderPath;- var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, LibraryManager, directoryService)+ var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService){FileInfo = new DirectoryInfo(path),Path = path,diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.csindex 3c89a9609d..1fca676a92 100644--- a/MediaBrowser.Controller/Entities/User.cs+++ b/MediaBrowser.Controller/Entities/User.cs@@ -168,7 +168,7 @@ namespace MediaBrowser.Controller.Entities}// If only the casing is changing, leave the file system alone- if (!UsesIdForConfigurationPath && !newName.Equals(Name, StringComparison.OrdinalIgnoreCase))+ if (!UsesIdForConfigurationPath && !string.Equals(newName, Name, StringComparison.OrdinalIgnoreCase)){UsesIdForConfigurationPath = true;diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.csindex 4fa07421cc..db441d285a 100644--- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs+++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs@@ -17,7 +17,6 @@ namespace MediaBrowser.Controller.Library/// The _app paths/// </summary>private readonly IServerApplicationPaths _appPaths;- private readonly ILibraryManager _libraryManager;public IDirectoryService DirectoryService { get; private set; }@@ -25,11 +24,10 @@ namespace MediaBrowser.Controller.Library/// Initializes a new instance of the <see cref="ItemResolveArgs" /> class./// </summary>/// <param name="appPaths">The app paths.</param>- /// <param name="libraryManager">The library manager.</param>- public ItemResolveArgs(IServerApplicationPaths appPaths, ILibraryManager libraryManager, IDirectoryService directoryService)+ /// <param name="directoryService">The directory service.</param>+ public ItemResolveArgs(IServerApplicationPaths appPaths, IDirectoryService directoryService){_appPaths = appPaths;- _libraryManager = libraryManager;DirectoryService = directoryService;}@@ -136,18 +134,6 @@ namespace MediaBrowser.Controller.Library}}- /// <summary>- /// Gets a value indicating whether this instance is root.- /// </summary>- /// <value><c>true</c> if this instance is root; otherwise, <c>false</c>.</value>- public bool IsRoot- {- get- {- return Parent == null;- }- }-/// <summary>/// Gets or sets the additional locations./// </summary>diff --git a/MediaBrowser.Model/Entities/MetadataProviders.cs b/MediaBrowser.Model/Entities/MetadataProviders.csindex e867737898..7644b150aa 100644--- a/MediaBrowser.Model/Entities/MetadataProviders.cs+++ b/MediaBrowser.Model/Entities/MetadataProviders.cs@@ -40,6 +40,7 @@ namespace MediaBrowser.Model.EntitiesNesBoxRom = 14,TvRage = 15,AudioDbArtist = 16,- AudioDbAlbum = 17+ AudioDbAlbum = 17,+ MusicBrainzTrack = 18}}diff --git a/MediaBrowser.Model/Sync/SyncJobCreationResult.cs b/MediaBrowser.Model/Sync/SyncJobCreationResult.csindex 797318b2a9..6723aa2cf7 100644--- a/MediaBrowser.Model/Sync/SyncJobCreationResult.cs+++ b/MediaBrowser.Model/Sync/SyncJobCreationResult.cs@@ -1,8 +1,15 @@-+using System.Collections.Generic;+namespace MediaBrowser.Model.Sync{public class SyncJobCreationResult{public SyncJob Job { get; set; }+ public List<SyncJobItem> JobItems { get; set; }++ public SyncJobCreationResult()+ {+ JobItems = new List<SyncJobItem>();+ }}}diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.csindex c5c6880e15..a8e16e4ae5 100644--- a/MediaBrowser.Providers/Manager/ImageSaver.cs+++ b/MediaBrowser.Providers/Manager/ImageSaver.cs@@ -1,6 +1,5 @@using MediaBrowser.Common.Configuration;using MediaBrowser.Common.IO;-using MediaBrowser.Common.Net;using MediaBrowser.Controller.Configuration;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Entities.Audio;@@ -9,6 +8,7 @@ using MediaBrowser.Controller.Library;using MediaBrowser.Model.Configuration;using MediaBrowser.Model.Entities;using MediaBrowser.Model.Logging;+using MediaBrowser.Model.Net;using System;using System.Collections.Generic;using System.Globalization;@@ -16,7 +16,6 @@ using System.IO;using System.Linq;using System.Threading;using System.Threading.Tasks;-using MediaBrowser.Model.Net;namespace MediaBrowser.Providers.Manager{diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.csindex b51af0d8af..ad2b6ed0ff 100644--- a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs+++ b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs@@ -187,18 +187,27 @@ namespace MediaBrowser.Providers.MediaInfoaudio.Album = FFProbeHelpers.GetDictionaryValue(tags, "album");- var artist = FFProbeHelpers.GetDictionaryValue(tags, "artist");+ var artists = FFProbeHelpers.GetDictionaryValue(tags, "artists");- if (string.IsNullOrWhiteSpace(artist))+ if (!string.IsNullOrWhiteSpace(artists)){- audio.Artists.Clear();+ audio.Artists = artists.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries)+ .Distinct(StringComparer.OrdinalIgnoreCase)+ .ToList();}else{- audio.Artists = SplitArtists(artist)- .Distinct(StringComparer.OrdinalIgnoreCase)- .ToList();-+ var artist = FFProbeHelpers.GetDictionaryValue(tags, "artist");+ if (string.IsNullOrWhiteSpace(artist))+ {+ audio.Artists.Clear();+ }+ else+ {+ audio.Artists = SplitArtists(artist)+ .Distinct(StringComparer.OrdinalIgnoreCase)+ .ToList();+ }}var albumArtist = FFProbeHelpers.GetDictionaryValue(tags, "albumartist") ?? FFProbeHelpers.GetDictionaryValue(tags, "album artist") ?? FFProbeHelpers.GetDictionaryValue(tags, "album_artist");@@ -250,10 +259,23 @@ namespace MediaBrowser.Providers.MediaInfoFetchStudios(audio, tags, "publisher");}- audio.SetProviderId(MetadataProviders.MusicBrainzAlbumArtist, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Artist Id"));- audio.SetProviderId(MetadataProviders.MusicBrainzArtist, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Artist Id"));+ // These support mulitple values, but for now we only store the first.+ audio.SetProviderId(MetadataProviders.MusicBrainzAlbumArtist, GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Artist Id")));+ audio.SetProviderId(MetadataProviders.MusicBrainzArtist, GetMultipleMusicBrainzId(FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Artist Id")));+audio.SetProviderId(MetadataProviders.MusicBrainzAlbum, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Album Id"));audio.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Release Group Id"));+ audio.SetProviderId(MetadataProviders.MusicBrainzTrack, FFProbeHelpers.GetDictionaryValue(tags, "MusicBrainz Release Track Id"));+ }++ private string GetMultipleMusicBrainzId(string value)+ {+ if (string.IsNullOrWhiteSpace(value))+ {+ return null;+ }++ return value.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();}private readonly char[] _nameDelimiters = { '/', '|', ';', '\\' };diff --git a/MediaBrowser.Providers/Music/MusicExternalIds.cs b/MediaBrowser.Providers/Music/MusicExternalIds.csindex a4eab1eee8..bcafdc6f62 100644--- a/MediaBrowser.Providers/Music/MusicExternalIds.cs+++ b/MediaBrowser.Providers/Music/MusicExternalIds.cs@@ -118,4 +118,27 @@ namespace MediaBrowser.Providers.Musicreturn item is Audio || item is MusicAlbum;}}++ public class MusicBrainzTrackId : IExternalId+ {+ public string Name+ {+ get { return "MusicBrainz Track"; }+ }++ public string Key+ {+ get { return MetadataProviders.MusicBrainzTrack.ToString(); }+ }++ public string UrlFormatString+ {+ get { return "http://musicbrainz.org/track/{0}"; }+ }++ public bool Supports(IHasProviderIds item)+ {+ return item is Audio;+ }+ }}diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.csindex 124bb396ef..d7ea444a38 100644--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs@@ -13,7 +13,6 @@ using MediaBrowser.Controller.Providers;using MediaBrowser.Controller.Resolvers;using MediaBrowser.Controller.Sorting;using MediaBrowser.Model.Configuration;-using MediaBrowser.Model.Dto;using MediaBrowser.Model.Entities;using MediaBrowser.Model.Logging;using MediaBrowser.Naming.Audio;@@ -579,7 +578,7 @@ namespace MediaBrowser.Server.Implementations.LibrarycollectionType = GetContentTypeOverride(fullPath, true);}- var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, this, directoryService)+ var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, directoryService){Parent = parent,Path = fullPath,@@ -753,12 +752,14 @@ namespace MediaBrowser.Server.Implementations.LibraryDirectory.CreateDirectory(userRootPath);- _userRootFolder = GetItemById(GetNewItemId(userRootPath, typeof(UserRootFolder))) as UserRootFolder;+ var tmpItem = GetItemById(GetNewItemId(userRootPath, typeof(UserRootFolder))) as UserRootFolder;- if (_userRootFolder == null)+ if (tmpItem == null){- _userRootFolder = (UserRootFolder)ResolvePath(new DirectoryInfo(userRootPath));+ tmpItem = (UserRootFolder)ResolvePath(new DirectoryInfo(userRootPath));}++ _userRootFolder = tmpItem;}}}diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/SpecialFolderResolver.csindex 0a41a6c040..31b2d8b0f9 100644--- a/MediaBrowser.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs@@ -1,4 +1,5 @@using MediaBrowser.Common.IO;+using MediaBrowser.Controller;using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.Library;using MediaBrowser.Controller.Resolvers;@@ -11,10 +12,12 @@ namespace MediaBrowser.Server.Implementations.Library.Resolversclass SpecialFolderResolver : FolderResolver<Folder>{private readonly IFileSystem _fileSystem;+ private readonly IServerApplicationPaths _appPaths;- public SpecialFolderResolver(IFileSystem fileSystem)+ public SpecialFolderResolver(IFileSystem fileSystem, IServerApplicationPaths appPaths){_fileSystem = fileSystem;+ _appPaths = appPaths;}/// <summary>@@ -39,7 +42,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers{return new AggregateFolder();}- if (args.IsRoot)+ if (string.Equals(args.Path, _appPaths.DefaultUserViewsPath, StringComparison.OrdinalIgnoreCase)){return new UserRootFolder(); //if we got here and still a root - must be user root}diff --git a/MediaBrowser.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs b/MediaBrowser.Server.Implementations/Sorting/AiredEpisodeOrderComparer.csindex 8707f2e5bb..c7bbca060e 100644--- a/MediaBrowser.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs+++ b/MediaBrowser.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs@@ -72,6 +72,8 @@ namespace MediaBrowser.Server.Implementations.Sortingprivate int CompareEpisodeToSpecial(Episode x, Episode y){+ // http://thetvdb.com/wiki/index.php?title=Special_Episodes+var xSeason = x.PhysicalSeasonNumber ?? -1;var ySeason = y.AirsAfterSeasonNumber ?? y.AirsBeforeSeasonNumber ?? -1;diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.csindex cdbb0d5e5c..71bc0e46b5 100644--- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs+++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs@@ -158,9 +158,16 @@ namespace MediaBrowser.Server.Implementations.Sync}, _logger);}+ jobItemsResult = _repo.GetJobItems(new SyncJobItemQuery+ {+ Statuses = new List<SyncJobItemStatus> { SyncJobItemStatus.Queued, SyncJobItemStatus.Converting },+ JobId = jobId+ });+return new SyncJobCreationResult{- Job = GetJob(jobId)+ Job = GetJob(jobId),+ JobItems = jobItemsResult.Items.ToList()};}