queue sync after creation

This commit is contained in:
Luke 2015-06-07 15:15:27 -04:00
parent 384a59abef
commit 7ac2ea6c18
2 changed files with 10 additions and 3 deletions

View File

@ -32,6 +32,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.ScheduledTasks;
namespace MediaBrowser.Server.Implementations.Sync
{
@ -51,7 +52,8 @@ namespace MediaBrowser.Server.Implementations.Sync
private readonly IConfigurationManager _config;
private readonly IUserDataManager _userDataManager;
private readonly Func<IMediaSourceManager> _mediaSourceManager;
private readonly IJsonSerializer _json;
private readonly IJsonSerializer _json;
private readonly ITaskManager _taskManager;
private ISyncProvider[] _providers = { };
@ -61,7 +63,7 @@ namespace MediaBrowser.Server.Implementations.Sync
public event EventHandler<GenericEventArgs<SyncJobItem>> SyncJobItemUpdated;
public event EventHandler<GenericEventArgs<SyncJobItem>> SyncJobItemCreated;
public SyncManager(ILibraryManager libraryManager, ISyncRepository repo, IImageProcessor imageProcessor, ILogger logger, IUserManager userManager, Func<IDtoService> dtoService, IServerApplicationHost appHost, ITVSeriesManager tvSeriesManager, Func<IMediaEncoder> mediaEncoder, IFileSystem fileSystem, Func<ISubtitleEncoder> subtitleEncoder, IConfigurationManager config, IUserDataManager userDataManager, Func<IMediaSourceManager> mediaSourceManager, IJsonSerializer json)
public SyncManager(ILibraryManager libraryManager, ISyncRepository repo, IImageProcessor imageProcessor, ILogger logger, IUserManager userManager, Func<IDtoService> dtoService, IServerApplicationHost appHost, ITVSeriesManager tvSeriesManager, Func<IMediaEncoder> mediaEncoder, IFileSystem fileSystem, Func<ISubtitleEncoder> subtitleEncoder, IConfigurationManager config, IUserDataManager userDataManager, Func<IMediaSourceManager> mediaSourceManager, IJsonSerializer json, ITaskManager taskManager)
{
_libraryManager = libraryManager;
_repo = repo;
@ -78,6 +80,7 @@ namespace MediaBrowser.Server.Implementations.Sync
_userDataManager = userDataManager;
_mediaSourceManager = mediaSourceManager;
_json = json;
_taskManager = taskManager;
}
public void AddParts(IEnumerable<ISyncProvider> providers)
@ -214,6 +217,10 @@ namespace MediaBrowser.Server.Implementations.Sync
}, _logger);
}
if (returnResult.JobItems.Any (i => i.Status == SyncJobItemStatus.Queued || i.Status == SyncJobItemStatus.Converting)) {
_taskManager.QueueScheduledTask<SyncConvertScheduledTask> ();
}
return returnResult;
}

View File

@ -447,7 +447,7 @@ namespace MediaBrowser.Server.Startup.Common
TVSeriesManager = new TVSeriesManager(UserManager, UserDataManager, LibraryManager);
RegisterSingleInstance(TVSeriesManager);
SyncManager = new SyncManager(LibraryManager, SyncRepository, ImageProcessor, LogManager.GetLogger("SyncManager"), UserManager, () => DtoService, this, TVSeriesManager, () => MediaEncoder, FileSystemManager, () => SubtitleEncoder, ServerConfigurationManager, UserDataManager, () => MediaSourceManager, JsonSerializer);
SyncManager = new SyncManager(LibraryManager, SyncRepository, ImageProcessor, LogManager.GetLogger("SyncManager"), UserManager, () => DtoService, this, TVSeriesManager, () => MediaEncoder, FileSystemManager, () => SubtitleEncoder, ServerConfigurationManager, UserDataManager, () => MediaSourceManager, JsonSerializer, TaskManager);
RegisterSingleInstance(SyncManager);
DtoService = new DtoService(LogManager.GetLogger("DtoService"), LibraryManager, UserDataManager, ItemRepository, ImageProcessor, ServerConfigurationManager, FileSystemManager, ProviderManager, () => ChannelManager, SyncManager, this, () => DeviceManager, () => MediaSourceManager, () => LiveTvManager);