diff --git a/src/Ombi.Api.CouchPotato/Models/CouchPotatoMovies.cs b/src/Ombi.Api.CouchPotato/Models/CouchPotatoMovies.cs index a1b2619cf..520687568 100644 --- a/src/Ombi.Api.CouchPotato/Models/CouchPotatoMovies.cs +++ b/src/Ombi.Api.CouchPotato/Models/CouchPotatoMovies.cs @@ -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 imdb { get; set; } - } - - public class Images - { - public List actors { get; set; } - public List backdrop { get; set; } - public List backdrop_original { get; set; } - public List banner { get; set; } - public List clear_art { get; set; } - public List disc_art { get; set; } - public List extra_fanart { get; set; } - public List extra_thumbs { get; set; } - public List landscape { get; set; } - public List logo { get; set; } - public List poster { get; set; } - public List poster_original { get; set; } - } public class Info - { - public List actor_roles { get; set; } - public List actors { get; set; } - public List directors { get; set; } - public List 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 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 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 image_poster { get; set; } - } - - public class Identifiers - { - public string imdb { get; set; } - } } \ No newline at end of file diff --git a/src/Ombi.Core/Senders/MovieSender.cs b/src/Ombi.Core/Senders/MovieSender.cs index f0c9b3f0c..5d19b5b06 100644 --- a/src/Ombi.Core/Senders/MovieSender.cs +++ b/src/Ombi.Core/Senders/MovieSender.cs @@ -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, IRadarrApi api, ILogger log, - ISettingsService dogSettings, IDogNzbApi dogApi) + ISettingsService dogSettings, IDogNzbApi dogApi, ISettingsService cpSettings, + ICouchPotatoApi cpApi) { RadarrSettings = radarrSettings; RadarrApi = api; Log = log; DogNzbSettings = dogSettings; DogNzbApi = dogApi; + CouchPotatoSettings = cpSettings; + CouchPotatoApi = cpApi; } private ISettingsService RadarrSettings { get; } @@ -28,10 +32,12 @@ namespace Ombi.Core.Senders private ILogger Log { get; } private IDogNzbApi DogNzbApi { get; } private ISettingsService DogNzbSettings { get; } + private ISettingsService CouchPotatoSettings { get; } + private ICouchPotatoApi CouchPotatoApi { get; } public async Task 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 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 SendToDogNzb(FullBaseRequest model, DogNzbSettings settings) { var id = model.ImdbId;