diff --git a/src/Ombi.Core/Update/UpdateEngine.cs b/src/Ombi.Core/Update/UpdateEngine.cs
deleted file mode 100644
index b344a6652..000000000
--- a/src/Ombi.Core/Update/UpdateEngine.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.IO.Compression;
-using System.Linq;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Threading.Tasks;
-
-namespace Ombi.Core.Update
-{
- public class UpdateEngine
- {
- public async Task Update(UpdateOptions options)
- {
- if (options.Status == UpdateStatus.UptoDate)
- {
- // We don't need to update...
- return;
- }
- // Download zip into temp location
- var path = await Download(options);
-
- Extract(path);
-
- var location = System.Reflection.Assembly.GetEntryAssembly().Location;
- var current = Path.GetDirectoryName(location);
- // TODO Run the Update.exe and pass in the args
- var start = new ProcessStartInfo
- {
- UseShellExecute = false,
- CreateNoWindow = true,
- FileName = Path.Combine(current, "Ombi.Updater.exe")
- };
- using (var proc = new Process { StartInfo = start })
- {
- proc.Start();
- }
-
- }
-
- private void Extract(string path)
- {
- using (var zip = ZipFile.OpenRead(path))
- {
- path = Path.GetDirectoryName(path);
- foreach (var entry in zip.Entries.Skip(1))
- {
- var fullname = string.Empty;
- if (entry.FullName.Contains("publish/")) // Don't extract the publish folder, we are already in there
- {
- fullname = entry.FullName.Replace("publish/", string.Empty);
- }
-
- var fullPath = Path.Combine(path, fullname);
-
- if (string.IsNullOrEmpty(entry.Name))
- {
- Directory.CreateDirectory(fullPath);
- }
- else
- {
- entry.ExtractToFile(fullPath, true);
- Console.WriteLine("Restored {0}", entry.FullName);
- }
- }
- }
- }
-
- ///
- /// Downloads the specified zip from the options and returns the zip path.
- ///
- /// The options.
- ///
- private async Task Download(UpdateOptions options)
- {
-
- // Create temp path
- var location = System.Reflection.Assembly.GetEntryAssembly().Location;
- var current = Path.GetDirectoryName(location);
- var tempDir = Directory.CreateDirectory(Path.Combine(current, "UpdateTemp"));
- var tempZip = Path.Combine(tempDir.FullName, "Ombi.zip");
-
- if (File.Exists(tempZip))
- {
- return tempZip;
- }
-
- using (var httpClient = new HttpClient())
- using (var contentStream = await httpClient.GetStreamAsync(options.DownloadUrl))
- using (var fileStream = new FileStream(tempZip, FileMode.Create, FileAccess.Write, FileShare.None, 1048576, true))
- {
- await contentStream.CopyToAsync(fileStream);
- }
-
- return tempZip;
- }
-
-
- public UpdateOptions CheckForUpdate()
- {
- return new UpdateOptions
- {
- Status = UpdateStatus.Available,
- DownloadUrl = "https://ci.appveyor.com/api/buildjobs/t500indclt3etd50/artifacts/Ombi_windows.zip",
- UpdateDate = DateTime.Now,
- Version = "3.0.0"
- };
- }
- }
-}
\ No newline at end of file
diff --git a/src/Ombi.Core/Update/UpdateOptions.cs b/src/Ombi.Core/Update/UpdateOptions.cs
deleted file mode 100644
index f5822601b..000000000
--- a/src/Ombi.Core/Update/UpdateOptions.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-using System;
-
-namespace Ombi.Core.Update
-{
- public class UpdateOptions
- {
- public UpdateStatus Status { get; set; }
- public string DownloadUrl { get; set; }
- public string Version { get; set; }
- public DateTime UpdateDate { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Ombi.Core/Update/UpdateStatus.cs b/src/Ombi.Core/Update/UpdateStatus.cs
deleted file mode 100644
index 866bc501f..000000000
--- a/src/Ombi.Core/Update/UpdateStatus.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Ombi.Core.Update
-{
- public enum UpdateStatus
- {
- Available,
- UptoDate
- }
-}
\ No newline at end of file
diff --git a/src/Ombi.Helpers/CacheKeys.cs b/src/Ombi.Helpers/CacheKeys.cs
index 18fc0e254..1bbdb66e4 100644
--- a/src/Ombi.Helpers/CacheKeys.cs
+++ b/src/Ombi.Helpers/CacheKeys.cs
@@ -6,6 +6,6 @@ namespace Ombi.Helpers
{
public static class CacheKeys
{
- public const string RadarrCacher = nameof(RadarrCacher);
+ public const string Update = nameof(Update);
}
}
diff --git a/src/Ombi.Helpers/MemoryCacheHelper.cs b/src/Ombi.Helpers/MemoryCacheHelper.cs
new file mode 100644
index 000000000..2c8c429fd
--- /dev/null
+++ b/src/Ombi.Helpers/MemoryCacheHelper.cs
@@ -0,0 +1,54 @@
+#region Copyright
+// /************************************************************************
+// Copyright (c) 2017 Jamie Rees
+// File: MemoryCacheHelper.cs
+// Created By: Jamie Rees
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+// ************************************************************************/
+#endregion
+
+
+using System;
+using Microsoft.Extensions.Caching.Memory;
+
+namespace Ombi.Helpers
+{
+ public static class MemoryCacheHelper
+ {
+ public static IMemoryCache TryAdd(this IMemoryCache cache, object cacheObject, TimeSpan slidingExpiration)
+ {
+ object cachedObject;
+ if (!cache.TryGetValue(CacheKeys.Update, out cachedObject))
+ {
+ // Key not in cache, so get data.
+
+ // Set cache options.
+ var cacheEntryOptions = new MemoryCacheEntryOptions()
+ .SetSlidingExpiration(slidingExpiration);
+
+ // Save data in cache.
+ cache.Set(CacheKeys.Update, cacheObject, cacheEntryOptions);
+ }
+
+ return cache;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Ombi.Helpers/Ombi.Helpers.csproj b/src/Ombi.Helpers/Ombi.Helpers.csproj
index f5d481daf..080ed0f8a 100644
--- a/src/Ombi.Helpers/Ombi.Helpers.csproj
+++ b/src/Ombi.Helpers/Ombi.Helpers.csproj
@@ -10,6 +10,7 @@
+
diff --git a/src/Ombi/ClientApp/app/app.component.html b/src/Ombi/ClientApp/app/app.component.html
index d0c947352..100e3e30a 100644
--- a/src/Ombi/ClientApp/app/app.component.html
+++ b/src/Ombi/ClientApp/app/app.component.html
@@ -33,7 +33,14 @@