Merge pull request #2667 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-05-27 07:42:49 -04:00 committed by GitHub
commit 772fb88aab
10 changed files with 52 additions and 34 deletions

View File

@ -87,8 +87,9 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
private void ProcessContext(HttpListenerContext context)
{
//Task.Factory.StartNew(() => InitTask(context), TaskCreationOptions.DenyChildAttach | TaskCreationOptions.PreferFairness);
Task.Run(() => InitTask(context, _disposeCancellationToken));
_logger.Info("thread id {0}", Thread.CurrentThread.ManagedThreadId);
InitTask(context, _disposeCancellationToken);
//Task.Run(() => InitTask(context, _disposeCancellationToken));
}
private Task InitTask(HttpListenerContext context, CancellationToken cancellationToken)

View File

@ -180,7 +180,7 @@ namespace Emby.Server.Implementations.IO
try
{
await item.ChangedExternally().ConfigureAwait(false);
item.ChangedExternally();
}
catch (IOException ex)
{
@ -282,11 +282,11 @@ namespace Emby.Server.Implementations.IO
return false;
}
}
//catch (DirectoryNotFoundException)
//{
// // File may have been deleted
// return false;
//}
catch (DirectoryNotFoundException)
{
// File may have been deleted
return false;
}
catch (FileNotFoundException)
{
// File may have been deleted

View File

@ -66,19 +66,19 @@ namespace Emby.Server.Implementations.Session
return SendMessage(name, new Dictionary<string, string>(), cancellationToken);
}
private async Task SendMessage(string name,
private Task SendMessage(string name,
Dictionary<string, string> args,
CancellationToken cancellationToken)
{
var url = PostUrl + "/" + name + ToQueryString(args);
await _httpClient.Post(new HttpRequestOptions
return _httpClient.Post(new HttpRequestOptions
{
Url = url,
CancellationToken = cancellationToken,
BufferContent = false
}).ConfigureAwait(false);
});
}
public Task SendSessionEndedNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken)
@ -159,8 +159,24 @@ namespace Emby.Server.Implementations.Session
public Task SendMessage<T>(string name, T data, CancellationToken cancellationToken)
{
// Not supported or needed right now
return Task.FromResult(true);
var url = PostUrl + "/" + name;
var options = new HttpRequestOptions
{
Url = url,
CancellationToken = cancellationToken,
BufferContent = false
};
options.RequestContent = _json.SerializeToString(data);
options.RequestContentType = "application/json";
return _httpClient.Post(new HttpRequestOptions
{
Url = url,
CancellationToken = cancellationToken,
BufferContent = false
});
}
private string ToQueryString(Dictionary<string, string> nvc)

View File

@ -61,7 +61,7 @@ namespace MediaBrowser.Api.Playback
{
}
//[Authenticated]
[Authenticated]
public class UniversalAudioService : BaseApiService
{
public UniversalAudioService(IServerConfigurationManager serverConfigurationManager, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, IDeviceManager deviceManager, ISubtitleEncoder subtitleEncoder, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IAuthorizationContext authorizationContext, IImageProcessor imageProcessor, INetworkManager networkManager, IEnvironmentInfo environmentInfo)

View File

@ -1854,10 +1854,13 @@ namespace MediaBrowser.Controller.Entities
/// Do whatever refreshing is necessary when the filesystem pertaining to this item has changed.
/// </summary>
/// <returns>Task.</returns>
public virtual Task ChangedExternally()
public virtual void ChangedExternally()
{
ProviderManager.QueueRefresh(Id, new MetadataRefreshOptions(FileSystem), RefreshPriority.High);
return Task.FromResult(true);
ProviderManager.QueueRefresh(Id, new MetadataRefreshOptions(FileSystem)
{
ValidateChildren = true,
}, RefreshPriority.High);
}
/// <summary>

View File

@ -1325,19 +1325,6 @@ namespace MediaBrowser.Controller.Entities
return false;
}
/// <summary>
/// Folders need to validate and refresh
/// </summary>
/// <returns>Task.</returns>
public override async Task ChangedExternally()
{
var progress = new Progress<double>();
await ValidateChildren(progress, CancellationToken.None).ConfigureAwait(false);
await base.ChangedExternally().ConfigureAwait(false);
}
/// <summary>
/// Marks the played.
/// </summary>

View File

@ -15,6 +15,7 @@ namespace MediaBrowser.Controller.Providers
public bool ReplaceAllMetadata { get; set; }
public bool IsPostRecursiveRefresh { get; set; }
public bool ValidateChildren { get; set; }
public MetadataRefreshMode MetadataRefreshMode { get; set; }
public RemoteSearchResult SearchResult { get; set; }

View File

@ -872,7 +872,7 @@ namespace MediaBrowser.Providers.Manager
if (!_isProcessingRefreshQueue)
{
_isProcessingRefreshQueue = true;
Task.Run(() => StartProcessingRefreshQueue());
Task.Run(StartProcessingRefreshQueue);
}
}
}
@ -897,6 +897,15 @@ namespace MediaBrowser.Providers.Manager
// Try to throttle this a little bit.
await Task.Delay(100).ConfigureAwait(false);
if (refreshItem.Item2.ValidateChildren)
{
var folder = item as Folder;
if (folder != null)
{
await folder.ValidateChildren(new Progress<double>(), CancellationToken.None).ConfigureAwait(false);
}
}
var artist = item as MusicArtist;
var task = artist == null
? RefreshItem(item, refreshItem.Item2, CancellationToken.None)

View File

@ -163,7 +163,7 @@ namespace MediaBrowser.Providers.Subtitles
Provider = provider.Name
}, _logger);
throw;
}
}
@ -256,7 +256,8 @@ namespace MediaBrowser.Providers.Subtitles
_monitor.ReportFileSystemChangeComplete(path, false);
}
return _libraryManager.GetItemById(itemId).ChangedExternally();
_libraryManager.GetItemById(itemId).ChangedExternally();
return Task.FromResult(true);
}
public Task<SubtitleResponse> GetRemoteSubtitles(string id, CancellationToken cancellationToken)

View File

@ -1,3 +1,3 @@
using System.Reflection;
[assembly: AssemblyVersion("3.2.17.16")]
[assembly: AssemblyVersion("3.2.17.17")]