mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-30 05:46:30 +01:00
rework scheduled tasks in preparation of common project going portable
This commit is contained in:
9
MediaBrowser.Model/Cryptography/ICryptographyProvider.cs
Normal file
9
MediaBrowser.Model/Cryptography/ICryptographyProvider.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.Cryptography
|
||||
{
|
||||
public interface ICryptographyProvider
|
||||
{
|
||||
Guid GetMD5(string str);
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ namespace MediaBrowser.Model.Entities
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
11
MediaBrowser.Model/IO/IMemoryStreamProvider.cs
Normal file
11
MediaBrowser.Model/IO/IMemoryStreamProvider.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.IO;
|
||||
|
||||
namespace MediaBrowser.Model.IO
|
||||
{
|
||||
public interface IMemoryStreamProvider
|
||||
{
|
||||
MemoryStream CreateNew();
|
||||
MemoryStream CreateNew(int capacity);
|
||||
MemoryStream CreateNew(byte[] buffer);
|
||||
}
|
||||
}
|
||||
19
MediaBrowser.Model/IO/StreamDefaults.cs
Normal file
19
MediaBrowser.Model/IO/StreamDefaults.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
namespace MediaBrowser.Model.IO
|
||||
{
|
||||
/// <summary>
|
||||
/// Class StreamDefaults
|
||||
/// </summary>
|
||||
public static class StreamDefaults
|
||||
{
|
||||
/// <summary>
|
||||
/// The default copy to buffer size
|
||||
/// </summary>
|
||||
public const int DefaultCopyToBufferSize = 81920;
|
||||
|
||||
/// <summary>
|
||||
/// The default file stream buffer size
|
||||
/// </summary>
|
||||
public const int DefaultFileStreamBufferSize = 81920;
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,7 @@
|
||||
<Compile Include="Connect\PinExchangeResult.cs" />
|
||||
<Compile Include="Connect\PinStatusResult.cs" />
|
||||
<Compile Include="Connect\UserLinkType.cs" />
|
||||
<Compile Include="Cryptography\ICryptographyProvider.cs" />
|
||||
<Compile Include="Devices\DeviceOptions.cs" />
|
||||
<Compile Include="Devices\DeviceQuery.cs" />
|
||||
<Compile Include="Devices\LocalFileInfo.cs" />
|
||||
@@ -133,6 +134,8 @@
|
||||
<Compile Include="Extensions\LinqExtensions.cs" />
|
||||
<Compile Include="FileOrganization\SmartMatchInfo.cs" />
|
||||
<Compile Include="Health\IHealthMonitor.cs" />
|
||||
<Compile Include="IO\IMemoryStreamProvider.cs" />
|
||||
<Compile Include="IO\StreamDefaults.cs" />
|
||||
<Compile Include="MediaInfo\LiveStreamRequest.cs" />
|
||||
<Compile Include="MediaInfo\LiveStreamResponse.cs" />
|
||||
<Compile Include="MediaInfo\PlaybackInfoRequest.cs" />
|
||||
@@ -384,6 +387,9 @@
|
||||
<Compile Include="System\Architecture.cs" />
|
||||
<Compile Include="System\LogFile.cs" />
|
||||
<Compile Include="System\PublicSystemInfo.cs" />
|
||||
<Compile Include="Tasks\IConfigurableScheduledTask.cs" />
|
||||
<Compile Include="Tasks\IScheduledTask.cs" />
|
||||
<Compile Include="Tasks\TaskExecutionOptions.cs" />
|
||||
<Compile Include="Updates\CheckForUpdateResult.cs" />
|
||||
<Compile Include="Updates\PackageTargetSystem.cs" />
|
||||
<Compile Include="Updates\InstallationInfo.cs" />
|
||||
|
||||
18
MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs
Normal file
18
MediaBrowser.Model/Tasks/IConfigurableScheduledTask.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
namespace MediaBrowser.Model.Tasks
|
||||
{
|
||||
public interface IConfigurableScheduledTask
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is hidden.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value>
|
||||
bool IsHidden { get; }
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is enabled.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance is enabled; otherwise, <c>false</c>.</value>
|
||||
bool IsEnabled { get; }
|
||||
|
||||
bool IsLogged { get; }
|
||||
}
|
||||
}
|
||||
47
MediaBrowser.Model/Tasks/IScheduledTask.cs
Normal file
47
MediaBrowser.Model/Tasks/IScheduledTask.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Model.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface IScheduledTaskWorker
|
||||
/// </summary>
|
||||
public interface IScheduledTask
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name of the task
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
string Name { get; }
|
||||
|
||||
string Key { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the description.
|
||||
/// </summary>
|
||||
/// <value>The description.</value>
|
||||
string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the category.
|
||||
/// </summary>
|
||||
/// <value>The category.</value>
|
||||
string Category { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Executes the task
|
||||
/// </summary>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
/// <param name="progress">The progress.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task Execute(CancellationToken cancellationToken, IProgress<double> progress);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default triggers.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
|
||||
IEnumerable<TaskTriggerInfo> GetDefaultTriggers();
|
||||
}
|
||||
}
|
||||
11
MediaBrowser.Model/Tasks/TaskExecutionOptions.cs
Normal file
11
MediaBrowser.Model/Tasks/TaskExecutionOptions.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
namespace MediaBrowser.Model.Tasks
|
||||
{
|
||||
/// <summary>
|
||||
/// A class that encomposases all common task run properties.
|
||||
/// </summary>
|
||||
public class TaskExecutionOptions
|
||||
{
|
||||
public int? MaxRuntimeMs { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -42,5 +42,11 @@ namespace MediaBrowser.Model.Tasks
|
||||
/// </summary>
|
||||
/// <value>The maximum runtime ms.</value>
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user