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")]
public class ReportPlaybackStopped : PlaybackStopInfo, IReturnVoid
{
@ -336,6 +343,11 @@ namespace MediaBrowser.Api.UserLibrary
Task.WaitAll(task);
}
public void Post(PingPlaybackSession request)
{
ApiEntryPoint.Instance.PingTranscodingJob(request.PlaySessionId);
}
/// <summary>
/// Posts the specified request.
/// </summary>

View File

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

View File

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

View File

@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Controller.Providers
{
@ -54,13 +52,6 @@ namespace MediaBrowser.Controller.Providers
/// <value>The last result error message.</value>
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 void AddStatus(ProviderRefreshStatus status, string errorMessage)
@ -83,9 +74,6 @@ namespace MediaBrowser.Controller.Providers
public MetadataStatus()
{
LastStatus = ProviderRefreshStatus.Success;
MetadataProvidersRefreshed = new List<Guid>();
ImageProvidersRefreshed = new List<Guid>();
}
public bool IsDirty { get; private set; }
@ -109,33 +97,5 @@ namespace MediaBrowser.Controller.Providers
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

@ -114,7 +114,7 @@ namespace MediaBrowser.Dlna.PlayTo
_mediaSourceManager);
controller.Init(device);
var profile = _dlnaManager.GetProfile(device.Properties.ToDeviceIdentification()) ??
_dlnaManager.GetDefaultProfile();

View File

@ -69,6 +69,12 @@ namespace MediaBrowser.Model.Dto
/// <value>The key.</value>
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;
}
}

View File

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

View File

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

View File

@ -68,7 +68,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
}
keys.Add(e.Item);
var baseItem = e.Item as BaseItem;
// Go up one level for indicators
@ -117,7 +117,12 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
var dtoList = pair.Value
.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();
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);
if (_config.Configuration.EnableUserSpecificUserViews)
if (_config.Configuration.EnableUserSpecificUserViews || !enableRichView)
{
viewType = enableRichView ? viewType : null;
var view = await _libraryManager.GetNamedView(user, name, viewType, sortName, cancellationToken).ConfigureAwait(false);
@ -222,7 +222,6 @@ namespace MediaBrowser.Server.Implementations.Library
return view;
}
viewType = enableRichView ? viewType : CollectionType.Folders;
return await _libraryManager.GetNamedView(user, name, viewType, sortName, cancellationToken).ConfigureAwait(false);
}
else

View File

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

View File

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