aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2015-12-02 23:41:39 -0500
committerLuke <luke.pulverenti@gmail.com>2015-12-02 23:41:39 -0500
commitc1d44bf71bd582acf8d936a4cb4f8606ac7391b1 (patch)
tree60a7a2f4a0939d0e907eea4c12b8e35abe496ea2
parent4238ddd19787f2dc97eddea2dd5474d76765265b (diff)
parentb9638b484ddc27de3c554ad622f1bdbdc97541de (diff)
Merge pull request #1297 from MediaBrowser/master
merge from master
-rw-r--r--MediaBrowser.Common/ScheduledTasks/IntervalTrigger.cs38
-rw-r--r--MediaBrowser.Server.Mac/Emby.Server.Mac.csproj6
-rw-r--r--README.md2
3 files changed, 24 insertions, 22 deletions
diff --git a/MediaBrowser.Common/ScheduledTasks/IntervalTrigger.cs b/MediaBrowser.Common/ScheduledTasks/IntervalTrigger.cs
index a12fea14c..e07dfcceb 100644
--- a/MediaBrowser.Common/ScheduledTasks/IntervalTrigger.cs
+++ b/MediaBrowser.Common/ScheduledTasks/IntervalTrigger.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Tasks;
using System;
+using System.Linq;
using System.Threading;
namespace MediaBrowser.Common.ScheduledTasks
@@ -30,16 +31,7 @@ namespace MediaBrowser.Common.ScheduledTasks
/// </value>
public TaskExecutionOptions TaskOptions { get; set; }
- /// <summary>
- /// 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);
- }
+ private DateTime _lastStartDate;
/// <summary>
/// Stars waiting for the trigger action
@@ -50,20 +42,21 @@ namespace MediaBrowser.Common.ScheduledTasks
{
DisposeTimer();
- var triggerDate = lastResult != null ?
- lastResult.EndTimeUtc.Add(Interval) :
- DateTime.UtcNow.Add(FirstRunDelay);
+ DateTime triggerDate;
+
+ 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 (isApplicationStartup)
- {
- triggerDate = DateTime.UtcNow.AddMinutes(1);
- }
- else
- {
- triggerDate = DateTime.UtcNow.AddMinutes(1);
- }
+ triggerDate = DateTime.UtcNow.AddMinutes(1);
}
Timer = new Timer(state => OnTriggered(), null, triggerDate - DateTime.UtcNow, TimeSpan.FromMilliseconds(-1));
@@ -98,8 +91,11 @@ namespace MediaBrowser.Common.ScheduledTasks
/// </summary>
private void OnTriggered()
{
+ DisposeTimer();
+
if (Triggered != null)
{
+ _lastStartDate = DateTime.UtcNow;
Triggered(this, new GenericEventArgs<TaskExecutionOptions>(TaskOptions));
}
}
diff --git a/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj b/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj
index 62c2386f0..9fdb528dd 100644
--- a/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj
+++ b/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj
@@ -4855,6 +4855,9 @@
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\strings\javascript\kk.json">
<Link>Resources\dashboard-ui\strings\javascript\kk.json</Link>
</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">
<Link>Resources\dashboard-ui\strings\javascript\ms.json</Link>
</BundleResource>
@@ -4924,6 +4927,9 @@
<BundleResource Include="..\MediaBrowser.WebDashboard\dashboard-ui\thirdparty\headroom.js">
<Link>Resources\dashboard-ui\thirdparty\headroom.js</Link>
</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">
<Link>Resources\dashboard-ui\thirdparty\jquery.unveil-custom.js</Link>
</BundleResource>
diff --git a/README.md b/README.md
index f10556ee7..6ee0855b7 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ It features a REST-based api with built-in documention to facilitate client deve
## Emby Apps
- [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")
- [Amazon Fire TV](http://www.amazon.com/Emby-for-Fire-TV/dp/B00VVJKTW8 "Amazon Fire TV")
- [HTML5](http://app.emby.media "HTML5")