From 6375411f53a2b561d04f167b4a162892a8671ef4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 15 Jul 2014 00:12:26 -0400 Subject: [PATCH] added sync model objects --- .../MediaBrowser.Controller.csproj | 1 + MediaBrowser.Controller/Sync/ISyncManager.cs | 50 +++++++++++++++++++ .../MediaBrowser.Model.Portable.csproj | 24 +++++++++ .../MediaBrowser.Model.net35.csproj | 24 +++++++++ MediaBrowser.Model/MediaBrowser.Model.csproj | 8 +++ MediaBrowser.Model/Sync/SyncJob.cs | 47 +++++++++++++++++ MediaBrowser.Model/Sync/SyncJobQuery.cs | 7 +++ MediaBrowser.Model/Sync/SyncJobRequest.cs | 28 +++++++++++ MediaBrowser.Model/Sync/SyncJobStatus.cs | 35 +++++++++++++ MediaBrowser.Model/Sync/SyncQuality.cs | 21 ++++++++ MediaBrowser.Model/Sync/SyncSchedule.cs | 12 +++++ MediaBrowser.Model/Sync/SyncScheduleQuery.cs | 7 +++ .../Sync/SyncScheduleRequest.cs | 23 +++++++++ .../Manager/MetadataService.cs | 1 - 14 files changed, 287 insertions(+), 1 deletion(-) create mode 100644 MediaBrowser.Controller/Sync/ISyncManager.cs create mode 100644 MediaBrowser.Model/Sync/SyncJob.cs create mode 100644 MediaBrowser.Model/Sync/SyncJobQuery.cs create mode 100644 MediaBrowser.Model/Sync/SyncJobRequest.cs create mode 100644 MediaBrowser.Model/Sync/SyncJobStatus.cs create mode 100644 MediaBrowser.Model/Sync/SyncQuality.cs create mode 100644 MediaBrowser.Model/Sync/SyncSchedule.cs create mode 100644 MediaBrowser.Model/Sync/SyncScheduleQuery.cs create mode 100644 MediaBrowser.Model/Sync/SyncScheduleRequest.cs diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 1c60ea8e6..fb50deb66 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -319,6 +319,7 @@ + diff --git a/MediaBrowser.Controller/Sync/ISyncManager.cs b/MediaBrowser.Controller/Sync/ISyncManager.cs new file mode 100644 index 000000000..fc92718ca --- /dev/null +++ b/MediaBrowser.Controller/Sync/ISyncManager.cs @@ -0,0 +1,50 @@ +using MediaBrowser.Model.Querying; +using MediaBrowser.Model.Sync; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace MediaBrowser.Controller.Sync +{ + public interface ISyncManager + { + /// + /// Creates the job. + /// + /// The request. + /// Task. + Task> CreateJob(SyncJobRequest request); + + /// + /// Creates the schedule. + /// + /// The request. + /// Task. + Task CreateSchedule(SyncScheduleRequest request); + + /// + /// Gets the jobs. + /// + /// QueryResult<SyncJob>. + QueryResult GetJobs(SyncJobQuery query); + + /// + /// Gets the schedules. + /// + /// QueryResult<SyncSchedule>. + QueryResult GetSchedules(SyncScheduleQuery query); + + /// + /// Cancels the job. + /// + /// The identifier. + /// Task. + Task CancelJob(string id); + + /// + /// Cancels the schedule. + /// + /// The identifier. + /// Task. + Task CancelSchedule(string id); + } +} diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index baa9f933d..9a5cf81f5 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -842,6 +842,30 @@ Session\UserDataChangeInfo.cs + + Sync\SyncJob.cs + + + Sync\SyncJobQuery.cs + + + Sync\SyncJobRequest.cs + + + Sync\SyncJobStatus.cs + + + Sync\SyncQuality.cs + + + Sync\SyncSchedule.cs + + + Sync\SyncScheduleQuery.cs + + + Sync\SyncScheduleRequest.cs + System\LogFile.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index 782e8524d..d96717429 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -799,6 +799,30 @@ Session\UserDataChangeInfo.cs + + Sync\SyncJob.cs + + + Sync\SyncJobQuery.cs + + + Sync\SyncJobRequest.cs + + + Sync\SyncJobStatus.cs + + + Sync\SyncQuality.cs + + + Sync\SyncSchedule.cs + + + Sync\SyncScheduleQuery.cs + + + Sync\SyncScheduleRequest.cs + System\LogFile.cs diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 4d4ca8e20..d82e64aa3 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -295,6 +295,14 @@ + + + + + + + + diff --git a/MediaBrowser.Model/Sync/SyncJob.cs b/MediaBrowser.Model/Sync/SyncJob.cs new file mode 100644 index 000000000..09049a196 --- /dev/null +++ b/MediaBrowser.Model/Sync/SyncJob.cs @@ -0,0 +1,47 @@ + +namespace MediaBrowser.Model.Sync +{ + public class SyncJob + { + /// + /// Gets or sets the identifier. + /// + /// The identifier. + public string Id { get; set; } + /// + /// Gets or sets the device identifier. + /// + /// The device identifier. + public string DeviceId { get; set; } + /// + /// Gets or sets the item identifier. + /// + /// The item identifier. + public string ItemId { get; set; } + /// + /// Gets or sets the quality. + /// + /// The quality. + public SyncQuality Quality { get; set; } + /// + /// Gets or sets the status. + /// + /// The status. + public SyncJobStatus Status { get; set; } + /// + /// Gets or sets the current progress. + /// + /// The current progress. + public double? CurrentProgress { get; set; } + /// + /// Gets or sets the synchronize rule identifier. + /// + /// The synchronize rule identifier. + public string SyncScheduleId { get; set; } + /// + /// Gets or sets the transcoded path. + /// + /// The transcoded path. + public string TranscodedPath { get; set; } + } +} diff --git a/MediaBrowser.Model/Sync/SyncJobQuery.cs b/MediaBrowser.Model/Sync/SyncJobQuery.cs new file mode 100644 index 000000000..f41544db9 --- /dev/null +++ b/MediaBrowser.Model/Sync/SyncJobQuery.cs @@ -0,0 +1,7 @@ + +namespace MediaBrowser.Model.Sync +{ + public class SyncJobQuery + { + } +} diff --git a/MediaBrowser.Model/Sync/SyncJobRequest.cs b/MediaBrowser.Model/Sync/SyncJobRequest.cs new file mode 100644 index 000000000..9871f976d --- /dev/null +++ b/MediaBrowser.Model/Sync/SyncJobRequest.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.Sync +{ + public class SyncJobRequest + { + /// + /// Gets or sets the device identifier. + /// + /// The device identifier. + public List DeviceIds { get; set; } + /// + /// Gets or sets the item identifier. + /// + /// The item identifier. + public string ItemId { get; set; } + /// + /// Gets or sets the quality. + /// + /// The quality. + public SyncQuality Quality { get; set; } + + public SyncJobRequest() + { + DeviceIds = new List(); + } + } +} diff --git a/MediaBrowser.Model/Sync/SyncJobStatus.cs b/MediaBrowser.Model/Sync/SyncJobStatus.cs new file mode 100644 index 000000000..2a216fe04 --- /dev/null +++ b/MediaBrowser.Model/Sync/SyncJobStatus.cs @@ -0,0 +1,35 @@ + +namespace MediaBrowser.Model.Sync +{ + public enum SyncJobStatus + { + /// + /// The queued + /// + Queued = 0, + /// + /// The transcoding + /// + Transcoding = 1, + /// + /// The transcoding failed + /// + TranscodingFailed = 2, + /// + /// The transcoding completed + /// + TranscodingCompleted = 3, + /// + /// The transfering + /// + Transfering = 4, + /// + /// The transfer failed + /// + TransferFailed = 4, + /// + /// The completed + /// + Completed = 6 + } +} diff --git a/MediaBrowser.Model/Sync/SyncQuality.cs b/MediaBrowser.Model/Sync/SyncQuality.cs new file mode 100644 index 000000000..f915e2768 --- /dev/null +++ b/MediaBrowser.Model/Sync/SyncQuality.cs @@ -0,0 +1,21 @@ + +namespace MediaBrowser.Model.Sync +{ + public enum SyncQuality + { + /// + /// The good + /// + Good = 0, + + /// + /// The better + /// + Better = 1, + + /// + /// The best + /// + Best = 2 + } +} diff --git a/MediaBrowser.Model/Sync/SyncSchedule.cs b/MediaBrowser.Model/Sync/SyncSchedule.cs new file mode 100644 index 000000000..297cbd145 --- /dev/null +++ b/MediaBrowser.Model/Sync/SyncSchedule.cs @@ -0,0 +1,12 @@ + +namespace MediaBrowser.Model.Sync +{ + public class SyncSchedule + { + /// + /// Gets or sets the identifier. + /// + /// The identifier. + public string Id { get; set; } + } +} diff --git a/MediaBrowser.Model/Sync/SyncScheduleQuery.cs b/MediaBrowser.Model/Sync/SyncScheduleQuery.cs new file mode 100644 index 000000000..b704a358c --- /dev/null +++ b/MediaBrowser.Model/Sync/SyncScheduleQuery.cs @@ -0,0 +1,7 @@ + +namespace MediaBrowser.Model.Sync +{ + public class SyncScheduleQuery + { + } +} diff --git a/MediaBrowser.Model/Sync/SyncScheduleRequest.cs b/MediaBrowser.Model/Sync/SyncScheduleRequest.cs new file mode 100644 index 000000000..e1ba4b115 --- /dev/null +++ b/MediaBrowser.Model/Sync/SyncScheduleRequest.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; + +namespace MediaBrowser.Model.Sync +{ + public class SyncScheduleRequest + { + /// + /// Gets or sets the device identifier. + /// + /// The device identifier. + public List DeviceIds { get; set; } + /// + /// Gets or sets the quality. + /// + /// The quality. + public SyncQuality Quality { get; set; } + + public SyncScheduleRequest() + { + DeviceIds = new List(); + } + } +} diff --git a/MediaBrowser.Providers/Manager/MetadataService.cs b/MediaBrowser.Providers/Manager/MetadataService.cs index 335fb9769..b84d060d7 100644 --- a/MediaBrowser.Providers/Manager/MetadataService.cs +++ b/MediaBrowser.Providers/Manager/MetadataService.cs @@ -339,7 +339,6 @@ namespace MediaBrowser.Providers.Manager break; } - failedProviderCount++; Logger.Debug("{0} returned no metadata for {1}", providerName, item.Path ?? item.Name); } catch (OperationCanceledException)