add AlbumArtists to item dto's

This commit is contained in:
Luke Pulverenti 2015-03-13 11:54:20 -04:00
parent 4309455c37
commit a92723fde3
15 changed files with 70 additions and 37 deletions

View File

@ -394,7 +394,10 @@ namespace MediaBrowser.Api
if (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();
}

View File

@ -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.UserLibrary
Tags = 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.UserLibrary
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
if (!string.IsNullOrEmpty(request.VideoTypes))
{

View File

@ -30,7 +30,6 @@ namespace MediaBrowser.Controller.Entities
public 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.Entities
MediaTypes = new string[] { };
IncludeItemTypes = new string[] { };
ExcludeItemTypes = new string[] { };
AllGenres = new string[] { };
Genres = new string[] { };
Studios = new string[] { };
ImageTypes = new ImageType[] { };

View File

@ -935,11 +935,6 @@ namespace MediaBrowser.Controller.Entities
return false;
}
if (request.AllGenres.Length > 0)
{
return false;
}
if (request.Genres.Length > 0)
{
return false;
@ -1569,12 +1564,6 @@ namespace MediaBrowser.Controller.Entities
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
if (query.VideoTypes.Length > 0)
{

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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; }
}
}

View File

@ -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()

View File

@ -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" />

View File

@ -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>

View File

@ -1175,6 +1175,28 @@ namespace MediaBrowser.Server.Implementations.Dto
if (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 info

View File

@ -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:",

View File

@ -136,6 +136,14 @@ namespace MediaBrowser.Server.Implementations.Sync
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
{
Id = jobId,

View File

@ -50,7 +50,7 @@ namespace MediaBrowser.Server.Implementations.Sync
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 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)",