From 800a16a2130ed49204a8b1358e62901077285a82 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 29 Dec 2014 00:56:55 -0500 Subject: [PATCH] sync updates --- MediaBrowser.Api/Sync/SyncService.cs | 12 ++++++++++++ MediaBrowser.Controller/Sync/ISyncManager.cs | 7 +++++++ .../MediaBrowser.Model.Portable.csproj | 6 ++++++ .../MediaBrowser.Model.net35.csproj | 6 ++++++ MediaBrowser.Model/ApiClient/IApiClient.cs | 7 +++++++ MediaBrowser.Model/MediaBrowser.Model.csproj | 2 ++ MediaBrowser.Model/Sync/DeviceFileInfo.cs | 2 +- MediaBrowser.Model/Sync/ItemFIleInfo.cs | 2 +- MediaBrowser.Model/Sync/LocalItem.cs | 2 +- MediaBrowser.Model/Sync/SyncDataRequest.cs | 16 ++++++++++++++++ MediaBrowser.Model/Sync/SyncDataResponse.cs | 14 ++++++++++++++ .../Sync/SyncManager.cs | 7 +++++++ Nuget/MediaBrowser.Common.Internal.nuspec | 4 ++-- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Model.Signed.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 ++-- 16 files changed, 86 insertions(+), 9 deletions(-) create mode 100644 MediaBrowser.Model/Sync/SyncDataRequest.cs create mode 100644 MediaBrowser.Model/Sync/SyncDataResponse.cs diff --git a/MediaBrowser.Api/Sync/SyncService.cs b/MediaBrowser.Api/Sync/SyncService.cs index 0036b316ff..31442c1d94 100644 --- a/MediaBrowser.Api/Sync/SyncService.cs +++ b/MediaBrowser.Api/Sync/SyncService.cs @@ -92,6 +92,11 @@ namespace MediaBrowser.Api.Sync public string TargetId { get; set; } } + [Route("/Sync/Data", "POST", Summary = "Syncs data between device and server")] + public class SyncData : SyncDataRequest, IReturn + { + } + [Authenticated] public class SyncService : BaseApiService { @@ -219,5 +224,12 @@ namespace MediaBrowser.Api.Sync { return ToOptimizedResult(_syncManager.GetReadySyncItems(request.TargetId)); } + + public async Task Post(SyncData request) + { + var response = await _syncManager.SyncData(request).ConfigureAwait(false); + + return ToOptimizedResult(response); + } } } diff --git a/MediaBrowser.Controller/Sync/ISyncManager.cs b/MediaBrowser.Controller/Sync/ISyncManager.cs index 39cec4f00f..6cad197369 100644 --- a/MediaBrowser.Controller/Sync/ISyncManager.cs +++ b/MediaBrowser.Controller/Sync/ISyncManager.cs @@ -95,5 +95,12 @@ namespace MediaBrowser.Controller.Sync /// The target identifier. /// List<SyncedItem>. List GetReadySyncItems(string targetId); + + /// + /// Synchronizes the data. + /// + /// The request. + /// Task<SyncDataResponse>. + Task SyncData(SyncDataRequest request); } } diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index f4d92b6f3b..e4cfab571f 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -1055,6 +1055,12 @@ Sync\SyncCategory.cs + + Sync\SyncDataRequest.cs + + + Sync\SyncDataResponse.cs + Sync\SyncDialogOptions.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index b07e8557fb..3fc5201a7b 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -1014,6 +1014,12 @@ Sync\SyncCategory.cs + + Sync\SyncDataRequest.cs + + + Sync\SyncDataResponse.cs + Sync\SyncDialogOptions.cs diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs index 883e54308d..9faa8fceda 100644 --- a/MediaBrowser.Model/ApiClient/IApiClient.cs +++ b/MediaBrowser.Model/ApiClient/IApiClient.cs @@ -1433,5 +1433,12 @@ namespace MediaBrowser.Model.ApiClient /// The target identifier. /// List<SyncedItem>. Task> GetReadySyncItems(string targetId); + + /// + /// Synchronizes the data. + /// + /// The request. + /// Task<SyncDataResponse>. + Task SyncData(SyncDataRequest request); } } \ No newline at end of file diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 8ec271626d..d5280f4b11 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -372,6 +372,8 @@ + + diff --git a/MediaBrowser.Model/Sync/DeviceFileInfo.cs b/MediaBrowser.Model/Sync/DeviceFileInfo.cs index bb9a0c6ef2..bc93b69bcf 100644 --- a/MediaBrowser.Model/Sync/DeviceFileInfo.cs +++ b/MediaBrowser.Model/Sync/DeviceFileInfo.cs @@ -3,7 +3,7 @@ namespace MediaBrowser.Model.Sync { public class DeviceFileInfo { - public string[] Path { get; set; } + public string Path { get; set; } public string Name { get; set; } } } diff --git a/MediaBrowser.Model/Sync/ItemFIleInfo.cs b/MediaBrowser.Model/Sync/ItemFIleInfo.cs index f0829bc2bf..b110af6b5a 100644 --- a/MediaBrowser.Model/Sync/ItemFIleInfo.cs +++ b/MediaBrowser.Model/Sync/ItemFIleInfo.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.Model.Sync /// Gets or sets the path. /// /// The path. - public string[] Path { get; set; } + public string Path { get; set; } /// /// Gets or sets the type of the image. /// diff --git a/MediaBrowser.Model/Sync/LocalItem.cs b/MediaBrowser.Model/Sync/LocalItem.cs index 9e660c5909..51faaff904 100644 --- a/MediaBrowser.Model/Sync/LocalItem.cs +++ b/MediaBrowser.Model/Sync/LocalItem.cs @@ -13,7 +13,7 @@ namespace MediaBrowser.Model.Sync /// Gets or sets the local path. /// /// The local path. - public string[] LocalPath { get; set; } + public string LocalPath { get; set; } /// /// Gets or sets the server identifier. /// diff --git a/MediaBrowser.Model/Sync/SyncDataRequest.cs b/MediaBrowser.Model/Sync/SyncDataRequest.cs new file mode 100644 index 0000000000..3eb447b3f2 --- /dev/null +++ b/MediaBrowser.Model/Sync/SyncDataRequest.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.Sync +{ + public class SyncDataRequest + { + public List LocalItemIds { get; set; } + + public string TargetId { get; set; } + + public SyncDataRequest() + { + LocalItemIds = new List(); + } + } +} diff --git a/MediaBrowser.Model/Sync/SyncDataResponse.cs b/MediaBrowser.Model/Sync/SyncDataResponse.cs new file mode 100644 index 0000000000..ac7ff5c84a --- /dev/null +++ b/MediaBrowser.Model/Sync/SyncDataResponse.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.Sync +{ + public class SyncDataResponse + { + public List ItemIdsToRemove { get; set; } + + public SyncDataResponse() + { + ItemIdsToRemove = new List(); + } + } +} diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs index 24b9b0b83c..3f30dcb1ce 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs @@ -388,5 +388,12 @@ namespace MediaBrowser.Server.Implementations.Sync return jobItemResult.Items.Select(GetJobItemInfo) .ToList(); } + + public async Task SyncData(SyncDataRequest request) + { + var response = new SyncDataResponse(); + + return response; + } } } diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec index f637622ef9..c4588f825d 100644 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ b/Nuget/MediaBrowser.Common.Internal.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common.Internal - 3.0.534 + 3.0.537 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 eddbcd0d20..125dd6d289 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.534 + 3.0.537 MediaBrowser.Common Media Browser Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Model.Signed.nuspec b/Nuget/MediaBrowser.Model.Signed.nuspec index 7e10950b07..1a7d948c5a 100644 --- a/Nuget/MediaBrowser.Model.Signed.nuspec +++ b/Nuget/MediaBrowser.Model.Signed.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Model.Signed - 3.0.534 + 3.0.537 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 7fde54fe41..b63ff3ca11 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.534 + 3.0.537 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 - +