aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Sync
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Sync')
-rw-r--r--MediaBrowser.Controller/Sync/ICloudSyncProvider.cs21
-rw-r--r--MediaBrowser.Controller/Sync/IServerSyncProvider.cs57
-rw-r--r--MediaBrowser.Controller/Sync/ISyncDataProvider.cs50
-rw-r--r--MediaBrowser.Controller/Sync/ISyncManager.cs36
-rw-r--r--MediaBrowser.Controller/Sync/ISyncProvider.cs12
-rw-r--r--MediaBrowser.Controller/Sync/SendFileResult.cs18
6 files changed, 128 insertions, 66 deletions
diff --git a/MediaBrowser.Controller/Sync/ICloudSyncProvider.cs b/MediaBrowser.Controller/Sync/ICloudSyncProvider.cs
deleted file mode 100644
index f9327a71c..000000000
--- a/MediaBrowser.Controller/Sync/ICloudSyncProvider.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using MediaBrowser.Model.Sync;
-using System.Collections.Generic;
-
-namespace MediaBrowser.Controller.Sync
-{
- public interface ICloudSyncProvider
- {
- /// <summary>
- /// Gets the name.
- /// </summary>
- /// <value>The name.</value>
- string Name { get; }
-
- /// <summary>
- /// Gets the synchronize targets.
- /// </summary>
- /// <param name="userId">The user identifier.</param>
- /// <returns>IEnumerable&lt;SyncTarget&gt;.</returns>
- IEnumerable<SyncTarget> GetSyncTargets(string userId);
- }
-}
diff --git a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs
index 8ef54fd43..abf884e9d 100644
--- a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs
+++ b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs
@@ -1,5 +1,7 @@
using MediaBrowser.Model.Sync;
+using System;
using System.Collections.Generic;
+using System.IO;
using System.Threading;
using System.Threading.Tasks;
@@ -8,35 +10,58 @@ namespace MediaBrowser.Controller.Sync
public interface IServerSyncProvider : ISyncProvider
{
/// <summary>
- /// Gets the server item ids.
+ /// Transfers the file.
/// </summary>
- /// <param name="serverId">The server identifier.</param>
+ /// <param name="stream">The stream.</param>
+ /// <param name="remotePath">The remote path.</param>
/// <param name="target">The target.</param>
+ /// <param name="progress">The progress.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task&lt;List&lt;System.String&gt;&gt;.</returns>
- Task<List<string>> GetServerItemIds(string serverId, SyncTarget target, CancellationToken cancellationToken);
+ /// <returns>Task.</returns>
+ Task<SendFileResult> SendFile(Stream stream, string remotePath, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken);
/// <summary>
- /// Removes the item.
+ /// Deletes the file.
/// </summary>
- /// <param name="serverId">The server identifier.</param>
- /// <param name="itemId">The item identifier.</param>
+ /// <param name="path">The path.</param>
/// <param name="target">The target.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
- Task DeleteItem(string serverId, string itemId, SyncTarget target, CancellationToken cancellationToken);
+ Task DeleteFile(string path, SyncTarget target, CancellationToken cancellationToken);
/// <summary>
- /// Transfers the file.
+ /// Gets the file.
/// </summary>
- /// <param name="serverId">The server identifier.</param>
- /// <param name="itemId">The item identifier.</param>
- /// <param name="pathParts">The path parts.</param>
- /// <param name="name">The name.</param>
- /// <param name="fileType">Type of the file.</param>
+ /// <param name="path">The path.</param>
/// <param name="target">The target.</param>
+ /// <param name="progress">The progress.</param>
/// <param name="cancellationToken">The cancellation token.</param>
- /// <returns>Task.</returns>
- Task TransferItemFile(string serverId, string itemId, string[] pathParts, string name, ItemFileType fileType, SyncTarget target, CancellationToken cancellationToken);
+ /// <returns>Task&lt;Stream&gt;.</returns>
+ Task<Stream> GetFile(string path, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Gets the full path.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="target">The target.</param>
+ /// <returns>System.String.</returns>
+ string GetFullPath(IEnumerable<string> path, SyncTarget target);
+
+ /// <summary>
+ /// Gets the parent directory path.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="target">The target.</param>
+ /// <returns>System.String.</returns>
+ string GetParentDirectoryPath(string path, SyncTarget target);
+
+ /// <summary>
+ /// Gets the file system entries.
+ /// </summary>
+ /// <param name="path">The path.</param>
+ /// <param name="target">The target.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task&lt;List&lt;DeviceFileInfo&gt;&gt;.</returns>
+ Task<List<DeviceFileInfo>> GetFileSystemEntries(string path, SyncTarget target, CancellationToken cancellationToken);
}
}
diff --git a/MediaBrowser.Controller/Sync/ISyncDataProvider.cs b/MediaBrowser.Controller/Sync/ISyncDataProvider.cs
new file mode 100644
index 000000000..f84748b97
--- /dev/null
+++ b/MediaBrowser.Controller/Sync/ISyncDataProvider.cs
@@ -0,0 +1,50 @@
+using MediaBrowser.Model.Sync;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Controller.Sync
+{
+ public interface ISyncDataProvider
+ {
+ /// <summary>
+ /// Gets the server item ids.
+ /// </summary>
+ /// <param name="target">The target.</param>
+ /// <param name="serverId">The server identifier.</param>
+ /// <returns>Task&lt;List&lt;System.String&gt;&gt;.</returns>
+ Task<List<string>> GetServerItemIds(SyncTarget target, string serverId);
+
+ /// <summary>
+ /// Adds the or update.
+ /// </summary>
+ /// <param name="target">The target.</param>
+ /// <param name="item">The item.</param>
+ /// <returns>Task.</returns>
+ Task AddOrUpdate(SyncTarget target, LocalItem item);
+
+ /// <summary>
+ /// Deletes the specified identifier.
+ /// </summary>
+ /// <param name="target">The target.</param>
+ /// <param name="id">The identifier.</param>
+ /// <returns>Task.</returns>
+ Task Delete(SyncTarget target, string id);
+
+ /// <summary>
+ /// Gets the specified identifier.
+ /// </summary>
+ /// <param name="target">The target.</param>
+ /// <param name="id">The identifier.</param>
+ /// <returns>Task&lt;LocalItem&gt;.</returns>
+ Task<LocalItem> Get(SyncTarget target, string id);
+
+ /// <summary>
+ /// Gets the cached item.
+ /// </summary>
+ /// <param name="target">The target.</param>
+ /// <param name="serverId">The server identifier.</param>
+ /// <param name="itemId">The item identifier.</param>
+ /// <returns>Task&lt;LocalItem&gt;.</returns>
+ Task<List<LocalItem>> GetCachedItems(SyncTarget target, string serverId, string itemId);
+ }
+}
diff --git a/MediaBrowser.Controller/Sync/ISyncManager.cs b/MediaBrowser.Controller/Sync/ISyncManager.cs
index 4b800cac9..c51c8c1ba 100644
--- a/MediaBrowser.Controller/Sync/ISyncManager.cs
+++ b/MediaBrowser.Controller/Sync/ISyncManager.cs
@@ -91,13 +91,6 @@ namespace MediaBrowser.Controller.Sync
bool SupportsSync(BaseItem item);
/// <summary>
- /// Gets the device profile.
- /// </summary>
- /// <param name="targetId">The target identifier.</param>
- /// <returns>DeviceProfile.</returns>
- DeviceProfile GetDeviceProfile(string targetId);
-
- /// <summary>
/// Reports the synchronize job item transferred.
/// </summary>
/// <param name="id">The identifier.</param>
@@ -154,21 +147,6 @@ namespace MediaBrowser.Controller.Sync
QueryResult<string> GetLibraryItemIds(SyncJobItemQuery query);
/// <summary>
- /// Gets the audio options.
- /// </summary>
- /// <param name="jobItem">The job item.</param>
- /// <returns>AudioOptions.</returns>
- AudioOptions GetAudioOptions(SyncJobItem jobItem);
-
- /// <summary>
- /// Gets the video options.
- /// </summary>
- /// <param name="jobItem">The job item.</param>
- /// <param name="job">The job.</param>
- /// <returns>VideoOptions.</returns>
- VideoOptions GetVideoOptions(SyncJobItem jobItem, SyncJob job);
-
- /// <summary>
/// Reports the synchronize job item transfer beginning.
/// </summary>
/// <param name="id">The identifier.</param>
@@ -181,5 +159,19 @@ namespace MediaBrowser.Controller.Sync
/// <param name="id">The identifier.</param>
/// <returns>Task.</returns>
Task ReportSyncJobItemTransferFailed(string id);
+
+ /// <summary>
+ /// Gets the quality options.
+ /// </summary>
+ /// <param name="targetId">The target identifier.</param>
+ /// <returns>IEnumerable&lt;SyncQualityOption&gt;.</returns>
+ IEnumerable<SyncQualityOption> GetQualityOptions(string targetId);
+
+ /// <summary>
+ /// Gets the profile options.
+ /// </summary>
+ /// <param name="targetId">The target identifier.</param>
+ /// <returns>IEnumerable&lt;SyncQualityOption&gt;.</returns>
+ IEnumerable<SyncProfileOption> GetProfileOptions(string targetId);
}
}
diff --git a/MediaBrowser.Controller/Sync/ISyncProvider.cs b/MediaBrowser.Controller/Sync/ISyncProvider.cs
index 6f24eac1a..ef34bfe69 100644
--- a/MediaBrowser.Controller/Sync/ISyncProvider.cs
+++ b/MediaBrowser.Controller/Sync/ISyncProvider.cs
@@ -1,5 +1,4 @@
-using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Sync;
+using MediaBrowser.Model.Sync;
using System.Collections.Generic;
namespace MediaBrowser.Controller.Sync
@@ -18,13 +17,12 @@ namespace MediaBrowser.Controller.Sync
/// <param name="userId">The user identifier.</param>
/// <returns>IEnumerable&lt;SyncTarget&gt;.</returns>
IEnumerable<SyncTarget> GetSyncTargets(string userId);
-
+
/// <summary>
- /// Gets the device profile.
+ /// Gets all synchronize targets.
/// </summary>
- /// <param name="target">The target.</param>
- /// <returns>DeviceProfile.</returns>
- DeviceProfile GetDeviceProfile(SyncTarget target);
+ /// <returns>IEnumerable&lt;SyncTarget&gt;.</returns>
+ IEnumerable<SyncTarget> GetAllSyncTargets();
}
public interface IHasUniqueTargetIds
diff --git a/MediaBrowser.Controller/Sync/SendFileResult.cs b/MediaBrowser.Controller/Sync/SendFileResult.cs
new file mode 100644
index 000000000..62753444a
--- /dev/null
+++ b/MediaBrowser.Controller/Sync/SendFileResult.cs
@@ -0,0 +1,18 @@
+using MediaBrowser.Model.MediaInfo;
+
+namespace MediaBrowser.Controller.Sync
+{
+ public class SendFileResult
+ {
+ /// <summary>
+ /// Gets or sets the path.
+ /// </summary>
+ /// <value>The path.</value>
+ public string Path { get; set; }
+ /// <summary>
+ /// Gets or sets the protocol.
+ /// </summary>
+ /// <value>The protocol.</value>
+ public MediaProtocol Protocol { get; set; }
+ }
+}