From bda0b2f7c490fbd2f462902aba13ee7db80688c3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 28 Mar 2015 01:07:29 -0400 Subject: sync updates --- .../MediaBrowser.Controller.csproj | 4 +-- MediaBrowser.Controller/Sync/IHasDynamicAccess.cs | 18 ++++++++++++++ .../Sync/IRequiresDynamicAccess.cs | 18 -------------- .../Sync/IServerSyncProvider.cs | 2 +- MediaBrowser.Controller/Sync/SendFileResult.cs | 18 -------------- MediaBrowser.Controller/Sync/SyncedFileInfo.cs | 29 ++++++++++++++++++++++ .../Sync/MediaSync.cs | 2 +- .../Sync/SyncedMediaSourceProvider.cs | 6 ++--- Nuget/MediaBrowser.Common.Internal.nuspec | 4 +-- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Model.Signed.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +-- 12 files changed, 60 insertions(+), 49 deletions(-) create mode 100644 MediaBrowser.Controller/Sync/IHasDynamicAccess.cs delete mode 100644 MediaBrowser.Controller/Sync/IRequiresDynamicAccess.cs delete mode 100644 MediaBrowser.Controller/Sync/SendFileResult.cs create mode 100644 MediaBrowser.Controller/Sync/SyncedFileInfo.cs diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 809d1f6f4..2fa62f79f 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -393,13 +393,13 @@ - + - + diff --git a/MediaBrowser.Controller/Sync/IHasDynamicAccess.cs b/MediaBrowser.Controller/Sync/IHasDynamicAccess.cs new file mode 100644 index 000000000..f907de729 --- /dev/null +++ b/MediaBrowser.Controller/Sync/IHasDynamicAccess.cs @@ -0,0 +1,18 @@ +using MediaBrowser.Model.Sync; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Sync +{ + public interface IHasDynamicAccess + { + /// + /// Gets the synced file information. + /// + /// The remote path. + /// The target. + /// The cancellation token. + /// Task<SyncedFileInfo>. + Task GetSyncedFileInfo(string remotePath, SyncTarget target, CancellationToken cancellationToken); + } +} diff --git a/MediaBrowser.Controller/Sync/IRequiresDynamicAccess.cs b/MediaBrowser.Controller/Sync/IRequiresDynamicAccess.cs deleted file mode 100644 index 820a1dce0..000000000 --- a/MediaBrowser.Controller/Sync/IRequiresDynamicAccess.cs +++ /dev/null @@ -1,18 +0,0 @@ -using MediaBrowser.Model.Sync; -using System.Threading; -using System.Threading.Tasks; - -namespace MediaBrowser.Controller.Sync -{ - public interface IRequiresDynamicAccess - { - /// - /// Gets the file information. - /// - /// The remote path. - /// The target. - /// The cancellation token. - /// Task<SendFileResult>. - Task GetFileInfo(string remotePath, SyncTarget target, CancellationToken cancellationToken); - } -} diff --git a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs index 9cccd4150..46bbbd329 100644 --- a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs +++ b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Sync /// The progress. /// The cancellation token. /// Task. - Task SendFile(Stream stream, string remotePath, SyncTarget target, IProgress progress, CancellationToken cancellationToken); + Task SendFile(Stream stream, string remotePath, SyncTarget target, IProgress progress, CancellationToken cancellationToken); /// /// Deletes the file. diff --git a/MediaBrowser.Controller/Sync/SendFileResult.cs b/MediaBrowser.Controller/Sync/SendFileResult.cs deleted file mode 100644 index 62753444a..000000000 --- a/MediaBrowser.Controller/Sync/SendFileResult.cs +++ /dev/null @@ -1,18 +0,0 @@ -using MediaBrowser.Model.MediaInfo; - -namespace MediaBrowser.Controller.Sync -{ - public class SendFileResult - { - /// - /// Gets or sets the path. - /// - /// The path. - public string Path { get; set; } - /// - /// Gets or sets the protocol. - /// - /// The protocol. - public MediaProtocol Protocol { get; set; } - } -} diff --git a/MediaBrowser.Controller/Sync/SyncedFileInfo.cs b/MediaBrowser.Controller/Sync/SyncedFileInfo.cs new file mode 100644 index 000000000..550af2d55 --- /dev/null +++ b/MediaBrowser.Controller/Sync/SyncedFileInfo.cs @@ -0,0 +1,29 @@ +using MediaBrowser.Model.MediaInfo; +using System.Collections.Generic; + +namespace MediaBrowser.Controller.Sync +{ + public class SyncedFileInfo + { + /// + /// Gets or sets the path. + /// + /// The path. + public string Path { get; set; } + /// + /// Gets or sets the protocol. + /// + /// The protocol. + public MediaProtocol Protocol { get; set; } + /// + /// Gets or sets the required HTTP headers. + /// + /// The required HTTP headers. + public Dictionary RequiredHttpHeaders { get; set; } + + public SyncedFileInfo() + { + RequiredHttpHeaders = new Dictionary(); + } + } +} diff --git a/MediaBrowser.Server.Implementations/Sync/MediaSync.cs b/MediaBrowser.Server.Implementations/Sync/MediaSync.cs index befddabd8..03a7e92a4 100644 --- a/MediaBrowser.Server.Implementations/Sync/MediaSync.cs +++ b/MediaBrowser.Server.Implementations/Sync/MediaSync.cs @@ -301,7 +301,7 @@ namespace MediaBrowser.Server.Implementations.Sync } } - private async Task SendFile(IServerSyncProvider provider, string inputPath, string remotePath, SyncTarget target, IProgress progress, CancellationToken cancellationToken) + private async Task SendFile(IServerSyncProvider provider, string inputPath, string remotePath, SyncTarget target, IProgress progress, CancellationToken cancellationToken) { _logger.Debug("Sending {0} to {1}. Remote path: {2}", inputPath, provider.Name, remotePath); using (var stream = _fileSystem.GetFileStream(inputPath, FileMode.Open, FileAccess.Read, FileShare.Read, true)) diff --git a/MediaBrowser.Server.Implementations/Sync/SyncedMediaSourceProvider.cs b/MediaBrowser.Server.Implementations/Sync/SyncedMediaSourceProvider.cs index e7e1d1c63..4172cfc2d 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncedMediaSourceProvider.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncedMediaSourceProvider.cs @@ -78,7 +78,7 @@ namespace MediaBrowser.Server.Implementations.Sync SyncTarget target, CancellationToken cancellationToken) { - var requiresDynamicAccess = provider as IRequiresDynamicAccess; + var requiresDynamicAccess = provider as IHasDynamicAccess; if (requiresDynamicAccess == null) { @@ -88,11 +88,11 @@ namespace MediaBrowser.Server.Implementations.Sync try { - var dynamicInfo = await requiresDynamicAccess.GetFileInfo(item.LocalPath, target, cancellationToken).ConfigureAwait(false); + var dynamicInfo = await requiresDynamicAccess.GetSyncedFileInfo(item.LocalPath, target, cancellationToken).ConfigureAwait(false); foreach (var stream in mediaSource.MediaStreams) { - var dynamicStreamInfo = await requiresDynamicAccess.GetFileInfo(stream.ExternalId, target, cancellationToken).ConfigureAwait(false); + var dynamicStreamInfo = await requiresDynamicAccess.GetSyncedFileInfo(stream.ExternalId, target, cancellationToken).ConfigureAwait(false); stream.Path = dynamicStreamInfo.Path; } diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index 84187e72b..31441ff79 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.602 + 3.0.603 MediaBrowser.Common.Internal Luke ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption. Copyright © Media Browser 2013 - + diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index 59ec2aa65..568a47dfe 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.602 + 3.0.603 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Model.Signed.nuspec b/Nuget/MediaBrowser.Model.Signed.nuspec index 6f4b6a7e3..fb00fd840 100644 --- a/Nuget/MediaBrowser.Model.Signed.nuspec +++ b/Nuget/MediaBrowser.Model.Signed.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Model.Signed - 3.0.602 + 3.0.603 MediaBrowser.Model - Signed Edition Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 4d919a965..c36fb6d6c 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.602 + 3.0.603 Media Browser.Server.Core Media Browser Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Media Browser Server. Copyright © Media Browser 2013 - + -- cgit v1.2.3