Merge pull request #2254 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-10-23 18:45:47 -04:00 committed by GitHub
commit 931f5f2e6a
103 changed files with 19097 additions and 576 deletions

View File

@ -9,6 +9,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO; using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Api.Dlna namespace MediaBrowser.Api.Dlna
{ {

View File

@ -1,5 +1,4 @@
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Tasks; using MediaBrowser.Model.Tasks;
using ServiceStack; using ServiceStack;
@ -198,10 +197,7 @@ namespace MediaBrowser.Api.ScheduledTasks
throw new ResourceNotFoundException("Task not found"); throw new ResourceNotFoundException("Task not found");
} }
var hasKey = task.ScheduledTask as IHasKey; if (string.Equals(task.ScheduledTask.Key, "SystemUpdateTask", StringComparison.OrdinalIgnoreCase))
if (hasKey != null)
{
if (string.Equals(hasKey.Key, "SystemUpdateTask", StringComparison.OrdinalIgnoreCase))
{ {
// This is a hack for now just to get the update application function to work when auto-update is disabled // This is a hack for now just to get the update application function to work when auto-update is disabled
if (!_config.Configuration.EnableAutoUpdate) if (!_config.Configuration.EnableAutoUpdate)
@ -210,7 +206,6 @@ namespace MediaBrowser.Api.ScheduledTasks
_config.SaveConfiguration(); _config.SaveConfiguration();
} }
} }
}
TaskManager.Execute(task); TaskManager.Execute(task);
} }
@ -252,7 +247,7 @@ namespace MediaBrowser.Api.ScheduledTasks
var triggerInfos = request; var triggerInfos = request;
task.Triggers = triggerInfos.Select(ScheduledTaskHelpers.GetTrigger); task.Triggers = triggerInfos.ToArray();
} }
} }
} }

View File

@ -1,5 +1,4 @@
using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Events; using MediaBrowser.Model.Events;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Tasks; using MediaBrowser.Model.Tasks;

View File

@ -26,11 +26,16 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Implementations.Cryptography;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.Cryptography;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Common.Implementations namespace MediaBrowser.Common.Implementations
{ {
@ -67,7 +72,7 @@ namespace MediaBrowser.Common.Implementations
/// Gets or sets the plugins. /// Gets or sets the plugins.
/// </summary> /// </summary>
/// <value>The plugins.</value> /// <value>The plugins.</value>
public IEnumerable<IPlugin> Plugins { get; protected set; } public IPlugin[] Plugins { get; protected set; }
/// <summary> /// <summary>
/// Gets or sets the log manager. /// Gets or sets the log manager.
@ -174,6 +179,8 @@ namespace MediaBrowser.Common.Implementations
/// <value><c>true</c> if this instance is running as service; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is running as service; otherwise, <c>false</c>.</value>
public abstract bool IsRunningAsService { get; } public abstract bool IsRunningAsService { get; }
protected ICryptographyProvider CryptographyProvider = new CryptographyProvider();
private DeviceId _deviceId; private DeviceId _deviceId;
public string SystemId public string SystemId
{ {
@ -202,6 +209,9 @@ namespace MediaBrowser.Common.Implementations
ILogManager logManager, ILogManager logManager,
IFileSystem fileSystem) IFileSystem fileSystem)
{ {
// hack alert, until common can target .net core
BaseExtensions.CryptographyProvider = CryptographyProvider;
XmlSerializer = new XmlSerializer (fileSystem, logManager.GetLogger("XmlSerializer")); XmlSerializer = new XmlSerializer (fileSystem, logManager.GetLogger("XmlSerializer"));
FailedAssemblies = new List<string>(); FailedAssemblies = new List<string>();
@ -430,7 +440,36 @@ namespace MediaBrowser.Common.Implementations
RegisterModules(); RegisterModules();
ConfigurationManager.AddParts(GetExports<IConfigurationFactory>()); ConfigurationManager.AddParts(GetExports<IConfigurationFactory>());
Plugins = GetExports<IPlugin>(); Plugins = GetExports<IPlugin>().Select(LoadPlugin).Where(i => i != null).ToArray();
}
private IPlugin LoadPlugin(IPlugin plugin)
{
try
{
var assemblyPlugin = plugin as IPluginAssembly;
if (assemblyPlugin != null)
{
var assembly = plugin.GetType().Assembly;
var assemblyName = assembly.GetName();
var attribute = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0];
var assemblyId = new Guid(attribute.Value);
var assemblyFileName = assemblyName.Name + ".dll";
var assemblyFilePath = Path.Combine(ApplicationPaths.PluginsPath, assemblyFileName);
assemblyPlugin.SetAttributes(assemblyFilePath, assemblyFileName, assemblyName.Version, assemblyId);
}
}
catch (Exception ex)
{
Logger.ErrorException("Error loading plugin {0}", ex, plugin.GetType().FullName);
return null;
}
return plugin;
} }
/// <summary> /// <summary>
@ -565,7 +604,7 @@ namespace MediaBrowser.Common.Implementations
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.ErrorException("Error creating {0}", ex, type.Name); Logger.ErrorException("Error creating {0}", ex, type.FullName);
throw; throw;
} }
@ -584,7 +623,7 @@ namespace MediaBrowser.Common.Implementations
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.ErrorException("Error creating {0}", ex, type.Name); Logger.ErrorException("Error creating {0}", ex, type.FullName);
// Don't blow up in release mode // Don't blow up in release mode
return null; return null;
} }
@ -747,7 +786,7 @@ namespace MediaBrowser.Common.Implementations
{ {
var list = Plugins.ToList(); var list = Plugins.ToList();
list.Remove(plugin); list.Remove(plugin);
Plugins = list; Plugins = list.ToArray();
} }
/// <summary> /// <summary>

View File

@ -0,0 +1,18 @@
using System;
using System.Security.Cryptography;
using System.Text;
using MediaBrowser.Model.Cryptography;
namespace MediaBrowser.Common.Implementations.Cryptography
{
public class CryptographyProvider : ICryptographyProvider
{
public Guid GetMD5(string str)
{
using (var provider = MD5.Create())
{
return new Guid(provider.ComputeHash(Encoding.Unicode.GetBytes(str)));
}
}
}
}

View File

@ -18,6 +18,7 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Common.Implementations.HttpClientManager namespace MediaBrowser.Common.Implementations.HttpClientManager
{ {

View File

@ -1,5 +1,6 @@
using System.IO; using System.IO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
using Microsoft.IO; using Microsoft.IO;
namespace MediaBrowser.Common.Implementations.IO namespace MediaBrowser.Common.Implementations.IO

View File

@ -91,6 +91,7 @@
<Compile Include="BaseApplicationPaths.cs" /> <Compile Include="BaseApplicationPaths.cs" />
<Compile Include="Configuration\BaseConfigurationManager.cs" /> <Compile Include="Configuration\BaseConfigurationManager.cs" />
<Compile Include="Configuration\ConfigurationHelper.cs" /> <Compile Include="Configuration\ConfigurationHelper.cs" />
<Compile Include="Cryptography\CryptographyProvider.cs" />
<Compile Include="Devices\DeviceId.cs" /> <Compile Include="Devices\DeviceId.cs" />
<Compile Include="HttpClientManager\HttpClientInfo.cs" /> <Compile Include="HttpClientManager\HttpClientInfo.cs" />
<Compile Include="HttpClientManager\HttpClientManager.cs" /> <Compile Include="HttpClientManager\HttpClientManager.cs" />
@ -101,11 +102,16 @@
<Compile Include="Logging\NlogManager.cs" /> <Compile Include="Logging\NlogManager.cs" />
<Compile Include="Networking\BaseNetworkManager.cs" /> <Compile Include="Networking\BaseNetworkManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScheduledTasks\DailyTrigger.cs" />
<Compile Include="ScheduledTasks\IntervalTrigger.cs" />
<Compile Include="ScheduledTasks\ScheduledTaskWorker.cs" /> <Compile Include="ScheduledTasks\ScheduledTaskWorker.cs" />
<Compile Include="ScheduledTasks\StartupTrigger.cs" />
<Compile Include="ScheduledTasks\SystemEventTrigger.cs" />
<Compile Include="ScheduledTasks\TaskManager.cs" /> <Compile Include="ScheduledTasks\TaskManager.cs" />
<Compile Include="ScheduledTasks\Tasks\DeleteCacheFileTask.cs" /> <Compile Include="ScheduledTasks\Tasks\DeleteCacheFileTask.cs" />
<Compile Include="ScheduledTasks\Tasks\DeleteLogFileTask.cs" /> <Compile Include="ScheduledTasks\Tasks\DeleteLogFileTask.cs" />
<Compile Include="ScheduledTasks\Tasks\ReloadLoggerFileTask.cs" /> <Compile Include="ScheduledTasks\Tasks\ReloadLoggerFileTask.cs" />
<Compile Include="ScheduledTasks\WeeklyTrigger.cs" />
<Compile Include="Security\MbAdmin.cs" /> <Compile Include="Security\MbAdmin.cs" />
<Compile Include="Security\MBLicenseFile.cs" /> <Compile Include="Security\MBLicenseFile.cs" />
<Compile Include="Security\PluginSecurityManager.cs" /> <Compile Include="Security\PluginSecurityManager.cs" />

View File

@ -232,13 +232,12 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
/// <summary> /// <summary>
/// The _triggers /// The _triggers
/// </summary> /// </summary>
private List<ITaskTrigger> _triggers; private Tuple<TaskTriggerInfo,ITaskTrigger>[] _triggers;
/// <summary> /// <summary>
/// Gets the triggers that define when the task will run /// Gets the triggers that define when the task will run
/// </summary> /// </summary>
/// <value>The triggers.</value> /// <value>The triggers.</value>
/// <exception cref="System.ArgumentNullException">value</exception> private Tuple<TaskTriggerInfo, ITaskTrigger>[] InternalTriggers
public IEnumerable<ITaskTrigger> Triggers
{ {
get get
{ {
@ -257,11 +256,33 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
DisposeTriggers(); DisposeTriggers();
} }
_triggers = value.ToList(); _triggers = value.ToArray();
ReloadTriggerEvents(false); ReloadTriggerEvents(false);
}
}
SaveTriggers(_triggers); /// <summary>
/// Gets the triggers that define when the task will run
/// </summary>
/// <value>The triggers.</value>
/// <exception cref="System.ArgumentNullException">value</exception>
public TaskTriggerInfo[] Triggers
{
get
{
return InternalTriggers.Select(i => i.Item1).ToArray();
}
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
SaveTriggers(value);
InternalTriggers = value.Select(i => new Tuple<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray();
} }
} }
@ -304,8 +325,10 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param> /// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
private void ReloadTriggerEvents(bool isApplicationStartup) private void ReloadTriggerEvents(bool isApplicationStartup)
{ {
foreach (var trigger in Triggers) foreach (var triggerInfo in InternalTriggers)
{ {
var trigger = triggerInfo.Item2;
trigger.Stop(); trigger.Stop();
trigger.Triggered -= trigger_Triggered; trigger.Triggered -= trigger_Triggered;
@ -507,23 +530,29 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
/// Loads the triggers. /// Loads the triggers.
/// </summary> /// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns> /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
private List<ITaskTrigger> LoadTriggers() private Tuple<TaskTriggerInfo, ITaskTrigger>[] LoadTriggers()
{
var settings = LoadTriggerSettings();
return settings.Select(i => new Tuple<TaskTriggerInfo, ITaskTrigger>(i, GetTrigger(i))).ToArray();
}
private TaskTriggerInfo[] LoadTriggerSettings()
{ {
try try
{ {
return JsonSerializer.DeserializeFromFile<IEnumerable<TaskTriggerInfo>>(GetConfigurationFilePath()) return JsonSerializer.DeserializeFromFile<IEnumerable<TaskTriggerInfo>>(GetConfigurationFilePath())
.Select(ScheduledTaskHelpers.GetTrigger) .ToArray();
.ToList();
} }
catch (FileNotFoundException) catch (FileNotFoundException)
{ {
// File doesn't exist. No biggie. Return defaults. // File doesn't exist. No biggie. Return defaults.
return ScheduledTask.GetDefaultTriggers().ToList(); return ScheduledTask.GetDefaultTriggers().ToArray();
} }
catch (DirectoryNotFoundException) catch (DirectoryNotFoundException)
{ {
// File doesn't exist. No biggie. Return defaults. // File doesn't exist. No biggie. Return defaults.
return ScheduledTask.GetDefaultTriggers().ToList(); return ScheduledTask.GetDefaultTriggers().ToArray();
} }
} }
@ -531,13 +560,13 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
/// Saves the triggers. /// Saves the triggers.
/// </summary> /// </summary>
/// <param name="triggers">The triggers.</param> /// <param name="triggers">The triggers.</param>
private void SaveTriggers(IEnumerable<ITaskTrigger> triggers) private void SaveTriggers(TaskTriggerInfo[] triggers)
{ {
var path = GetConfigurationFilePath(); var path = GetConfigurationFilePath();
_fileSystem.CreateDirectory(Path.GetDirectoryName(path)); _fileSystem.CreateDirectory(Path.GetDirectoryName(path));
JsonSerializer.SerializeToFile(triggers.Select(ScheduledTaskHelpers.GetTriggerInfo), path); JsonSerializer.SerializeToFile(triggers, path);
} }
/// <summary> /// <summary>
@ -561,11 +590,7 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
Id = Id Id = Id
}; };
var hasKey = ScheduledTask as IHasKey; result.Key = ScheduledTask.Key;
if (hasKey != null)
{
result.Key = hasKey.Key;
}
if (ex != null) if (ex != null)
{ {
@ -655,13 +680,98 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks
} }
} }
/// <summary>
/// Converts a TaskTriggerInfo into a concrete BaseTaskTrigger
/// </summary>
/// <param name="info">The info.</param>
/// <returns>BaseTaskTrigger.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
/// <exception cref="System.ArgumentException">Invalid trigger type: + info.Type</exception>
public static ITaskTrigger GetTrigger(TaskTriggerInfo info)
{
var options = new TaskExecutionOptions
{
MaxRuntimeMs = info.MaxRuntimeMs
};
if (info.Type.Equals(typeof(DailyTrigger).Name, StringComparison.OrdinalIgnoreCase))
{
if (!info.TimeOfDayTicks.HasValue)
{
throw new ArgumentNullException();
}
return new DailyTrigger
{
TimeOfDay = TimeSpan.FromTicks(info.TimeOfDayTicks.Value),
TaskOptions = options
};
}
if (info.Type.Equals(typeof(WeeklyTrigger).Name, StringComparison.OrdinalIgnoreCase))
{
if (!info.TimeOfDayTicks.HasValue)
{
throw new ArgumentNullException();
}
if (!info.DayOfWeek.HasValue)
{
throw new ArgumentNullException();
}
return new WeeklyTrigger
{
TimeOfDay = TimeSpan.FromTicks(info.TimeOfDayTicks.Value),
DayOfWeek = info.DayOfWeek.Value,
TaskOptions = options
};
}
if (info.Type.Equals(typeof(IntervalTrigger).Name, StringComparison.OrdinalIgnoreCase))
{
if (!info.IntervalTicks.HasValue)
{
throw new ArgumentNullException();
}
return new IntervalTrigger
{
Interval = TimeSpan.FromTicks(info.IntervalTicks.Value),
TaskOptions = options
};
}
if (info.Type.Equals(typeof(SystemEventTrigger).Name, StringComparison.OrdinalIgnoreCase))
{
if (!info.SystemEvent.HasValue)
{
throw new ArgumentNullException();
}
return new SystemEventTrigger
{
SystemEvent = info.SystemEvent.Value,
TaskOptions = options
};
}
if (info.Type.Equals(typeof(StartupTrigger).Name, StringComparison.OrdinalIgnoreCase))
{
return new StartupTrigger();
}
throw new ArgumentException("Unrecognized trigger type: " + info.Type);
}
/// <summary> /// <summary>
/// Disposes each trigger /// Disposes each trigger
/// </summary> /// </summary>
private void DisposeTriggers() private void DisposeTriggers()
{ {
foreach (var trigger in Triggers) foreach (var triggerInfo in InternalTriggers)
{ {
var trigger = triggerInfo.Item2;
trigger.Triggered -= trigger_Triggered; trigger.Triggered -= trigger_Triggered;
trigger.Stop(); trigger.Stop();
} }

View File

@ -8,6 +8,7 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
{ {
@ -40,13 +41,12 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
/// Creates the triggers that define when the task will run /// Creates the triggers that define when the task will run
/// </summary> /// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns> /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<ITaskTrigger> GetDefaultTriggers() public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
// Until we can vary these default triggers per server and MBT, we need something that makes sense for both return new[] {
return new ITaskTrigger[] {
// Every so often // Every so often
new IntervalTrigger { Interval = TimeSpan.FromHours(24)} new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
}; };
} }
@ -168,6 +168,11 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
get { return "Cache file cleanup"; } get { return "Cache file cleanup"; }
} }
public string Key
{
get { return "DeleteCacheFiles"; }
}
/// <summary> /// <summary>
/// Gets the description. /// Gets the description.
/// </summary> /// </summary>
@ -202,5 +207,10 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
{ {
get { return true; } get { return true; }
} }
public bool IsLogged
{
get { return true; }
}
} }
} }

View File

@ -6,6 +6,7 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
{ {
@ -36,13 +37,12 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
/// Creates the triggers that define when the task will run /// Creates the triggers that define when the task will run
/// </summary> /// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns> /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<ITaskTrigger> GetDefaultTriggers() public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
// Until we can vary these default triggers per server and MBT, we need something that makes sense for both return new[] {
return new ITaskTrigger[] {
// Every so often // Every so often
new IntervalTrigger { Interval = TimeSpan.FromHours(24)} new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
}; };
} }
@ -82,6 +82,11 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
return Task.FromResult(true); return Task.FromResult(true);
} }
public string Key
{
get { return "CleanLogFiles"; }
}
/// <summary> /// <summary>
/// Gets the name of the task /// Gets the name of the task
/// </summary> /// </summary>
@ -125,5 +130,10 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
{ {
get { return true; } get { return true; }
} }
public bool IsLogged
{
get { return true; }
}
} }
} }

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
{ {
@ -39,9 +40,9 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
/// Gets the default triggers. /// Gets the default triggers.
/// </summary> /// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns> /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<ITaskTrigger> GetDefaultTriggers() public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
var trigger = new DailyTrigger { TimeOfDay = TimeSpan.FromHours(0) }; //12am var trigger = new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerDaily, TimeOfDayTicks = TimeSpan.FromHours(0).Ticks }; //12am
return new[] { trigger }; return new[] { trigger };
} }
@ -74,6 +75,8 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
get { return "Start new log file"; } get { return "Start new log file"; }
} }
public string Key { get; }
/// <summary> /// <summary>
/// Gets the description. /// Gets the description.
/// </summary> /// </summary>
@ -101,5 +104,10 @@ namespace MediaBrowser.Common.Implementations.ScheduledTasks.Tasks
{ {
get { return true; } get { return true; }
} }
public bool IsLogged
{
get { return true; }
}
} }
} }

View File

@ -1,9 +1,7 @@
using System; using System;
using System.Globalization; using System.Globalization;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using MediaBrowser.Model.Cryptography;
namespace MediaBrowser.Common.Extensions namespace MediaBrowser.Common.Extensions
{ {
@ -12,6 +10,7 @@ namespace MediaBrowser.Common.Extensions
/// </summary> /// </summary>
public static class BaseExtensions public static class BaseExtensions
{ {
public static ICryptographyProvider CryptographyProvider { get; set; }
/// <summary> /// <summary>
/// Strips the HTML. /// Strips the HTML.
@ -26,15 +25,6 @@ namespace MediaBrowser.Common.Extensions
return Regex.Replace(htmlString, pattern, string.Empty).Trim(); return Regex.Replace(htmlString, pattern, string.Empty).Trim();
} }
public static string RemoveDiacritics(this string text)
{
return String.Concat(
text.Normalize(NormalizationForm.FormD)
.Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) !=
UnicodeCategory.NonSpacingMark)
).Normalize(NormalizationForm.FormC);
}
/// <summary> /// <summary>
/// Gets the M d5. /// Gets the M d5.
/// </summary> /// </summary>
@ -42,10 +32,7 @@ namespace MediaBrowser.Common.Extensions
/// <returns>Guid.</returns> /// <returns>Guid.</returns>
public static Guid GetMD5(this string str) public static Guid GetMD5(this string str)
{ {
using (var provider = MD5.Create()) return CryptographyProvider.GetMD5(str);
{
return new Guid(provider.ComputeHash(Encoding.Unicode.GetBytes(str)));
}
} }
/// <summary> /// <summary>

View File

@ -142,7 +142,7 @@ namespace MediaBrowser.Common
/// Gets the plugins. /// Gets the plugins.
/// </summary> /// </summary>
/// <value>The plugins.</value> /// <value>The plugins.</value>
IEnumerable<IPlugin> Plugins { get; } IPlugin[] Plugins { get; }
/// <summary> /// <summary>
/// Removes the plugin. /// Removes the plugin.

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@ -13,7 +13,8 @@
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<ProductVersion>10.0.0</ProductVersion> <ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -57,9 +58,7 @@
<Compile Include="Extensions\BaseExtensions.cs" /> <Compile Include="Extensions\BaseExtensions.cs" />
<Compile Include="Extensions\ResourceNotFoundException.cs" /> <Compile Include="Extensions\ResourceNotFoundException.cs" />
<Compile Include="IDependencyContainer.cs" /> <Compile Include="IDependencyContainer.cs" />
<Compile Include="IO\IMemoryStreamProvider.cs" />
<Compile Include="IO\ProgressStream.cs" /> <Compile Include="IO\ProgressStream.cs" />
<Compile Include="IO\StreamDefaults.cs" />
<Compile Include="Configuration\IApplicationPaths.cs" /> <Compile Include="Configuration\IApplicationPaths.cs" />
<Compile Include="Net\HttpRequestOptions.cs" /> <Compile Include="Net\HttpRequestOptions.cs" />
<Compile Include="Net\HttpResponseInfo.cs" /> <Compile Include="Net\HttpResponseInfo.cs" />
@ -69,22 +68,8 @@
<Compile Include="Plugins\IDependencyModule.cs" /> <Compile Include="Plugins\IDependencyModule.cs" />
<Compile Include="Plugins\IPlugin.cs" /> <Compile Include="Plugins\IPlugin.cs" />
<Compile Include="Progress\ActionableProgress.cs" /> <Compile Include="Progress\ActionableProgress.cs" />
<Compile Include="ScheduledTasks\IConfigurableScheduledTask.cs" />
<Compile Include="ScheduledTasks\IHasKey.cs" />
<Compile Include="ScheduledTasks\IScheduledTask.cs" />
<Compile Include="ScheduledTasks\IScheduledTaskWorker.cs" />
<Compile Include="ScheduledTasks\ITaskManager.cs" />
<Compile Include="ScheduledTasks\ITaskTrigger.cs" />
<Compile Include="ScheduledTasks\ScheduledTaskHelpers.cs" />
<Compile Include="ScheduledTasks\StartupTrigger.cs" />
<Compile Include="ScheduledTasks\SystemEventTrigger.cs" />
<Compile Include="Plugins\BasePlugin.cs" /> <Compile Include="Plugins\BasePlugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScheduledTasks\DailyTrigger.cs" />
<Compile Include="ScheduledTasks\IntervalTrigger.cs" />
<Compile Include="ScheduledTasks\TaskCompletionEventArgs.cs" />
<Compile Include="ScheduledTasks\TaskExecutionOptions.cs" />
<Compile Include="ScheduledTasks\WeeklyTrigger.cs" />
<Compile Include="Security\IRequiresRegistration.cs" /> <Compile Include="Security\IRequiresRegistration.cs" />
<Compile Include="Security\ISecurityManager.cs" /> <Compile Include="Security\ISecurityManager.cs" />
<Compile Include="Security\PaymentRequiredException.cs" /> <Compile Include="Security\PaymentRequiredException.cs" />

View File

@ -3,8 +3,6 @@ using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using System; using System;
using System.IO; using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
namespace MediaBrowser.Common.Plugins namespace MediaBrowser.Common.Plugins
{ {
@ -12,7 +10,7 @@ namespace MediaBrowser.Common.Plugins
/// Provides a common base class for all plugins /// Provides a common base class for all plugins
/// </summary> /// </summary>
/// <typeparam name="TConfigurationType">The type of the T configuration type.</typeparam> /// <typeparam name="TConfigurationType">The type of the T configuration type.</typeparam>
public abstract class BasePlugin<TConfigurationType> : IPlugin public abstract class BasePlugin<TConfigurationType> : IPlugin, IPluginAssembly
where TConfigurationType : BasePluginConfiguration where TConfigurationType : BasePluginConfiguration
{ {
/// <summary> /// <summary>
@ -57,69 +55,33 @@ namespace MediaBrowser.Common.Plugins
get { return typeof(TConfigurationType); } get { return typeof(TConfigurationType); }
} }
/// <summary> public void SetAttributes(string assemblyFilePath, string assemblyFileName, Version assemblyVersion, Guid assemblyId)
/// The _assembly name
/// </summary>
private AssemblyName _assemblyName;
/// <summary>
/// Gets the name of the assembly.
/// </summary>
/// <value>The name of the assembly.</value>
protected AssemblyName AssemblyName
{ {
get AssemblyFilePath = assemblyFilePath;
{ AssemblyFileName = assemblyFileName;
return _assemblyName ?? (_assemblyName = GetType().Assembly.GetName()); Version = assemblyVersion;
} Id = assemblyId;
}
/// <summary> IsFirstRun = !File.Exists(ConfigurationFilePath);
/// The _unique id }
/// </summary>
private Guid? _uniqueId;
/// <summary> /// <summary>
/// Gets the unique id. /// Gets the unique id.
/// </summary> /// </summary>
/// <value>The unique id.</value> /// <value>The unique id.</value>
public Guid Id public Guid Id { get; private set; }
{
get
{
if (!_uniqueId.HasValue)
{
var attribute = (GuidAttribute)GetType().Assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0];
_uniqueId = new Guid(attribute.Value);
}
return _uniqueId.Value;
}
}
/// <summary> /// <summary>
/// Gets the plugin version /// Gets the plugin version
/// </summary> /// </summary>
/// <value>The version.</value> /// <value>The version.</value>
public Version Version public Version Version { get; private set; }
{
get
{
return AssemblyName.Version;
}
}
/// <summary> /// <summary>
/// Gets the name the assembly file /// Gets the name the assembly file
/// </summary> /// </summary>
/// <value>The name of the assembly file.</value> /// <value>The name of the assembly file.</value>
public string AssemblyFileName protected string AssemblyFileName { get; private set; }
{
get
{
return AssemblyName.Name + ".dll";
}
}
/// <summary> /// <summary>
/// Gets the last date modified of the configuration /// Gets the last date modified of the configuration
@ -136,29 +98,11 @@ namespace MediaBrowser.Common.Plugins
} }
} }
/// <summary>
/// Gets the last date modified of the plugin
/// </summary>
/// <value>The assembly date last modified.</value>
public DateTime AssemblyDateLastModified
{
get
{
return File.GetLastWriteTimeUtc(AssemblyFilePath);
}
}
/// <summary> /// <summary>
/// Gets the path to the assembly file /// Gets the path to the assembly file
/// </summary> /// </summary>
/// <value>The assembly file path.</value> /// <value>The assembly file path.</value>
public string AssemblyFilePath public string AssemblyFilePath { get; private set; }
{
get
{
return Path.Combine(ApplicationPaths.PluginsPath, AssemblyFileName);
}
}
/// <summary> /// <summary>
/// The _configuration sync lock /// The _configuration sync lock
@ -272,8 +216,6 @@ namespace MediaBrowser.Common.Plugins
{ {
ApplicationPaths = applicationPaths; ApplicationPaths = applicationPaths;
XmlSerializer = xmlSerializer; XmlSerializer = xmlSerializer;
IsFirstRun = !File.Exists(ConfigurationFilePath);
} }
/// <summary> /// <summary>
@ -349,4 +291,9 @@ namespace MediaBrowser.Common.Plugins
get { return Configuration; } get { return Configuration; }
} }
} }
public interface IPluginAssembly
{
void SetAttributes(string assemblyFilePath, string assemblyFileName, Version assemblyVersion, Guid assemblyId);
}
} }

View File

@ -38,12 +38,6 @@ namespace MediaBrowser.Common.Plugins
/// <value>The version.</value> /// <value>The version.</value>
Version Version { get; } Version Version { get; }
/// <summary>
/// Gets the name the assembly file
/// </summary>
/// <value>The name of the assembly file.</value>
string AssemblyFileName { get; }
/// <summary> /// <summary>
/// Gets a value indicating whether this instance is first run. /// Gets a value indicating whether this instance is first run.
/// </summary> /// </summary>
@ -56,12 +50,6 @@ namespace MediaBrowser.Common.Plugins
/// <value>The configuration date last modified.</value> /// <value>The configuration date last modified.</value>
DateTime ConfigurationDateLastModified { get; } DateTime ConfigurationDateLastModified { get; }
/// <summary>
/// Gets the last date modified of the plugin
/// </summary>
/// <value>The assembly date last modified.</value>
DateTime AssemblyDateLastModified { get; }
/// <summary> /// <summary>
/// Gets the path to the assembly file /// Gets the path to the assembly file
/// </summary> /// </summary>

View File

@ -1,7 +0,0 @@
namespace MediaBrowser.Common.ScheduledTasks
{
public interface IHasKey
{
string Key { get; }
}
}

View File

@ -1,194 +0,0 @@
using MediaBrowser.Model.Tasks;
using System;
using System.Linq;
namespace MediaBrowser.Common.ScheduledTasks
{
/// <summary>
/// Class ScheduledTaskHelpers
/// </summary>
public static class ScheduledTaskHelpers
{
/// <summary>
/// Gets the task info.
/// </summary>
/// <param name="task">The task.</param>
/// <returns>TaskInfo.</returns>
public static TaskInfo GetTaskInfo(IScheduledTaskWorker task)
{
var isHidden = false;
var configurableTask = task.ScheduledTask as IConfigurableScheduledTask;
if (configurableTask != null)
{
isHidden = configurableTask.IsHidden;
}
string key = null;
var hasKey = task.ScheduledTask as IHasKey;
if (hasKey != null)
{
key = hasKey.Key;
}
var triggers = task.Triggers
.Select(GetTriggerInfo)
.OrderBy(i => i.Type)
.ThenBy(i => i.DayOfWeek ?? DayOfWeek.Sunday)
.ThenBy(i => i.TimeOfDayTicks ?? 0)
.ToList();
return new TaskInfo
{
Name = task.Name,
CurrentProgressPercentage = task.CurrentProgress,
State = task.State,
Id = task.Id,
LastExecutionResult = task.LastExecutionResult,
Triggers = triggers,
Description = task.Description,
Category = task.Category,
IsHidden = isHidden,
Key = key
};
}
/// <summary>
/// Gets the trigger info.
/// </summary>
/// <param name="trigger">The trigger.</param>
/// <returns>TaskTriggerInfo.</returns>
public static TaskTriggerInfo GetTriggerInfo(ITaskTrigger trigger)
{
var info = new TaskTriggerInfo
{
Type = trigger.GetType().Name
};
var dailyTrigger = trigger as DailyTrigger;
if (dailyTrigger != null)
{
info.TimeOfDayTicks = dailyTrigger.TimeOfDay.Ticks;
}
var weeklyTaskTrigger = trigger as WeeklyTrigger;
if (weeklyTaskTrigger != null)
{
info.TimeOfDayTicks = weeklyTaskTrigger.TimeOfDay.Ticks;
info.DayOfWeek = weeklyTaskTrigger.DayOfWeek;
}
var intervalTaskTrigger = trigger as IntervalTrigger;
if (intervalTaskTrigger != null)
{
info.IntervalTicks = intervalTaskTrigger.Interval.Ticks;
}
var systemEventTrigger = trigger as SystemEventTrigger;
if (systemEventTrigger != null)
{
info.SystemEvent = systemEventTrigger.SystemEvent;
}
if (trigger.TaskOptions != null)
{
info.MaxRuntimeMs = trigger.TaskOptions.MaxRuntimeMs;
}
return info;
}
/// <summary>
/// Converts a TaskTriggerInfo into a concrete BaseTaskTrigger
/// </summary>
/// <param name="info">The info.</param>
/// <returns>BaseTaskTrigger.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
/// <exception cref="System.ArgumentException">Invalid trigger type: + info.Type</exception>
public static ITaskTrigger GetTrigger(TaskTriggerInfo info)
{
var options = new TaskExecutionOptions
{
MaxRuntimeMs = info.MaxRuntimeMs
};
if (info.Type.Equals(typeof(DailyTrigger).Name, StringComparison.OrdinalIgnoreCase))
{
if (!info.TimeOfDayTicks.HasValue)
{
throw new ArgumentNullException();
}
return new DailyTrigger
{
TimeOfDay = TimeSpan.FromTicks(info.TimeOfDayTicks.Value),
TaskOptions = options
};
}
if (info.Type.Equals(typeof(WeeklyTrigger).Name, StringComparison.OrdinalIgnoreCase))
{
if (!info.TimeOfDayTicks.HasValue)
{
throw new ArgumentNullException();
}
if (!info.DayOfWeek.HasValue)
{
throw new ArgumentNullException();
}
return new WeeklyTrigger
{
TimeOfDay = TimeSpan.FromTicks(info.TimeOfDayTicks.Value),
DayOfWeek = info.DayOfWeek.Value,
TaskOptions = options
};
}
if (info.Type.Equals(typeof(IntervalTrigger).Name, StringComparison.OrdinalIgnoreCase))
{
if (!info.IntervalTicks.HasValue)
{
throw new ArgumentNullException();
}
return new IntervalTrigger
{
Interval = TimeSpan.FromTicks(info.IntervalTicks.Value),
TaskOptions = options
};
}
if (info.Type.Equals(typeof(SystemEventTrigger).Name, StringComparison.OrdinalIgnoreCase))
{
if (!info.SystemEvent.HasValue)
{
throw new ArgumentNullException();
}
return new SystemEventTrigger
{
SystemEvent = info.SystemEvent.Value,
TaskOptions = options
};
}
if (info.Type.Equals(typeof(StartupTrigger).Name, StringComparison.OrdinalIgnoreCase))
{
return new StartupTrigger();
}
throw new ArgumentException("Unrecognized trigger type: " + info.Type);
}
}
}

View File

@ -10,6 +10,8 @@ using System.Runtime.Serialization;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Entities.Audio namespace MediaBrowser.Controller.Entities.Audio
{ {

View File

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Entities.Audio namespace MediaBrowser.Controller.Entities.Audio
{ {

View File

@ -24,7 +24,9 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Controller.Sorting; using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Providers; using MediaBrowser.Model.Providers;

View File

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities
{ {

View File

@ -4,6 +4,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities
{ {

View File

@ -4,7 +4,9 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities
{ {

View File

@ -3,6 +3,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Entities namespace MediaBrowser.Controller.Entities
{ {

View File

@ -0,0 +1,22 @@
using System;
using System.Globalization;
using System.Linq;
using System.Text;
namespace MediaBrowser.Controller.Extensions
{
/// <summary>
/// Class BaseExtensions
/// </summary>
public static class StringExtensions
{
public static string RemoveDiacritics(this string text)
{
return String.Concat(
text.Normalize(NormalizationForm.FormD)
.Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) !=
UnicodeCategory.NonSpacingMark)
).Normalize(NormalizationForm.FormC);
}
}
}

View File

@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Controller.Library namespace MediaBrowser.Controller.Library

View File

@ -165,6 +165,7 @@
<Compile Include="Entities\TagExtensions.cs" /> <Compile Include="Entities\TagExtensions.cs" />
<Compile Include="Entities\UserView.cs" /> <Compile Include="Entities\UserView.cs" />
<Compile Include="Entities\UserViewBuilder.cs" /> <Compile Include="Entities\UserViewBuilder.cs" />
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="FileOrganization\IFileOrganizationService.cs" /> <Compile Include="FileOrganization\IFileOrganizationService.cs" />
<Compile Include="IO\ThrottledStream.cs" /> <Compile Include="IO\ThrottledStream.cs" />
<Compile Include="Library\DeleteOptions.cs" /> <Compile Include="Library\DeleteOptions.cs" />

View File

@ -12,6 +12,7 @@ using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO; using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo; using MediaBrowser.Model.MediaInfo;

View File

@ -20,6 +20,7 @@ using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO; using MediaBrowser.Controller.IO;
using MediaBrowser.Model.IO;
using UniversalDetector; using UniversalDetector;
namespace MediaBrowser.MediaEncoding.Subtitles namespace MediaBrowser.MediaEncoding.Subtitles

View File

@ -0,0 +1,9 @@
using System;
namespace MediaBrowser.Model.Cryptography
{
public interface ICryptographyProvider
{
Guid GetMD5(string str);
}
}

View File

@ -171,7 +171,7 @@ namespace MediaBrowser.Model.Dlna
} }
bool expected; bool expected;
if (BoolHelper.TryParseCultureInvariant(condition.Value, out expected)) if (bool.TryParse(condition.Value, out expected))
{ {
switch (condition.Condition) switch (condition.Condition)
{ {
@ -196,7 +196,7 @@ namespace MediaBrowser.Model.Dlna
} }
float expected; float expected;
if (FloatHelper.TryParseCultureInvariant(condition.Value, out expected)) if (float.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected))
{ {
switch (condition.Condition) switch (condition.Condition)
{ {
@ -225,7 +225,7 @@ namespace MediaBrowser.Model.Dlna
} }
double expected; double expected;
if (DoubleHelper.TryParseCultureInvariant(condition.Value, out expected)) if (double.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out expected))
{ {
switch (condition.Condition) switch (condition.Condition)
{ {

View File

@ -1111,7 +1111,7 @@ namespace MediaBrowser.Model.Dlna
case ProfileConditionValue.VideoFramerate: case ProfileConditionValue.VideoFramerate:
{ {
float num; float num;
if (FloatHelper.TryParseCultureInvariant(value, out num)) if (float.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out num))
{ {
item.MaxFramerate = num; item.MaxFramerate = num;
} }

View File

@ -1,4 +1,4 @@
using MediaBrowser.Model.Extensions; using System.Globalization;
namespace MediaBrowser.Model.Drawing namespace MediaBrowser.Model.Drawing
{ {
@ -71,12 +71,12 @@ namespace MediaBrowser.Model.Drawing
{ {
double val; double val;
if (DoubleHelper.TryParseCultureInvariant(parts[0], out val)) if (double.TryParse(parts[0], NumberStyles.Any, CultureInfo.InvariantCulture, out val))
{ {
_width = val; _width = val;
} }
if (DoubleHelper.TryParseCultureInvariant(parts[1], out val)) if (double.TryParse(parts[1], NumberStyles.Any, CultureInfo.InvariantCulture, out val))
{ {
_height = val; _height = val;
} }

View File

@ -118,7 +118,7 @@ namespace MediaBrowser.Model.Entities
private string AddLanguageIfNeeded(string title) private string AddLanguageIfNeeded(string title)
{ {
if (!string.IsNullOrEmpty(Language) && title.IndexOf(Language, StringComparison.OrdinalIgnoreCase) == -1) if (!string.IsNullOrEmpty(Language) && !string.Equals(Language, "und", StringComparison.OrdinalIgnoreCase) && title.IndexOf(Language, StringComparison.OrdinalIgnoreCase) == -1)
{ {
title = StringHelper.FirstToUpper(Language) + " " + title; title = StringHelper.FirstToUpper(Language) + " " + title;
} }

View File

@ -1,16 +0,0 @@
namespace MediaBrowser.Model.Extensions
{
public static class BoolHelper
{
/// <summary>
/// Tries the parse culture invariant.
/// </summary>
/// <param name="s">The s.</param>
/// <param name="result">The result.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public static bool TryParseCultureInvariant(string s, out bool result)
{
return bool.TryParse(s, out result);
}
}
}

View File

@ -1,21 +0,0 @@
using System.Globalization;
namespace MediaBrowser.Model.Extensions
{
/// <summary>
/// Isolating these helpers allow this entire project to be easily converted to Java
/// </summary>
public static class DoubleHelper
{
/// <summary>
/// Tries the parse culture invariant.
/// </summary>
/// <param name="s">The s.</param>
/// <param name="result">The result.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public static bool TryParseCultureInvariant(string s, out double result)
{
return double.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
}
}
}

View File

@ -1,18 +0,0 @@
using System.Globalization;
namespace MediaBrowser.Model.Extensions
{
public static class FloatHelper
{
/// <summary>
/// Tries the parse culture invariant.
/// </summary>
/// <param name="s">The s.</param>
/// <param name="result">The result.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
public static bool TryParseCultureInvariant(string s, out float result)
{
return float.TryParse(s, NumberStyles.Any, CultureInfo.InvariantCulture, out result);
}
}
}

View File

@ -1,6 +1,6 @@
using System.IO; using System.IO;
namespace MediaBrowser.Common.IO namespace MediaBrowser.Model.IO
{ {
public interface IMemoryStreamProvider public interface IMemoryStreamProvider
{ {

View File

@ -1,5 +1,5 @@
 
namespace MediaBrowser.Common.IO namespace MediaBrowser.Model.IO
{ {
/// <summary> /// <summary>
/// Class StreamDefaults /// Class StreamDefaults

View File

@ -2,7 +2,7 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion> <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}</ProjectGuid> <ProjectGuid>{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}</ProjectGuid>
@ -13,8 +13,9 @@
<DefaultLanguage>en-US</DefaultLanguage> <DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile> <TargetFrameworkProfile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> </TargetFrameworkProfile>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
@ -98,6 +99,7 @@
<Compile Include="Connect\PinExchangeResult.cs" /> <Compile Include="Connect\PinExchangeResult.cs" />
<Compile Include="Connect\PinStatusResult.cs" /> <Compile Include="Connect\PinStatusResult.cs" />
<Compile Include="Connect\UserLinkType.cs" /> <Compile Include="Connect\UserLinkType.cs" />
<Compile Include="Cryptography\ICryptographyProvider.cs" />
<Compile Include="Devices\DeviceOptions.cs" /> <Compile Include="Devices\DeviceOptions.cs" />
<Compile Include="Devices\DeviceQuery.cs" /> <Compile Include="Devices\DeviceQuery.cs" />
<Compile Include="Devices\LocalFileInfo.cs" /> <Compile Include="Devices\LocalFileInfo.cs" />
@ -133,6 +135,8 @@
<Compile Include="Extensions\LinqExtensions.cs" /> <Compile Include="Extensions\LinqExtensions.cs" />
<Compile Include="FileOrganization\SmartMatchInfo.cs" /> <Compile Include="FileOrganization\SmartMatchInfo.cs" />
<Compile Include="Health\IHealthMonitor.cs" /> <Compile Include="Health\IHealthMonitor.cs" />
<Compile Include="IO\IMemoryStreamProvider.cs" />
<Compile Include="IO\StreamDefaults.cs" />
<Compile Include="MediaInfo\LiveStreamRequest.cs" /> <Compile Include="MediaInfo\LiveStreamRequest.cs" />
<Compile Include="MediaInfo\LiveStreamResponse.cs" /> <Compile Include="MediaInfo\LiveStreamResponse.cs" />
<Compile Include="MediaInfo\PlaybackInfoRequest.cs" /> <Compile Include="MediaInfo\PlaybackInfoRequest.cs" />
@ -141,8 +145,6 @@
<Compile Include="Configuration\DynamicDayOfWeek.cs" /> <Compile Include="Configuration\DynamicDayOfWeek.cs" />
<Compile Include="Entities\ExtraType.cs" /> <Compile Include="Entities\ExtraType.cs" />
<Compile Include="Entities\TrailerType.cs" /> <Compile Include="Entities\TrailerType.cs" />
<Compile Include="Extensions\BoolHelper.cs" />
<Compile Include="Extensions\FloatHelper.cs" />
<Compile Include="FileOrganization\AutoOrganizeOptions.cs" /> <Compile Include="FileOrganization\AutoOrganizeOptions.cs" />
<Compile Include="FileOrganization\TvFileOrganizationOptions.cs" /> <Compile Include="FileOrganization\TvFileOrganizationOptions.cs" />
<Compile Include="Configuration\BaseApplicationConfiguration.cs" /> <Compile Include="Configuration\BaseApplicationConfiguration.cs" />
@ -215,7 +217,6 @@
<Compile Include="Entities\ScrollDirection.cs" /> <Compile Include="Entities\ScrollDirection.cs" />
<Compile Include="Entities\SortOrder.cs" /> <Compile Include="Entities\SortOrder.cs" />
<Compile Include="Events\GenericEventArgs.cs" /> <Compile Include="Events\GenericEventArgs.cs" />
<Compile Include="Extensions\DoubleHelper.cs" />
<Compile Include="Extensions\ListHelper.cs" /> <Compile Include="Extensions\ListHelper.cs" />
<Compile Include="Extensions\StringHelper.cs" /> <Compile Include="Extensions\StringHelper.cs" />
<Compile Include="FileOrganization\EpisodeFileOrganizationRequest.cs" /> <Compile Include="FileOrganization\EpisodeFileOrganizationRequest.cs" />
@ -384,6 +385,14 @@
<Compile Include="System\Architecture.cs" /> <Compile Include="System\Architecture.cs" />
<Compile Include="System\LogFile.cs" /> <Compile Include="System\LogFile.cs" />
<Compile Include="System\PublicSystemInfo.cs" /> <Compile Include="System\PublicSystemInfo.cs" />
<Compile Include="Tasks\IConfigurableScheduledTask.cs" />
<Compile Include="Tasks\IScheduledTask.cs" />
<Compile Include="Tasks\IScheduledTaskWorker.cs" />
<Compile Include="Tasks\ITaskManager.cs" />
<Compile Include="Tasks\ITaskTrigger.cs" />
<Compile Include="Tasks\ScheduledTaskHelpers.cs" />
<Compile Include="Tasks\TaskCompletionEventArgs.cs" />
<Compile Include="Tasks\TaskExecutionOptions.cs" />
<Compile Include="Updates\CheckForUpdateResult.cs" /> <Compile Include="Updates\CheckForUpdateResult.cs" />
<Compile Include="Updates\PackageTargetSystem.cs" /> <Compile Include="Updates\PackageTargetSystem.cs" />
<Compile Include="Updates\InstallationInfo.cs" /> <Compile Include="Updates\InstallationInfo.cs" />

View File

@ -1,4 +1,4 @@
namespace MediaBrowser.Common.ScheduledTasks namespace MediaBrowser.Model.Tasks
{ {
public interface IConfigurableScheduledTask public interface IConfigurableScheduledTask
{ {
@ -12,10 +12,7 @@
/// </summary> /// </summary>
/// <value><c>true</c> if this instance is enabled; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance is enabled; otherwise, <c>false</c>.</value>
bool IsEnabled { get; } bool IsEnabled { get; }
}
public interface IScheduledTaskActivityLog bool IsLogged { get; }
{
bool IsActivityLogged { get; }
} }
} }

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace MediaBrowser.Common.ScheduledTasks namespace MediaBrowser.Model.Tasks
{ {
/// <summary> /// <summary>
/// Interface IScheduledTaskWorker /// Interface IScheduledTaskWorker
@ -16,6 +16,8 @@ namespace MediaBrowser.Common.ScheduledTasks
/// <value>The name.</value> /// <value>The name.</value>
string Name { get; } string Name { get; }
string Key { get; }
/// <summary> /// <summary>
/// Gets the description. /// Gets the description.
/// </summary> /// </summary>
@ -40,6 +42,6 @@ namespace MediaBrowser.Common.ScheduledTasks
/// Gets the default triggers. /// Gets the default triggers.
/// </summary> /// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns> /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
IEnumerable<ITaskTrigger> GetDefaultTriggers(); IEnumerable<TaskTriggerInfo> GetDefaultTriggers();
} }
} }

View File

@ -1,9 +1,7 @@
using MediaBrowser.Model.Events; using System;
using MediaBrowser.Model.Tasks; using MediaBrowser.Model.Events;
using System;
using System.Collections.Generic;
namespace MediaBrowser.Common.ScheduledTasks namespace MediaBrowser.Model.Tasks
{ {
/// <summary> /// <summary>
/// Interface IScheduledTaskWorker /// Interface IScheduledTaskWorker
@ -61,8 +59,8 @@ namespace MediaBrowser.Common.ScheduledTasks
/// Gets the triggers that define when the task will run /// Gets the triggers that define when the task will run
/// </summary> /// </summary>
/// <value>The triggers.</value> /// <value>The triggers.</value>
/// <exception cref="System.ArgumentNullException">value</exception> /// <exception cref="ArgumentNullException">value</exception>
IEnumerable<ITaskTrigger> Triggers { get; set; } TaskTriggerInfo[] Triggers { get; set; }
/// <summary> /// <summary>
/// Gets the unique id. /// Gets the unique id.

View File

@ -1,9 +1,9 @@
using MediaBrowser.Model.Events; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Events;
namespace MediaBrowser.Common.ScheduledTasks namespace MediaBrowser.Model.Tasks
{ {
public interface ITaskManager : IDisposable public interface ITaskManager : IDisposable
{ {

View File

@ -1,9 +1,8 @@
using MediaBrowser.Model.Events; using System;
using MediaBrowser.Model.Tasks; using MediaBrowser.Model.Events;
using System;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
namespace MediaBrowser.Common.ScheduledTasks namespace MediaBrowser.Model.Tasks
{ {
/// <summary> /// <summary>
/// Interface ITaskTrigger /// Interface ITaskTrigger
@ -18,8 +17,6 @@ namespace MediaBrowser.Common.ScheduledTasks
/// <summary> /// <summary>
/// Stars waiting for the trigger action /// Stars waiting for the trigger action
/// </summary> /// </summary>
/// <param name="lastResult">The last result.</param>
/// <param name="isApplicationStartup">if set to <c>true</c> [is application startup].</param>
void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup); void Start(TaskResult lastResult, ILogger logger, string taskName, bool isApplicationStartup);
/// <summary> /// <summary>

View File

@ -0,0 +1,52 @@
using System;
using System.Linq;
namespace MediaBrowser.Model.Tasks
{
/// <summary>
/// Class ScheduledTaskHelpers
/// </summary>
public static class ScheduledTaskHelpers
{
/// <summary>
/// Gets the task info.
/// </summary>
/// <param name="task">The task.</param>
/// <returns>TaskInfo.</returns>
public static TaskInfo GetTaskInfo(IScheduledTaskWorker task)
{
var isHidden = false;
var configurableTask = task.ScheduledTask as IConfigurableScheduledTask;
if (configurableTask != null)
{
isHidden = configurableTask.IsHidden;
}
string key = task.ScheduledTask.Key;
var triggers = task.Triggers
.OrderBy(i => i.Type)
.ThenBy(i => i.DayOfWeek ?? DayOfWeek.Sunday)
.ThenBy(i => i.TimeOfDayTicks ?? 0)
.ToList();
return new TaskInfo
{
Name = task.Name,
CurrentProgressPercentage = task.CurrentProgress,
State = task.State,
Id = task.Id,
LastExecutionResult = task.LastExecutionResult,
Triggers = triggers,
Description = task.Description,
Category = task.Category,
IsHidden = isHidden,
Key = key
};
}
}
}

View File

@ -1,7 +1,6 @@
using MediaBrowser.Model.Tasks; using System;
using System;
namespace MediaBrowser.Common.ScheduledTasks namespace MediaBrowser.Model.Tasks
{ {
public class TaskCompletionEventArgs : EventArgs public class TaskCompletionEventArgs : EventArgs
{ {

View File

@ -1,5 +1,5 @@
 
namespace MediaBrowser.Common.ScheduledTasks namespace MediaBrowser.Model.Tasks
{ {
/// <summary> /// <summary>
/// A class that encomposases all common task run properties. /// A class that encomposases all common task run properties.

View File

@ -42,5 +42,11 @@ namespace MediaBrowser.Model.Tasks
/// </summary> /// </summary>
/// <value>The maximum runtime ms.</value> /// <value>The maximum runtime ms.</value>
public int? MaxRuntimeMs { get; set; } public int? MaxRuntimeMs { get; set; }
public const string TriggerDaily = "DailyTrigger";
public const string TriggerWeekly = "WeeklyTrigger";
public const string TriggerInterval = "IntervalTrigger";
public const string TriggerSystemEvent = "SystemEventTrigger";
public const string TriggerStartup = "StartupTrigger";
} }
} }

View File

@ -1,7 +1,16 @@
{ {
"supports": {}, "supports": {
"dependencies": {}, "net46.app": {},
"uwp.10.0.app": {},
"dnxcore50.app": {}
},
"dependencies": {
"Microsoft.NETCore": "5.0.0",
"Microsoft.NETCore.Portable.Compatibility": "1.0.0"
},
"frameworks": { "frameworks": {
".NETPortable,Version=v4.5,Profile=Profile7": {} "dotnet": {
"imports": "portable-net452+win81"
}
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,7 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Providers.Manager namespace MediaBrowser.Providers.Manager
{ {

View File

@ -21,6 +21,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
namespace MediaBrowser.Providers.Manager namespace MediaBrowser.Providers.Manager

View File

@ -1,5 +1,4 @@
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.Movies;
@ -16,6 +15,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.IO; using System.IO;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Providers.MediaInfo namespace MediaBrowser.Providers.MediaInfo
{ {
@ -184,12 +184,18 @@ namespace MediaBrowser.Providers.MediaInfo
return false; return false;
} }
public IEnumerable<ITaskTrigger> GetDefaultTriggers() public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
return new ITaskTrigger[] return new[] {
{
new IntervalTrigger{ Interval = TimeSpan.FromHours(8)} // Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
}; };
} }
public string Key
{
get { return "DownloadSubtitles"; }
}
} }
} }

View File

@ -11,9 +11,9 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Plugins; using MediaBrowser.Controller.Plugins;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Providers.TV namespace MediaBrowser.Providers.TV
{ {

View File

@ -5,10 +5,11 @@ using MediaBrowser.Model.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.Channels namespace MediaBrowser.Server.Implementations.Channels
{ {
class RefreshChannelsScheduledTask : IScheduledTask, IConfigurableScheduledTask class RefreshChannelsScheduledTask : IScheduledTask
{ {
private readonly IChannelManager _channelManager; private readonly IChannelManager _channelManager;
private readonly IUserManager _userManager; private readonly IUserManager _userManager;
@ -48,14 +49,23 @@ namespace MediaBrowser.Server.Implementations.Channels
.ConfigureAwait(false); .ConfigureAwait(false);
} }
public IEnumerable<ITaskTrigger> GetDefaultTriggers() /// <summary>
/// Creates the triggers that define when the task will run
/// </summary>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
return new ITaskTrigger[] return new[] {
{
new IntervalTrigger{ Interval = TimeSpan.FromHours(24)} // Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
}; };
} }
public string Key
{
get { return "RefreshInternetChannels"; }
}
public bool IsHidden public bool IsHidden
{ {
get { return false; } get { return false; }

View File

@ -401,8 +401,8 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
{ {
var task = e.Argument; var task = e.Argument;
var activityTask = task.ScheduledTask as IScheduledTaskActivityLog; var activityTask = task.ScheduledTask as IConfigurableScheduledTask;
if (activityTask != null && !activityTask.IsActivityLogged) if (activityTask != null && !activityTask.IsLogged)
{ {
return; return;
} }
@ -419,8 +419,8 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
var result = e.Result; var result = e.Result;
var task = e.Task; var task = e.Task;
var activityTask = task.ScheduledTask as IScheduledTaskActivityLog; var activityTask = task.ScheduledTask as IConfigurableScheduledTask;
if (activityTask != null && !activityTask.IsActivityLogged) if (activityTask != null && !activityTask.IsLogged)
{ {
return; return;
} }

View File

@ -13,6 +13,7 @@ using MediaBrowser.Model.Sync;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.EntryPoints namespace MediaBrowser.Server.Implementations.EntryPoints
{ {

View File

@ -7,6 +7,7 @@ using MediaBrowser.Model.FileOrganization;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using System; using System;
using System.Threading; using System.Threading;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.FileOrganization namespace MediaBrowser.Server.Implementations.FileOrganization
{ {

View File

@ -18,6 +18,7 @@ using CommonIO;
using MediaBrowser.Controller.Session; using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Events; using MediaBrowser.Model.Events;
using MediaBrowser.Common.Events; using MediaBrowser.Common.Events;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.FileOrganization namespace MediaBrowser.Server.Implementations.FileOrganization
{ {

View File

@ -10,10 +10,11 @@ using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.FileOrganization namespace MediaBrowser.Server.Implementations.FileOrganization
{ {
public class OrganizerScheduledTask : IScheduledTask, IConfigurableScheduledTask, IScheduledTaskActivityLog, IHasKey public class OrganizerScheduledTask : IScheduledTask, IConfigurableScheduledTask
{ {
private readonly ILibraryMonitor _libraryMonitor; private readonly ILibraryMonitor _libraryMonitor;
private readonly ILibraryManager _libraryManager; private readonly ILibraryManager _libraryManager;
@ -63,11 +64,16 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
} }
} }
public IEnumerable<ITaskTrigger> GetDefaultTriggers() /// <summary>
/// Creates the triggers that define when the task will run
/// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
return new ITaskTrigger[] return new[] {
{
new IntervalTrigger{ Interval = TimeSpan.FromMinutes(5)} // Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromMinutes(5).Ticks}
}; };
} }
@ -81,7 +87,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
get { return GetAutoOrganizeOptions().TvOptions.IsEnabled; } get { return GetAutoOrganizeOptions().TvOptions.IsEnabled; }
} }
public bool IsActivityLogged public bool IsLogged
{ {
get { return false; } get { return false; }
} }

View File

@ -23,6 +23,7 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Common.Security; using MediaBrowser.Common.Security;
using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Server.Implementations.HttpServer namespace MediaBrowser.Server.Implementations.HttpServer
{ {

View File

@ -3,6 +3,7 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using ServiceStack.Logging; using ServiceStack.Logging;

View File

@ -10,6 +10,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
{ {

View File

@ -4,6 +4,7 @@ using System.IO;
using System.Text; using System.Text;
using Funq; using Funq;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using ServiceStack; using ServiceStack;
using ServiceStack.Host; using ServiceStack.Host;

View File

@ -12,6 +12,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Server.Implementations.ScheduledTasks; using MediaBrowser.Server.Implementations.ScheduledTasks;
namespace MediaBrowser.Server.Implementations.IO namespace MediaBrowser.Server.Implementations.IO

View File

@ -14,6 +14,7 @@ using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.IO namespace MediaBrowser.Server.Implementations.IO
{ {
@ -174,6 +175,11 @@ namespace MediaBrowser.Server.Implementations.IO
private bool IsLibraryMonitorEnabaled(BaseItem item) private bool IsLibraryMonitorEnabaled(BaseItem item)
{ {
if (item is BasePluginFolder)
{
return false;
}
var options = LibraryManager.GetLibraryOptions(item); var options = LibraryManager.GetLibraryOptions(item);
if (options != null) if (options != null)

View File

@ -43,6 +43,7 @@ using MediaBrowser.Server.Implementations.Library.Resolvers;
using SortOrder = MediaBrowser.Model.Entities.SortOrder; using SortOrder = MediaBrowser.Model.Entities.SortOrder;
using VideoResolver = MediaBrowser.Naming.Video.VideoResolver; using VideoResolver = MediaBrowser.Naming.Video.VideoResolver;
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.Library namespace MediaBrowser.Server.Implementations.Library
{ {

View File

@ -10,6 +10,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Server.Implementations.Library namespace MediaBrowser.Server.Implementations.Library
{ {

View File

@ -35,6 +35,7 @@ using MediaBrowser.Controller.Entities.Movies;
using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.Events; using MediaBrowser.Model.Events;
using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Server.Implementations.LiveTv.Listings; using MediaBrowser.Server.Implementations.LiveTv.Listings;
namespace MediaBrowser.Server.Implementations.LiveTv namespace MediaBrowser.Server.Implementations.LiveTv

View File

@ -6,10 +6,11 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.LiveTv namespace MediaBrowser.Server.Implementations.LiveTv
{ {
public class RefreshChannelsScheduledTask : IScheduledTask, IConfigurableScheduledTask, IHasKey public class RefreshChannelsScheduledTask : IScheduledTask, IConfigurableScheduledTask
{ {
private readonly ILiveTvManager _liveTvManager; private readonly ILiveTvManager _liveTvManager;
private readonly IConfigurationManager _config; private readonly IConfigurationManager _config;
@ -42,11 +43,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return manager.RefreshChannels(progress, cancellationToken); return manager.RefreshChannels(progress, cancellationToken);
} }
public IEnumerable<ITaskTrigger> GetDefaultTriggers() /// <summary>
/// Creates the triggers that define when the task will run
/// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
return new ITaskTrigger[] return new[] {
{
new IntervalTrigger{ Interval = TimeSpan.FromHours(12)} // Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(12).Ticks}
}; };
} }
@ -65,6 +71,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv
get { return true; } get { return true; }
} }
public bool IsLogged
{
get { return true; }
}
public string Key public string Key
{ {
get { return "RefreshGuide"; } get { return "RefreshGuide"; }

View File

@ -47,7 +47,7 @@
<HintPath>..\packages\CommonIO.1.0.0.9\lib\net45\CommonIO.dll</HintPath> <HintPath>..\packages\CommonIO.1.0.0.9\lib\net45\CommonIO.dll</HintPath>
</Reference> </Reference>
<Reference Include="Emby.XmlTv, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Emby.XmlTv, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Emby.XmlTv.1.0.0.56\lib\net45\Emby.XmlTv.dll</HintPath> <HintPath>..\packages\Emby.XmlTv.1.0.0.57\lib\portable-net46+win10\Emby.XmlTv.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="INIFileParser, Version=2.3.0.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL"> <Reference Include="INIFileParser, Version=2.3.0.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL">

View File

@ -18,6 +18,7 @@ using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Localization; using MediaBrowser.Controller.Localization;
using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Net;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Server.Implementations.ScheduledTasks; using MediaBrowser.Server.Implementations.ScheduledTasks;
namespace MediaBrowser.Server.Implementations.Persistence namespace MediaBrowser.Server.Implementations.Persistence
@ -337,12 +338,22 @@ namespace MediaBrowser.Server.Implementations.Persistence
} }
} }
public IEnumerable<ITaskTrigger> GetDefaultTriggers() /// <summary>
/// Creates the triggers that define when the task will run
/// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
return new ITaskTrigger[] return new[] {
{
new IntervalTrigger{ Interval = TimeSpan.FromHours(24)} // Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
}; };
} }
public string Key
{
get { return "CleanDatabase"; }
}
} }
} }

View File

@ -5,6 +5,7 @@ using System;
using System.Data; using System.Data;
using System.IO; using System.IO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Server.Implementations.Persistence namespace MediaBrowser.Server.Implementations.Persistence
{ {

View File

@ -11,6 +11,7 @@ using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Server.Implementations.Persistence namespace MediaBrowser.Server.Implementations.Persistence
{ {

View File

@ -23,8 +23,11 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Collections; using MediaBrowser.Controller.Collections;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Extensions;
using MediaBrowser.Controller.Playlists; using MediaBrowser.Controller.Playlists;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.LiveTv;
using MediaBrowser.Server.Implementations.Devices; using MediaBrowser.Server.Implementations.Devices;
using MediaBrowser.Server.Implementations.Playlists; using MediaBrowser.Server.Implementations.Playlists;

View File

@ -10,6 +10,7 @@ using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Server.Implementations.Persistence namespace MediaBrowser.Server.Implementations.Persistence
{ {

View File

@ -13,6 +13,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.ScheduledTasks namespace MediaBrowser.Server.Implementations.ScheduledTasks
{ {
@ -62,22 +63,24 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
/// <summary> /// <summary>
/// Creates the triggers that define when the task will run /// Creates the triggers that define when the task will run
/// </summary> /// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns> public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
public IEnumerable<ITaskTrigger> GetDefaultTriggers()
{ {
return new ITaskTrigger[] return new[] {
{
new DailyTrigger new TaskTriggerInfo
{
TimeOfDay = TimeSpan.FromHours(1),
TaskOptions = new TaskExecutionOptions
{ {
Type = TaskTriggerInfo.TriggerDaily,
TimeOfDayTicks = TimeSpan.FromHours(1).Ticks,
MaxRuntimeMs = Convert.ToInt32(TimeSpan.FromHours(4).TotalMilliseconds) MaxRuntimeMs = Convert.ToInt32(TimeSpan.FromHours(4).TotalMilliseconds)
} }
}
}; };
} }
public string Key
{
get { return "RefreshChapterImages"; }
}
/// <summary> /// <summary>
/// Returns the task to be executed /// Returns the task to be executed
/// </summary> /// </summary>

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.ScheduledTasks namespace MediaBrowser.Server.Implementations.ScheduledTasks
{ {
@ -33,18 +34,23 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
/// <summary> /// <summary>
/// Creates the triggers that define when the task will run /// Creates the triggers that define when the task will run
/// </summary> /// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns> public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
public IEnumerable<ITaskTrigger> GetDefaultTriggers()
{ {
// Randomize the default start hour because this operation can really hammer internet metadata providers // Randomize the default start hour because this operation can really hammer internet metadata providers
var startHour = new Random(_appHost.SystemId.GetHashCode()).Next(0, 8); var startHour = new Random(_appHost.SystemId.GetHashCode()).Next(0, 8);
return new ITaskTrigger[] return new[] {
{
new DailyTrigger { TimeOfDay = TimeSpan.FromHours(startHour) }, // Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerDaily, TimeOfDayTicks = TimeSpan.FromHours(startHour).Ticks}
}; };
} }
public string Key
{
get { return "RefreshPeople"; }
}
/// <summary> /// <summary>
/// Returns the task to be executed /// Returns the task to be executed
/// </summary> /// </summary>

View File

@ -9,6 +9,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.ScheduledTasks namespace MediaBrowser.Server.Implementations.ScheduledTasks
{ {
@ -37,18 +38,23 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
/// Creates the triggers that define when the task will run /// Creates the triggers that define when the task will run
/// </summary> /// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns> /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<ITaskTrigger> GetDefaultTriggers() public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
return new ITaskTrigger[] { return new[] {
// At startup // At startup
new StartupTrigger(), new TaskTriggerInfo {Type = TaskTriggerInfo.TriggerStartup},
// Every so often // Every so often
new IntervalTrigger { Interval = TimeSpan.FromHours(24)} new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
}; };
} }
public string Key
{
get { return "PluginUpdates"; }
}
/// <summary> /// <summary>
/// Update installed plugins /// Update installed plugins
/// </summary> /// </summary>

View File

@ -7,13 +7,14 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.ScheduledTasks namespace MediaBrowser.Server.Implementations.ScheduledTasks
{ {
/// <summary> /// <summary>
/// Class RefreshMediaLibraryTask /// Class RefreshMediaLibraryTask
/// </summary> /// </summary>
public class RefreshMediaLibraryTask : IScheduledTask, IHasKey public class RefreshMediaLibraryTask : IScheduledTask
{ {
/// <summary> /// <summary>
/// The _library manager /// The _library manager
@ -32,18 +33,16 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
} }
/// <summary> /// <summary>
/// Gets the default triggers. /// Creates the triggers that define when the task will run
/// </summary> /// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns> /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<ITaskTrigger> GetDefaultTriggers() public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
var list = new ITaskTrigger[] { return new[] {
new IntervalTrigger{ Interval = TimeSpan.FromHours(12)} // Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(12).Ticks}
}.ToList(); };
return list;
} }
/// <summary> /// <summary>

View File

@ -6,13 +6,14 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.ScheduledTasks namespace MediaBrowser.Server.Implementations.ScheduledTasks
{ {
/// <summary> /// <summary>
/// Plugin Update Task /// Plugin Update Task
/// </summary> /// </summary>
public class SystemUpdateTask : IScheduledTask, IHasKey public class SystemUpdateTask : IScheduledTask
{ {
/// <summary> /// <summary>
/// The _app host /// The _app host
@ -47,16 +48,15 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
/// Creates the triggers that define when the task will run /// Creates the triggers that define when the task will run
/// </summary> /// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns> /// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<ITaskTrigger> GetDefaultTriggers() public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
// Until we can vary these default triggers per server and MBT, we need something that makes sense for both return new[] {
return new ITaskTrigger[] {
// At startup // At startup
new StartupTrigger(), new TaskTriggerInfo {Type = TaskTriggerInfo.TriggerStartup},
// Every so often // Every so often
new IntervalTrigger { Interval = TimeSpan.FromHours(24)} new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(24).Ticks}
}; };
} }

View File

@ -14,6 +14,7 @@ using System.Net.Sockets;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Server.Implementations.ServerManager namespace MediaBrowser.Server.Implementations.ServerManager
{ {

View File

@ -10,6 +10,7 @@ using System.IO;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
using UniversalDetector; using UniversalDetector;
namespace MediaBrowser.Server.Implementations.ServerManager namespace MediaBrowser.Server.Implementations.ServerManager

View File

@ -9,10 +9,11 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.Sync namespace MediaBrowser.Server.Implementations.Sync
{ {
class ServerSyncScheduledTask : IScheduledTask, IConfigurableScheduledTask, IHasKey class ServerSyncScheduledTask : IScheduledTask, IConfigurableScheduledTask
{ {
private readonly ISyncManager _syncManager; private readonly ISyncManager _syncManager;
private readonly ILogger _logger; private readonly ILogger _logger;
@ -58,14 +59,17 @@ namespace MediaBrowser.Server.Implementations.Sync
get { return ((SyncManager)_syncManager).ServerSyncProviders; } get { return ((SyncManager)_syncManager).ServerSyncProviders; }
} }
public IEnumerable<ITaskTrigger> GetDefaultTriggers() /// <summary>
/// Creates the triggers that define when the task will run
/// </summary>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
return new ITaskTrigger[] return new[] {
{
new IntervalTrigger { Interval = TimeSpan.FromHours(3) } // Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(3).Ticks}
}; };
} }
public bool IsHidden public bool IsHidden
{ {
get { return !IsEnabled; } get { return !IsEnabled; }
@ -76,6 +80,11 @@ namespace MediaBrowser.Server.Implementations.Sync
get { return ServerSyncProviders.Any(); } get { return ServerSyncProviders.Any(); }
} }
public bool IsLogged
{
get { return true; }
}
public string Key public string Key
{ {
get { return "ServerSync"; } get { return "ServerSync"; }

View File

@ -10,10 +10,11 @@ using System.Collections.Generic;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.Sync namespace MediaBrowser.Server.Implementations.Sync
{ {
public class SyncConvertScheduledTask : IScheduledTask, IConfigurableScheduledTask, IHasKey public class SyncConvertScheduledTask : IScheduledTask
{ {
private readonly ILibraryManager _libraryManager; private readonly ILibraryManager _libraryManager;
private readonly ISyncRepository _syncRepo; private readonly ISyncRepository _syncRepo;
@ -66,24 +67,19 @@ namespace MediaBrowser.Server.Implementations.Sync
.Sync(progress, cancellationToken); .Sync(progress, cancellationToken);
} }
public IEnumerable<ITaskTrigger> GetDefaultTriggers() /// <summary>
/// Creates the triggers that define when the task will run
/// </summary>
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{ {
return new ITaskTrigger[] return new[] {
{
new IntervalTrigger { Interval = TimeSpan.FromHours(3) } // Every so often
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(3).Ticks}
}; };
} }
public bool IsHidden
{
get { return false; }
}
public bool IsEnabled
{
get { return true; }
}
public string Key public string Key
{ {
get { return "SyncPrepare"; } get { return "SyncPrepare"; }

View File

@ -25,6 +25,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Server.Implementations.Sync namespace MediaBrowser.Server.Implementations.Sync
{ {

View File

@ -30,6 +30,8 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Tasks;
namespace MediaBrowser.Server.Implementations.Sync namespace MediaBrowser.Server.Implementations.Sync
{ {

View File

@ -13,6 +13,7 @@ using System.Threading.Tasks;
using CommonIO; using CommonIO;
using Interfaces.IO; using Interfaces.IO;
using MediaBrowser.Common.IO; using MediaBrowser.Common.IO;
using MediaBrowser.Model.IO;
namespace MediaBrowser.Server.Implementations.Sync namespace MediaBrowser.Server.Implementations.Sync
{ {

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="CommonIO" version="1.0.0.9" targetFramework="net45" /> <package id="CommonIO" version="1.0.0.9" targetFramework="net45" />
<package id="Emby.XmlTv" version="1.0.0.56" targetFramework="net45" /> <package id="Emby.XmlTv" version="1.0.0.57" targetFramework="net46" />
<package id="ini-parser" version="2.3.0" targetFramework="net45" /> <package id="ini-parser" version="2.3.0" targetFramework="net45" />
<package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" /> <package id="Interfaces.IO" version="1.0.0.5" targetFramework="net45" />
<package id="MediaBrowser.Naming" version="1.0.0.55" targetFramework="net45" /> <package id="MediaBrowser.Naming" version="1.0.0.55" targetFramework="net45" />

View File

@ -1,6 +1,7 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Server.Implementations.Persistence; using MediaBrowser.Server.Implementations.Persistence;
namespace MediaBrowser.Server.Startup.Common.Migrations namespace MediaBrowser.Server.Startup.Common.Migrations

View File

@ -192,7 +192,7 @@ namespace MediaBrowser.ServerApplication
{ {
_logger.Info("Found a duplicate process. Giving it time to exit."); _logger.Info("Found a duplicate process. Giving it time to exit.");
if (!duplicate.WaitForExit(20000)) if (!duplicate.WaitForExit(30000))
{ {
_logger.Info("The duplicate process did not exit."); _logger.Info("The duplicate process did not exit.");
return true; return true;

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common.Internal</id> <id>MediaBrowser.Common.Internal</id>
<version>3.0.665</version> <version>3.0.667</version>
<title>Emby.Common.Internal</title> <title>Emby.Common.Internal</title>
<authors>Luke</authors> <authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption.</description> <description>Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Emby 2013</copyright> <copyright>Copyright © Emby 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.665" /> <dependency id="MediaBrowser.Common" version="3.0.667" />
<dependency id="NLog" version="4.3.8" /> <dependency id="NLog" version="4.3.8" />
<dependency id="SimpleInjector" version="3.2.2" /> <dependency id="SimpleInjector" version="3.2.2" />
</dependencies> </dependencies>

Some files were not shown because too many files have changed in this diff Show More