The Free Software Media System - Server Backend & API
add AlbumArtists to item dto's
Luke Pulverentia92723fde3fc
diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.csindex 6517d738b9..bdcad73b0d 100644--- a/MediaBrowser.Api/ItemUpdateService.cs+++ b/MediaBrowser.Api/ItemUpdateService.cs@@ -394,7 +394,10 @@ namespace MediaBrowser.Apiif (song != null){song.Album = request.Album;- song.AlbumArtists = string.IsNullOrWhiteSpace(request.AlbumArtist) ? new List<string>() : new List<string> { request.AlbumArtist };+ song.AlbumArtists = request+ .AlbumArtists+ .Select(i => i.Name)+ .ToList();song.Artists = request.Artists.ToList();}diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.csindex 9b5ef3a981..0b636e93b4 100644--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs@@ -46,9 +46,6 @@ namespace MediaBrowser.Api.UserLibrary[ApiMember(Name = "PersonTypes", Description = "Optional. If specified, along with Person, results will be filtered to include only those containing the specified person and PersonType. Allows multiple, comma-delimited", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]public string PersonTypes { get; set; }- [ApiMember(Name = "AllGenres", Description = "Optional. If specified, results will be filtered based on genre. This allows multiple, pipe delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]- public string AllGenres { get; set; }-/// <summary>/// Limit results to items containing specific studios/// </summary>@@ -226,11 +223,6 @@ namespace MediaBrowser.Api.UserLibrary[ApiMember(Name = "CollapseBoxSetItems", Description = "Whether or not to hide items behind their boxsets.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]public bool? CollapseBoxSetItems { get; set; }- public string[] GetAllGenres()- {- return (AllGenres ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);- }-public string[] GetStudios(){return (Studios ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);@@ -471,7 +463,6 @@ namespace MediaBrowser.Api.UserLibraryTags = request.GetTags(),OfficialRatings = request.GetOfficialRatings(),Genres = request.GetGenres(),- AllGenres = request.GetAllGenres(),Studios = request.GetStudios(),Person = request.Person,PersonTypes = request.GetPersonTypes(),@@ -930,13 +921,6 @@ namespace MediaBrowser.Api.UserLibraryreturn false;}- // Apply genre filter- var allGenres = request.GetAllGenres();- if (allGenres.Length > 0 && !allGenres.All(v => i.Genres.Contains(v, StringComparer.OrdinalIgnoreCase)))- {- return false;- }-// Filter by VideoTypeif (!string.IsNullOrEmpty(request.VideoTypes)){diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.csindex e99c11e87d..ccd499a579 100644--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs@@ -30,7 +30,6 @@ namespace MediaBrowser.Controller.Entitiespublic string[] IncludeItemTypes { get; set; }public string[] ExcludeItemTypes { get; set; }public string[] Genres { get; set; }- public string[] AllGenres { get; set; }public bool? IsMissing { get; set; }public bool? IsUnaired { get; set; }@@ -80,7 +79,6 @@ namespace MediaBrowser.Controller.EntitiesMediaTypes = new string[] { };IncludeItemTypes = new string[] { };ExcludeItemTypes = new string[] { };- AllGenres = new string[] { };Genres = new string[] { };Studios = new string[] { };ImageTypes = new ImageType[] { };diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.csindex 35ada4aef0..c8f9339da3 100644--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs@@ -935,11 +935,6 @@ namespace MediaBrowser.Controller.Entitiesreturn false;}- if (request.AllGenres.Length > 0)- {- return false;- }-if (request.Genres.Length > 0){return false;@@ -1569,12 +1564,6 @@ namespace MediaBrowser.Controller.Entitiesreturn false;}- // Apply genre filter- if (query.AllGenres.Length > 0 && !query.AllGenres.All(v => item.Genres.Contains(v, StringComparer.OrdinalIgnoreCase)))- {- return false;- }-// Filter by VideoTypeif (query.VideoTypes.Length > 0){diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csprojindex 2e61ed89cb..b72a895ca2 100644--- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj+++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj@@ -491,6 +491,9 @@<Compile Include="..\MediaBrowser.Model\Dto\MetadataEditorInfo.cs"><Link>Dto\MetadataEditorInfo.cs</Link></Compile>+ <Compile Include="..\MediaBrowser.Model\Dto\NameIdPair.cs">+ <Link>Dto\NameIdPair.cs</Link>+ </Compile><Compile Include="..\MediaBrowser.Model\Dto\NameValuePair.cs"><Link>Dto\NameValuePair.cs</Link></Compile>diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csprojindex ba4ac22e7c..7a28f6de83 100644--- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj+++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj@@ -459,6 +459,9 @@<Compile Include="..\MediaBrowser.Model\Dto\MetadataEditorInfo.cs"><Link>Dto\MetadataEditorInfo.cs</Link></Compile>+ <Compile Include="..\MediaBrowser.Model\Dto\NameIdPair.cs">+ <Link>Dto\NameIdPair.cs</Link>+ </Compile><Compile Include="..\MediaBrowser.Model\Dto\NameValuePair.cs"><Link>Dto\NameValuePair.cs</Link></Compile>diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.csindex 113a4c6f44..66066e392d 100644--- a/MediaBrowser.Model/Dto/BaseItemDto.cs+++ b/MediaBrowser.Model/Dto/BaseItemDto.cs@@ -507,6 +507,12 @@ namespace MediaBrowser.Model.Dto/// <value>The album artist.</value>public string AlbumArtist { get; set; }+ /// <summary>+ /// Gets or sets the album artists.+ /// </summary>+ /// <value>The album artists.</value>+ public List<NameIdPair> AlbumArtists { get; set; }+/// <summary>/// Gets or sets the name of the season./// </summary>diff --git a/MediaBrowser.Model/Dto/NameIdPair.cs b/MediaBrowser.Model/Dto/NameIdPair.csnew file mode 100644index 0000000000..d3931516cd--- /dev/null+++ b/MediaBrowser.Model/Dto/NameIdPair.cs@@ -0,0 +1,17 @@++namespace MediaBrowser.Model.Dto+{+ public class NameIdPair+ {+ /// <summary>+ /// Gets or sets the name.+ /// </summary>+ /// <value>The name.</value>+ public string Name { get; set; }+ /// <summary>+ /// Gets or sets the identifier.+ /// </summary>+ /// <value>The identifier.</value>+ public string Id { get; set; }+ }+}diff --git a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs b/MediaBrowser.Model/LiveTv/RecordingInfoDto.csindex a6cd85d8d3..d6d6980381 100644--- a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs+++ b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs@@ -273,6 +273,10 @@ namespace MediaBrowser.Model.LiveTv/// <value>The type.</value>public string Type { get; set; }+ /// <summary>+ /// Gets or sets the media sources.+ /// </summary>+ /// <value>The media sources.</value>public List<MediaSourceInfo> MediaSources { get; set; }public RecordingInfoDto()diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csprojindex 14ec093ec6..fd50e598a9 100644--- a/MediaBrowser.Model/MediaBrowser.Model.csproj+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj@@ -139,6 +139,7 @@<Compile Include="Drawing\ImageOrientation.cs" /><Compile Include="Dto\IHasServerId.cs" /><Compile Include="Dto\MetadataEditorInfo.cs" />+ <Compile Include="Dto\NameIdPair.cs" /><Compile Include="Dto\NameValuePair.cs" /><Compile Include="MediaInfo\LiveMediaInfoResult.cs" /><Compile Include="Dto\MediaSourceType.cs" />diff --git a/MediaBrowser.Model/Querying/ItemQuery.cs b/MediaBrowser.Model/Querying/ItemQuery.csindex 0f929fa9bb..a40eca5b5a 100644--- a/MediaBrowser.Model/Querying/ItemQuery.cs+++ b/MediaBrowser.Model/Querying/ItemQuery.cs@@ -92,12 +92,6 @@ namespace MediaBrowser.Model.Querying/// <value>The genres.</value>public string[] Genres { get; set; }- /// <summary>- /// Limit results to items containing specific genres- /// </summary>- /// <value>The genres.</value>- public string[] AllGenres { get; set; }-/// <summary>/// Limit results to items containing specific studios/// </summary>diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.csindex f9b7470b2c..8086033ebb 100644--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs@@ -1175,6 +1175,28 @@ namespace MediaBrowser.Server.Implementations.Dtoif (hasAlbumArtist != null){dto.AlbumArtist = hasAlbumArtist.AlbumArtists.FirstOrDefault();++ dto.AlbumArtists = hasAlbumArtist+ .AlbumArtists+ .Select(i =>+ {+ try+ {+ var artist = _libraryManager.GetArtist(i);+ return new NameIdPair+ {+ Name = artist.Name,+ Id = artist.Id.ToString("N")+ };+ }+ catch (Exception ex)+ {+ _logger.ErrorException("Error getting album artist", ex);+ return null;+ }+ })+ .Where(i => i != null)+ .ToList();}// Add video infodiff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.jsonindex 9464309b70..4935170046 100644--- a/MediaBrowser.Server.Implementations/Localization/Server/server.json+++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json@@ -1172,6 +1172,7 @@"LabelIfYouWishToContinueWithDeletion": "If you wish to continue, please confirm by entering the value of:","ButtonIdentify": "Identify","LabelAlbumArtist": "Album artist:",+ "LabelAlbumArtists": "Album artists:","LabelAlbum": "Album:","LabelCommunityRating": "Community rating:","LabelVoteCount": "Vote count:",diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.csindex a974a7675a..0bf9a2e23a 100644--- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs+++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs@@ -136,6 +136,14 @@ namespace MediaBrowser.Server.Implementations.Syncvar jobId = Guid.NewGuid().ToString("N");+ if (string.IsNullOrWhiteSpace(request.Quality))+ {+ request.Quality = GetQualityOptions(request.TargetId)+ .Where(i => i.IsDefault)+ .Select(i => i.Id)+ .FirstOrDefault(i => !string.IsNullOrWhiteSpace(i));+ }+var job = new SyncJob{Id = jobId,diff --git a/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs b/MediaBrowser.Server.Implementations/Sync/SyncRepository.csindex 45b35523a6..9d820eaa2b 100644--- a/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs+++ b/MediaBrowser.Server.Implementations/Sync/SyncRepository.cs@@ -50,7 +50,7 @@ namespace MediaBrowser.Server.Implementations.Syncstring[] queries = {- "create table if not exists SyncJobs (Id GUID PRIMARY KEY, TargetId TEXT NOT NULL, Name TEXT NOT NULL, Quality TEXT NOT NULL, Status TEXT NOT NULL, Progress FLOAT, UserId TEXT NOT NULL, ItemIds TEXT NOT NULL, Category TEXT, ParentId TEXT, UnwatchedOnly BIT, ItemLimit INT, SyncNewContent BIT, DateCreated DateTime, DateLastModified DateTime, ItemCount int)",+ "create table if not exists SyncJobs (Id GUID PRIMARY KEY, TargetId TEXT NOT NULL, Name TEXT NOT NULL, Quality TEXT, Status TEXT NOT NULL, Progress FLOAT, UserId TEXT NOT NULL, ItemIds TEXT NOT NULL, Category TEXT, ParentId TEXT, UnwatchedOnly BIT, ItemLimit INT, SyncNewContent BIT, DateCreated DateTime, DateLastModified DateTime, ItemCount int)","create index if not exists idx_SyncJobs on SyncJobs(Id)","create table if not exists SyncJobItems (Id GUID PRIMARY KEY, ItemId TEXT, ItemName TEXT, MediaSourceId TEXT, JobId TEXT, TemporaryPath TEXT, OutputPath TEXT, Status TEXT, TargetId TEXT, DateCreated DateTime, Progress FLOAT, AdditionalFiles TEXT, MediaSource TEXT, IsMarkedForRemoval BIT, JobItemIndex INT)",