More work on watcher, should all be good now. #878

pull/889/head
Jamie.Rees 8 years ago
parent 34e00e15c2
commit add4e86d49

@ -36,5 +36,6 @@ namespace Ombi.Api.Interfaces
WatcherAddMovieResult AddMovie(string imdbId, string apiKey, Uri baseUrl);
WatcherListStatusResultContainer ListMovies(string apiKey, Uri baseUrl);
WatcherListStatusResultContainer ListMovies(string apiKey, Uri baseUrl, string imdbId);
WatcherVersion Version(string apiKey, Uri baseUri);
}
}

@ -108,6 +108,7 @@
<Compile Include="Tv\TvShowImages.cs" />
<Compile Include="Watcher\WatcherAddMovieResult.cs" />
<Compile Include="Watcher\WatcherListStatusResult.cs" />
<Compile Include="Watcher\WatcherVersion.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />

@ -0,0 +1,35 @@
#region Copyright
// /************************************************************************
// Copyright (c) 2017 Jamie Rees
// File: WatcherVersion.cs
// Created By: Jamie Rees
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ************************************************************************/
#endregion
namespace Ombi.Api.Models.Watcher
{
public class WatcherVersion
{
public string version { get; set; }
public bool response { get; set; }
public string ErrorMessage { get; set; }
}
}

@ -64,6 +64,23 @@ namespace Ombi.Api
};
}
}
public WatcherVersion Version(string apiKey, Uri baseUri)
{
var response = Send("version", apiKey, baseUri);
try
{
return JsonConvert.DeserializeObject<WatcherVersion>(response.Content);
}
catch (Exception e)
{
Log.Error(e);
return new WatcherVersion
{
response = false,
ErrorMessage = e.Message
};
}
}
public WatcherListStatusResultContainer ListMovies(string apiKey, Uri baseUrl)
{

@ -113,8 +113,8 @@ namespace Ombi.UI.Modules
}
try
{
var status = WatcherApi.ListMovies(settings.ApiKey, settings.FullUri);
return !status.Error
var status = WatcherApi.Version(settings.ApiKey, settings.FullUri);
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}" });

Loading…
Cancel
Save