Merge pull request #1797 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-05-31 14:47:53 -04:00
commit 322ecae53e
29 changed files with 170 additions and 191 deletions

View File

@ -298,11 +298,7 @@ namespace MediaBrowser.Api
hasShortOverview.ShortOverview = request.ShortOverview; hasShortOverview.ShortOverview = request.ShortOverview;
} }
var hasKeywords = item as IHasKeywords; item.Keywords = request.Keywords;
if (hasKeywords != null)
{
hasKeywords.Keywords = request.Keywords;
}
if (request.Studios != null) if (request.Studios != null)
{ {

View File

@ -146,21 +146,12 @@ namespace MediaBrowser.Api.Movies
var movies = _libraryManager.GetItemList(query, parentIds) var movies = _libraryManager.GetItemList(query, parentIds)
.OrderBy(i => (int)i.SourceType); .OrderBy(i => (int)i.SourceType);
var listEligibleForCategories = new List<BaseItem>();
var listEligibleForSuggestion = new List<BaseItem>(); var listEligibleForSuggestion = new List<BaseItem>();
var list = movies.ToList(); var list = movies.ToList();
listEligibleForCategories.AddRange(list);
listEligibleForSuggestion.AddRange(list); listEligibleForSuggestion.AddRange(list);
listEligibleForCategories = listEligibleForCategories
// Exclude trailers from the suggestion categories
.Where(i => i is Movie)
.DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
.DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString(), StringComparer.OrdinalIgnoreCase)
.ToList();
listEligibleForSuggestion = listEligibleForSuggestion listEligibleForSuggestion = listEligibleForSuggestion
.DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase) .DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
.DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString(), StringComparer.OrdinalIgnoreCase) .DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString(), StringComparer.OrdinalIgnoreCase)
@ -170,7 +161,7 @@ namespace MediaBrowser.Api.Movies
dtoOptions.Fields = request.GetItemFields().ToList(); dtoOptions.Fields = request.GetItemFields().ToList();
var result = GetRecommendationCategories(user, listEligibleForCategories, listEligibleForSuggestion, request.CategoryLimit, request.ItemLimit, dtoOptions); var result = GetRecommendationCategories(user, request.ParentId, listEligibleForSuggestion, request.CategoryLimit, request.ItemLimit, dtoOptions);
return ToOptimizedResult(result); return ToOptimizedResult(result);
} }
@ -233,44 +224,43 @@ namespace MediaBrowser.Api.Movies
return result; return result;
} }
private IEnumerable<RecommendationDto> GetRecommendationCategories(User user, List<BaseItem> allMoviesForCategories, List<BaseItem> allMovies, int categoryLimit, int itemLimit, DtoOptions dtoOptions) private IEnumerable<RecommendationDto> GetRecommendationCategories(User user, string parentId, List<BaseItem> allMovies, int categoryLimit, int itemLimit, DtoOptions dtoOptions)
{ {
var categories = new List<RecommendationDto>(); var categories = new List<RecommendationDto>();
var recentlyPlayedMovies = allMoviesForCategories var parentIds = string.IsNullOrWhiteSpace(parentId) ? new string[] { } : new[] { parentId };
.Select(i => var query = new InternalItemsQuery(user)
{ {
var userdata = _userDataRepository.GetUserData(user, i); IncludeItemTypes = new[]
return new Tuple<BaseItem, bool, DateTime>(i, userdata.Played, userdata.LastPlayedDate ?? DateTime.MinValue); {
}) typeof(Movie).Name,
.Where(i => i.Item2) //typeof(Trailer).Name,
.OrderByDescending(i => i.Item3) //typeof(LiveTvProgram).Name
.Select(i => i.Item1) },
.ToList(); // IsMovie = true
SortBy = new[] { ItemSortBy.DatePlayed, ItemSortBy.Random },
SortOrder = SortOrder.Descending,
Limit = 7
};
var excludeFromLiked = recentlyPlayedMovies.Take(10); var recentlyPlayedMovies = _libraryManager.GetItemList(query, parentIds).ToList();
var likedMovies = allMovies
.Select(i =>
{
var score = 0;
var userData = _userDataRepository.GetUserData(user, i);
if (userData.IsFavorite) var likedMovies = _libraryManager.GetItemList(new InternalItemsQuery(user)
{ {
score = 2; IncludeItemTypes = new[]
}
else
{ {
score = userData.Likes.HasValue ? userData.Likes.Value ? 1 : -1 : 0; typeof(Movie).Name,
} typeof(Trailer).Name,
typeof(LiveTvProgram).Name
},
IsMovie = true,
SortBy = new[] { ItemSortBy.Random },
SortOrder = SortOrder.Descending,
Limit = 10,
IsFavoriteOrLiked = true,
ExcludeItemIds = recentlyPlayedMovies.Select(i => i.Id.ToString("N")).ToArray()
return new Tuple<BaseItem, int>(i, score); }, parentIds);
})
.OrderByDescending(i => i.Item2)
.ThenBy(i => Guid.NewGuid())
.Where(i => i.Item2 > 0)
.Select(i => i.Item1)
.Where(i => !excludeFromLiked.Contains(i));
var mostRecentMovies = recentlyPlayedMovies.Take(6).ToList(); var mostRecentMovies = recentlyPlayedMovies.Take(6).ToList();
// Get recently played directors // Get recently played directors
@ -286,8 +276,8 @@ namespace MediaBrowser.Api.Movies
var similarToRecentlyPlayed = GetSimilarTo(user, allMovies, recentlyPlayedMovies.Take(7).OrderBy(i => Guid.NewGuid()), itemLimit, dtoOptions, RecommendationType.SimilarToRecentlyPlayed).GetEnumerator(); var similarToRecentlyPlayed = GetSimilarTo(user, allMovies, recentlyPlayedMovies.Take(7).OrderBy(i => Guid.NewGuid()), itemLimit, dtoOptions, RecommendationType.SimilarToRecentlyPlayed).GetEnumerator();
var similarToLiked = GetSimilarTo(user, allMovies, likedMovies, itemLimit, dtoOptions, RecommendationType.SimilarToLikedItem).GetEnumerator(); var similarToLiked = GetSimilarTo(user, allMovies, likedMovies, itemLimit, dtoOptions, RecommendationType.SimilarToLikedItem).GetEnumerator();
var hasDirectorFromRecentlyPlayed = GetWithDirector(user, allMovies, recentDirectors, itemLimit, dtoOptions, RecommendationType.HasDirectorFromRecentlyPlayed).GetEnumerator(); var hasDirectorFromRecentlyPlayed = GetWithDirector(user, recentDirectors, itemLimit, dtoOptions, RecommendationType.HasDirectorFromRecentlyPlayed).GetEnumerator();
var hasActorFromRecentlyPlayed = GetWithActor(user, allMovies, recentActors, itemLimit, dtoOptions, RecommendationType.HasActorFromRecentlyPlayed).GetEnumerator(); var hasActorFromRecentlyPlayed = GetWithActor(user, recentActors, itemLimit, dtoOptions, RecommendationType.HasActorFromRecentlyPlayed).GetEnumerator();
var categoryTypes = new List<IEnumerator<RecommendationDto>> var categoryTypes = new List<IEnumerator<RecommendationDto>>
{ {
@ -330,14 +320,25 @@ namespace MediaBrowser.Api.Movies
return categories.OrderBy(i => i.RecommendationType).ThenBy(i => Guid.NewGuid()); return categories.OrderBy(i => i.RecommendationType).ThenBy(i => Guid.NewGuid());
} }
private IEnumerable<RecommendationDto> GetWithDirector(User user, List<BaseItem> allMovies, IEnumerable<string> directors, int itemLimit, DtoOptions dtoOptions, RecommendationType type) private IEnumerable<RecommendationDto> GetWithDirector(User user, IEnumerable<string> names, int itemLimit, DtoOptions dtoOptions, RecommendationType type)
{ {
var userId = user.Id; foreach (var name in names)
{
var items = _libraryManager.GetItemList(new InternalItemsQuery(user)
{
Person = name,
// Account for duplicates by imdb id, since the database doesn't support this yet
Limit = itemLimit + 2,
PersonTypes = new[] { PersonType.Director },
IncludeItemTypes = new[]
{
typeof(Movie).Name,
typeof(Trailer).Name,
typeof(LiveTvProgram).Name
},
IsMovie = true
foreach (var director in directors) }).DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N"))
{
var items = allMovies
.Where(i => _libraryManager.GetPeople(i).Any(p => string.Equals(p.Type, PersonType.Director, StringComparison.OrdinalIgnoreCase) && string.Equals(p.Name, director, StringComparison.OrdinalIgnoreCase)))
.Take(itemLimit) .Take(itemLimit)
.ToList(); .ToList();
@ -345,8 +346,8 @@ namespace MediaBrowser.Api.Movies
{ {
yield return new RecommendationDto yield return new RecommendationDto
{ {
BaselineItemName = director, BaselineItemName = name,
CategoryId = director.GetMD5().ToString("N"), CategoryId = name.GetMD5().ToString("N"),
RecommendationType = type, RecommendationType = type,
Items = _dtoService.GetBaseItemDtos(items, dtoOptions, user).ToArray() Items = _dtoService.GetBaseItemDtos(items, dtoOptions, user).ToArray()
}; };
@ -354,18 +355,24 @@ namespace MediaBrowser.Api.Movies
} }
} }
private IEnumerable<RecommendationDto> GetWithActor(User user, List<BaseItem> allMovies, IEnumerable<string> names, int itemLimit, DtoOptions dtoOptions, RecommendationType type) private IEnumerable<RecommendationDto> GetWithActor(User user, IEnumerable<string> names, int itemLimit, DtoOptions dtoOptions, RecommendationType type)
{ {
foreach (var name in names) foreach (var name in names)
{ {
var itemsWithActor = _libraryManager.GetItemIds(new InternalItemsQuery(user) var items = _libraryManager.GetItemList(new InternalItemsQuery(user)
{ {
Person = name Person = name,
// Account for duplicates by imdb id, since the database doesn't support this yet
Limit = itemLimit + 2,
IncludeItemTypes = new[]
{
typeof(Movie).Name,
typeof(Trailer).Name,
typeof(LiveTvProgram).Name
},
IsMovie = true
}); }).DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N"))
var items = allMovies
.Where(i => itemsWithActor.Contains(i.Id))
.Take(itemLimit) .Take(itemLimit)
.ToList(); .ToList();

View File

@ -980,11 +980,6 @@ namespace MediaBrowser.Api.Playback
var transcodingId = Guid.NewGuid().ToString("N"); var transcodingId = Guid.NewGuid().ToString("N");
var commandLineArgs = GetCommandLineArguments(outputPath, state, true); var commandLineArgs = GetCommandLineArguments(outputPath, state, true);
if (ApiEntryPoint.Instance.GetEncodingOptions().EnableDebugLogging)
{
commandLineArgs = "-loglevel debug " + commandLineArgs;
}
var process = new Process var process = new Process
{ {
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo

View File

@ -127,13 +127,7 @@ namespace MediaBrowser.Api
private static IEnumerable<string> GetKeywords(BaseItem item) private static IEnumerable<string> GetKeywords(BaseItem item)
{ {
var hasTags = item as IHasKeywords; return item.Keywords;
if (hasTags != null)
{
return hasTags.Keywords;
}
return new List<string>();
} }
/// <summary> /// <summary>

View File

@ -37,6 +37,7 @@ namespace MediaBrowser.Controller.Entities
{ {
protected BaseItem() protected BaseItem()
{ {
Keywords = new List<string>();
Tags = new List<string>(); Tags = new List<string>();
Genres = new List<string>(); Genres = new List<string>();
Studios = new List<string>(); Studios = new List<string>();
@ -811,6 +812,8 @@ namespace MediaBrowser.Controller.Entities
[IgnoreDataMember] [IgnoreDataMember]
public List<string> Tags { get; set; } public List<string> Tags { get; set; }
public List<string> Keywords { get; set; }
/// <summary> /// <summary>
/// Gets or sets the home page URL. /// Gets or sets the home page URL.
/// </summary> /// </summary>

View File

@ -33,6 +33,7 @@ namespace MediaBrowser.Controller.Entities
public string[] ExcludeTags { get; set; } public string[] ExcludeTags { get; set; }
public string[] ExcludeInheritedTags { get; set; } public string[] ExcludeInheritedTags { get; set; }
public string[] Genres { get; set; } public string[] Genres { get; set; }
public string[] Keywords { get; set; }
public bool? IsMissing { get; set; } public bool? IsMissing { get; set; }
public bool? IsUnaired { get; set; } public bool? IsUnaired { get; set; }
@ -52,6 +53,7 @@ namespace MediaBrowser.Controller.Entities
public string Person { get; set; } public string Person { get; set; }
public string[] PersonIds { get; set; } public string[] PersonIds { get; set; }
public string[] ItemIds { get; set; } public string[] ItemIds { get; set; }
public string[] ExcludeItemIds { get; set; }
public string AdjacentTo { get; set; } public string AdjacentTo { get; set; }
public string[] PersonTypes { get; set; } public string[] PersonTypes { get; set; }
@ -151,6 +153,7 @@ namespace MediaBrowser.Controller.Entities
OfficialRatings = new string[] { }; OfficialRatings = new string[] { };
SortBy = new string[] { }; SortBy = new string[] { };
MediaTypes = new string[] { }; MediaTypes = new string[] { };
Keywords = new string[] { };
IncludeItemTypes = new string[] { }; IncludeItemTypes = new string[] { };
ExcludeItemTypes = new string[] { }; ExcludeItemTypes = new string[] { };
Genres = new string[] { }; Genres = new string[] { };
@ -164,6 +167,7 @@ namespace MediaBrowser.Controller.Entities
PersonIds = new string[] { }; PersonIds = new string[] { };
ChannelIds = new string[] { }; ChannelIds = new string[] { };
ItemIds = new string[] { }; ItemIds = new string[] { };
ExcludeItemIds = new string[] { };
AncestorIds = new string[] { }; AncestorIds = new string[] { };
TopParentIds = new string[] { }; TopParentIds = new string[] { };
ExcludeTags = new string[] { }; ExcludeTags = new string[] { };

View File

@ -1,21 +1,11 @@
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities
{ {
public interface IHasKeywords
{
/// <summary>
/// Gets or sets the keywords.
/// </summary>
/// <value>The keywords.</value>
List<string> Keywords { get; set; }
}
public static class KeywordExtensions public static class KeywordExtensions
{ {
public static void AddKeyword(this IHasKeywords item, string name) public static void AddKeyword(this BaseItem item, string name)
{ {
if (string.IsNullOrWhiteSpace(name)) if (string.IsNullOrWhiteSpace(name))
{ {

View File

@ -15,7 +15,7 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <summary> /// <summary>
/// Class BoxSet /// Class BoxSet
/// </summary> /// </summary>
public class BoxSet : Folder, IHasTrailers, IHasKeywords, IHasDisplayOrder, IHasLookupInfo<BoxSetInfo>, IHasShares public class BoxSet : Folder, IHasTrailers, IHasDisplayOrder, IHasLookupInfo<BoxSetInfo>, IHasShares
{ {
public List<Share> Shares { get; set; } public List<Share> Shares { get; set; }
@ -26,7 +26,6 @@ namespace MediaBrowser.Controller.Entities.Movies
RemoteTrailerIds = new List<Guid>(); RemoteTrailerIds = new List<Guid>();
DisplayOrder = ItemSortBy.PremiereDate; DisplayOrder = ItemSortBy.PremiereDate;
Keywords = new List<string>();
Shares = new List<Share>(); Shares = new List<Share>();
} }
@ -47,12 +46,6 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <value>The remote trailers.</value> /// <value>The remote trailers.</value>
public List<MediaUrl> RemoteTrailers { get; set; } public List<MediaUrl> RemoteTrailers { get; set; }
/// <summary>
/// Gets or sets the tags.
/// </summary>
/// <value>The tags.</value>
public List<string> Keywords { get; set; }
/// <summary> /// <summary>
/// Gets or sets the display order. /// Gets or sets the display order.
/// </summary> /// </summary>

View File

@ -15,7 +15,7 @@ namespace MediaBrowser.Controller.Entities.Movies
/// <summary> /// <summary>
/// Class Movie /// Class Movie
/// </summary> /// </summary>
public class Movie : Video, IHasCriticRating, IHasSpecialFeatures, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping, IHasOriginalTitle public class Movie : Video, IHasCriticRating, IHasSpecialFeatures, IHasProductionLocations, IHasBudget, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping, IHasOriginalTitle
{ {
public List<Guid> SpecialFeatureIds { get; set; } public List<Guid> SpecialFeatureIds { get; set; }
@ -32,7 +32,6 @@ namespace MediaBrowser.Controller.Entities.Movies
ThemeSongIds = new List<Guid>(); ThemeSongIds = new List<Guid>();
ThemeVideoIds = new List<Guid>(); ThemeVideoIds = new List<Guid>();
Taglines = new List<string>(); Taglines = new List<string>();
Keywords = new List<string>();
ProductionLocations = new List<string>(); ProductionLocations = new List<string>();
} }
@ -42,7 +41,6 @@ namespace MediaBrowser.Controller.Entities.Movies
public List<Guid> LocalTrailerIds { get; set; } public List<Guid> LocalTrailerIds { get; set; }
public List<Guid> RemoteTrailerIds { get; set; } public List<Guid> RemoteTrailerIds { get; set; }
public List<string> Keywords { get; set; }
public List<MediaUrl> RemoteTrailers { get; set; } public List<MediaUrl> RemoteTrailers { get; set; }

View File

@ -9,6 +9,7 @@ using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Providers;
using MoreLinq; using MoreLinq;
namespace MediaBrowser.Controller.Entities.TV namespace MediaBrowser.Controller.Entities.TV
@ -516,5 +517,22 @@ namespace MediaBrowser.Controller.Entities.TV
return hasChanges; return hasChanges;
} }
public override List<ExternalUrl> GetRelatedUrls()
{
var list = base.GetRelatedUrls();
var imdbId = this.GetProviderId(MetadataProviders.Imdb);
if (!string.IsNullOrWhiteSpace(imdbId))
{
list.Add(new ExternalUrl
{
Name = "Trakt",
Url = string.Format("https://trakt.tv/shows/{0}", imdbId)
});
}
return list;
}
} }
} }

View File

@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.Entities
/// <summary> /// <summary>
/// Class Trailer /// Class Trailer
/// </summary> /// </summary>
public class Trailer : Video, IHasCriticRating, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTaglines, IHasMetascore, IHasOriginalTitle, IHasLookupInfo<TrailerInfo> public class Trailer : Video, IHasCriticRating, IHasProductionLocations, IHasBudget, IHasTaglines, IHasMetascore, IHasOriginalTitle, IHasLookupInfo<TrailerInfo>
{ {
public List<string> ProductionLocations { get; set; } public List<string> ProductionLocations { get; set; }
@ -31,8 +31,6 @@ namespace MediaBrowser.Controller.Entities
public List<MediaUrl> RemoteTrailers { get; set; } public List<MediaUrl> RemoteTrailers { get; set; }
public List<string> Keywords { get; set; }
[IgnoreDataMember] [IgnoreDataMember]
public bool IsLocalTrailer public bool IsLocalTrailer
{ {

View File

@ -142,7 +142,7 @@
<Compile Include="Entities\IHasDisplayOrder.cs" /> <Compile Include="Entities\IHasDisplayOrder.cs" />
<Compile Include="Entities\IHasId.cs" /> <Compile Include="Entities\IHasId.cs" />
<Compile Include="Entities\IHasImages.cs" /> <Compile Include="Entities\IHasImages.cs" />
<Compile Include="Entities\IHasKeywords.cs" /> <Compile Include="Entities\KeywordExtensions.cs" />
<Compile Include="Entities\IHasMediaSources.cs" /> <Compile Include="Entities\IHasMediaSources.cs" />
<Compile Include="Entities\IHasMetascore.cs" /> <Compile Include="Entities\IHasMetascore.cs" />
<Compile Include="Entities\IHasOriginalTitle.cs" /> <Compile Include="Entities\IHasOriginalTitle.cs" />

View File

@ -816,11 +816,7 @@ namespace MediaBrowser.Controller.Providers
{ {
using (var subtree = reader.ReadSubtree()) using (var subtree = reader.ReadSubtree())
{ {
var hasTags = item as IHasKeywords; FetchFromKeywordsNode(subtree, item);
if (hasTags != null)
{
FetchFromKeywordsNode(subtree, hasTags);
}
} }
break; break;
} }
@ -1099,7 +1095,7 @@ namespace MediaBrowser.Controller.Providers
} }
} }
private void FetchFromKeywordsNode(XmlReader reader, IHasKeywords item) private void FetchFromKeywordsNode(XmlReader reader, BaseItem item)
{ {
reader.MoveToContent(); reader.MoveToContent();

View File

@ -609,21 +609,17 @@ namespace MediaBrowser.LocalMetadata.Savers
} }
} }
var hasKeywords = item as IHasKeywords; if (item.Keywords.Count > 0)
if (hasKeywords != null)
{
if (hasKeywords.Keywords.Count > 0)
{ {
builder.Append("<PlotKeywords>"); builder.Append("<PlotKeywords>");
foreach (var tag in hasKeywords.Keywords) foreach (var tag in item.Keywords)
{ {
builder.Append("<PlotKeyword>" + SecurityElement.Escape(tag) + "</PlotKeyword>"); builder.Append("<PlotKeyword>" + SecurityElement.Escape(tag) + "</PlotKeyword>");
} }
builder.Append("</PlotKeywords>"); builder.Append("</PlotKeywords>");
} }
}
var people = libraryManager.GetPeople(item); var people = libraryManager.GetPeople(item);

View File

@ -73,11 +73,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
var commandLineArgs = GetCommandLineArguments(encodingJob); var commandLineArgs = GetCommandLineArguments(encodingJob);
if (GetEncodingOptions().EnableDebugLogging)
{
commandLineArgs = "-loglevel debug " + commandLineArgs;
}
var process = new Process var process = new Process
{ {
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo

View File

@ -6,7 +6,6 @@ namespace MediaBrowser.Model.Configuration
public int EncodingThreadCount { get; set; } public int EncodingThreadCount { get; set; }
public string TranscodingTempPath { get; set; } public string TranscodingTempPath { get; set; }
public double DownMixAudioBoost { get; set; } public double DownMixAudioBoost { get; set; }
public bool EnableDebugLogging { get; set; }
public bool EnableThrottling { get; set; } public bool EnableThrottling { get; set; }
public int ThrottleDelaySeconds { get; set; } public int ThrottleDelaySeconds { get; set; }
public string HardwareAccelerationType { get; set; } public string HardwareAccelerationType { get; set; }

View File

@ -165,15 +165,9 @@ namespace MediaBrowser.Providers.Manager
if (!lockedFields.Contains(MetadataFields.Keywords)) if (!lockedFields.Contains(MetadataFields.Keywords))
{ {
var sourceHasKeywords = source as IHasKeywords; if (replaceData || target.Keywords.Count == 0)
var targetHasKeywords = target as IHasKeywords;
if (sourceHasKeywords != null && targetHasKeywords != null)
{ {
if (replaceData || targetHasKeywords.Keywords.Count == 0) target.Keywords = source.Keywords;
{
targetHasKeywords.Keywords = sourceHasKeywords.Keywords;
}
} }
} }

View File

@ -314,11 +314,7 @@ namespace MediaBrowser.Providers.Movies
if (movieData.keywords != null && movieData.keywords.keywords != null) if (movieData.keywords != null && movieData.keywords.keywords != null)
{ {
var hasTags = movie as IHasKeywords; movie.Keywords = movieData.keywords.keywords.Select(i => i.name).ToList();
if (hasTags != null)
{
hasTags.Keywords = movieData.keywords.keywords.Select(i => i.name).ToList();
}
} }
if (movieData.trailers != null && movieData.trailers.youtube != null && if (movieData.trailers != null && movieData.trailers.youtube != null &&

View File

@ -983,16 +983,7 @@ namespace MediaBrowser.Server.Implementations.Dto
if (fields.Contains(ItemFields.Keywords)) if (fields.Contains(ItemFields.Keywords))
{ {
var hasTags = item as IHasKeywords; dto.Keywords = item.Keywords;
if (hasTags != null)
{
dto.Keywords = hasTags.Keywords;
}
if (dto.Keywords == null)
{
dto.Keywords = new List<string>();
}
} }
if (fields.Contains(ItemFields.ProductionLocations)) if (fields.Contains(ItemFields.ProductionLocations))

View File

@ -433,13 +433,7 @@ namespace MediaBrowser.Server.Implementations.Intros
private static IEnumerable<string> GetKeywords(BaseItem item) private static IEnumerable<string> GetKeywords(BaseItem item)
{ {
var hasTags = item as IHasKeywords; return item.Keywords;
if (hasTags != null)
{
return hasTags.Keywords;
}
return new List<string>();
} }
public IEnumerable<string> GetAllIntroFiles() public IEnumerable<string> GetAllIntroFiles()

View File

@ -87,7 +87,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
private IDbCommand _updateInheritedRatingCommand; private IDbCommand _updateInheritedRatingCommand;
private IDbCommand _updateInheritedTagsCommand; private IDbCommand _updateInheritedTagsCommand;
public const int LatestSchemaVersion = 80; public const int LatestSchemaVersion = 82;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class. /// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
@ -2489,8 +2489,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
var index = 0; var index = 0;
foreach (var item in query.Genres) foreach (var item in query.Genres)
{ {
clauses.Add("Genres like @Genres" + index); clauses.Add("@Genre" + index + " in (select value from itemvalues where ItemId=Guid and Type=2)");
cmd.Parameters.Add(cmd, "@Genres" + index, DbType.String).Value = "%" + item + "%"; cmd.Parameters.Add(cmd, "@Genre" + index, DbType.String).Value = item;
index++; index++;
} }
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")"; var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
@ -2503,8 +2503,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
var index = 0; var index = 0;
foreach (var item in query.Tags) foreach (var item in query.Tags)
{ {
clauses.Add("Tags like @Tags" + index); clauses.Add("@Tag" + index + " in (select value from itemvalues where ItemId=Guid and Type=4)");
cmd.Parameters.Add(cmd, "@Tags" + index, DbType.String).Value = "%" + item + "%"; cmd.Parameters.Add(cmd, "@Tag" + index, DbType.String).Value = item;
index++; index++;
} }
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")"; var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
@ -2517,8 +2517,22 @@ namespace MediaBrowser.Server.Implementations.Persistence
var index = 0; var index = 0;
foreach (var item in query.Studios) foreach (var item in query.Studios)
{ {
clauses.Add("Studios like @Studios" + index); clauses.Add("@Studio" + index + " in (select value from itemvalues where ItemId=Guid and Type=3)");
cmd.Parameters.Add(cmd, "@Studios" + index, DbType.String).Value = "%" + item + "%"; cmd.Parameters.Add(cmd, "@Studio" + index, DbType.String).Value = item;
index++;
}
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
whereClauses.Add(clause);
}
if (query.Keywords.Length > 0)
{
var clauses = new List<string>();
var index = 0;
foreach (var item in query.Keywords)
{
clauses.Add("@Keyword" + index + " in (select value from itemvalues where ItemId=Guid and Type=5)");
cmd.Parameters.Add(cmd, "@Keyword" + index, DbType.String).Value = item;
index++; index++;
} }
var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")"; var clause = "(" + string.Join(" OR ", clauses.ToArray()) + ")";
@ -2614,6 +2628,20 @@ namespace MediaBrowser.Server.Implementations.Persistence
whereClauses.Add("MediaType in (" + val + ")"); whereClauses.Add("MediaType in (" + val + ")");
} }
if (query.ExcludeItemIds.Length > 0)
{
var excludeIds = new List<string>();
var index = 0;
foreach (var id in query.ExcludeItemIds)
{
excludeIds.Add("Guid <> @ExcludeId" + index);
cmd.Parameters.Add(cmd, "@ExcludeId" + index, DbType.Guid).Value = new Guid(id);
index++;
}
whereClauses.Add(string.Join(" AND ", excludeIds.ToArray()));
}
if (query.AlbumNames.Length > 0) if (query.AlbumNames.Length > 0)
{ {
@ -3233,6 +3261,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
list.AddRange(hasAlbumArtist.AlbumArtists.Select(i => new Tuple<int, string>(1, i))); list.AddRange(hasAlbumArtist.AlbumArtists.Select(i => new Tuple<int, string>(1, i)));
} }
list.AddRange(item.Genres.Select(i => new Tuple<int, string>(2, i)));
list.AddRange(item.Studios.Select(i => new Tuple<int, string>(3, i)));
list.AddRange(item.Tags.Select(i => new Tuple<int, string>(4, i)));
list.AddRange(item.Keywords.Select(i => new Tuple<int, string>(5, i)));
return list; return list;
} }

View File

@ -32,7 +32,7 @@ namespace MediaBrowser.Server.Mono.Native
{ {
PageSize = 4096, PageSize = 4096,
CacheSize = 2000, CacheSize = 2000,
SyncMode = SynchronizationModes.Full, SyncMode = SynchronizationModes.Normal,
DataSource = dbPath, DataSource = dbPath,
JournalMode = SQLiteJournalModeEnum.Wal JournalMode = SQLiteJournalModeEnum.Wal
}; };

View File

@ -32,7 +32,7 @@ namespace MediaBrowser.ServerApplication.Native
{ {
PageSize = 4096, PageSize = 4096,
CacheSize = 2000, CacheSize = 2000,
SyncMode = SynchronizationModes.Full, SyncMode = SynchronizationModes.Normal,
DataSource = dbPath, DataSource = dbPath,
JournalMode = SQLiteJournalModeEnum.Wal JournalMode = SQLiteJournalModeEnum.Wal
}; };

View File

@ -143,6 +143,9 @@
<Content Include="dashboard-ui\components\viewcontainer-lite.js"> <Content Include="dashboard-ui\components\viewcontainer-lite.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\css\dashboard.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\css\images\logo.png"> <Content Include="dashboard-ui\css\images\logo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@ -371,9 +374,6 @@
<Content Include="dashboard-ui\shared.html"> <Content Include="dashboard-ui\shared.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\components\subtitleeditor\subtitleeditor.template.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\devices\android\android.css"> <Content Include="dashboard-ui\devices\android\android.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@ -884,9 +884,6 @@
<Content Include="dashboard-ui\scripts\dlnasettings.js"> <Content Include="dashboard-ui\scripts\dlnasettings.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="dashboard-ui\components\subtitleeditor\subtitleeditor.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\encodingsettings.js"> <Content Include="dashboard-ui\scripts\encodingsettings.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

View File

@ -932,13 +932,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers
{ {
var val = reader.ReadElementContentAsString(); var val = reader.ReadElementContentAsString();
var hasKeywords = item as IHasKeywords;
if (hasKeywords != null)
{
if (!string.IsNullOrWhiteSpace(val)) if (!string.IsNullOrWhiteSpace(val))
{ {
hasKeywords.AddKeyword(val); item.AddKeyword(val);
}
} }
break; break;
} }

View File

@ -752,14 +752,10 @@ namespace MediaBrowser.XbmcMetadata.Savers
} }
} }
var hasKeywords = item as IHasKeywords; foreach (var tag in item.Keywords)
if (hasKeywords != null)
{
foreach (var tag in hasKeywords.Keywords)
{ {
writer.WriteElementString("plotkeyword", tag); writer.WriteElementString("plotkeyword", tag);
} }
}
var hasAwards = item as IHasAwards; var hasAwards = item as IHasAwards;
if (hasAwards != null && !string.IsNullOrEmpty(hasAwards.AwardSummary)) if (hasAwards != null && !string.IsNullOrEmpty(hasAwards.AwardSummary))

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common.Internal</id> <id>MediaBrowser.Common.Internal</id>
<version>3.0.648</version> <version>3.0.649</version>
<title>MediaBrowser.Common.Internal</title> <title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors> <authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption.</description> <description>Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Emby 2013</copyright> <copyright>Copyright © Emby 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.648" /> <dependency id="MediaBrowser.Common" version="3.0.649" />
<dependency id="NLog" version="4.3.4" /> <dependency id="NLog" version="4.3.4" />
<dependency id="SimpleInjector" version="3.1.5" /> <dependency id="SimpleInjector" version="3.1.5" />
</dependencies> </dependencies>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common</id> <id>MediaBrowser.Common</id>
<version>3.0.648</version> <version>3.0.649</version>
<title>MediaBrowser.Common</title> <title>MediaBrowser.Common</title>
<authors>Emby Team</authors> <authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.648</version> <version>3.0.649</version>
<title>Media Browser.Server.Core</title> <title>Media Browser.Server.Core</title>
<authors>Emby Team</authors> <authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Emby Server.</description> <description>Contains core components required to build plugins for Emby Server.</description>
<copyright>Copyright © Emby 2013</copyright> <copyright>Copyright © Emby 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.648" /> <dependency id="MediaBrowser.Common" version="3.0.649" />
<dependency id="Interfaces.IO" version="1.0.0.5" /> <dependency id="Interfaces.IO" version="1.0.0.5" />
</dependencies> </dependencies>
</metadata> </metadata>