commit
c1d44bf71b
|
@ -1,6 +1,7 @@
|
||||||
using MediaBrowser.Model.Events;
|
using MediaBrowser.Model.Events;
|
||||||
using MediaBrowser.Model.Tasks;
|
using MediaBrowser.Model.Tasks;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace MediaBrowser.Common.ScheduledTasks
|
namespace MediaBrowser.Common.ScheduledTasks
|
||||||
|
@ -30,16 +31,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// </value>
|
/// </value>
|
||||||
public TaskExecutionOptions TaskOptions { get; set; }
|
public TaskExecutionOptions TaskOptions { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
private DateTime _lastStartDate;
|
||||||
/// Gets or sets the first run delay.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The first run delay.</value>
|
|
||||||
public TimeSpan FirstRunDelay { get; set; }
|
|
||||||
|
|
||||||
public IntervalTrigger()
|
|
||||||
{
|
|
||||||
FirstRunDelay = TimeSpan.FromHours(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stars waiting for the trigger action
|
/// Stars waiting for the trigger action
|
||||||
|
@ -50,20 +42,21 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
{
|
{
|
||||||
DisposeTimer();
|
DisposeTimer();
|
||||||
|
|
||||||
var triggerDate = lastResult != null ?
|
DateTime triggerDate;
|
||||||
lastResult.EndTimeUtc.Add(Interval) :
|
|
||||||
DateTime.UtcNow.Add(FirstRunDelay);
|
if (lastResult == null)
|
||||||
|
{
|
||||||
|
// Task has never been completed before
|
||||||
|
triggerDate = DateTime.UtcNow.AddHours(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
triggerDate = new[] { lastResult.EndTimeUtc, _lastStartDate }.Max().Add(Interval);
|
||||||
|
}
|
||||||
|
|
||||||
if (DateTime.UtcNow > triggerDate)
|
if (DateTime.UtcNow > triggerDate)
|
||||||
{
|
{
|
||||||
if (isApplicationStartup)
|
triggerDate = DateTime.UtcNow.AddMinutes(1);
|
||||||
{
|
|
||||||
triggerDate = DateTime.UtcNow.AddMinutes(1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
triggerDate = DateTime.UtcNow.AddMinutes(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer = new Timer(state => OnTriggered(), null, triggerDate - DateTime.UtcNow, TimeSpan.FromMilliseconds(-1));
|
Timer = new Timer(state => OnTriggered(), null, triggerDate - DateTime.UtcNow, TimeSpan.FromMilliseconds(-1));
|
||||||
|
@ -98,8 +91,11 @@ namespace MediaBrowser.Common.ScheduledTasks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void OnTriggered()
|
private void OnTriggered()
|
||||||
{
|
{
|
||||||
|
DisposeTimer();
|
||||||
|
|
||||||
if (Triggered != null)
|
if (Triggered != null)
|
||||||
{
|
{
|
||||||
|
_lastStartDate = DateTime.UtcNow;
|
||||||
Triggered(this, new GenericEventArgs<TaskExecutionOptions>(TaskOptions));
|
Triggered(this, new GenericEventArgs<TaskExecutionOptions>(TaskOptions));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4855,6 +4855,9 @@
|
||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\javascript\kk.json">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\javascript\kk.json">
|
||||||
<Link>Resources\dashboard-ui\strings\javascript\kk.json</Link>
|
<Link>Resources\dashboard-ui\strings\javascript\kk.json</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\javascript\ko.json">
|
||||||
|
<Link>Resources\dashboard-ui\strings\javascript\ko.json</Link>
|
||||||
|
</BundleResource>
|
||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\javascript\ms.json">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\javascript\ms.json">
|
||||||
<Link>Resources\dashboard-ui\strings\javascript\ms.json</Link>
|
<Link>Resources\dashboard-ui\strings\javascript\ms.json</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
|
@ -4924,6 +4927,9 @@
|
||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\thirdparty\headroom.js">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\thirdparty\headroom.js">
|
||||||
<Link>Resources\dashboard-ui\thirdparty\headroom.js</Link>
|
<Link>Resources\dashboard-ui\thirdparty\headroom.js</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\thirdparty\hls.min.js">
|
||||||
|
<Link>Resources\dashboard-ui\thirdparty\hls.min.js</Link>
|
||||||
|
</BundleResource>
|
||||||
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\thirdparty\jquery.unveil-custom.js">
|
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\thirdparty\jquery.unveil-custom.js">
|
||||||
<Link>Resources\dashboard-ui\thirdparty\jquery.unveil-custom.js</Link>
|
<Link>Resources\dashboard-ui\thirdparty\jquery.unveil-custom.js</Link>
|
||||||
</BundleResource>
|
</BundleResource>
|
||||||
|
|
|
@ -8,7 +8,7 @@ It features a REST-based api with built-in documention to facilitate client deve
|
||||||
## Emby Apps
|
## Emby Apps
|
||||||
|
|
||||||
- [Android Mobile (Play Store)](https://play.google.com/store/apps/details?id=com.mb.android "Android Mobile (Play Store)")
|
- [Android Mobile (Play Store)](https://play.google.com/store/apps/details?id=com.mb.android "Android Mobile (Play Store)")
|
||||||
- [Android Mobile (Amazon)](http://www.amazon.com/Emby-Mobile/dp/B017OSA1QS "Android Mobile (Amazon)")
|
- [Android Mobile (Amazon)](http://www.amazon.com/Emby-for-Android/dp/B00GVH9O0I "Android Mobile (Amazon)")
|
||||||
- [Android TV](https://play.google.com/store/apps/details?id=tv.emby.embyatv "Android TV")
|
- [Android TV](https://play.google.com/store/apps/details?id=tv.emby.embyatv "Android TV")
|
||||||
- [Amazon Fire TV](http://www.amazon.com/Emby-for-Fire-TV/dp/B00VVJKTW8 "Amazon Fire TV")
|
- [Amazon Fire TV](http://www.amazon.com/Emby-for-Fire-TV/dp/B00VVJKTW8 "Amazon Fire TV")
|
||||||
- [HTML5](http://app.emby.media "HTML5")
|
- [HTML5](http://app.emby.media "HTML5")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user