aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Sync
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-24 17:33:26 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-01-24 17:33:26 -0500
commit67559378009062a26173888ad457d0c9116bfc9a (patch)
tree0bfeb5b72b6dd39d696f45840b592458390d0499 /MediaBrowser.Server.Implementations/Sync
parentee00f8bf726ae5498d64cff0086b9b7e638936ea (diff)
sync updates
Diffstat (limited to 'MediaBrowser.Server.Implementations/Sync')
-rw-r--r--MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs12
-rw-r--r--MediaBrowser.Server.Implementations/Sync/SyncRegistrationInfo.cs31
2 files changed, 42 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
index 716584084c..b926ee3388 100644
--- a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
+++ b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
@@ -90,7 +90,7 @@ namespace MediaBrowser.Server.Implementations.Sync
continue;
}
- var index = jobItems.Count == 0 ?
+ var index = jobItems.Count == 0 ?
0 :
(jobItems.Select(i => i.JobItemIndex).Max() + 1);
@@ -348,10 +348,20 @@ namespace MediaBrowser.Server.Implementations.Sync
private void CleanDeadSyncFiles()
{
// TODO
+ // Clean files in sync temp folder that are not linked to any sync jobs
}
public async Task SyncJobItems(SyncJobItem[] items, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken)
{
+ if (items.Length > 0)
+ {
+ if (!SyncRegistrationInfo.Instance.IsRegistered)
+ {
+ _logger.Debug("Cancelling sync job processing. Please obtain a supporter membership.");
+ return;
+ }
+ }
+
var numComplete = 0;
foreach (var item in items)
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncRegistrationInfo.cs b/MediaBrowser.Server.Implementations/Sync/SyncRegistrationInfo.cs
new file mode 100644
index 0000000000..40b84b1c21
--- /dev/null
+++ b/MediaBrowser.Server.Implementations/Sync/SyncRegistrationInfo.cs
@@ -0,0 +1,31 @@
+using MediaBrowser.Common.Security;
+using System.Threading.Tasks;
+
+namespace MediaBrowser.Server.Implementations.Sync
+{
+ public class SyncRegistrationInfo : IRequiresRegistration
+ {
+ private readonly ISecurityManager _securityManager;
+
+ public static SyncRegistrationInfo Instance;
+
+ public SyncRegistrationInfo(ISecurityManager securityManager)
+ {
+ _securityManager = securityManager;
+ Instance = this;
+ }
+
+ private bool _registered;
+ public bool IsRegistered
+ {
+ get { return _registered; }
+ }
+
+ public async Task LoadRegistrationInfoAsync()
+ {
+ var info = await _securityManager.GetRegistrationStatus("sync").ConfigureAwait(false);
+
+ _registered = info.IsValid;
+ }
+ }
+}