Repository navigation
Expand file tree
/
Copy pathCollectionScanTask.cs
More file actions
50 lines (43 loc) · 1.57 KB
/
Copy pathCollectionScanTask.cs
File metadata and controls
50 lines (43 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Tasks;
namespace NotifySync
{
/// <summary>
/// A scheduled task that periodically scans monitored collections (BoxSets) for newly added items.
/// </summary>
public class CollectionScanTask : IScheduledTask
{
/// <inheritdoc />
public string Name => "NotifySync: Collection Scan";
/// <inheritdoc />
public string Key => "NotifySyncCollectionScanTask";
/// <inheritdoc />
public string Description => "Scanne les collections surveillées pour détecter les nouveaux ajouts et créer des notifications.";
/// <inheritdoc />
public string Category => "NotifySync";
/// <inheritdoc />
public Task ExecuteAsync(IProgress<double> progress, CancellationToken cancellationToken)
{
if (NotificationManager.Instance == null)
{
return Task.CompletedTask;
}
return Task.Run(() => NotificationManager.Instance.ScanCollections(progress, cancellationToken), cancellationToken);
}
/// <inheritdoc />
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
return new[]
{
new TaskTriggerInfo
{
Type = TaskTriggerInfoType.IntervalTrigger,
IntervalTicks = TimeSpan.FromMinutes(15).Ticks
}
};
}
}
}