diff --git a/src/NzbDrone.Core/Exceptions/MovieNotFoundExceptions.cs b/src/NzbDrone.Core/Exceptions/MovieNotFoundExceptions.cs deleted file mode 100644 index 5018b2889..000000000 --- a/src/NzbDrone.Core/Exceptions/MovieNotFoundExceptions.cs +++ /dev/null @@ -1,33 +0,0 @@ -using NzbDrone.Common.Exceptions; - -namespace NzbDrone.Core.Exceptions -{ - public class MovieNotFoundException : NzbDroneException - { - public int TmdbMovieId { get; set; } - - public MovieNotFoundException(int tmdbMovieId) - : base(string.Format("Movie with tmdbId {0} was not found, it may have been removed from TMDb.", tmdbMovieId)) - { - TmdbMovieId = tmdbMovieId; - } - - public MovieNotFoundException(string imdbId) - : base(string.Format("Movie with IMDBId {0} was not found, it may have been removed from TMDb.", imdbId)) - { - TmdbMovieId = 0; - } - - public MovieNotFoundException(int tmdbMovieId, string message, params object[] args) - : base(message, args) - { - TmdbMovieId = tmdbMovieId; - } - - public MovieNotFoundException(int tmdbMovieId, string message) - : base(message) - { - TmdbMovieId = tmdbMovieId; - } - } -} diff --git a/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs b/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs index 4266f7889..3a805f04c 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/BakaBT.cs @@ -46,6 +46,26 @@ namespace NzbDrone.Core.Indexers.Definitions return new BakaBTParser(Settings, Capabilities.Categories); } + public override async Task Download(Uri link) + { + var request = new HttpRequestBuilder(link.ToString()) + .SetCookies(GetCookies() ?? new Dictionary()) + .Build(); + + var response = await _httpClient.ExecuteAsync(request, Definition); + + var parser = new HtmlParser(); + var dom = parser.ParseDocument(response.Content); + var downloadLink = dom.QuerySelectorAll(".download_link").First().GetAttribute("href"); + + if (string.IsNullOrWhiteSpace(downloadLink)) + { + throw new Exception("Unable to find download link."); + } + + return await base.Download(new Uri(Settings.BaseUrl + downloadLink)); + } + protected override async Task DoLogin() { UpdateCookies(null, null);