mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 18:47:15 -07:00
Api changed again, so more fixes for #878
This commit is contained in:
parent
d87aa95dea
commit
6048053c3c
10 changed files with 20 additions and 20 deletions
|
@ -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]
|
||||
|
|
|
@ -84,16 +84,15 @@ namespace Ombi.Api
|
|||
|
||||
public WatcherListStatusResultContainer ListMovies(string apiKey, Uri baseUrl)
|
||||
{
|
||||
var response = Send("liststatus", apiKey, baseUrl);
|
||||
var response = Send("liststatus", apiKey, baseUrl);
|
||||
try
|
||||
{
|
||||
if (response.Content.Contains("No movies found"))
|
||||
{
|
||||
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();
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
@ -576,8 +577,7 @@ namespace Ombi.UI.Modules
|
|||
}
|
||||
if (!result.MovieSendingEnabled)
|
||||
{
|
||||
|
||||
model.Approved = true;
|
||||
|
||||
return await AddRequest(model, settings, $"{fullMovieName} {Resources.UI.Search_SuccessfullyAdded}");
|
||||
}
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue