瀏覽代碼

add AlbumArtists to item dto's

Luke Pulverenti 10 年之前
父節點
當前提交
a92723fde3

+ 4 - 1
MediaBrowser.Api/ItemUpdateService.cs

@@ -394,7 +394,10 @@ namespace MediaBrowser.Api
             if (song != null)
             if (song != null)
             {
             {
                 song.Album = request.Album;
                 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();
                 song.Artists = request.Artists.ToList();
             }
             }
 
 

+ 0 - 16
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")]
         [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; }
         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>
         /// <summary>
         /// Limit results to items containing specific studios
         /// Limit results to items containing specific studios
         /// </summary>
         /// </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")]
         [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 bool? CollapseBoxSetItems { get; set; }
 
 
-        public string[] GetAllGenres()
-        {
-            return (AllGenres ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
-        }
-
         public string[] GetStudios()
         public string[] GetStudios()
         {
         {
             return (Studios ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
             return (Studios ?? string.Empty).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
@@ -471,7 +463,6 @@ namespace MediaBrowser.Api.UserLibrary
                 Tags = request.GetTags(),
                 Tags = request.GetTags(),
                 OfficialRatings = request.GetOfficialRatings(),
                 OfficialRatings = request.GetOfficialRatings(),
                 Genres = request.GetGenres(),
                 Genres = request.GetGenres(),
-                AllGenres = request.GetAllGenres(),
                 Studios = request.GetStudios(),
                 Studios = request.GetStudios(),
                 Person = request.Person,
                 Person = request.Person,
                 PersonTypes = request.GetPersonTypes(),
                 PersonTypes = request.GetPersonTypes(),
@@ -930,13 +921,6 @@ namespace MediaBrowser.Api.UserLibrary
                     return false;
                     return 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 VideoType
                 // Filter by VideoType
                 if (!string.IsNullOrEmpty(request.VideoTypes))
                 if (!string.IsNullOrEmpty(request.VideoTypes))
                 {
                 {

+ 0 - 2
MediaBrowser.Controller/Entities/InternalItemsQuery.cs

@@ -30,7 +30,6 @@ namespace MediaBrowser.Controller.Entities
         public string[] IncludeItemTypes { get; set; }
         public string[] IncludeItemTypes { get; set; }
         public string[] ExcludeItemTypes { get; set; }
         public string[] ExcludeItemTypes { get; set; }
         public string[] Genres { get; set; }
         public string[] Genres { get; set; }
-        public string[] AllGenres { get; set; }
 
 
         public bool? IsMissing { get; set; }
         public bool? IsMissing { get; set; }
         public bool? IsUnaired { get; set; }
         public bool? IsUnaired { get; set; }
@@ -80,7 +79,6 @@ namespace MediaBrowser.Controller.Entities
             MediaTypes = new string[] { };
             MediaTypes = new string[] { };
             IncludeItemTypes = new string[] { };
             IncludeItemTypes = new string[] { };
             ExcludeItemTypes = new string[] { };
             ExcludeItemTypes = new string[] { };
-            AllGenres = new string[] { };
             Genres = new string[] { };
             Genres = new string[] { };
             Studios = new string[] { };
             Studios = new string[] { };
             ImageTypes = new ImageType[] { };
             ImageTypes = new ImageType[] { };

+ 0 - 11
MediaBrowser.Controller/Entities/UserViewBuilder.cs

@@ -935,11 +935,6 @@ namespace MediaBrowser.Controller.Entities
                 return false;
                 return false;
             }
             }
 
 
-            if (request.AllGenres.Length > 0)
-            {
-                return false;
-            }
-
             if (request.Genres.Length > 0)
             if (request.Genres.Length > 0)
             {
             {
                 return false;
                 return false;
@@ -1569,12 +1564,6 @@ namespace MediaBrowser.Controller.Entities
                 return false;
                 return false;
             }
             }
 
 
-            // Apply genre filter
-            if (query.AllGenres.Length > 0 && !query.AllGenres.All(v => item.Genres.Contains(v, StringComparer.OrdinalIgnoreCase)))
-            {
-                return false;
-            }
-
             // Filter by VideoType
             // Filter by VideoType
             if (query.VideoTypes.Length > 0)
             if (query.VideoTypes.Length > 0)
             {
             {

+ 3 - 0
MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj

@@ -491,6 +491,9 @@
     <Compile Include="..\MediaBrowser.Model\Dto\MetadataEditorInfo.cs">
     <Compile Include="..\MediaBrowser.Model\Dto\MetadataEditorInfo.cs">
       <Link>Dto\MetadataEditorInfo.cs</Link>
       <Link>Dto\MetadataEditorInfo.cs</Link>
     </Compile>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\Dto\NameIdPair.cs">
+      <Link>Dto\NameIdPair.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\Dto\NameValuePair.cs">
     <Compile Include="..\MediaBrowser.Model\Dto\NameValuePair.cs">
       <Link>Dto\NameValuePair.cs</Link>
       <Link>Dto\NameValuePair.cs</Link>
     </Compile>
     </Compile>

+ 3 - 0
MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj

@@ -459,6 +459,9 @@
     <Compile Include="..\MediaBrowser.Model\Dto\MetadataEditorInfo.cs">
     <Compile Include="..\MediaBrowser.Model\Dto\MetadataEditorInfo.cs">
       <Link>Dto\MetadataEditorInfo.cs</Link>
       <Link>Dto\MetadataEditorInfo.cs</Link>
     </Compile>
     </Compile>
+    <Compile Include="..\MediaBrowser.Model\Dto\NameIdPair.cs">
+      <Link>Dto\NameIdPair.cs</Link>
+    </Compile>
     <Compile Include="..\MediaBrowser.Model\Dto\NameValuePair.cs">
     <Compile Include="..\MediaBrowser.Model\Dto\NameValuePair.cs">
       <Link>Dto\NameValuePair.cs</Link>
       <Link>Dto\NameValuePair.cs</Link>
     </Compile>
     </Compile>

+ 6 - 0
MediaBrowser.Model/Dto/BaseItemDto.cs

@@ -507,6 +507,12 @@ namespace MediaBrowser.Model.Dto
         /// <value>The album artist.</value>
         /// <value>The album artist.</value>
         public string AlbumArtist { get; set; }
         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>
         /// <summary>
         /// Gets or sets the name of the season.
         /// Gets or sets the name of the season.
         /// </summary>
         /// </summary>

+ 17 - 0
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; }
+    }
+}

+ 4 - 0
MediaBrowser.Model/LiveTv/RecordingInfoDto.cs

@@ -273,6 +273,10 @@ namespace MediaBrowser.Model.LiveTv
         /// <value>The type.</value>
         /// <value>The type.</value>
         public string Type { get; set; }
         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 List<MediaSourceInfo> MediaSources { get; set; }
         
         
         public RecordingInfoDto()
         public RecordingInfoDto()

+ 1 - 0
MediaBrowser.Model/MediaBrowser.Model.csproj

@@ -139,6 +139,7 @@
     <Compile Include="Drawing\ImageOrientation.cs" />
     <Compile Include="Drawing\ImageOrientation.cs" />
     <Compile Include="Dto\IHasServerId.cs" />
     <Compile Include="Dto\IHasServerId.cs" />
     <Compile Include="Dto\MetadataEditorInfo.cs" />
     <Compile Include="Dto\MetadataEditorInfo.cs" />
+    <Compile Include="Dto\NameIdPair.cs" />
     <Compile Include="Dto\NameValuePair.cs" />
     <Compile Include="Dto\NameValuePair.cs" />
     <Compile Include="MediaInfo\LiveMediaInfoResult.cs" />
     <Compile Include="MediaInfo\LiveMediaInfoResult.cs" />
     <Compile Include="Dto\MediaSourceType.cs" />
     <Compile Include="Dto\MediaSourceType.cs" />

+ 0 - 6
MediaBrowser.Model/Querying/ItemQuery.cs

@@ -92,12 +92,6 @@ namespace MediaBrowser.Model.Querying
         /// <value>The genres.</value>
         /// <value>The genres.</value>
         public string[] Genres { get; set; }
         public string[] Genres { get; set; }
 
 
-        /// <summary>
-        /// Limit results to items containing specific genres
-        /// </summary>
-        /// <value>The genres.</value>
-        public string[] AllGenres { get; set; }
-
         /// <summary>
         /// <summary>
         /// Limit results to items containing specific studios
         /// Limit results to items containing specific studios
         /// </summary>
         /// </summary>

+ 22 - 0
MediaBrowser.Server.Implementations/Dto/DtoService.cs

@@ -1175,6 +1175,28 @@ namespace MediaBrowser.Server.Implementations.Dto
             if (hasAlbumArtist != null)
             if (hasAlbumArtist != null)
             {
             {
                 dto.AlbumArtist = hasAlbumArtist.AlbumArtists.FirstOrDefault();
                 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 info
             // Add video info

+ 1 - 0
MediaBrowser.Server.Implementations/Localization/Server/server.json

@@ -1172,6 +1172,7 @@
     "LabelIfYouWishToContinueWithDeletion": "If you wish to continue, please confirm by entering the value of:",
     "LabelIfYouWishToContinueWithDeletion": "If you wish to continue, please confirm by entering the value of:",
     "ButtonIdentify": "Identify",
     "ButtonIdentify": "Identify",
     "LabelAlbumArtist": "Album artist:",
     "LabelAlbumArtist": "Album artist:",
+    "LabelAlbumArtists": "Album artists:",
     "LabelAlbum": "Album:",
     "LabelAlbum": "Album:",
     "LabelCommunityRating": "Community rating:",
     "LabelCommunityRating": "Community rating:",
     "LabelVoteCount": "Vote count:",
     "LabelVoteCount": "Vote count:",

+ 8 - 0
MediaBrowser.Server.Implementations/Sync/SyncManager.cs

@@ -136,6 +136,14 @@ namespace MediaBrowser.Server.Implementations.Sync
 
 
             var jobId = Guid.NewGuid().ToString("N");
             var 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
             var job = new SyncJob
             {
             {
                 Id = jobId,
                 Id = jobId,

+ 1 - 1
MediaBrowser.Server.Implementations/Sync/SyncRepository.cs

@@ -50,7 +50,7 @@ namespace MediaBrowser.Server.Implementations.Sync
 
 
             string[] queries = {
             string[] 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 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)",
                                 "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)",