cinema mode fixes

pull/1154/head
Luke Pulverenti 9 years ago
parent fc534f50d9
commit 0708c23ed7

@ -123,7 +123,6 @@ namespace MediaBrowser.Controller.Entities
public SourceType[] SourceTypes { get; set; } public SourceType[] SourceTypes { get; set; }
public SourceType[] ExcludeSourceTypes { get; set; } public SourceType[] ExcludeSourceTypes { get; set; }
public TrailerType[] TrailerTypes { get; set; } public TrailerType[] TrailerTypes { get; set; }
public TrailerType[] ExcludeTrailerTypes { get; set; }
public DayOfWeek[] AirDays { get; set; } public DayOfWeek[] AirDays { get; set; }
public SeriesStatus[] SeriesStatuses { get; set; } public SeriesStatus[] SeriesStatuses { get; set; }
@ -165,7 +164,6 @@ namespace MediaBrowser.Controller.Entities
SourceTypes = new SourceType[] { }; SourceTypes = new SourceType[] { };
ExcludeSourceTypes = new SourceType[] { }; ExcludeSourceTypes = new SourceType[] { };
TrailerTypes = new TrailerType[] { }; TrailerTypes = new TrailerType[] { };
ExcludeTrailerTypes = new TrailerType[] { };
AirDays = new DayOfWeek[] { }; AirDays = new DayOfWeek[] { };
SeriesStatuses = new SeriesStatus[] { }; SeriesStatuses = new SeriesStatus[] { };
} }

@ -102,15 +102,10 @@ namespace MediaBrowser.Server.Implementations.Intros
if (trailerTypes.Count > 0) if (trailerTypes.Count > 0)
{ {
var excludeTrailerTypes = Enum.GetNames(typeof(TrailerType))
.Select(i => (TrailerType)Enum.Parse(typeof(TrailerType), i, true))
.Except(trailerTypes)
.ToArray();
var trailerResult = _libraryManager.GetItemList(new InternalItemsQuery var trailerResult = _libraryManager.GetItemList(new InternalItemsQuery
{ {
IncludeItemTypes = new[] { typeof(Trailer).Name }, IncludeItemTypes = new[] { typeof(Trailer).Name },
ExcludeTrailerTypes = excludeTrailerTypes TrailerTypes = trailerTypes.ToArray()
}); });
candidates.AddRange(trailerResult.Select(i => new ItemWithTrailer candidates.AddRange(trailerResult.Select(i => new ItemWithTrailer

@ -27,13 +27,16 @@ namespace MediaBrowser.Server.Implementations.Library
.Cast<IHasTrailers>() .Cast<IHasTrailers>()
.ToList(); .ToList();
var trailerTypes = Enum.GetNames(typeof(TrailerType))
.Select(i => (TrailerType)Enum.Parse(typeof(TrailerType), i, true))
.Except(new[] { TrailerType.LocalTrailer })
.ToArray();
var trailers = _libraryManager.GetItemList(new InternalItemsQuery var trailers = _libraryManager.GetItemList(new InternalItemsQuery
{ {
IncludeItemTypes = new[] { typeof(Trailer).Name }, IncludeItemTypes = new[] { typeof(Trailer).Name },
ExcludeTrailerTypes = new[] TrailerTypes = trailerTypes
{
TrailerType.LocalTrailer
}
}).ToArray(); }).ToArray();
var numComplete = 0; var numComplete = 0;

@ -1960,20 +1960,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
whereClauses.Add(clause); whereClauses.Add(clause);
} }
if (query.ExcludeTrailerTypes.Length > 0)
{
var clauses = new List<string>();
var index = 0;
foreach (var type in query.ExcludeTrailerTypes)
{
clauses.Add("(TrailerTypes is null OR TrailerTypes not like @TrailerTypes" + index + ")");
cmd.Parameters.Add(cmd, "@TrailerTypes" + index, DbType.String).Value = "%" + type + "%";
index++;
}
var clause = "(" + string.Join(" AND ", clauses.ToArray()) + ")";
whereClauses.Add(clause);
}
if (query.IsAiring.HasValue) if (query.IsAiring.HasValue)
{ {
if (query.IsAiring.Value) if (query.IsAiring.Value)

Loading…
Cancel
Save