diff --git a/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj b/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj
index 6ed010778..24d326e36 100644
--- a/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj
+++ b/src/Ombi.Core.Tests/Ombi.Core.Tests.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/src/Ombi.Core/Ombi.Core.csproj b/src/Ombi.Core/Ombi.Core.csproj
index e837d8009..547176cbc 100644
--- a/src/Ombi.Core/Ombi.Core.csproj
+++ b/src/Ombi.Core/Ombi.Core.csproj
@@ -9,8 +9,8 @@
-
-
+
+
diff --git a/src/Ombi.Mapping/Ombi.Mapping.csproj b/src/Ombi.Mapping/Ombi.Mapping.csproj
index b25c4f3e9..78f39bcd5 100644
--- a/src/Ombi.Mapping/Ombi.Mapping.csproj
+++ b/src/Ombi.Mapping/Ombi.Mapping.csproj
@@ -9,9 +9,9 @@
-
-
-
+
+
+
diff --git a/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj b/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj
index 9cb0c6641..9aab37a61 100644
--- a/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj
+++ b/src/Ombi.Schedule.Tests/Ombi.Schedule.Tests.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/src/Ombi.Schedule/JobSetup.cs b/src/Ombi.Schedule/JobSetup.cs
index 904f59c0e..d00b9dbb5 100644
--- a/src/Ombi.Schedule/JobSetup.cs
+++ b/src/Ombi.Schedule/JobSetup.cs
@@ -31,7 +31,7 @@ namespace Ombi.Schedule
RecurringJob.AddOrUpdate(() => EmbyContentCacher.Start(), Cron.Hourly);
RecurringJob.AddOrUpdate(() => RadarrCacher.CacheContent(), Cron.Hourly);
RecurringJob.AddOrUpdate(() => PlexUserImporter.Start(), Cron.Daily);
- RecurringJob.AddOrUpdate(() => Updater.Update(), Cron.Daily);
+ RecurringJob.AddOrUpdate(() => Updater.Update(null), Cron.Daily);
//BackgroundJob.Enqueue(() => PlexUserImporter.Start());
}
diff --git a/src/Ombi.Schedule/Jobs/Ombi/IOmbiAutomaticUpdater.cs b/src/Ombi.Schedule/Jobs/Ombi/IOmbiAutomaticUpdater.cs
index c6c94d03d..bd007eb92 100644
--- a/src/Ombi.Schedule/Jobs/Ombi/IOmbiAutomaticUpdater.cs
+++ b/src/Ombi.Schedule/Jobs/Ombi/IOmbiAutomaticUpdater.cs
@@ -1,9 +1,10 @@
using System.Threading.Tasks;
+using Hangfire.Server;
namespace Ombi.Schedule.Ombi
{
public interface IOmbiAutomaticUpdater
{
- Task Update();
+ Task Update(PerformContext context);
}
}
\ No newline at end of file
diff --git a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs
index 43e133a9b..00824e631 100644
--- a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs
+++ b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs
@@ -8,6 +8,8 @@ using System.Net.Http;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
+using Hangfire.Console;
+using Hangfire.Server;
using Microsoft.Extensions.Logging;
using Ombi.Api.Service;
@@ -28,15 +30,17 @@ namespace Ombi.Schedule.Jobs.Ombi
private ILogger Logger { get; }
private IOmbiService OmbiService { get; }
- public async Task Update()
+ public async Task Update(PerformContext c)
{
-
+ c.WriteLine("Starting the updater");
// IF AutoUpdateEnabled =>
// ELSE Return;
var currentLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
-
+ c.WriteLine("Path: {0}", currentLocation);
+
var productVersion = AssemblyHelper.GetRuntimeVersion();
Logger.LogInformation(LoggingEvents.Updater, "Product Version {0}", productVersion);
+ c.WriteLine("Product Version {0}", productVersion);
var productArray = productVersion.Split('-');
var version = productArray[0];
@@ -46,119 +50,127 @@ namespace Ombi.Schedule.Jobs.Ombi
Logger.LogInformation(LoggingEvents.Updater, "Version {0}", version);
Logger.LogInformation(LoggingEvents.Updater, "Branch {0}", branch);
-
- var updates = await OmbiService.GetUpdates(branch);
- var serverVersion = updates.UpdateVersionString;
-
- Logger.LogInformation(LoggingEvents.Updater, "Service Version {0}", updates.UpdateVersionString);
-
- if (!serverVersion.Equals(version, StringComparison.CurrentCultureIgnoreCase))
+ try
{
+ var updates = await OmbiService.GetUpdates(branch);
+ var serverVersion = updates.UpdateVersionString;
- // Let's download the correct zip
- var desc = RuntimeInformation.OSDescription;
- var proce = RuntimeInformation.ProcessArchitecture;
- Logger.LogInformation(LoggingEvents.Updater, "OS Information: {0} {1}", desc, proce);
- Download download;
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- Logger.LogInformation(LoggingEvents.Updater, "We are Windows");
- download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("windows", CompareOptions.IgnoreCase));
- }
- else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
- {
- Logger.LogInformation(LoggingEvents.Updater, "We are OSX");
- download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("osx", CompareOptions.IgnoreCase));
+ Logger.LogInformation(LoggingEvents.Updater, "Service Version {0}", updates.UpdateVersionString);
+ c.WriteLine("Service Version {0}", updates.UpdateVersionString);
- }
- else
+ if (!serverVersion.Equals(version, StringComparison.CurrentCultureIgnoreCase))
{
- // Linux
- if (desc.Contains("ubuntu", CompareOptions.IgnoreCase))
- {
- // Ubuntu
- Logger.LogInformation(LoggingEvents.Updater, "We are ubuntu");
- download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("ubuntu", CompareOptions.IgnoreCase));
+ // Let's download the correct zip
+ var desc = RuntimeInformation.OSDescription;
+ var proce = RuntimeInformation.ProcessArchitecture;
- }
- else if (desc.Contains("debian", CompareOptions.IgnoreCase))
+ Logger.LogInformation(LoggingEvents.Updater, "OS Information: {0} {1}", desc, proce);
+ Download download;
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- // Debian
- Logger.LogInformation(LoggingEvents.Updater, "We are debian");
- download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("debian", CompareOptions.IgnoreCase));
+ Logger.LogInformation(LoggingEvents.Updater, "We are Windows");
+ download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("windows", CompareOptions.IgnoreCase));
}
- else if (desc.Contains("centos", CompareOptions.IgnoreCase))
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
- // Centos
- Logger.LogInformation(LoggingEvents.Updater, "We are centos");
- download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("centos",
- CompareOptions.IgnoreCase));
+ Logger.LogInformation(LoggingEvents.Updater, "We are OSX");
+ download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("osx", CompareOptions.IgnoreCase));
+
}
else
+ {
+ // Linux
+ if (desc.Contains("ubuntu", CompareOptions.IgnoreCase))
+ {
+ // Ubuntu
+ Logger.LogInformation(LoggingEvents.Updater, "We are ubuntu");
+ download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("ubuntu", CompareOptions.IgnoreCase));
+
+ }
+ else if (desc.Contains("debian", CompareOptions.IgnoreCase))
+ {
+ // Debian
+ Logger.LogInformation(LoggingEvents.Updater, "We are debian");
+ download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("debian", CompareOptions.IgnoreCase));
+ }
+ else if (desc.Contains("centos", CompareOptions.IgnoreCase))
+ {
+ // Centos
+ Logger.LogInformation(LoggingEvents.Updater, "We are centos");
+ download = updates.Downloads.FirstOrDefault(x => x.Name.Contains("centos",
+ CompareOptions.IgnoreCase));
+ }
+ else
+ {
+ return;
+ }
+ }
+ if (download == null)
{
return;
}
- }
- if (download == null)
- {
- return;
- }
- // Download it
- Logger.LogInformation(LoggingEvents.Updater, "Downloading the file {0} from {1}", download.Name, download.Url);
- var extension = download.Name.Split('.').Last();
- var zipDir = Path.Combine(currentLocation, $"Ombi.{extension}");
- try
- {
- if (File.Exists(zipDir))
+ // Download it
+ Logger.LogInformation(LoggingEvents.Updater, "Downloading the file {0} from {1}", download.Name, download.Url);
+ var extension = download.Name.Split('.').Last();
+ var zipDir = Path.Combine(currentLocation, $"Ombi.{extension}");
+ try
{
- File.Delete(zipDir);
- }
+ if (File.Exists(zipDir))
+ {
+ File.Delete(zipDir);
+ }
- await DownloadAsync(download.Url, zipDir);
- }
- catch (Exception e)
- {
- Logger.LogError(LoggingEvents.Updater, e, "Error when downloading the zip");
- throw;
- }
+ await DownloadAsync(download.Url, zipDir);
+ }
+ catch (Exception e)
+ {
+ Logger.LogError(LoggingEvents.Updater, e, "Error when downloading the zip");
+ throw;
+ }
- var tempPath = Path.Combine(currentLocation, "TempUpdate");
- if (Directory.Exists(tempPath))
- {
- Directory.Delete(tempPath, true);
- }
- // Extract it
- using (var files = ZipFile.OpenRead(zipDir))
- {
- // Temp Path
- Directory.CreateDirectory(tempPath);
- foreach (var entry in files.Entries)
+ var tempPath = Path.Combine(currentLocation, "TempUpdate");
+ if (Directory.Exists(tempPath))
{
- if (entry.FullName.Contains("/"))
+ Directory.Delete(tempPath, true);
+ }
+ // Extract it
+ using (var files = ZipFile.OpenRead(zipDir))
+ {
+ // Temp Path
+ Directory.CreateDirectory(tempPath);
+ foreach (var entry in files.Entries)
{
- var path = Path.GetDirectoryName(Path.Combine(tempPath, entry.FullName));
- Directory.CreateDirectory(path);
+ if (entry.FullName.Contains("/"))
+ {
+ var path = Path.GetDirectoryName(Path.Combine(tempPath, entry.FullName));
+ Directory.CreateDirectory(path);
+ }
+
+ entry.ExtractToFile(Path.Combine(tempPath, entry.FullName));
}
+ }
- entry.ExtractToFile(Path.Combine(tempPath, entry.FullName));
+ // There must be an update
+ var start = new ProcessStartInfo
+ {
+ UseShellExecute = false,
+ CreateNoWindow = true,
+ FileName = "Ombi.Updater",
+ Arguments = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + " " + extension,
+ };
+ using (var proc = new Process { StartInfo = start })
+ {
+ proc.Start();
}
- }
- // There must be an update
- var start = new ProcessStartInfo
- {
- UseShellExecute = false,
- CreateNoWindow = true,
- FileName = "Ombi.Updater",
- Arguments = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + " " + extension,
- };
- using (var proc = new Process { StartInfo = start })
- {
- proc.Start();
}
-
+ }
+ catch (Exception e)
+ {
+ c.WriteLine(e);
+ throw;
}
}
diff --git a/src/Ombi.Schedule/Ombi.Schedule.csproj b/src/Ombi.Schedule/Ombi.Schedule.csproj
index 10e361f0f..cf944f8c5 100644
--- a/src/Ombi.Schedule/Ombi.Schedule.csproj
+++ b/src/Ombi.Schedule/Ombi.Schedule.csproj
@@ -11,9 +11,10 @@
+
-
+
diff --git a/src/Ombi.TheMovieDbApi/Ombi.Api.TheMovieDb.csproj b/src/Ombi.TheMovieDbApi/Ombi.Api.TheMovieDb.csproj
index 66689e1c6..98557b81f 100644
--- a/src/Ombi.TheMovieDbApi/Ombi.Api.TheMovieDb.csproj
+++ b/src/Ombi.TheMovieDbApi/Ombi.Api.TheMovieDb.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj
index e0e37fb90..2e553c2ad 100644
--- a/src/Ombi/Ombi.csproj
+++ b/src/Ombi/Ombi.csproj
@@ -46,9 +46,10 @@
-
+
+
@@ -57,8 +58,8 @@
-
-
+
+
diff --git a/src/Ombi/Startup.cs b/src/Ombi/Startup.cs
index 073a4274a..6a9c8c4eb 100644
--- a/src/Ombi/Startup.cs
+++ b/src/Ombi/Startup.cs
@@ -5,6 +5,7 @@ using System.Text;
using AutoMapper;
using AutoMapper.EquivalencyExpression;
using Hangfire;
+using Hangfire.Console;
using Hangfire.Dashboard;
using Hangfire.MemoryStorage;
using Microsoft.AspNetCore.Authentication.JwtBearer;
@@ -179,6 +180,7 @@ namespace Ombi
x.UseMemoryStorage(new MemoryStorageOptions());
//x.UseSQLiteStorage("Data Source=Ombi.db;");
x.UseActivator(new IoCJobActivator(services.BuildServiceProvider()));
+ x.UseConsole();
});