diff --git a/appveyor.yml b/appveyor.yml index f6a14f1b0..836ff5491 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,10 @@ version: 3.0.{build} configuration: Release os: Visual Studio 2015 +dotnet_csproj: + patch: true + file: '**\*.csproj' + version: '{version}' environment: nodejs_version: "7.8.0" @@ -29,8 +33,6 @@ after_build: -#cache: -#- '%USERPROFILE%\.nuget\packages' deploy: - provider: GitHub release: Ombi v$(appveyor_build_version) diff --git a/src/Ombi.Api.Telegram/Class1.cs b/src/Ombi.Api.Telegram/Class1.cs deleted file mode 100644 index 1901930b2..000000000 --- a/src/Ombi.Api.Telegram/Class1.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace Ombi.Api.Telegram -{ - public class TelegramApi - { - public TelegramApi(IApi api) - { - Api = api; - } - //https://core.telegram.org/bots/api - //https://github.com/TelegramBots/telegram.bot - private IApi Api { get; } - } -} diff --git a/src/Ombi.Api.Telegram/Ombi.Api.Telegram.csproj b/src/Ombi.Api.Telegram/Ombi.Api.Telegram.csproj index 105bb5244..931dc0688 100644 --- a/src/Ombi.Api.Telegram/Ombi.Api.Telegram.csproj +++ b/src/Ombi.Api.Telegram/Ombi.Api.Telegram.csproj @@ -4,6 +4,10 @@ netstandard1.6 + + + + diff --git a/src/Ombi.Api.Telegram/TelegramApi.cs b/src/Ombi.Api.Telegram/TelegramApi.cs new file mode 100644 index 000000000..eabed5433 --- /dev/null +++ b/src/Ombi.Api.Telegram/TelegramApi.cs @@ -0,0 +1,21 @@ +using System; +using System.Threading.Tasks; +using Telegram.Bot; +using Telegram.Bot.Types; + +namespace Ombi.Api.Telegram +{ + public class TelegramApi + { + + //https://core.telegram.org/bots/api + //https://github.com/TelegramBots/telegram.bot + + public async Task Send() + { + var botClient = new TelegramBotClient("422833810:AAEztVaoaSIeoXI3l9-rECKlSKJZtpFuMAU"); + var me = await botClient.GetMeAsync(); + await botClient.SendTextMessageAsync(new ChatId("@Ombi"), "Test"); + } + } +} diff --git a/src/Ombi.Schedule/JobSetup.cs b/src/Ombi.Schedule/JobSetup.cs index e97882ce5..6816fe677 100644 --- a/src/Ombi.Schedule/JobSetup.cs +++ b/src/Ombi.Schedule/JobSetup.cs @@ -21,7 +21,9 @@ namespace Ombi.Schedule { RecurringJob.AddOrUpdate(() => Cacher.CacheContent(), Cron.Hourly); RecurringJob.AddOrUpdate(() => RadarrCacher.CacheContent(), Cron.Hourly); - RecurringJob.AddOrUpdate(() => Updater.Update(), Cron.Daily); + //RecurringJob.AddOrUpdate(() => Updater.Update(), Cron.Daily); + + BackgroundJob.Enqueue(() => Updater.Update()); } } } diff --git a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs index 8938410f7..f8c9b36ee 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs @@ -93,7 +93,7 @@ namespace Ombi.Schedule.Ombi return; } } - if(download == null) + if (download == null) { return; } @@ -101,20 +101,38 @@ namespace Ombi.Schedule.Ombi // Download it var extension = download.Name.Split('.').Last(); var zipDir = Path.Combine(currentLocation, $"Ombi.{extension}"); - await DownloadAsync(download.Url, zipDir); + try + { + + await DownloadAsync(download.Url, zipDir); + } + catch (Exception e) + { + Console.WriteLine(e); + 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) { - // Temp Path - Directory.CreateDirectory(tempPath); + if (entry.FullName.Contains("/")) + { + var path = Path.GetDirectoryName(Path.Combine(tempPath, entry.FullName)); + Directory.CreateDirectory(path); + } entry.ExtractToFile(Path.Combine(tempPath, entry.FullName)); } - } + } // There must be an update var start = new ProcessStartInfo @@ -122,7 +140,7 @@ namespace Ombi.Schedule.Ombi UseShellExecute = false, CreateNoWindow = true, FileName = "Ombi.Updater", - Arguments = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + " " +extension , + Arguments = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + " " + extension, }; using (var proc = new Process { StartInfo = start }) { diff --git a/src/Ombi.Updater/Installer.cs b/src/Ombi.Updater/Installer.cs index 7501d11f0..c86123eda 100644 --- a/src/Ombi.Updater/Installer.cs +++ b/src/Ombi.Updater/Installer.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; +using System.Runtime.InteropServices; using System.Text; namespace Ombi.Updater @@ -30,10 +31,16 @@ namespace Ombi.Updater private void StartOmbi(StartupOptions options) { + var fileName = "Ombi.exe"; + if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) + { + fileName = "Ombi"; + } + var start = new ProcessStartInfo { UseShellExecute = false, - FileName = Path.Combine(options.ApplicationPath,"Ombi.exe"), + FileName = Path.Combine(options.ApplicationPath,fileName), WorkingDirectory = options.ApplicationPath }; using (var proc = new Process { StartInfo = start }) diff --git a/src/Ombi.Updater/Program.cs b/src/Ombi.Updater/Program.cs index f74dafa0d..8e787d989 100644 --- a/src/Ombi.Updater/Program.cs +++ b/src/Ombi.Updater/Program.cs @@ -8,9 +8,9 @@ namespace Ombi.Updater { static void Main(string[] args) { - Console.WriteLine("======================================="); - Console.WriteLine(" Starting the Ombi Updater" ); - Console.WriteLine("======================================="); + Console.WriteLine(" ======================================="); + Console.WriteLine(" Starting the Ombi Updater" ); + Console.WriteLine(" ======================================="); var options = CheckArgs(args); diff --git a/src/Ombi.Updater/Properties/launchSettings.json b/src/Ombi.Updater/Properties/launchSettings.json index 834fa8fec..c9a8dc3e8 100644 --- a/src/Ombi.Updater/Properties/launchSettings.json +++ b/src/Ombi.Updater/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "Ombi.Updater": { "commandName": "Project", - "commandLineArgs": "C:\\Users\\Jamie\\Desktop\\Test\\" + "commandLineArgs": "C:\\Users\\Jamie.Rees\\Source\\Repos\\PlexRequests.Net\\src\\Ombi\\bin\\Debug\\netcoreapp1.1\\" } } } \ No newline at end of file diff --git a/src/Ombi/Controllers/HomeController.cs b/src/Ombi/Controllers/HomeController.cs index fdae5b6ff..5f87ed1d1 100644 --- a/src/Ombi/Controllers/HomeController.cs +++ b/src/Ombi/Controllers/HomeController.cs @@ -1,4 +1,6 @@ -using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Ombi.Api.Telegram; namespace Ombi.Controllers { @@ -9,9 +11,9 @@ namespace Ombi.Controllers /// Indexes this instance. /// /// - public IActionResult Index() + public async Task Index() { - return View(); + return View(); } } } diff --git a/src/Ombi/Ombi.csproj b/src/Ombi/Ombi.csproj index cf5527676..fed2c7533 100644 --- a/src/Ombi/Ombi.csproj +++ b/src/Ombi/Ombi.csproj @@ -3,8 +3,10 @@ netcoreapp1.1 win10-x64;osx.10.12-x64;ubuntu.16.04-x64;debian.8-x64;centos.7-x64; - True + false 2.3 + 3.0.0.0 + 3.0.0.0 @@ -69,6 +71,7 @@ + @@ -77,11 +80,5 @@ - - - - slack.component.ts - -