#1460 #865 working on the auto updater

pull/1510/head
Jamie.Rees 7 years ago
parent ff242f2531
commit f60d133f41

@ -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)

@ -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; }
}
}

@ -4,6 +4,10 @@
<TargetFramework>netstandard1.6</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Telegram.Bot" Version="13.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Ombi.Api\Ombi.Api.csproj" />
</ItemGroup>

@ -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");
}
}
}

@ -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());
}
}
}

@ -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 })
{

@ -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 })

@ -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);

@ -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\\"
}
}
}

@ -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.
/// </summary>
/// <returns></returns>
public IActionResult Index()
public async Task<IActionResult> Index()
{
return View();
return View();
}
}
}

@ -3,8 +3,10 @@
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<RuntimeIdentifiers>win10-x64;osx.10.12-x64;ubuntu.16.04-x64;debian.8-x64;centos.7-x64;</RuntimeIdentifiers>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<TypeScriptToolsVersion>2.3</TypeScriptToolsVersion>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
@ -69,6 +71,7 @@
<ItemGroup>
<ProjectReference Include="..\Ombi.Api.Emby\Ombi.Api.Emby.csproj" />
<ProjectReference Include="..\Ombi.Api.Telegram\Ombi.Api.Telegram.csproj" />
<ProjectReference Include="..\Ombi.Core\Ombi.Core.csproj" />
<ProjectReference Include="..\Ombi.DependencyInjection\Ombi.DependencyInjection.csproj" />
<ProjectReference Include="..\Ombi.Mapping\Ombi.Mapping.csproj" />
@ -77,11 +80,5 @@
<ProjectReference Include="..\Ombi.TheMovieDbApi\Ombi.Api.TheMovieDb.csproj" />
<ProjectReference Include="..\Ombi.Updater\Ombi.Updater.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="ClientApp\app\settings\notifications\slack.component.js">
<DependentUpon>slack.component.ts</DependentUpon>
</None>
</ItemGroup>
</Project>

Loading…
Cancel
Save