Merge pull request #1792 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-05-30 14:22:12 -04:00
commit 47dbd1c1b2
13 changed files with 81 additions and 57 deletions

View File

@ -14,6 +14,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Controller.LiveTv;
namespace MediaBrowser.Api.Movies
{
@ -132,13 +133,15 @@ namespace MediaBrowser.Api.Movies
var query = new InternalItemsQuery(user)
{
IncludeItemTypes = new[] { typeof(Movie).Name }
IncludeItemTypes = new[]
{
typeof(Movie).Name,
typeof(Trailer).Name,
//typeof(LiveTvProgram).Name
},
// IsMovie = true
};
var includeList = query.IncludeItemTypes.ToList();
includeList.Add(typeof(Trailer).Name);
query.IncludeItemTypes = includeList.ToArray();
var parentIds = string.IsNullOrWhiteSpace(request.ParentId) ? new string[] { } : new[] { request.ParentId };
var movies = _libraryManager.GetItemList(query, parentIds)
.OrderBy(i => (int)i.SourceType);
@ -182,13 +185,15 @@ namespace MediaBrowser.Api.Movies
var query = new InternalItemsQuery(user)
{
IncludeItemTypes = new[] { typeof(Movie).Name }
IncludeItemTypes = new[]
{
typeof(Movie).Name,
typeof(Trailer).Name,
//typeof(LiveTvProgram).Name
},
//IsMovie = true
};
var includeList = query.IncludeItemTypes.ToList();
includeList.Add(typeof(Trailer).Name);
query.IncludeItemTypes = includeList.ToArray();
var list = _libraryManager.GetItemList(query)
.OrderBy(i => (int)i.SourceType)
.DistinctBy(i => i.GetProviderId(MetadataProviders.Imdb) ?? Guid.NewGuid().ToString("N"))

View File

@ -179,17 +179,13 @@ namespace MediaBrowser.Controller.Entities.Audio
{
var items = GetRecursiveChildren().ToList();
var songs = items.OfType<Audio>().ToList();
var others = items.Except(songs).ToList();
var totalItems = songs.Count + others.Count;
var totalItems = items.Count;
var numComplete = 0;
var childUpdateType = ItemUpdateType.None;
// Refresh songs
foreach (var item in songs)
foreach (var item in items)
{
cancellationToken.ThrowIfCancellationRequested();
@ -199,7 +195,7 @@ namespace MediaBrowser.Controller.Entities.Audio
numComplete++;
double percent = numComplete;
percent /= totalItems;
progress.Report(percent * 100);
progress.Report(percent * 95);
}
var parentRefreshOptions = refreshOptions;
@ -212,19 +208,6 @@ namespace MediaBrowser.Controller.Entities.Audio
// Refresh current item
await RefreshMetadata(parentRefreshOptions, cancellationToken).ConfigureAwait(false);
// Refresh all non-songs
foreach (var item in others)
{
cancellationToken.ThrowIfCancellationRequested();
var updateType = await item.RefreshMetadata(parentRefreshOptions, cancellationToken).ConfigureAwait(false);
numComplete++;
double percent = numComplete;
percent /= totalItems;
progress.Report(percent * 100);
}
progress.Report(100);
}
}

View File

@ -283,9 +283,6 @@ namespace MediaBrowser.Controller.Entities.TV
var totalItems = seasons.Count + otherItems.Count;
var numComplete = 0;
refreshOptions = new MetadataRefreshOptions(refreshOptions);
refreshOptions.IsPostRecursiveRefresh = true;
// Refresh current item
await RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
@ -315,7 +312,7 @@ namespace MediaBrowser.Controller.Entities.TV
&& refreshOptions.MetadataRefreshMode != MetadataRefreshMode.FullRefresh
&& !refreshOptions.ReplaceAllMetadata
&& episode.IsMissingEpisode
&& episode.LocationType == Model.Entities.LocationType.Virtual
&& episode.LocationType == LocationType.Virtual
&& episode.PremiereDate.HasValue
&& (DateTime.UtcNow - episode.PremiereDate.Value).TotalDays > 30)
{
@ -333,6 +330,8 @@ namespace MediaBrowser.Controller.Entities.TV
progress.Report(percent * 100);
}
refreshOptions = new MetadataRefreshOptions(refreshOptions);
refreshOptions.IsPostRecursiveRefresh = true;
await ProviderManager.RefreshSingleItem(this, refreshOptions, cancellationToken).ConfigureAwait(false);
progress.Report(100);

View File

@ -184,8 +184,6 @@ namespace MediaBrowser.Model.Configuration
public bool EnableVideoArchiveFiles { get; set; }
public int RemoteClientBitrateLimit { get; set; }
public bool DenyIFrameEmbedding { get; set; }
public AutoOnOff EnableLibraryMonitor { get; set; }
public int SharingExpirationDays { get; set; }
@ -222,7 +220,6 @@ namespace MediaBrowser.Model.Configuration
EnableAnonymousUsageReporting = true;
EnableAutomaticRestart = true;
DenyIFrameEmbedding = true;
EnableUPnP = true;
SharingExpirationDays = 30;

View File

@ -51,6 +51,11 @@ namespace MediaBrowser.Server.Implementations.Devices
public async Task<DeviceInfo> RegisterDevice(string reportedId, string name, string appName, string appVersion, string usedByUserId)
{
if (string.IsNullOrWhiteSpace(reportedId))
{
throw new ArgumentNullException("reportedId");
}
var device = GetDevice(reportedId) ?? new DeviceInfo
{
Id = reportedId

View File

@ -106,7 +106,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
}
});
HostContext.GlobalResponseFilters.Add(new ResponseFilter(_logger, () => _config.Configuration.DenyIFrameEmbedding).FilterResponse);
HostContext.GlobalResponseFilters.Add(new ResponseFilter(_logger).FilterResponse);
}
public override void OnAfterInit()

View File

@ -12,12 +12,10 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
private readonly ILogger _logger;
private readonly Func<bool> _denyIframeEmbedding;
public ResponseFilter(ILogger logger, Func<bool> denyIframeEmbedding)
public ResponseFilter(ILogger logger)
{
_logger = logger;
_denyIframeEmbedding = denyIframeEmbedding;
}
/// <summary>
@ -31,11 +29,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
// Try to prevent compatibility view
res.AddHeader("X-UA-Compatible", "IE=Edge");
if (_denyIframeEmbedding())
{
res.AddHeader("X-Frame-Options", "SAMEORIGIN");
}
var exception = dto as Exception;
if (exception != null)

View File

@ -122,7 +122,7 @@ namespace MediaBrowser.Server.Implementations.Library
AddIfMissing(excludeItemTypes, typeof(MusicGenre).Name);
}
if (query.IncludePeople && (includeItemTypes.Count == 0 || includeItemTypes.Contains("People", StringComparer.OrdinalIgnoreCase)))
if (query.IncludePeople && (includeItemTypes.Count == 0 || includeItemTypes.Contains("People", StringComparer.OrdinalIgnoreCase) || includeItemTypes.Contains("Person", StringComparer.OrdinalIgnoreCase)))
{
if (!query.IncludeMedia)
{

View File

@ -2131,8 +2131,42 @@ namespace MediaBrowser.Server.Implementations.Persistence
cmd.Parameters.Add(cmd, "@IsOffline", DbType.Boolean).Value = query.IsOffline;
}
if (query.IsMovie.HasValue)
{
var alternateTypes = new List<string>();
if (query.IncludeItemTypes.Length == 0 || query.IncludeItemTypes.Contains(typeof(Movie).Name))
{
alternateTypes.Add(typeof(Movie).FullName);
}
if (query.IncludeItemTypes.Length == 0 || query.IncludeItemTypes.Contains(typeof(Trailer).Name))
{
alternateTypes.Add(typeof(Trailer).FullName);
}
if (alternateTypes.Count == 0)
{
whereClauses.Add("IsMovie=@IsMovie");
}
else
{
if (query.IsMovie.Value)
{
var typeClauses = new List<string>();
var typeIndex = 0;
foreach (var type in alternateTypes)
{
var paramName = "@AlternateType" + typeIndex.ToString(CultureInfo.InvariantCulture);
typeClauses.Add("Type=" + paramName);
cmd.Parameters.Add(cmd, paramName, DbType.String).Value = type;
typeIndex++;
}
whereClauses.Add("(IsMovie=@IsMovie OR " + string.Join(" OR ", typeClauses.ToArray()) + ")");
}
else
{
whereClauses.Add("(IsMovie is null OR IsMovie=@IsMovie)");
}
}
cmd.Parameters.Add(cmd, "@IsMovie", DbType.Boolean).Value = query.IsMovie;
}
if (query.IsKids.HasValue)

View File

@ -404,6 +404,10 @@ namespace MediaBrowser.Server.Implementations.Session
/// <returns>SessionInfo.</returns>
private async Task<SessionInfo> GetSessionInfo(string appName, string appVersion, string deviceId, string deviceName, string remoteEndPoint, User user)
{
if (string.IsNullOrWhiteSpace(deviceId))
{
throw new ArgumentNullException("deviceId");
}
var key = GetSessionKey(appName, deviceId);
await _sessionLock.WaitAsync(CancellationToken.None).ConfigureAwait(false);
@ -1748,6 +1752,11 @@ namespace MediaBrowser.Server.Implementations.Session
public void ReportNowViewingItem(string sessionId, string itemId)
{
if (string.IsNullOrWhiteSpace(itemId))
{
throw new ArgumentNullException("itemId");
}
var item = _libraryManager.GetItemById(new Guid(itemId));
var info = GetItemInfo(item, null, null);

View File

@ -230,7 +230,12 @@ namespace MediaBrowser.Server.Implementations.Session
{
var vals = message.Data.Split('|');
_sessionManager.ReportNowViewingItem(session.Id, vals[1]);
var itemId = vals[1];
if (!string.IsNullOrWhiteSpace(itemId))
{
_sessionManager.ReportNowViewingItem(session.Id, itemId);
}
}
}

View File

@ -25,7 +25,7 @@ namespace MediaBrowser.ServerApplication
Description = "The windows background service for Emby Server.",
// Will ensure the network is available
ServicesDependedOn = new[] { "LanmanServer", "Tcpip" }
ServicesDependedOn = new[] { "LanmanServer", "EventLog", "Tcpip", "http" }
};
// Microsoft didn't add the ability to add a

View File

@ -125,12 +125,6 @@
<Content Include="dashboard-ui\components\guestinviter\guestinviter.template.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\ironcardlist\ironcardlist.template.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\ironcardlist\ironcardlist.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\components\metadataeditor\metadataeditor.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>