From 78f9364b034d73ec80836e2c3a3b62714c8a3bdd Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 2 Nov 2016 16:58:51 -0400 Subject: move classes to portable server project --- .../Branding/BrandingConfigurationFactory.cs | 21 +++ .../Emby.Server.Implementations.csproj | 6 + .../ScheduledTasks/ChapterImagesTask.cs | 192 +++++++++++++++++++++ .../ScheduledTasks/PeopleValidationTask.cs | 94 ++++++++++ .../ScheduledTasks/PluginUpdateTask.cs | 140 +++++++++++++++ .../ScheduledTasks/RefreshIntrosTask.cs | 105 +++++++++++ .../ScheduledTasks/SystemUpdateTask.cs | 148 ++++++++++++++++ 7 files changed, 706 insertions(+) create mode 100644 Emby.Server.Implementations/Branding/BrandingConfigurationFactory.cs create mode 100644 Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs create mode 100644 Emby.Server.Implementations/ScheduledTasks/PeopleValidationTask.cs create mode 100644 Emby.Server.Implementations/ScheduledTasks/PluginUpdateTask.cs create mode 100644 Emby.Server.Implementations/ScheduledTasks/RefreshIntrosTask.cs create mode 100644 Emby.Server.Implementations/ScheduledTasks/SystemUpdateTask.cs (limited to 'Emby.Server.Implementations') diff --git a/Emby.Server.Implementations/Branding/BrandingConfigurationFactory.cs b/Emby.Server.Implementations/Branding/BrandingConfigurationFactory.cs new file mode 100644 index 000000000..a29f55f16 --- /dev/null +++ b/Emby.Server.Implementations/Branding/BrandingConfigurationFactory.cs @@ -0,0 +1,21 @@ +using MediaBrowser.Common.Configuration; +using MediaBrowser.Model.Branding; +using System.Collections.Generic; + +namespace Emby.Server.Implementations.Branding +{ + public class BrandingConfigurationFactory : IConfigurationFactory + { + public IEnumerable GetConfigurations() + { + return new[] + { + new ConfigurationStore + { + ConfigurationType = typeof(BrandingOptions), + Key = "branding" + } + }; + } + } +} diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index 317b1b9b8..85dfda0a3 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -52,6 +52,7 @@ Properties\SharedVersion.cs + @@ -61,6 +62,11 @@ + + + + + diff --git a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs new file mode 100644 index 000000000..d75815847 --- /dev/null +++ b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs @@ -0,0 +1,192 @@ +using MediaBrowser.Common.Configuration; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.MediaEncoding; +using MediaBrowser.Controller.Persistence; +using MediaBrowser.Model.Logging; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using MediaBrowser.Common.IO; +using MediaBrowser.Controller.IO; +using MediaBrowser.Model.IO; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Tasks; + +namespace Emby.Server.Implementations.ScheduledTasks +{ + /// + /// Class ChapterImagesTask + /// + class ChapterImagesTask : IScheduledTask + { + /// + /// The _logger + /// + private readonly ILogger _logger; + /// + /// The _library manager + /// + private readonly ILibraryManager _libraryManager; + + private readonly IItemRepository _itemRepo; + + private readonly IApplicationPaths _appPaths; + + private readonly IEncodingManager _encodingManager; + private readonly IFileSystem _fileSystem; + + /// + /// Initializes a new instance of the class. + /// + public ChapterImagesTask(ILogManager logManager, ILibraryManager libraryManager, IItemRepository itemRepo, IApplicationPaths appPaths, IEncodingManager encodingManager, IFileSystem fileSystem) + { + _logger = logManager.GetLogger(GetType().Name); + _libraryManager = libraryManager; + _itemRepo = itemRepo; + _appPaths = appPaths; + _encodingManager = encodingManager; + _fileSystem = fileSystem; + } + + /// + /// Creates the triggers that define when the task will run + /// + public IEnumerable GetDefaultTriggers() + { + return new[] { + + new TaskTriggerInfo + { + Type = TaskTriggerInfo.TriggerDaily, + TimeOfDayTicks = TimeSpan.FromHours(1).Ticks, + MaxRuntimeMs = Convert.ToInt32(TimeSpan.FromHours(4).TotalMilliseconds) + } + }; + } + + public string Key + { + get { return "RefreshChapterImages"; } + } + + /// + /// Returns the task to be executed + /// + /// The cancellation token. + /// The progress. + /// Task. + public async Task Execute(CancellationToken cancellationToken, IProgress progress) + { + var videos = _libraryManager.GetItemList(new InternalItemsQuery + { + MediaTypes = new[] { MediaType.Video }, + IsFolder = false, + Recursive = true + }) + .OfType