Merge pull request #1790 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-05-29 15:01:34 -04:00
commit 8ec9b73eae
11 changed files with 94 additions and 25 deletions

View File

@ -135,12 +135,9 @@ namespace MediaBrowser.Api.Movies
IncludeItemTypes = new[] { typeof(Movie).Name } IncludeItemTypes = new[] { typeof(Movie).Name }
}; };
if (user.Configuration.IncludeTrailersInSuggestions) var includeList = query.IncludeItemTypes.ToList();
{ includeList.Add(typeof(Trailer).Name);
var includeList = query.IncludeItemTypes.ToList(); query.IncludeItemTypes = includeList.ToArray();
includeList.Add(typeof(Trailer).Name);
query.IncludeItemTypes = includeList.ToArray();
}
var parentIds = string.IsNullOrWhiteSpace(request.ParentId) ? new string[] { } : new[] { request.ParentId }; var parentIds = string.IsNullOrWhiteSpace(request.ParentId) ? new string[] { } : new[] { request.ParentId };
var movies = _libraryManager.GetItemList(query, parentIds) var movies = _libraryManager.GetItemList(query, parentIds)
@ -188,12 +185,9 @@ namespace MediaBrowser.Api.Movies
IncludeItemTypes = new[] { typeof(Movie).Name } IncludeItemTypes = new[] { typeof(Movie).Name }
}; };
if (user == null || user.Configuration.IncludeTrailersInSuggestions) var includeList = query.IncludeItemTypes.ToList();
{ includeList.Add(typeof(Trailer).Name);
var includeList = query.IncludeItemTypes.ToList(); query.IncludeItemTypes = includeList.ToArray();
includeList.Add(typeof(Trailer).Name);
query.IncludeItemTypes = includeList.ToArray();
}
var list = _libraryManager.GetItemList(query) var list = _libraryManager.GetItemList(query)
.OrderBy(i => (int)i.SourceType) .OrderBy(i => (int)i.SourceType)

View File

@ -26,6 +26,7 @@ using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Controller.Sorting; using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities
{ {
@ -2212,5 +2213,10 @@ namespace MediaBrowser.Controller.Entities
DeleteFileLocation = false DeleteFileLocation = false
}); });
} }
public virtual List<ExternalUrl> GetRelatedUrls()
{
return new List<ExternalUrl>();
}
} }
} }

View File

@ -8,6 +8,7 @@ using System.Runtime.Serialization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Controller.Entities.Movies namespace MediaBrowser.Controller.Entities.Movies
{ {
@ -163,5 +164,22 @@ namespace MediaBrowser.Controller.Entities.Movies
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/movies/{0}", imdbId)
});
}
return list;
}
} }
} }

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities
{ {
@ -110,5 +111,22 @@ namespace MediaBrowser.Controller.Entities
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/movies/{0}", imdbId)
});
}
return list;
}
} }
} }

View File

@ -7,6 +7,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Controller.LiveTv namespace MediaBrowser.Controller.LiveTv
{ {
@ -235,5 +236,25 @@ namespace MediaBrowser.Controller.LiveTv
return false; return false;
} }
} }
public override List<ExternalUrl> GetRelatedUrls()
{
var list = base.GetRelatedUrls();
var imdbId = this.GetProviderId(MetadataProviders.Imdb);
if (!string.IsNullOrWhiteSpace(imdbId))
{
if (IsMovie)
{
list.Add(new ExternalUrl
{
Name = "Trakt",
Url = string.Format("https://trakt.tv/movies/{0}", imdbId)
});
}
}
return list;
}
} }
} }

View File

@ -133,7 +133,7 @@ namespace MediaBrowser.Controller.Providers
/// </summary> /// </summary>
/// <param name="item">The item.</param> /// <param name="item">The item.</param>
/// <returns>IEnumerable{ExternalUrl}.</returns> /// <returns>IEnumerable{ExternalUrl}.</returns>
IEnumerable<ExternalUrl> GetExternalUrls(IHasProviderIds item); IEnumerable<ExternalUrl> GetExternalUrls(BaseItem item);
/// <summary> /// <summary>
/// Gets the external identifier infos. /// Gets the external identifier infos.

View File

@ -39,8 +39,6 @@ namespace MediaBrowser.Model.Configuration
public string[] OrderedViews { get; set; } public string[] OrderedViews { get; set; }
public bool IncludeTrailersInSuggestions { get; set; }
public string[] LatestItemsExcludes { get; set; } public string[] LatestItemsExcludes { get; set; }
public string[] PlainFolderViews { get; set; } public string[] PlainFolderViews { get; set; }
@ -68,8 +66,6 @@ namespace MediaBrowser.Model.Configuration
PlainFolderViews = new string[] { }; PlainFolderViews = new string[] { };
IncludeTrailersInSuggestions = true;
GroupedFolders = new string[] { }; GroupedFolders = new string[] { };
} }
} }

View File

@ -830,7 +830,7 @@ namespace MediaBrowser.Providers.Manager
}); });
} }
public IEnumerable<ExternalUrl> GetExternalUrls(IHasProviderIds item) public IEnumerable<ExternalUrl> GetExternalUrls(BaseItem item)
{ {
return GetExternalIds(item) return GetExternalIds(item)
.Select(i => .Select(i =>
@ -853,7 +853,7 @@ namespace MediaBrowser.Providers.Manager
Url = string.Format(i.UrlFormatString, value) Url = string.Format(i.UrlFormatString, value)
}; };
}).Where(i => i != null); }).Where(i => i != null).Concat(item.GetRelatedUrls());
} }
public IEnumerable<ExternalIdInfo> GetExternalIdInfos(IHasProviderIds item) public IEnumerable<ExternalIdInfo> GetExternalIdInfos(IHasProviderIds item)

View File

@ -548,9 +548,20 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{ {
PostPaddingSeconds = Math.Max(config.PostPaddingSeconds, 0), PostPaddingSeconds = Math.Max(config.PostPaddingSeconds, 0),
PrePaddingSeconds = Math.Max(config.PrePaddingSeconds, 0), PrePaddingSeconds = Math.Max(config.PrePaddingSeconds, 0),
RecordAnyChannel = false, RecordAnyChannel = true,
RecordAnyTime = false, RecordAnyTime = true,
RecordNewOnly = false RecordNewOnly = false,
Days = new List<DayOfWeek>
{
DayOfWeek.Sunday,
DayOfWeek.Monday,
DayOfWeek.Tuesday,
DayOfWeek.Wednesday,
DayOfWeek.Thursday,
DayOfWeek.Friday,
DayOfWeek.Saturday
}
}; };
if (program != null) if (program != null)
@ -1215,6 +1226,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
if (!seriesTimer.RecordAnyTime) if (!seriesTimer.RecordAnyTime)
{ {
allPrograms = allPrograms.Where(epg => Math.Abs(seriesTimer.StartDate.TimeOfDay.Ticks - epg.StartDate.TimeOfDay.Ticks) < TimeSpan.FromMinutes(5).Ticks); allPrograms = allPrograms.Where(epg => Math.Abs(seriesTimer.StartDate.TimeOfDay.Ticks - epg.StartDate.TimeOfDay.Ticks) < TimeSpan.FromMinutes(5).Ticks);
allPrograms = allPrograms.Where(i => seriesTimer.Days.Contains(i.StartDate.ToLocalTime().DayOfWeek));
} }
if (seriesTimer.RecordNewOnly) if (seriesTimer.RecordNewOnly)
@ -1227,8 +1240,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
allPrograms = allPrograms.Where(epg => string.Equals(epg.ChannelId, seriesTimer.ChannelId, StringComparison.OrdinalIgnoreCase)); allPrograms = allPrograms.Where(epg => string.Equals(epg.ChannelId, seriesTimer.ChannelId, StringComparison.OrdinalIgnoreCase));
} }
allPrograms = allPrograms.Where(i => seriesTimer.Days.Contains(i.StartDate.ToLocalTime().DayOfWeek));
if (string.IsNullOrWhiteSpace(seriesTimer.SeriesId)) if (string.IsNullOrWhiteSpace(seriesTimer.SeriesId))
{ {
_logger.Error("seriesTimer.SeriesId is null. Cannot find programs for series"); _logger.Error("seriesTimer.SeriesId is null. Cannot find programs for series");

View File

@ -248,7 +248,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
"create index if not exists idx_PresentationUniqueKey on TypedBaseItems(PresentationUniqueKey)", "create index if not exists idx_PresentationUniqueKey on TypedBaseItems(PresentationUniqueKey)",
"create index if not exists idx_Type on TypedBaseItems(Type)", "create index if not exists idx_Type on TypedBaseItems(Type)",
"create index if not exists idx_TopParentId on TypedBaseItems(TopParentId)", "create index if not exists idx_TopParentId on TypedBaseItems(TopParentId)",
//"create index if not exists idx_TypeTopParentId on TypedBaseItems(Type,TopParentId)" "create index if not exists idx_TypeTopParentId on TypedBaseItems(Type,TopParentId)"
}; };
_connection.RunQueries(postQueries, Logger); _connection.RunQueries(postQueries, Logger);

View File

@ -483,6 +483,11 @@ namespace MediaBrowser.Server.Implementations.Sync
private async Task ProcessJobItem(SyncJobItem jobItem, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken) private async Task ProcessJobItem(SyncJobItem jobItem, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken)
{ {
if (jobItem == null)
{
throw new ArgumentNullException("jobItem");
}
var item = _libraryManager.GetItemById(jobItem.ItemId); var item = _libraryManager.GetItemById(jobItem.ItemId);
if (item == null) if (item == null)
{ {