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 class WatcherAddMovieResult
{ {
public string status { get; set; } public bool response { get; set; }
public string message { get; set; } public string message { get; set; }
[JsonIgnore] [JsonIgnore]

@ -78,7 +78,10 @@ namespace Ombi.Api.Models.Watcher
public class WatcherListStatusResultContainer 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] [JsonIgnore]
public string ErrorMessage { get; set; } public string ErrorMessage { get; set; }
[JsonIgnore] [JsonIgnore]

@ -84,16 +84,15 @@ namespace Ombi.Api
public WatcherListStatusResultContainer ListMovies(string apiKey, Uri baseUrl) public WatcherListStatusResultContainer ListMovies(string apiKey, Uri baseUrl)
{ {
var response = Send("liststatus", apiKey, baseUrl); var response = Send("liststatus", apiKey, baseUrl);
try try
{ {
if (response.Content.Contains("No movies found")) if (response.Content.Contains("No movies found"))
{ {
return new WatcherListStatusResultContainer(); return new WatcherListStatusResultContainer();
} }
var items = JsonConvert.DeserializeObject<List<WatcherListStatusResult>>(response.Content); var items = JsonConvert.DeserializeObject<WatcherListStatusResultContainer>(response.Content);
return items;
return new WatcherListStatusResultContainer {Results = items};
} }
catch (Exception e) catch (Exception e)
{ {
@ -115,9 +114,7 @@ namespace Ombi.Api
{ {
return new WatcherListStatusResultContainer(); return new WatcherListStatusResultContainer();
} }
var items = JsonConvert.DeserializeObject<List<WatcherListStatusResult>>(response.Content); return JsonConvert.DeserializeObject<WatcherListStatusResultContainer>(response.Content);
return new WatcherListStatusResultContainer { Results = items };
} }
catch (Exception e) catch (Exception e)
{ {

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

@ -77,10 +77,10 @@ namespace Ombi.Services.Jobs
Log.Error(movies.ErrorMessage); Log.Error(movies.ErrorMessage);
} }
var wantedMovies = 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()) 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 = var cpCacher =
TriggerBuilder.Create() TriggerBuilder.Create()
.WithIdentity("CouchPotatoCacher", "Cache") .WithIdentity("CouchPotatoCacher", "Cache")
.StartAt(DateBuilder.FutureDate(4, IntervalUnit.Minute)) .StartAt(DateBuilder.FutureDate(2, IntervalUnit.Minute))
.WithSimpleSchedule(x => x.WithIntervalInMinutes(s.CouchPotatoCacher).RepeatForever()) .WithSimpleSchedule(x => x.WithIntervalInMinutes(s.CouchPotatoCacher).RepeatForever())
.Build(); .Build();
@ -218,7 +218,7 @@ namespace Ombi.UI.Jobs
TriggerBuilder.Create() TriggerBuilder.Create()
.WithIdentity("WatcherCacher", "Cache") .WithIdentity("WatcherCacher", "Cache")
//.StartNow() //.StartNow()
.StartAt(DateBuilder.FutureDate(3, IntervalUnit.Minute)) .StartAt(DateBuilder.FutureDate(2, IntervalUnit.Minute))
.WithSimpleSchedule(x => x.WithIntervalInMinutes(s.WatcherCacher).RepeatForever()) .WithSimpleSchedule(x => x.WithIntervalInMinutes(s.WatcherCacher).RepeatForever())
.Build(); .Build();

@ -123,17 +123,17 @@ namespace Ombi.UI.Modules.Admin
var url = Request.Form["url"]; var url = Request.Form["url"];
var args = (string)Request.Form["args"].ToString(); var args = (string)Request.Form["args"].ToString();
var lowered = args.ToLower(); 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 (!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 var startInfo = Type.GetType("Mono.Runtime") != null
? new ProcessStartInfo(startArgs) { Arguments = $"{url} {lowered}", } ? new ProcessStartInfo(startArgs) { Arguments = $"{url} {lowered}", }

@ -114,7 +114,7 @@ namespace Ombi.UI.Modules
try try
{ {
var status = WatcherApi.Version(settings.ApiKey, settings.FullUri); 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 = true, Message = "Connected to Watcher successfully!" })
: Response.AsJson(new JsonResponseModel { Result = false, Message = $"Could not connect to Watcher, Error: {status.ErrorMessage}" }); : 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)) if (ShouldAutoApprove(RequestType.Movie, settings, Username))
{ {
model.Approved = true;
var result = await MovieSender.Send(model); var result = await MovieSender.Send(model);
if (result.Result) if (result.Result)
@ -576,8 +577,7 @@ namespace Ombi.UI.Modules
} }
if (!result.MovieSendingEnabled) if (!result.MovieSendingEnabled)
{ {
model.Approved = true;
return await AddRequest(model, settings, $"{fullMovieName} {Resources.UI.Search_SuccessfullyAdded}"); 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) private static void PrintToConsole(string message, ConsoleColor colour = ConsoleColor.Gray)
{ {
Console.ForegroundColor = colour; // Console.ForegroundColor = colour;
Console.WriteLine(message); Console.WriteLine(message);
Console.ForegroundColor = ConsoleColor.Gray; //Console.ForegroundColor = ConsoleColor.Gray;
} }
private static void CheckUpdate(UpdateValue val) private static void CheckUpdate(UpdateValue val)

@ -16,7 +16,7 @@
<form class="form-horizontal" method="POST" id="mainForm"> <form class="form-horizontal" method="POST" id="mainForm">
<fieldset> <fieldset>
<legend>Watcher Settings</legend> <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") @Html.Checkbox(Model.Enabled, "Enabled", "Enabled")
<div class="form-group"> <div class="form-group">

@ -10,10 +10,10 @@
@Html.GetSidebarUrl(Context, "/admin/usermanagementsettings", "User Management Settings") @Html.GetSidebarUrl(Context, "/admin/usermanagementsettings", "User Management Settings")
@Html.GetSidebarUrl(Context, "/admin/plex", "Plex") @Html.GetSidebarUrl(Context, "/admin/plex", "Plex")
@Html.GetSidebarUrl(Context, "/admin/couchpotato", "CouchPotato") @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/sonarr", "Sonarr")
@Html.GetSidebarUrl(Context, "/admin/sickrage", "SickRage") @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/newsletter", "Newsletter Settings")
@Html.GetSidebarUrl(Context, "/admin/emailnotification", "Email Notifications") @Html.GetSidebarUrl(Context, "/admin/emailnotification", "Email Notifications")
@Html.GetSidebarUrl(Context, "/admin/pushbulletnotification", "Pushbullet Notifications") @Html.GetSidebarUrl(Context, "/admin/pushbulletnotification", "Pushbullet Notifications")

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

Loading…
Cancel
Save