resolve photo scan hang

This commit is contained in:
Luke Pulverenti 2015-04-16 23:31:19 -04:00
parent 6bd18c6e72
commit fd261cecf7
12 changed files with 55 additions and 83 deletions

View File

@ -67,6 +67,13 @@ namespace MediaBrowser.Api.UserLibrary
{ {
} }
[Route("/Sessions/Playing/Ping", "POST", Summary = "Pings a playback session")]
public class PingPlaybackSession : IReturnVoid
{
[ApiMember(Name = "PlaySessionId", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]
public string PlaySessionId { get; set; }
}
[Route("/Sessions/Playing/Stopped", "POST", Summary = "Reports playback has stopped within a session")] [Route("/Sessions/Playing/Stopped", "POST", Summary = "Reports playback has stopped within a session")]
public class ReportPlaybackStopped : PlaybackStopInfo, IReturnVoid public class ReportPlaybackStopped : PlaybackStopInfo, IReturnVoid
{ {
@ -336,6 +343,11 @@ namespace MediaBrowser.Api.UserLibrary
Task.WaitAll(task); Task.WaitAll(task);
} }
public void Post(PingPlaybackSession request)
{
ApiEntryPoint.Instance.PingTranscodingJob(request.PlaySessionId);
}
/// <summary> /// <summary>
/// Posts the specified request. /// Posts the specified request.
/// </summary> /// </summary>

View File

@ -1,5 +1,4 @@
using System.Globalization; using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Collections; using MediaBrowser.Controller.Collections;
@ -18,6 +17,7 @@ using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Users; using MediaBrowser.Model.Users;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;

View File

@ -164,18 +164,22 @@ namespace MediaBrowser.Controller.Entities
protected void AddChildrenInternal(IEnumerable<BaseItem> children) protected void AddChildrenInternal(IEnumerable<BaseItem> children)
{ {
var actualChildren = ActualChildren;
lock (_childrenSyncLock) lock (_childrenSyncLock)
{ {
var newChildren = ActualChildren.ToList(); var newChildren = actualChildren.ToList();
newChildren.AddRange(children); newChildren.AddRange(children);
_children = newChildren; _children = newChildren;
} }
} }
protected void AddChildInternal(BaseItem child) protected void AddChildInternal(BaseItem child)
{ {
var actualChildren = ActualChildren;
lock (_childrenSyncLock) lock (_childrenSyncLock)
{ {
var newChildren = ActualChildren.ToList(); var newChildren = actualChildren.ToList();
newChildren.Add(child); newChildren.Add(child);
_children = newChildren; _children = newChildren;
} }
@ -184,10 +188,11 @@ namespace MediaBrowser.Controller.Entities
protected void RemoveChildrenInternal(IEnumerable<BaseItem> children) protected void RemoveChildrenInternal(IEnumerable<BaseItem> children)
{ {
var ids = children.Select(i => i.Id).ToList(); var ids = children.Select(i => i.Id).ToList();
var actualChildren = ActualChildren;
lock (_childrenSyncLock) lock (_childrenSyncLock)
{ {
_children = ActualChildren.Where(i => !ids.Contains(i.Id)).ToList(); _children = actualChildren.Where(i => !ids.Contains(i.Id)).ToList();
} }
} }
@ -302,7 +307,7 @@ namespace MediaBrowser.Controller.Entities
{ {
if (_children == null) if (_children == null)
{ {
_children = LoadChildrenInternal(); _children = LoadChildren().ToList();
} }
} }
} }
@ -356,11 +361,6 @@ namespace MediaBrowser.Controller.Entities
return base.IsVisible(user); return base.IsVisible(user);
} }
private List<BaseItem> LoadChildrenInternal()
{
return LoadChildren().ToList();
}
/// <summary> /// <summary>
/// Loads our children. Validation will occur externally. /// Loads our children. Validation will occur externally.
/// We want this sychronous. /// We want this sychronous.

View File

@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Controller.Providers namespace MediaBrowser.Controller.Providers
{ {
@ -54,13 +52,6 @@ namespace MediaBrowser.Controller.Providers
/// <value>The last result error message.</value> /// <value>The last result error message.</value>
public string LastErrorMessage { get; set; } public string LastErrorMessage { get; set; }
/// <summary>
/// Gets or sets the providers refreshed.
/// </summary>
/// <value>The providers refreshed.</value>
public List<Guid> MetadataProvidersRefreshed { get; set; }
public List<Guid> ImageProvidersRefreshed { get; set; }
public DateTime? ItemDateModified { get; set; } public DateTime? ItemDateModified { get; set; }
public void AddStatus(ProviderRefreshStatus status, string errorMessage) public void AddStatus(ProviderRefreshStatus status, string errorMessage)
@ -83,9 +74,6 @@ namespace MediaBrowser.Controller.Providers
public MetadataStatus() public MetadataStatus()
{ {
LastStatus = ProviderRefreshStatus.Success; LastStatus = ProviderRefreshStatus.Success;
MetadataProvidersRefreshed = new List<Guid>();
ImageProvidersRefreshed = new List<Guid>();
} }
public bool IsDirty { get; private set; } public bool IsDirty { get; private set; }
@ -109,33 +97,5 @@ namespace MediaBrowser.Controller.Providers
DateLastImagesRefresh = date; DateLastImagesRefresh = date;
} }
public void AddImageProvidersRefreshed(List<Guid> providerIds)
{
var count = ImageProvidersRefreshed.Count;
providerIds.AddRange(ImageProvidersRefreshed);
ImageProvidersRefreshed = providerIds.Distinct().ToList();
if (ImageProvidersRefreshed.Count != count)
{
IsDirty = true;
}
}
public void AddMetadataProvidersRefreshed(List<Guid> providerIds)
{
var count = MetadataProvidersRefreshed.Count;
providerIds.AddRange(MetadataProvidersRefreshed);
MetadataProvidersRefreshed = providerIds.Distinct().ToList();
if (MetadataProvidersRefreshed.Count != count)
{
IsDirty = true;
}
}
} }
} }

View File

@ -69,6 +69,12 @@ namespace MediaBrowser.Model.Dto
/// <value>The key.</value> /// <value>The key.</value>
public string Key { get; set; } public string Key { get; set; }
/// <summary>
/// Gets or sets the item identifier.
/// </summary>
/// <value>The item identifier.</value>
public string ItemId { get; set; }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
} }
} }

View File

@ -21,8 +21,8 @@ namespace MediaBrowser.Model.Session
public DeviceProfile DeviceProfile { get; set; } public DeviceProfile DeviceProfile { get; set; }
public List<string> SupportedLiveMediaTypes { get; set; } public List<string> SupportedLiveMediaTypes { get; set; }
public string Url { get; set; } public string AppStoreUrl { get; set; }
public string ImageUrl { get; set; } public string IconUrl { get; set; }
public ClientCapabilities() public ClientCapabilities()
{ {

View File

@ -141,7 +141,6 @@ namespace MediaBrowser.Providers.Manager
updateType = updateType | result.UpdateType; updateType = updateType | result.UpdateType;
refreshResult.AddStatus(result.Status, result.ErrorMessage); refreshResult.AddStatus(result.Status, result.ErrorMessage);
refreshResult.SetDateLastMetadataRefresh(DateTime.UtcNow); refreshResult.SetDateLastMetadataRefresh(DateTime.UtcNow);
refreshResult.AddMetadataProvidersRefreshed(result.Providers);
MergeIdentities(itemOfType, id); MergeIdentities(itemOfType, id);
} }
@ -159,7 +158,6 @@ namespace MediaBrowser.Providers.Manager
updateType = updateType | result.UpdateType; updateType = updateType | result.UpdateType;
refreshResult.AddStatus(result.Status, result.ErrorMessage); refreshResult.AddStatus(result.Status, result.ErrorMessage);
refreshResult.SetDateLastImagesRefresh(DateTime.UtcNow); refreshResult.SetDateLastImagesRefresh(DateTime.UtcNow);
refreshResult.AddImageProvidersRefreshed(result.Providers);
} }
} }

View File

@ -117,7 +117,12 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
var dtoList = pair.Value var dtoList = pair.Value
.DistinctBy(i => i.Id) .DistinctBy(i => i.Id)
.Select(i => _userDataManager.GetUserDataDto(i, user)) .Select(i =>
{
var dto = _userDataManager.GetUserDataDto(i, user);
dto.ItemId = i.Id.ToString("N");
return dto;
})
.ToList(); .ToList();
var info = new UserDataChangeInfo var info = new UserDataChangeInfo

View File

@ -209,7 +209,7 @@ namespace MediaBrowser.Server.Implementations.Library
var enableRichView = !user.Configuration.PlainFolderViews.Contains(parentId.ToString("N"), StringComparer.OrdinalIgnoreCase); var enableRichView = !user.Configuration.PlainFolderViews.Contains(parentId.ToString("N"), StringComparer.OrdinalIgnoreCase);
if (_config.Configuration.EnableUserSpecificUserViews) if (_config.Configuration.EnableUserSpecificUserViews || !enableRichView)
{ {
viewType = enableRichView ? viewType : null; viewType = enableRichView ? viewType : null;
var view = await _libraryManager.GetNamedView(user, name, viewType, sortName, cancellationToken).ConfigureAwait(false); var view = await _libraryManager.GetNamedView(user, name, viewType, sortName, cancellationToken).ConfigureAwait(false);
@ -222,7 +222,6 @@ namespace MediaBrowser.Server.Implementations.Library
return view; return view;
} }
viewType = enableRichView ? viewType : CollectionType.Folders;
return await _libraryManager.GetNamedView(user, name, viewType, sortName, cancellationToken).ConfigureAwait(false); return await _libraryManager.GetNamedView(user, name, viewType, sortName, cancellationToken).ConfigureAwait(false);
} }
else else

View File

@ -208,15 +208,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
result.LastErrorMessage = reader.GetString(7); result.LastErrorMessage = reader.GetString(7);
} }
if (!reader.IsDBNull(8)) // Skip metadata and image providers
{
result.MetadataProvidersRefreshed = reader.GetString(8).Split('|').Where(i => !string.IsNullOrEmpty(i)).Select(i => new Guid(i)).ToList();
}
if (!reader.IsDBNull(9))
{
result.ImageProvidersRefreshed = reader.GetString(9).Split('|').Where(i => !string.IsNullOrEmpty(i)).Select(i => new Guid(i)).ToList();
}
if (!reader.IsDBNull(10)) if (!reader.IsDBNull(10))
{ {
@ -251,8 +243,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
_saveStatusCommand.GetParameter(5).Value = status.DateLastImagesRefresh; _saveStatusCommand.GetParameter(5).Value = status.DateLastImagesRefresh;
_saveStatusCommand.GetParameter(6).Value = status.LastStatus.ToString(); _saveStatusCommand.GetParameter(6).Value = status.LastStatus.ToString();
_saveStatusCommand.GetParameter(7).Value = status.LastErrorMessage; _saveStatusCommand.GetParameter(7).Value = status.LastErrorMessage;
_saveStatusCommand.GetParameter(8).Value = string.Join("|", status.MetadataProvidersRefreshed.ToArray()); _saveStatusCommand.GetParameter(8).Value = string.Empty;
_saveStatusCommand.GetParameter(9).Value = string.Join("|", status.ImageProvidersRefreshed.ToArray()); _saveStatusCommand.GetParameter(9).Value = string.Empty;
_saveStatusCommand.GetParameter(10).Value = status.ItemDateModified; _saveStatusCommand.GetParameter(10).Value = status.ItemDateModified;
_saveStatusCommand.Transaction = transaction; _saveStatusCommand.Transaction = transaction;

View File

@ -9,18 +9,18 @@ using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.Photos namespace MediaBrowser.Server.Implementations.Photos
{ {
public class PhotoAlbumImageProvider : BaseDynamicImageProvider<PhotoAlbum> //public class PhotoAlbumImageProvider : BaseDynamicImageProvider<PhotoAlbum>
{ //{
public PhotoAlbumImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor) : base(fileSystem, providerManager, applicationPaths, imageProcessor) // public PhotoAlbumImageProvider(IFileSystem fileSystem, IProviderManager providerManager, IApplicationPaths applicationPaths, IImageProcessor imageProcessor) : base(fileSystem, providerManager, applicationPaths, imageProcessor)
{ // {
} // }
protected override Task<List<BaseItem>> GetItemsWithImages(IHasImages item) // protected override Task<List<BaseItem>> GetItemsWithImages(IHasImages item)
{ // {
var photoAlbum = (PhotoAlbum)item; // var photoAlbum = (PhotoAlbum)item;
var items = GetFinalItems(photoAlbum.Children.ToList()); // var items = GetFinalItems(photoAlbum.Children.ToList());
return Task.FromResult(items); // return Task.FromResult(items);
} // }
} //}
} }