mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 16:22:55 -07:00
parent
5c72d585f4
commit
863df6e1cc
26 changed files with 303 additions and 23 deletions
|
@ -8,4 +8,5 @@ param([String]$env='local')
|
||||||
$appSettingsPath = $env:APPVEYOR_BUILD_FOLDER + '\src\Ombi\appsettings.json'
|
$appSettingsPath = $env:APPVEYOR_BUILD_FOLDER + '\src\Ombi\appsettings.json'
|
||||||
$appSettings = Get-Content $appSettingsPath -raw
|
$appSettings = Get-Content $appSettingsPath -raw
|
||||||
$appSettings = $appSettings.Replace("{{VERSIONNUMBER}}",$env:APPVEYOR_BUILD_VERSION);
|
$appSettings = $appSettings.Replace("{{VERSIONNUMBER}}",$env:APPVEYOR_BUILD_VERSION);
|
||||||
|
$appSettings = $appSettings.Replace("{{BRANCH}}",$env:APPVEYOR_REPO_BRANCH);
|
||||||
Set-Content -Path $appSettingsPath -Value $appSettings
|
Set-Content -Path $appSettingsPath -Value $appSettings
|
||||||
|
|
10
appveyor.yml
10
appveyor.yml
|
@ -34,15 +34,15 @@ after_build:
|
||||||
- dotnet publish "../Ombi.Updater" -c Release -r centos.7-x64
|
- dotnet publish "../Ombi.Updater" -c Release -r centos.7-x64
|
||||||
# Copy over the updater files so we can include them in the .zip
|
# Copy over the updater files so we can include them in the .zip
|
||||||
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.dll"
|
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.dll"
|
||||||
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.exe"
|
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.exe" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\win10-x64\publish\Ombi.Updater.exe"
|
||||||
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater.dll"
|
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater.dll"
|
||||||
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater.exe"
|
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\osx.10.12-x64\publish\Ombi.Updater"
|
||||||
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\ubuntu.16.10-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.16.10-x64\publish\Ombi.Updater.dll"
|
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\ubuntu.16.10-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.16.10-x64\publish\Ombi.Updater.dll"
|
||||||
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\ubuntu.16.10-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.16.10-x64\publish\Ombi.Updater.exe"
|
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\ubuntu.16.10-x64\publish\Ombi.Updater" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\ubuntu.16.10-x64\publish\Ombi.Updater"
|
||||||
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater.dll"
|
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater.dll"
|
||||||
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater.exe"
|
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\debian.8-x64\publish\Ombi.Updater"
|
||||||
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater.dll"
|
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater.dll"
|
||||||
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater.dll" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater.exe"
|
- copy "%APPVEYOR_BUILD_FOLDER%\src\Ombi.Updater\bin\release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater" "%APPVEYOR_BUILD_FOLDER%\src\Ombi\bin\Release\netcoreapp1.1\centos.7-x64\publish\Ombi.Updater"
|
||||||
|
|
||||||
#Copy the swagger files
|
#Copy the swagger files
|
||||||
|
|
||||||
|
|
10
src/Ombi.Api.Service/IOmbiService.cs
Normal file
10
src/Ombi.Api.Service/IOmbiService.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Ombi.Api.Service.Models;
|
||||||
|
|
||||||
|
namespace Ombi.Api.Service
|
||||||
|
{
|
||||||
|
public interface IOmbiService
|
||||||
|
{
|
||||||
|
Task<Updates> GetUpdates(string branch);
|
||||||
|
}
|
||||||
|
}
|
47
src/Ombi.Api.Service/Models/Updates.cs
Normal file
47
src/Ombi.Api.Service/Models/Updates.cs
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Ombi.Api.Service.Models
|
||||||
|
{
|
||||||
|
|
||||||
|
public class Updates
|
||||||
|
{
|
||||||
|
[JsonProperty("id")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
[JsonProperty("updateVersionString")]
|
||||||
|
public string UpdateVersionString { get; set; }
|
||||||
|
[JsonProperty("updateVersion")]
|
||||||
|
public int UpdateVersion { get; set; }
|
||||||
|
[JsonProperty("updateDate")]
|
||||||
|
public DateTime UpdateDate { get; set; }
|
||||||
|
[JsonProperty("changeLogs")]
|
||||||
|
public List<Changelog> ChangeLogs { get; set; }
|
||||||
|
[JsonProperty("downloads")]
|
||||||
|
public List<Download> Downloads { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Changelog
|
||||||
|
{
|
||||||
|
[JsonProperty("id")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
[JsonProperty("type")]
|
||||||
|
public string Type { get; set; }
|
||||||
|
[JsonProperty("descripion")]
|
||||||
|
public string Descripion { get; set; }
|
||||||
|
[JsonProperty("updateId")]
|
||||||
|
public int UpdateId { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Download
|
||||||
|
{
|
||||||
|
[JsonProperty("id")]
|
||||||
|
public int Id { get; set; }
|
||||||
|
[JsonProperty("name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
[JsonProperty("url")]
|
||||||
|
public string Url { get; set; }
|
||||||
|
[JsonProperty("updateId")]
|
||||||
|
public int UpdateId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
18
src/Ombi.Api.Service/Ombi.Api.Service.csproj
Normal file
18
src/Ombi.Api.Service/Ombi.Api.Service.csproj
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard1.6</TargetFramework>
|
||||||
|
<AssemblyName>Ombi.Api.Service</AssemblyName>
|
||||||
|
<RootNamespace>Ombi.Api.Service</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Options" Version="1.1.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Ombi.Api\Ombi.Api.csproj" />
|
||||||
|
<ProjectReference Include="..\Ombi.Helpers\Ombi.Helpers.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
33
src/Ombi.Api.Service/OmbiService.cs
Normal file
33
src/Ombi.Api.Service/OmbiService.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Ombi.Api.Service.Models;
|
||||||
|
using Ombi.Helpers;
|
||||||
|
|
||||||
|
namespace Ombi.Api.Service
|
||||||
|
{
|
||||||
|
public class OmbiService : IOmbiService
|
||||||
|
{
|
||||||
|
public OmbiService(IOptions<ApplicationSettings> settings, IApi api, ILogger<OmbiService> log)
|
||||||
|
{
|
||||||
|
Settings = settings.Value;
|
||||||
|
Api = api;
|
||||||
|
Logger = log;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ApplicationSettings Settings { get; }
|
||||||
|
private ILogger<OmbiService> Logger { get; }
|
||||||
|
private IApi Api { get; }
|
||||||
|
|
||||||
|
public async Task<Updates> GetUpdates(string branch)
|
||||||
|
{
|
||||||
|
var request = new Request($"api/update/{branch}", Settings.OmbiService, HttpMethod.Get);
|
||||||
|
|
||||||
|
request.ContentHeaders.Add(new KeyValuePair<string, string>("Content-Type", "application/json"));
|
||||||
|
|
||||||
|
return await Api.Request<Updates>(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -45,7 +45,7 @@ namespace Ombi.Core.Engine
|
||||||
public async Task<RequestEngineResult> RequestMovie(SearchMovieViewModel model)
|
public async Task<RequestEngineResult> RequestMovie(SearchMovieViewModel model)
|
||||||
{
|
{
|
||||||
var movieInfo = await MovieApi.GetMovieInformation(model.Id);
|
var movieInfo = await MovieApi.GetMovieInformation(model.Id);
|
||||||
if (movieInfo == null)
|
if (movieInfo == null || movieInfo.Id == 0)
|
||||||
{
|
{
|
||||||
return new RequestEngineResult
|
return new RequestEngineResult
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,9 @@ using Ombi.Store.Repository;
|
||||||
using Ombi.Notifications.Agents;
|
using Ombi.Notifications.Agents;
|
||||||
using Ombi.Schedule.Jobs.Radarr;
|
using Ombi.Schedule.Jobs.Radarr;
|
||||||
using Ombi.Api;
|
using Ombi.Api;
|
||||||
|
using Ombi.Api.Service;
|
||||||
using Ombi.Core.Rule.Interfaces;
|
using Ombi.Core.Rule.Interfaces;
|
||||||
|
using Ombi.Schedule.Ombi;
|
||||||
using Ombi.Store.Repository.Requests;
|
using Ombi.Store.Repository.Requests;
|
||||||
|
|
||||||
namespace Ombi.DependencyInjection
|
namespace Ombi.DependencyInjection
|
||||||
|
@ -68,6 +70,7 @@ namespace Ombi.DependencyInjection
|
||||||
services.AddTransient<ITraktApi, TraktApi>();
|
services.AddTransient<ITraktApi, TraktApi>();
|
||||||
services.AddTransient<IRadarrApi, RadarrApi>();
|
services.AddTransient<IRadarrApi, RadarrApi>();
|
||||||
services.AddTransient<IDiscordApi, DiscordApi>();
|
services.AddTransient<IDiscordApi, DiscordApi>();
|
||||||
|
services.AddTransient<IOmbiService, OmbiService>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RegisterStore(this IServiceCollection services)
|
public static void RegisterStore(this IServiceCollection services)
|
||||||
|
@ -103,6 +106,7 @@ namespace Ombi.DependencyInjection
|
||||||
services.AddTransient<IPlexContentCacher, PlexContentCacher>();
|
services.AddTransient<IPlexContentCacher, PlexContentCacher>();
|
||||||
services.AddTransient<IJobSetup, JobSetup>();
|
services.AddTransient<IJobSetup, JobSetup>();
|
||||||
services.AddTransient<IRadarrCacher, RadarrCacher>();
|
services.AddTransient<IRadarrCacher, RadarrCacher>();
|
||||||
|
services.AddTransient<IOmbiAutomaticUpdater, OmbiAutomaticUpdater>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void RegisterIdentity(this IServiceCollection services)
|
public static void RegisterIdentity(this IServiceCollection services)
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
<ProjectReference Include="..\Ombi.Api.Emby\Ombi.Api.Emby.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Emby\Ombi.Api.Emby.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.Plex\Ombi.Api.Plex.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Plex\Ombi.Api.Plex.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.Radarr\Ombi.Api.Radarr.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Radarr\Ombi.Api.Radarr.csproj" />
|
||||||
|
<ProjectReference Include="..\Ombi.Api.Service\Ombi.Api.Service.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.Sonarr\Ombi.Api.Sonarr.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Sonarr\Ombi.Api.Sonarr.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.Trakt\Ombi.Api.Trakt.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Trakt\Ombi.Api.Trakt.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.TvMaze\Ombi.Api.TvMaze.csproj" />
|
<ProjectReference Include="..\Ombi.Api.TvMaze\Ombi.Api.TvMaze.csproj" />
|
||||||
|
|
10
src/Ombi.Helpers/ApplicationSettings.cs
Normal file
10
src/Ombi.Helpers/ApplicationSettings.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
namespace Ombi.Helpers
|
||||||
|
{
|
||||||
|
public class ApplicationSettings
|
||||||
|
{
|
||||||
|
public string Branch { get; set; }
|
||||||
|
public string Version { get; set; }
|
||||||
|
public string OmbiService { get; set; }
|
||||||
|
public string FriendlyVersion { get; set; }
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,5 +18,8 @@ namespace Ombi.Helpers
|
||||||
public static EventId TvSender => new EventId(5000);
|
public static EventId TvSender => new EventId(5000);
|
||||||
public static EventId SonarrSender => new EventId(5001);
|
public static EventId SonarrSender => new EventId(5001);
|
||||||
|
|
||||||
|
|
||||||
|
public static EventId Updater => new EventId(6000);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,6 +9,10 @@ namespace Ombi.Helpers
|
||||||
{
|
{
|
||||||
public static bool Contains(this string paragraph, string word, CompareOptions opts)
|
public static bool Contains(this string paragraph, string word, CompareOptions opts)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(paragraph))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return CultureInfo.CurrentUICulture.CompareInfo.IndexOf(paragraph, word, CompareOptions.IgnoreCase) >= 0;
|
return CultureInfo.CurrentUICulture.CompareInfo.IndexOf(paragraph, word, CompareOptions.IgnoreCase) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,27 @@
|
||||||
using Hangfire;
|
using Hangfire;
|
||||||
using Ombi.Schedule.Jobs;
|
using Ombi.Schedule.Jobs;
|
||||||
using Ombi.Schedule.Jobs.Radarr;
|
using Ombi.Schedule.Jobs.Radarr;
|
||||||
|
using Ombi.Schedule.Ombi;
|
||||||
|
|
||||||
namespace Ombi.Schedule
|
namespace Ombi.Schedule
|
||||||
{
|
{
|
||||||
public class JobSetup : IJobSetup
|
public class JobSetup : IJobSetup
|
||||||
{
|
{
|
||||||
public JobSetup(IPlexContentCacher cacher, IRadarrCacher radarrCacher)
|
public JobSetup(IPlexContentCacher cacher, IRadarrCacher radarrCacher, IOmbiAutomaticUpdater updater)
|
||||||
{
|
{
|
||||||
Cacher = cacher;
|
Cacher = cacher;
|
||||||
RadarrCacher = radarrCacher;
|
RadarrCacher = radarrCacher;
|
||||||
|
Updater = updater;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPlexContentCacher Cacher { get; }
|
private IPlexContentCacher Cacher { get; }
|
||||||
private IRadarrCacher RadarrCacher { get; }
|
private IRadarrCacher RadarrCacher { get; }
|
||||||
|
private IOmbiAutomaticUpdater Updater { get; }
|
||||||
public void Setup()
|
public void Setup()
|
||||||
{
|
{
|
||||||
RecurringJob.AddOrUpdate(() => Cacher.CacheContent(), Cron.Hourly);
|
RecurringJob.AddOrUpdate(() => Cacher.CacheContent(), Cron.Hourly);
|
||||||
RecurringJob.AddOrUpdate(() => RadarrCacher.CacheContent(), Cron.Hourly);
|
RecurringJob.AddOrUpdate(() => RadarrCacher.CacheContent(), Cron.Hourly);
|
||||||
|
RecurringJob.AddOrUpdate(() => Updater.Update(), Cron.Minutely);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
132
src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs
Normal file
132
src/Ombi.Schedule/Jobs/Ombi/OmbiAutomaticUpdater.cs
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Microsoft.Extensions.Options;
|
||||||
|
using Ombi.Api.Service;
|
||||||
|
using Ombi.Api.Service.Models;
|
||||||
|
using Ombi.Helpers;
|
||||||
|
|
||||||
|
namespace Ombi.Schedule.Ombi
|
||||||
|
{
|
||||||
|
public class OmbiAutomaticUpdater : IOmbiAutomaticUpdater
|
||||||
|
{
|
||||||
|
public OmbiAutomaticUpdater(ILogger<OmbiAutomaticUpdater> log, IOmbiService service, IOptions<ApplicationSettings> settings)
|
||||||
|
{
|
||||||
|
Logger = log;
|
||||||
|
OmbiService = service;
|
||||||
|
Settings = settings.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ILogger<OmbiAutomaticUpdater> Logger { get; }
|
||||||
|
private IOmbiService OmbiService { get; }
|
||||||
|
private ApplicationSettings Settings { get; }
|
||||||
|
|
||||||
|
public async Task Update()
|
||||||
|
{
|
||||||
|
|
||||||
|
// IF AutoUpdateEnabled =>
|
||||||
|
// ELSE Return;
|
||||||
|
var currentLocation = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||||
|
var currentBranch = Settings.Branch;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
if (currentBranch == "{{BRANCH}}")
|
||||||
|
{
|
||||||
|
currentBranch = "DotNetCore";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
var updates = await OmbiService.GetUpdates(currentBranch);
|
||||||
|
var serverVersion = updates.UpdateVersionString.Substring(1, 6);
|
||||||
|
if (serverVersion != Settings.FriendlyVersion)
|
||||||
|
{
|
||||||
|
|
||||||
|
// 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));
|
||||||
|
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Download it
|
||||||
|
await DownloadAsync(download.Url, Path.Combine(currentLocation, "Ombi.zip"));
|
||||||
|
|
||||||
|
|
||||||
|
// There must be an update
|
||||||
|
//var start = new ProcessStartInfo
|
||||||
|
//{
|
||||||
|
// UseShellExecute = false,
|
||||||
|
// CreateNoWindow = true,
|
||||||
|
// FileName = "Ombi.Updater.exe",
|
||||||
|
// Arguments = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)
|
||||||
|
//};
|
||||||
|
//using (var proc = new Process { StartInfo = start })
|
||||||
|
//{
|
||||||
|
// proc.Start();
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No updates
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task DownloadAsync(string requestUri, string filename)
|
||||||
|
{
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
using (var request = new HttpRequestMessage(HttpMethod.Get, requestUri))
|
||||||
|
using (Stream contentStream = await (await client.SendAsync(request)).Content.ReadAsStreamAsync(),
|
||||||
|
stream = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None, 3145728, true))
|
||||||
|
{
|
||||||
|
await contentStream.CopyToAsync(stream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,12 +10,14 @@
|
||||||
<PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0" />
|
<PackageReference Include="Hangfire.MemoryStorage.Core" Version="1.4.0" />
|
||||||
<PackageReference Include="Hangfire.RecurringJobExtensions" Version="1.1.6" />
|
<PackageReference Include="Hangfire.RecurringJobExtensions" Version="1.1.6" />
|
||||||
<PackageReference Include="Serilog" Version="2.4.0" />
|
<PackageReference Include="Serilog" Version="2.4.0" />
|
||||||
|
<PackageReference Include="System.Diagnostics.Process" Version="4.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Ombi.Api.Emby\Ombi.Api.Emby.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Emby\Ombi.Api.Emby.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.Plex\Ombi.Api.Plex.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Plex\Ombi.Api.Plex.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Api.Radarr\Ombi.Api.Radarr.csproj" />
|
<ProjectReference Include="..\Ombi.Api.Radarr\Ombi.Api.Radarr.csproj" />
|
||||||
|
<ProjectReference Include="..\Ombi.Api.Service\Ombi.Api.Service.csproj" />
|
||||||
<ProjectReference Include="..\Ombi.Settings\Ombi.Settings.csproj" />
|
<ProjectReference Include="..\Ombi.Settings\Ombi.Settings.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
9
src/Ombi.Schedule/Ombi/Jobs/IOmbiAutomaticUpdater.cs
Normal file
9
src/Ombi.Schedule/Ombi/Jobs/IOmbiAutomaticUpdater.cs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Ombi.Schedule.Ombi
|
||||||
|
{
|
||||||
|
public interface IOmbiAutomaticUpdater
|
||||||
|
{
|
||||||
|
Task Update();
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,7 +13,6 @@ namespace Ombi.Updater
|
||||||
{
|
{
|
||||||
// Kill Ombi Process
|
// Kill Ombi Process
|
||||||
var p = new ProcessProvider();
|
var p = new ProcessProvider();
|
||||||
|
|
||||||
p.Kill(options.OmbiProcessId);
|
p.Kill(options.OmbiProcessId);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace Ombi.Updater
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Console.WriteLine("=======================================");
|
Console.WriteLine("=======================================");
|
||||||
Console.WriteLine(" Starting the Ombi Updater");
|
Console.WriteLine(" Starting the Ombi Updater" );
|
||||||
Console.WriteLine("=======================================");
|
Console.WriteLine("=======================================");
|
||||||
|
|
||||||
|
|
||||||
|
|
11
src/Ombi.sln
11
src/Ombi.sln
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26430.14
|
VisualStudioVersion = 15.0.26430.16
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi", "Ombi\Ombi.csproj", "{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi", "Ombi\Ombi.csproj", "{C987AA67-AFE1-468F-ACD3-EAD5A48E1F6A}"
|
||||||
EndProject
|
EndProject
|
||||||
|
@ -65,7 +65,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Updater", "Ombi.Update
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Update", "Update", "{D11FE57E-1E57-491D-A1D4-01AEF4BE5CB6}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Update", "Update", "{D11FE57E-1E57-491D-A1D4-01AEF4BE5CB6}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ombi.Notifications.Tests", "Ombi.Notifications.Tests\Ombi.Notifications.Tests.csproj", "{2C7836E7-B120-40A6-B641-DDAA02FBAE23}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Notifications.Tests", "Ombi.Notifications.Tests\Ombi.Notifications.Tests.csproj", "{2C7836E7-B120-40A6-B641-DDAA02FBAE23}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ombi.Api.Service", "Ombi.Api.Service\Ombi.Api.Service.csproj", "{A0892896-F5BD-47E2-823E-DFCE82514EEC}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -161,6 +163,10 @@ Global
|
||||||
{2C7836E7-B120-40A6-B641-DDAA02FBAE23}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2C7836E7-B120-40A6-B641-DDAA02FBAE23}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2C7836E7-B120-40A6-B641-DDAA02FBAE23}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2C7836E7-B120-40A6-B641-DDAA02FBAE23}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2C7836E7-B120-40A6-B641-DDAA02FBAE23}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2C7836E7-B120-40A6-B641-DDAA02FBAE23}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{A0892896-F5BD-47E2-823E-DFCE82514EEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{A0892896-F5BD-47E2-823E-DFCE82514EEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{A0892896-F5BD-47E2-823E-DFCE82514EEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{A0892896-F5BD-47E2-823E-DFCE82514EEC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -182,5 +188,6 @@ Global
|
||||||
{5AF2B6D2-5CC6-49FE-928A-BA27AF52B194} = {9293CA11-360A-4C20-A674-B9E794431BF5}
|
{5AF2B6D2-5CC6-49FE-928A-BA27AF52B194} = {9293CA11-360A-4C20-A674-B9E794431BF5}
|
||||||
{6294A82D-4915-4FC3-B301-8F985716F34C} = {D11FE57E-1E57-491D-A1D4-01AEF4BE5CB6}
|
{6294A82D-4915-4FC3-B301-8F985716F34C} = {D11FE57E-1E57-491D-A1D4-01AEF4BE5CB6}
|
||||||
{2C7836E7-B120-40A6-B641-DDAA02FBAE23} = {6F42AB98-9196-44C4-B888-D5E409F415A1}
|
{2C7836E7-B120-40A6-B641-DDAA02FBAE23} = {6F42AB98-9196-44C4-B888-D5E409F415A1}
|
||||||
|
{A0892896-F5BD-47E2-823E-DFCE82514EEC} = {9293CA11-360A-4C20-A674-B9E794431BF5}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -93,7 +93,7 @@ export class TvSearchComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
anticipatedShows() {
|
anticipatedShows() {
|
||||||
this.clearResults();
|
this.clearResults();
|
||||||
this.searchService.anticiplatedTv()
|
this.searchService.anticipatedTv()
|
||||||
.takeUntil(this.subscriptions)
|
.takeUntil(this.subscriptions)
|
||||||
.subscribe(x => {
|
.subscribe(x => {
|
||||||
this.tvResults = x;
|
this.tvResults = x;
|
||||||
|
|
|
@ -48,7 +48,7 @@ export class SearchService extends ServiceAuthHelpers {
|
||||||
mostWatchedTv(): Observable<ISearchTvResult[]> {
|
mostWatchedTv(): Observable<ISearchTvResult[]> {
|
||||||
return this.http.get(`${this.url}/Tv/mostwatched`).map(this.extractData);
|
return this.http.get(`${this.url}/Tv/mostwatched`).map(this.extractData);
|
||||||
}
|
}
|
||||||
anticiplatedTv(): Observable<ISearchTvResult[]> {
|
anticipatedTv(): Observable<ISearchTvResult[]> {
|
||||||
return this.http.get(`${this.url}/Tv/anticipated`).map(this.extractData);
|
return this.http.get(`${this.url}/Tv/anticipated`).map(this.extractData);
|
||||||
}
|
}
|
||||||
trendingTv(): Observable<ISearchTvResult[]> {
|
trendingTv(): Observable<ISearchTvResult[]> {
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
namespace Ombi.Config
|
|
||||||
{
|
|
||||||
public class ApplicationSettings
|
|
||||||
{
|
|
||||||
public string Version { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -138,7 +138,7 @@ namespace Ombi.Controllers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>We use Trakt.tv as the Provider</remarks>
|
/// <remarks>We use Trakt.tv as the Provider</remarks>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("tv/anticiplated")]
|
[HttpGet("tv/anticipated")]
|
||||||
public async Task<IEnumerable<SearchTvShowViewModel>> AnticiplatedTv()
|
public async Task<IEnumerable<SearchTvShowViewModel>> AnticiplatedTv()
|
||||||
{
|
{
|
||||||
return await TvEngine.Anticipated();
|
return await TvEngine.Anticipated();
|
||||||
|
|
|
@ -25,6 +25,7 @@ using Microsoft.IdentityModel.Tokens;
|
||||||
using Ombi.Config;
|
using Ombi.Config;
|
||||||
using Ombi.Core.IdentityResolver;
|
using Ombi.Core.IdentityResolver;
|
||||||
using Ombi.DependencyInjection;
|
using Ombi.DependencyInjection;
|
||||||
|
using Ombi.Helpers;
|
||||||
using Ombi.Mapping;
|
using Ombi.Mapping;
|
||||||
using Ombi.Schedule;
|
using Ombi.Schedule;
|
||||||
using Ombi.Store.Context;
|
using Ombi.Store.Context;
|
||||||
|
|
|
@ -6,7 +6,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ApplicationSettings": {
|
"ApplicationSettings": {
|
||||||
"Verison": "{{VERSIONNUMBER}}"
|
"Verison": "{{VERSIONNUMBER}}",
|
||||||
|
"OmbiService": "https://ombiservice.azurewebsites.net/",
|
||||||
|
"Branch": "{{BRANCH}}",
|
||||||
|
"FriendlyVersion": "v3.0.0"
|
||||||
},
|
},
|
||||||
"UserSettings": {
|
"UserSettings": {
|
||||||
"WebsiteUrl": "http://localhost:52038",
|
"WebsiteUrl": "http://localhost:52038",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue