aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/FileOrganization/FileOrganizationService.cs
blob: bcbff74885c77b9e765acba2ede6fe5e71a9179c (plain)
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
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.FileOrganization;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.FileOrganization;
using MediaBrowser.Model.Querying;
using System.Threading;
using System.Threading.Tasks;

namespace MediaBrowser.Server.Implementations.FileOrganization
{
    public class FileOrganizationService : IFileOrganizationService
    {
        private readonly ITaskManager _taskManager;
        private readonly IFileOrganizationRepository _repo;

        public FileOrganizationService(ITaskManager taskManager, IFileOrganizationRepository repo)
        {
            _taskManager = taskManager;
            _repo = repo;
        }

        public void BeginProcessNewFiles()
        {
             _taskManager.CancelIfRunningAndQueue<OrganizerScheduledTask>();
        }


        public Task SaveResult(FileOrganizationResult result, CancellationToken cancellationToken)
        {
            return _repo.SaveResult(result, cancellationToken);
        }

        public QueryResult<FileOrganizationResult> GetResults(FileOrganizationResultQuery query)
        {
            return _repo.GetResults(query);
        }
    }
}