Merge pull request #903 from tidusjar/dev

Dev
pull/927/head^2
Jamie 8 years ago committed by GitHub
commit 69b2d22fac

@ -31,7 +31,7 @@ namespace Ombi.Api.Models.Watcher
{
public class WatcherAddMovieResult
{
public string status { get; set; }
public bool response { get; set; }
public string message { get; set; }
[JsonIgnore]

@ -78,7 +78,10 @@ namespace Ombi.Api.Models.Watcher
public class WatcherListStatusResultContainer
{
public List<WatcherListStatusResult> Results { get; set; }
[JsonProperty("movies")]
public List<WatcherListStatusResult> Movies { get; set; }
[JsonProperty("response")]
public bool Response { get; set; }
[JsonIgnore]
public string ErrorMessage { get; set; }
[JsonIgnore]

@ -91,9 +91,8 @@ namespace Ombi.Api
{
return new WatcherListStatusResultContainer();
}
var items = JsonConvert.DeserializeObject<List<WatcherListStatusResult>>(response.Content);
return new WatcherListStatusResultContainer {Results = items};
var items = JsonConvert.DeserializeObject<WatcherListStatusResultContainer>(response.Content);
return items;
}
catch (Exception e)
{
@ -115,9 +114,7 @@ namespace Ombi.Api
{
return new WatcherListStatusResultContainer();
}
var items = JsonConvert.DeserializeObject<List<WatcherListStatusResult>>(response.Content);
return new WatcherListStatusResultContainer { Results = items };
return JsonConvert.DeserializeObject<WatcherListStatusResultContainer>(response.Content);
}
catch (Exception e)
{

@ -78,7 +78,7 @@ namespace Ombi.Core
Log.Error(result.ErrorMessage);
return new MovieSenderResult { Result = false };
}
if (result.status.Equals("success", StringComparison.CurrentCultureIgnoreCase))
if (result.response)
{
return new MovieSenderResult { Result = true, MovieSendingEnabled = true };
}

@ -77,10 +77,10 @@ namespace Ombi.Services.Jobs
Log.Error(movies.ErrorMessage);
}
var wantedMovies =
movies?.Results?.Where(x => x.status.Equals("Wanted", StringComparison.CurrentCultureIgnoreCase));
movies?.Movies?.Where(x => x.status.Equals("Wanted", StringComparison.CurrentCultureIgnoreCase));
if (wantedMovies != null && wantedMovies.Any())
{
Cache.Set(CacheKeys.WatcherQueued, movies.Results.Select(x => x.imdbid).ToArray(), CacheKeys.TimeFrameMinutes.SchedulerCaching);
Cache.Set(CacheKeys.WatcherQueued, movies.Movies.Select(x => x.imdbid).ToArray(), CacheKeys.TimeFrameMinutes.SchedulerCaching);
}
}

@ -210,7 +210,7 @@ namespace Ombi.UI.Jobs
var cpCacher =
TriggerBuilder.Create()
.WithIdentity("CouchPotatoCacher", "Cache")
.StartAt(DateBuilder.FutureDate(4, IntervalUnit.Minute))
.StartAt(DateBuilder.FutureDate(2, IntervalUnit.Minute))
.WithSimpleSchedule(x => x.WithIntervalInMinutes(s.CouchPotatoCacher).RepeatForever())
.Build();
@ -218,7 +218,7 @@ namespace Ombi.UI.Jobs
TriggerBuilder.Create()
.WithIdentity("WatcherCacher", "Cache")
//.StartNow()
.StartAt(DateBuilder.FutureDate(3, IntervalUnit.Minute))
.StartAt(DateBuilder.FutureDate(2, IntervalUnit.Minute))
.WithSimpleSchedule(x => x.WithIntervalInMinutes(s.WatcherCacher).RepeatForever())
.Build();

@ -123,17 +123,17 @@ namespace Ombi.UI.Modules.Admin
var url = Request.Form["url"];
var args = (string)Request.Form["args"].ToString();
var lowered = args.ToLower();
var appPath = Path.Combine(Path.GetDirectoryName(Assembly.GetAssembly(typeof(SystemStatusModule)).Location ?? string.Empty) ?? string.Empty, "PlexRequests.Updater.exe");
var appPath = Path.Combine(Path.GetDirectoryName(Assembly.GetAssembly(typeof(SystemStatusModule)).Location ?? string.Empty) ?? string.Empty, "Ombi.Updater.exe");
if (!string.IsNullOrEmpty(lowered))
{
if (lowered.Contains("plexrequests.exe"))
if (lowered.Contains("ombi.exe"))
{
lowered = lowered.Replace("plexrequests.exe", "");
lowered = lowered.Replace("ombi.exe", "");
}
}
var startArgs = string.IsNullOrEmpty(lowered) ? appPath : $"{lowered} Plexrequests.Updater.exe";
var startArgs = string.IsNullOrEmpty(lowered) ? appPath : $"{lowered} Ombi.Updater.exe";
var startInfo = Type.GetType("Mono.Runtime") != null
? new ProcessStartInfo(startArgs) { Arguments = $"{url} {lowered}", }

@ -114,7 +114,7 @@ namespace Ombi.UI.Modules
try
{
var status = WatcherApi.Version(settings.ApiKey, settings.FullUri);
return !status.response
return status.response
? Response.AsJson(new JsonResponseModel { Result = true, Message = "Connected to Watcher successfully!" })
: Response.AsJson(new JsonResponseModel { Result = false, Message = $"Could not connect to Watcher, Error: {status.ErrorMessage}" });

@ -567,6 +567,7 @@ namespace Ombi.UI.Modules
{
if (ShouldAutoApprove(RequestType.Movie, settings, Username))
{
model.Approved = true;
var result = await MovieSender.Send(model);
if (result.Result)
@ -577,7 +578,6 @@ namespace Ombi.UI.Modules
if (!result.MovieSendingEnabled)
{
model.Approved = true;
return await AddRequest(model, settings, $"{fullMovieName} {Resources.UI.Search_SuccessfullyAdded}");
}

@ -159,9 +159,9 @@ namespace Ombi.UI
private static void PrintToConsole(string message, ConsoleColor colour = ConsoleColor.Gray)
{
Console.ForegroundColor = colour;
// Console.ForegroundColor = colour;
Console.WriteLine(message);
Console.ForegroundColor = ConsoleColor.Gray;
//Console.ForegroundColor = ConsoleColor.Gray;
}
private static void CheckUpdate(UpdateValue val)

@ -16,7 +16,7 @@
<form class="form-horizontal" method="POST" id="mainForm">
<fieldset>
<legend>Watcher Settings</legend>
<small>Please note, this is still in beta and may stop working at anytime as Watcher is still very much in development and is constantly changing.</small>
@Html.Checkbox(Model.Enabled, "Enabled", "Enabled")
<div class="form-group">

@ -10,10 +10,10 @@
@Html.GetSidebarUrl(Context, "/admin/usermanagementsettings", "User Management Settings")
@Html.GetSidebarUrl(Context, "/admin/plex", "Plex")
@Html.GetSidebarUrl(Context, "/admin/couchpotato", "CouchPotato")
@Html.GetSidebarUrl(Context, "/admin/watcher", "Watcher")
@Html.GetSidebarUrl(Context, "/admin/watcher", "Watcher (beta)")
@Html.GetSidebarUrl(Context, "/admin/sonarr", "Sonarr")
@Html.GetSidebarUrl(Context, "/admin/sickrage", "SickRage")
@Html.GetSidebarUrl(Context, "/admin/headphones", "Headphones (Beta)")
@Html.GetSidebarUrl(Context, "/admin/headphones", "Headphones (beta)")
@Html.GetSidebarUrl(Context, "/admin/newsletter", "Newsletter Settings")
@Html.GetSidebarUrl(Context, "/admin/emailnotification", "Email Notifications")
@Html.GetSidebarUrl(Context, "/admin/pushbulletnotification", "Pushbullet Notifications")

@ -56,7 +56,7 @@ namespace Ombi.Updater
}
else
{
if (entry.Name.Contains("PlexRequests.Updater"))
if (entry.Name.Contains("Ombi.Updater"))
{
entry.ExtractToFile(fullPath + "_Updated", true);
continue;
@ -75,7 +75,7 @@ namespace Ombi.Updater
{
BackupCurrentVersion();
var dir = CreateTempPath();
TempPath = Path.Combine(dir.FullName, "PlexRequestsUpdate.zip");
TempPath = Path.Combine(dir.FullName, "OmbiUpdate.zip");
CheckAndDelete(TempPath);
Console.WriteLine("Downloading new version");
@ -109,7 +109,7 @@ namespace Ombi.Updater
}
else
{
if (entry.Name.Contains("PlexRequests.Updater"))
if (entry.Name.Contains("Ombi.Updater"))
{
entry.ExtractToFile(fullPath + "_Updated", true);
continue;
@ -150,7 +150,7 @@ namespace Ombi.Updater
var dir = Directory.CreateDirectory(Path.Combine(applicationPath, "BackupSystem"));
var allfiles = Directory.GetFiles(applicationPath, "*.*", SearchOption.AllDirectories);
BackupPath = Path.Combine(dir.FullName, "PlexRequestsBackup.zip");
BackupPath = Path.Combine(dir.FullName, "OmbiBackup.zip");
CheckAndDelete(BackupPath);
using (var fileStream = new FileStream(BackupPath, FileMode.CreateNew))
@ -202,7 +202,7 @@ namespace Ombi.Updater
private void FinishUpdate(string launchOptions)
{
var args = Error ? "-u 2" : "-u 1";
var startInfo = new ProcessStartInfo($"{launchOptions}PlexRequests.exe") { Arguments = args, UseShellExecute = true };
var startInfo = new ProcessStartInfo($"{launchOptions}Ombi.exe") { Arguments = args, UseShellExecute = true };
Process.Start(startInfo);

Loading…
Cancel
Save