Couchpotato finished

pull/1614/head
tidusjar 7 years ago
parent ddaa7ca20c
commit 4eb58d359c

@ -16,8 +16,6 @@ namespace Ombi.Api.CouchPotato.Models
public string _rev { get; set; }
public string _t { get; set; }
public object category_id { get; set; }
public Files files { get; set; }
public Identifiers identifiers { get; set; }
public Info info { get; set; }
public int last_edit { get; set; }
public string profile_id { get; set; }
@ -33,67 +31,11 @@ namespace Ombi.Api.CouchPotato.Models
public bool success { get; set; }
}
public class Rating
{
public List<string> imdb { get; set; }
}
public class Images
{
public List<string> actors { get; set; }
public List<string> backdrop { get; set; }
public List<string> backdrop_original { get; set; }
public List<object> banner { get; set; }
public List<object> clear_art { get; set; }
public List<object> disc_art { get; set; }
public List<object> extra_fanart { get; set; }
public List<object> extra_thumbs { get; set; }
public List<object> landscape { get; set; }
public List<object> logo { get; set; }
public List<string> poster { get; set; }
public List<string> poster_original { get; set; }
}
public class Info
{
public List<string> actor_roles { get; set; }
public List<string> actors { get; set; }
public List<string> directors { get; set; }
public List<string> genres { get; set; }
public Images images { get; set; }
public string imdb { get; set; }
public string mpaa { get; set; }
public string original_title { get; set; }
public string plot { get; set; }
public Rating rating { get; set; }
public Release_Date release_date { get; set; }
public string released { get; set; }
public int runtime { get; set; }
public string tagline { get; set; }
public List<string> titles { get; set; }
{ public string imdb { get; set; }
public int tmdb_id { get; set; }
public string type { get; set; }
public bool via_imdb { get; set; }
public bool via_tmdb { get; set; }
public List<string> writers { get; set; }
public int year { get; set; }
}
public class Release_Date
{
public bool bluray { get; set; }
public int dvd { get; set; }
public int expires { get; set; }
public int theater { get; set; }
}
public class Files
{
public List<string> image_poster { get; set; }
}
public class Identifiers
{
public string imdb { get; set; }
}
}

@ -1,6 +1,7 @@
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Ombi.Api.CouchPotato;
using Ombi.Api.DogNzb.Models;
using Ombi.Api.Radarr;
using Ombi.Core.Settings;
@ -14,13 +15,16 @@ namespace Ombi.Core.Senders
public class MovieSender : IMovieSender
{
public MovieSender(ISettingsService<RadarrSettings> radarrSettings, IRadarrApi api, ILogger<MovieSender> log,
ISettingsService<DogNzbSettings> dogSettings, IDogNzbApi dogApi)
ISettingsService<DogNzbSettings> dogSettings, IDogNzbApi dogApi, ISettingsService<CouchPotatoSettings> cpSettings,
ICouchPotatoApi cpApi)
{
RadarrSettings = radarrSettings;
RadarrApi = api;
Log = log;
DogNzbSettings = dogSettings;
DogNzbApi = dogApi;
CouchPotatoSettings = cpSettings;
CouchPotatoApi = cpApi;
}
private ISettingsService<RadarrSettings> RadarrSettings { get; }
@ -28,10 +32,12 @@ namespace Ombi.Core.Senders
private ILogger<MovieSender> Log { get; }
private IDogNzbApi DogNzbApi { get; }
private ISettingsService<DogNzbSettings> DogNzbSettings { get; }
private ISettingsService<CouchPotatoSettings> CouchPotatoSettings { get; }
private ICouchPotatoApi CouchPotatoApi { get; }
public async Task<SenderResult> Send(MovieRequests model)
{
//var cpSettings = await CouchPotatoSettings.GetSettingsAsync();
var cpSettings = await CouchPotatoSettings.GetSettingsAsync();
//var watcherSettings = await WatcherSettings.GetSettingsAsync();
var radarrSettings = await RadarrSettings.GetSettingsAsync();
if (radarrSettings.Enabled)
@ -50,10 +56,10 @@ namespace Ombi.Core.Senders
};
}
//if (cpSettings.Enabled)
//{
// return SendToCp(model, cpSettings, string.IsNullOrEmpty(qualityId) ? cpSettings.ProfileId : qualityId);
//}
if (cpSettings.Enabled)
{
return await SendToCp(model, cpSettings, cpSettings.DefaultProfileId);
}
//if (watcherSettings.Enabled)
//{
@ -68,6 +74,12 @@ namespace Ombi.Core.Senders
};
}
private async Task<SenderResult> SendToCp(FullBaseRequest model, CouchPotatoSettings cpSettings, string cpSettingsDefaultProfileId)
{
var result = await CouchPotatoApi.AddMovie(model.ImdbId, cpSettings.ApiKey, model.Title, cpSettings.FullUri, cpSettingsDefaultProfileId);
return new SenderResult { Success = result, Sent = true };
}
private async Task<DogNzbMovieAddResult> SendToDogNzb(FullBaseRequest model, DogNzbSettings settings)
{
var id = model.ImdbId;

Loading…
Cancel
Save