Преглед изворни кода

separate task buttons script

Luke Pulverenti пре 10 година
родитељ
комит
9e809b06c4

+ 22 - 0
MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs

@@ -32,6 +32,9 @@ namespace MediaBrowser.Api.ScheduledTasks
     {
     {
         [ApiMember(Name = "IsHidden", Description = "Optional filter tasks that are hidden, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
         [ApiMember(Name = "IsHidden", Description = "Optional filter tasks that are hidden, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
         public bool? IsHidden { get; set; }
         public bool? IsHidden { get; set; }
+
+        [ApiMember(Name = "IsEnabled", Description = "Optional filter tasks that are enabled, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]
+        public bool? IsEnabled { get; set; }
     }
     }
 
 
     /// <summary>
     /// <summary>
@@ -132,6 +135,25 @@ namespace MediaBrowser.Api.ScheduledTasks
                 });
                 });
             }
             }
 
 
+            if (request.IsEnabled.HasValue)
+            {
+                var val = request.IsEnabled.Value;
+
+                result = result.Where(i =>
+                {
+                    var isEnabled = false;
+
+                    var configurableTask = i.ScheduledTask as IConfigurableScheduledTask;
+
+                    if (configurableTask != null)
+                    {
+                        isEnabled = configurableTask.IsEnabled;
+                    }
+
+                    return isEnabled == val;
+                });
+            }
+            
             var infos = result
             var infos = result
                 .Select(ScheduledTaskHelpers.GetTaskInfo)
                 .Select(ScheduledTaskHelpers.GetTaskInfo)
                 .ToList();
                 .ToList();

+ 6 - 3
MediaBrowser.Server.Implementations/FileOrganization/OrganizerScheduledTask.cs

@@ -54,10 +54,13 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
             return _config.GetAutoOrganizeOptions().TvOptions;
             return _config.GetAutoOrganizeOptions().TvOptions;
         }
         }
 
 
-        public Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
+        public async Task Execute(CancellationToken cancellationToken, IProgress<double> progress)
         {
         {
-            return new TvFolderOrganizer(_libraryManager, _logger, _fileSystem, _libraryMonitor, _organizationService, _config, _providerManager)
-                .Organize(GetTvOptions(), cancellationToken, progress);
+            if (GetTvOptions().IsEnabled)
+            {
+                await new TvFolderOrganizer(_libraryManager, _logger, _fileSystem, _libraryMonitor, _organizationService, _config, _providerManager)
+                    .Organize(GetTvOptions(), cancellationToken, progress).ConfigureAwait(false);
+            }
         }
         }
 
 
         public IEnumerable<ITaskTrigger> GetDefaultTriggers()
         public IEnumerable<ITaskTrigger> GetDefaultTriggers()

+ 1 - 1
MediaBrowser.Server.Implementations/Localization/Server/server.json

@@ -47,7 +47,7 @@
     "LabelDashboardSourcePath": "Web client source path:",
     "LabelDashboardSourcePath": "Web client source path:",
     "LabelDashboardSourcePathHelp": "If running the server from source, specify the path to the dashboard-ui folder. All web client files will be served from this location.",
     "LabelDashboardSourcePathHelp": "If running the server from source, specify the path to the dashboard-ui folder. All web client files will be served from this location.",
     "ButtonConvertMedia": "Convert media",
     "ButtonConvertMedia": "Convert media",
-    "ButtonOrganizeNow":  "Organize now",
+    "ButtonOrganize": "Organize",
     "ButtonOk": "Ok",
     "ButtonOk": "Ok",
     "ButtonCancel": "Cancel",
     "ButtonCancel": "Cancel",
     "ButtonNew": "New",
     "ButtonNew": "New",

+ 2 - 2
MediaBrowser.Server.Startup.Common/ApplicationHost.cs

@@ -532,9 +532,9 @@ namespace MediaBrowser.Server.Startup.Common
 
 
             SetStaticProperties();
             SetStaticProperties();
 
 
-            await ((UserManager)UserManager).Initialize().ConfigureAwait(false);
-
             SetKernelProperties();
             SetKernelProperties();
+
+            await ((UserManager)UserManager).Initialize().ConfigureAwait(false);
         }
         }
 
 
         protected override INetworkManager CreateNetworkManager(ILogger logger)
         protected override INetworkManager CreateNetworkManager(ILogger logger)

+ 1 - 0
MediaBrowser.WebDashboard/Api/PackageCreator.cs

@@ -366,6 +366,7 @@ namespace MediaBrowser.WebDashboard.Api
                                 "mediaplayer-video.js",
                                 "mediaplayer-video.js",
                                 "nowplayingbar.js",
                                 "nowplayingbar.js",
                                 "nowplayingpage.js",
                                 "nowplayingpage.js",
+                                "taskbutton.js",
 
 
                                 "ratingdialog.js",
                                 "ratingdialog.js",
                                 "aboutpage.js",
                                 "aboutpage.js",

+ 3 - 0
MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj

@@ -126,6 +126,9 @@
     <Content Include="dashboard-ui\scripts\syncsettings.js">
     <Content Include="dashboard-ui\scripts\syncsettings.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>
+    <Content Include="dashboard-ui\scripts\taskbutton.js">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </Content>
     <Content Include="dashboard-ui\scripts\usernew.js">
     <Content Include="dashboard-ui\scripts\usernew.js">
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
     </Content>