Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
79b5d3e195
|
@ -213,7 +213,6 @@ namespace MediaBrowser.Api.Reports
|
|||
NameStartsWith = request.NameStartsWith,
|
||||
NameStartsWithOrGreater = request.NameStartsWithOrGreater,
|
||||
HasImdbId = request.HasImdbId,
|
||||
IsYearMismatched = request.IsYearMismatched,
|
||||
IsPlaceHolder = request.IsPlaceHolder,
|
||||
IsLocked = request.IsLocked,
|
||||
IsInBoxSet = request.IsInBoxSet,
|
||||
|
|
|
@ -100,9 +100,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
[ApiMember(Name = "HasTvdbId", Description = "Optional filter by items that have a tvdb id or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
||||
public bool? HasTvdbId { get; set; }
|
||||
|
||||
[ApiMember(Name = "IsYearMismatched", Description = "Optional filter by items that are potentially misidentified.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
||||
public bool? IsYearMismatched { get; set; }
|
||||
|
||||
[ApiMember(Name = "IsInBoxSet", Description = "Optional filter by items that are in boxsets, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
|
||||
public bool? IsInBoxSet { get; set; }
|
||||
|
||||
|
|
|
@ -187,7 +187,6 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
NameStartsWith = request.NameStartsWith,
|
||||
NameStartsWithOrGreater = request.NameStartsWithOrGreater,
|
||||
HasImdbId = request.HasImdbId,
|
||||
IsYearMismatched = request.IsYearMismatched,
|
||||
IsPlaceHolder = request.IsPlaceHolder,
|
||||
IsLocked = request.IsLocked,
|
||||
IsInBoxSet = request.IsInBoxSet,
|
||||
|
|
|
@ -75,6 +75,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
/// Gets or sets the album.
|
||||
/// </summary>
|
||||
/// <value>The album.</value>
|
||||
[IgnoreDataMember]
|
||||
public string Album { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -840,30 +840,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
return true;
|
||||
}
|
||||
|
||||
if (query.HasImdbId.HasValue)
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to HasImdbId");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (query.HasTmdbId.HasValue)
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to HasTmdbId");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (query.HasTvdbId.HasValue)
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to HasTvdbId");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (query.IsYearMismatched.HasValue)
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to IsYearMismatched");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (query.HasOfficialRating.HasValue)
|
||||
{
|
||||
Logger.Debug("Query requires post-filtering due to HasOfficialRating");
|
||||
|
|
|
@ -64,7 +64,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
public bool? IsInBoxSet { get; set; }
|
||||
public bool? IsLocked { get; set; }
|
||||
public bool? IsPlaceHolder { get; set; }
|
||||
public bool? IsYearMismatched { get; set; }
|
||||
|
||||
public bool? HasImdbId { get; set; }
|
||||
public bool? HasOverview { get; set; }
|
||||
|
@ -141,6 +140,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
public bool GroupByPresentationUniqueKey { get; set; }
|
||||
public bool EnableTotalRecordCount { get; set; }
|
||||
public bool ForceDirect { get; set; }
|
||||
public Dictionary<string,string> ExcludeProviderIds { get; set; }
|
||||
|
||||
public InternalItemsQuery()
|
||||
{
|
||||
|
@ -149,7 +149,8 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
AlbumNames = new string[] { };
|
||||
ArtistNames = new string[] { };
|
||||
|
||||
ExcludeProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
BlockUnratedItems = new UnratedItem[] { };
|
||||
Tags = new string[] { };
|
||||
OfficialRatings = new string[] { };
|
||||
|
|
|
@ -995,11 +995,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
return false;
|
||||
}
|
||||
|
||||
if (request.IsYearMismatched.HasValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.Person))
|
||||
{
|
||||
return false;
|
||||
|
@ -1418,16 +1413,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
}
|
||||
|
||||
if (query.IsYearMismatched.HasValue)
|
||||
{
|
||||
var filterValue = query.IsYearMismatched.Value;
|
||||
|
||||
if (IsYearMismatched(item, libraryManager) != filterValue)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (query.HasOfficialRating.HasValue)
|
||||
{
|
||||
var filterValue = query.HasOfficialRating.Value;
|
||||
|
@ -1979,34 +1964,6 @@ namespace MediaBrowser.Controller.Entities
|
|||
return _userViewManager.GetUserSubView(parent.Id.ToString("N"), type, sortName, CancellationToken.None);
|
||||
}
|
||||
|
||||
public static bool IsYearMismatched(BaseItem item, ILibraryManager libraryManager)
|
||||
{
|
||||
if (item.ProductionYear.HasValue)
|
||||
{
|
||||
var path = item.Path;
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
var info = libraryManager.ParseName(Path.GetFileName(path));
|
||||
var yearInName = info.Year;
|
||||
|
||||
// Go up a level if we didn't get a year
|
||||
if (!yearInName.HasValue)
|
||||
{
|
||||
info = libraryManager.ParseName(Path.GetFileName(Path.GetDirectoryName(path)));
|
||||
yearInName = info.Year;
|
||||
}
|
||||
|
||||
if (yearInName.HasValue)
|
||||
{
|
||||
return yearInName.Value != item.ProductionYear.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static IEnumerable<BaseItem> FilterForAdjacency(IEnumerable<BaseItem> items, string adjacentToId)
|
||||
{
|
||||
var list = items.ToList();
|
||||
|
|
|
@ -56,8 +56,8 @@
|
|||
<Reference Include="Interfaces.IO">
|
||||
<HintPath>..\packages\Interfaces.IO.1.0.0.5\lib\portable-net45+sl4+wp71+win8+wpa81\Interfaces.IO.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MediaBrowser.Naming, Version=1.0.5981.21615, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.50\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
||||
<Reference Include="MediaBrowser.Naming, Version=1.0.5996.42016, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MediaBrowser.Naming.1.0.0.51\lib\portable-net45+sl4+wp71+win8+wpa81\MediaBrowser.Naming.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="MoreLinq">
|
||||
|
|
|
@ -85,10 +85,13 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
private IDbCommand _deleteItemValuesCommand;
|
||||
private IDbCommand _saveItemValuesCommand;
|
||||
|
||||
private IDbCommand _deleteProviderIdsCommand;
|
||||
private IDbCommand _saveProviderIdsCommand;
|
||||
|
||||
private IDbCommand _updateInheritedRatingCommand;
|
||||
private IDbCommand _updateInheritedTagsCommand;
|
||||
|
||||
public const int LatestSchemaVersion = 82;
|
||||
public const int LatestSchemaVersion = 83;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
||||
|
@ -143,6 +146,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
"create table if not exists ItemValues (ItemId GUID, Type INT, Value TEXT)",
|
||||
"create index if not exists idx_ItemValues on ItemValues(ItemId)",
|
||||
|
||||
"create table if not exists ProviderIds (ItemId GUID, Name TEXT, Value TEXT)",
|
||||
"create index if not exists Idx_ProviderIds on ProviderIds(ItemId)",
|
||||
|
||||
"create table if not exists People (ItemId GUID, Name TEXT NOT NULL, Role TEXT, PersonType TEXT, SortOrder int, ListOrder int)",
|
||||
"create index if not exists idxPeopleItemId on People(ItemId)",
|
||||
"create index if not exists idxPeopleName on People(Name)",
|
||||
|
@ -548,6 +554,17 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
_saveItemValuesCommand.Parameters.Add(_saveItemValuesCommand, "@Type");
|
||||
_saveItemValuesCommand.Parameters.Add(_saveItemValuesCommand, "@Value");
|
||||
|
||||
// provider ids
|
||||
_deleteProviderIdsCommand = _connection.CreateCommand();
|
||||
_deleteProviderIdsCommand.CommandText = "delete from ProviderIds where ItemId=@Id";
|
||||
_deleteProviderIdsCommand.Parameters.Add(_deleteProviderIdsCommand, "@Id");
|
||||
|
||||
_saveProviderIdsCommand = _connection.CreateCommand();
|
||||
_saveProviderIdsCommand.CommandText = "insert into ProviderIds (ItemId, Name, Value) values (@ItemId, @Name, @Value)";
|
||||
_saveProviderIdsCommand.Parameters.Add(_saveProviderIdsCommand, "@ItemId");
|
||||
_saveProviderIdsCommand.Parameters.Add(_saveProviderIdsCommand, "@Name");
|
||||
_saveProviderIdsCommand.Parameters.Add(_saveProviderIdsCommand, "@Value");
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -862,6 +879,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
}
|
||||
|
||||
UpdateUserDataKeys(item.Id, item.GetUserDataKeys().Distinct(StringComparer.OrdinalIgnoreCase).ToList(), transaction);
|
||||
UpdateProviderIds(item.Id, item.ProviderIds, transaction);
|
||||
UpdateItemValues(item.Id, GetItemValues(item), transaction);
|
||||
}
|
||||
|
||||
|
@ -1635,6 +1653,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
var excludeIds = query.ExcludeItemIds.ToList();
|
||||
excludeIds.Add(item.Id.ToString("N"));
|
||||
query.ExcludeItemIds = excludeIds.ToArray();
|
||||
|
||||
query.ExcludeProviderIds = item.ProviderIds;
|
||||
}
|
||||
|
||||
return list.ToArray();
|
||||
|
@ -2711,6 +2731,40 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
whereClauses.Add(string.Join(" AND ", excludeIds.ToArray()));
|
||||
}
|
||||
|
||||
if (query.ExcludeProviderIds.Count > 0)
|
||||
{
|
||||
var excludeIds = new List<string>();
|
||||
|
||||
var index = 0;
|
||||
foreach (var pair in query.ExcludeProviderIds)
|
||||
{
|
||||
var paramName = "@ExcludeProviderId" + index;
|
||||
excludeIds.Add("(COALESCE((select value from ProviderIds where ItemId=Guid and Name = 'Imdb'), '') <> " + paramName + ")");
|
||||
cmd.Parameters.Add(cmd, paramName, DbType.String).Value = pair.Value;
|
||||
index++;
|
||||
}
|
||||
|
||||
whereClauses.Add(string.Join(" AND ", excludeIds.ToArray()));
|
||||
}
|
||||
|
||||
if (query.HasImdbId.HasValue)
|
||||
{
|
||||
var fn = query.HasImdbId.Value ? "<>" : "=";
|
||||
whereClauses.Add("(COALESCE((select value from ProviderIds where ItemId=Guid and Name = 'Imdb'), '') " + fn + " '')");
|
||||
}
|
||||
|
||||
if (query.HasTmdbId.HasValue)
|
||||
{
|
||||
var fn = query.HasTmdbId.Value ? "<>" : "=";
|
||||
whereClauses.Add("(COALESCE((select value from ProviderIds where ItemId=Guid and Name = 'Tmdb'), '') " + fn + " '')");
|
||||
}
|
||||
|
||||
if (query.HasTvdbId.HasValue)
|
||||
{
|
||||
var fn = query.HasTvdbId.Value ? "<>" : "=";
|
||||
whereClauses.Add("(COALESCE((select value from ProviderIds where ItemId=Guid and Name = 'Tvdb'), '') " + fn + " '')");
|
||||
}
|
||||
|
||||
if (query.AlbumNames.Length > 0)
|
||||
{
|
||||
var clause = "(";
|
||||
|
@ -3121,6 +3175,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
_deleteItemValuesCommand.Transaction = transaction;
|
||||
_deleteItemValuesCommand.ExecuteNonQuery();
|
||||
|
||||
// Delete provider ids
|
||||
_deleteProviderIdsCommand.GetParameter(0).Value = id;
|
||||
_deleteProviderIdsCommand.Transaction = transaction;
|
||||
_deleteProviderIdsCommand.ExecuteNonQuery();
|
||||
|
||||
// Delete the item
|
||||
_deleteItemCommand.GetParameter(0).Value = id;
|
||||
_deleteItemCommand.Transaction = transaction;
|
||||
|
@ -3337,6 +3396,37 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
return list;
|
||||
}
|
||||
|
||||
private void UpdateProviderIds(Guid itemId, Dictionary<string, string> values, IDbTransaction transaction)
|
||||
{
|
||||
if (itemId == Guid.Empty)
|
||||
{
|
||||
throw new ArgumentNullException("itemId");
|
||||
}
|
||||
|
||||
if (values == null)
|
||||
{
|
||||
throw new ArgumentNullException("keys");
|
||||
}
|
||||
|
||||
CheckDisposed();
|
||||
|
||||
// First delete
|
||||
_deleteProviderIdsCommand.GetParameter(0).Value = itemId;
|
||||
_deleteProviderIdsCommand.Transaction = transaction;
|
||||
|
||||
_deleteProviderIdsCommand.ExecuteNonQuery();
|
||||
|
||||
foreach (var pair in values)
|
||||
{
|
||||
_saveProviderIdsCommand.GetParameter(0).Value = itemId;
|
||||
_saveProviderIdsCommand.GetParameter(1).Value = pair.Key;
|
||||
_saveProviderIdsCommand.GetParameter(2).Value = pair.Value;
|
||||
_saveProviderIdsCommand.Transaction = transaction;
|
||||
|
||||
_saveProviderIdsCommand.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateItemValues(Guid itemId, List<Tuple<int, string>> values, IDbTransaction transaction)
|
||||
{
|
||||
if (itemId == Guid.Empty)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<package id="Emby.XmlTv" version="1.0.0.50" targetFramework="net45" />
|
||||
<package id="ini-parser" version="2.3.0" targetFramework="net45" />
|
||||
<package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
|
||||
<package id="MediaBrowser.Naming" version="1.0.0.50" targetFramework="net45" />
|
||||
<package id="MediaBrowser.Naming" version="1.0.0.51" targetFramework="net45" />
|
||||
<package id="Mono.Nat" version="1.2.24.0" targetFramework="net45" />
|
||||
<package id="morelinq" version="1.4.0" targetFramework="net45" />
|
||||
<package id="Patterns.Logging" version="1.0.0.2" targetFramework="net45" />
|
||||
|
|
|
@ -140,6 +140,12 @@
|
|||
<Content Include="dashboard-ui\components\scrollthreshold.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\components\tvproviders\xmltv.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\components\tvproviders\xmltv.template.html">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="dashboard-ui\components\viewcontainer-lite.js">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
|
Loading…
Reference in New Issue
Block a user