Patch/onedr0p 3 13 17 (#1166)

* Update message when the person has no movies with helpful links

* Added ImdbId to the release info from AwesomeHD

* Add ImdbId to release info for PTP and HDBits

* ImdbId is required for HDBits

* Added some error handling in SkyHook for TMDb

* Remove un-needed imports

* DIsable movie search after list sync (causing issues)

* small change

* Fix HDBits tests
Devin Buhl 8 years ago committed by GitHub
parent 8ece7e8b4d
commit 35e046bb87

@ -4,6 +4,7 @@
{ {
public static readonly HttpAccept Rss = new HttpAccept("application/rss+xml, text/rss+xml, application/xml, text/xml"); public static readonly HttpAccept Rss = new HttpAccept("application/rss+xml, text/rss+xml, application/xml, text/xml");
public static readonly HttpAccept Json = new HttpAccept("application/json"); public static readonly HttpAccept Json = new HttpAccept("application/json");
public static readonly HttpAccept JsonCharset = new HttpAccept("application/json;charset=utf-8");
public static readonly HttpAccept Html = new HttpAccept("text/html"); public static readonly HttpAccept Html = new HttpAccept("text/html");
public string Value { get; private set; } public string Value { get; private set; }

@ -25,6 +25,9 @@
"id": 78901, "id": 78901,
"season": 10, "season": 10,
"episode": 17 "episode": 17
},
"imdb": {
"id": 78901
} }
}, },
{ {
@ -51,6 +54,9 @@
"id": 248841, "id": 248841,
"season": 4, "season": 4,
"episode": 18 "episode": 18
},
"imdb": {
"id": 78901
} }
} }
] ]

@ -25,6 +25,9 @@
"id": 78901, "id": 78901,
"season": 10, "season": 10,
"episode": 17 "episode": 17
},
"imdb": {
"id": 78901
} }
}, },
{ {
@ -51,6 +54,9 @@
"id": 248841, "id": 248841,
"season": 4, "season": 4,
"episode": 18 "episode": 18
},
"imdb": {
"id": 78901
} }
} }
] ]

@ -1,7 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Net; using System.Net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Core.Indexers.Exceptions; using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
@ -64,6 +62,7 @@ namespace NzbDrone.Core.Indexers.AwesomeHD
Subtitles = x.Element("subtitles").Value, Subtitles = x.Element("subtitles").Value,
EncodeStatus = x.Element("encodestatus").Value, EncodeStatus = x.Element("encodestatus").Value,
Freeleech = x.Element("freeleech").Value, Freeleech = x.Element("freeleech").Value,
ImdbId = x.Element("imdb").Value
}).ToList(); }).ToList();
foreach (var torrent in torrents) foreach (var torrent in torrents)
@ -80,7 +79,8 @@ namespace NzbDrone.Core.Indexers.AwesomeHD
InfoUrl = GetInfoUrl(torrent.GroupId, id), InfoUrl = GetInfoUrl(torrent.GroupId, id),
Seeders = int.Parse(torrent.Seeders), Seeders = int.Parse(torrent.Seeders),
Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders), Peers = int.Parse(torrent.Leechers) + int.Parse(torrent.Seeders),
PublishDate = torrent.Time.ToUniversalTime() PublishDate = torrent.Time.ToUniversalTime(),
ImdbId = int.Parse(torrent.ImdbId.Substring(2))
}); });
} }
} }

@ -101,7 +101,7 @@ namespace NzbDrone.Core.Indexers.HDBits
public class ImdbInfo public class ImdbInfo
{ {
public int? Id { get; set; } public int Id { get; set; }
public string EnglishTitle { get; set; } public string EnglishTitle { get; set; }
public string OriginalTitle { get; set; } public string OriginalTitle { get; set; }
public int? Year { get; set; } public int? Year { get; set; }

@ -1,8 +1,4 @@
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NzbDrone.Core.Indexers.HDBits namespace NzbDrone.Core.Indexers.HDBits
{ {

@ -64,7 +64,8 @@ namespace NzbDrone.Core.Indexers.HDBits
Seeders = result.Seeders, Seeders = result.Seeders,
Peers = result.Leechers + result.Seeders, Peers = result.Leechers + result.Seeders,
PublishDate = result.Added.ToUniversalTime(), PublishDate = result.Added.ToUniversalTime(),
Internal = internalRelease Internal = internalRelease,
ImdbId = result.ImdbInfo.Id
}); });
} }

@ -81,7 +81,8 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
PublishDate = torrent.UploadTime.ToUniversalTime(), PublishDate = torrent.UploadTime.ToUniversalTime(),
Golden = torrent.GoldenPopcorn, Golden = torrent.GoldenPopcorn,
Scene = torrent.Scene, Scene = torrent.Scene,
Approved = torrent.Checked Approved = torrent.Checked,
ImdbId = int.Parse(result.ImdbId)
}); });
} }
// Add all torrents // Add all torrents
@ -99,7 +100,8 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn
PublishDate = torrent.UploadTime.ToUniversalTime(), PublishDate = torrent.UploadTime.ToUniversalTime(),
Golden = torrent.GoldenPopcorn, Golden = torrent.GoldenPopcorn,
Scene = torrent.Scene, Scene = torrent.Scene,
Approved = torrent.Checked Approved = torrent.Checked,
ImdbId = int.Parse(result.ImdbId)
}); });
} }
// Don't add any torrents // Don't add any torrents

@ -84,9 +84,18 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
.Build(); .Build();
request.AllowAutoRedirect = true; request.AllowAutoRedirect = true;
request.SuppressHttpError = true; // request.SuppressHttpError = true;
var response = _httpClient.Get<MovieResourceRoot>(request); var response = _httpClient.Get<MovieResourceRoot>(request);
if (response.StatusCode != HttpStatusCode.OK)
{
throw new HttpException(request, response);
}
if (response.Headers.ContentType != HttpAccept.JsonCharset.Value)
{
throw new HttpException(request, response);
}
// The dude abides, so should us, Lets be nice to TMDb // The dude abides, so should us, Lets be nice to TMDb
// var allowed = int.Parse(response.Headers.GetValues("X-RateLimit-Limit").First()); // get allowed // var allowed = int.Parse(response.Headers.GetValues("X-RateLimit-Limit").First()); // get allowed
@ -301,19 +310,28 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
return movie; return movie;
} }
public Movie GetMovieInfo(string ImdbId) public Movie GetMovieInfo(string imdbId)
{ {
var request = _movieBuilder.Create() var request = _movieBuilder.Create()
.SetSegment("route", "find") .SetSegment("route", "find")
.SetSegment("id", ImdbId) .SetSegment("id", imdbId)
.SetSegment("secondaryRoute", "") .SetSegment("secondaryRoute", "")
.AddQueryParam("external_source", "imdb_id") .AddQueryParam("external_source", "imdb_id")
.Build(); .Build();
request.AllowAutoRedirect = true; request.AllowAutoRedirect = true;
request.SuppressHttpError = true; // request.SuppressHttpError = true;
var response = _httpClient.Get<FindRoot>(request); var response = _httpClient.Get<FindRoot>(request);
if (response.StatusCode != HttpStatusCode.OK)
{
throw new HttpException(request, response);
}
if (response.Headers.ContentType != HttpAccept.JsonCharset.Value)
{
throw new HttpException(request, response);
}
// The dude abides, so should us, Lets be nice to TMDb // The dude abides, so should us, Lets be nice to TMDb
// var allowed = int.Parse(response.Headers.GetValues("X-RateLimit-Limit").First()); // get allowed // var allowed = int.Parse(response.Headers.GetValues("X-RateLimit-Limit").First()); // get allowed

@ -81,7 +81,7 @@ namespace NzbDrone.Core.NetImport
_logger.Debug("Found {0} movies from list(s) {1}", movies.Count, string.Join(", ", lists.Select(l => l.Definition.Name))); _logger.Debug("Found {0} movies from list(s) {1}", movies.Count, string.Join(", ", lists.Select(l => l.Definition.Name)));
return movies; return movies.DistinctBy(x => x.TmdbId).ToList();
} }
@ -114,29 +114,29 @@ namespace NzbDrone.Core.NetImport
// listedMovies = listedMovies.Where(ah => importExclusions.Any(h => ah.TmdbId.ToString() != h)).ToList(); // listedMovies = listedMovies.Where(ah => importExclusions.Any(h => ah.TmdbId.ToString() != h)).ToList();
} }
var downloadedCount = 0; //var downloadedCount = 0;
foreach (var movie in listedMovies) foreach (var movie in listedMovies)
{ {
var mapped = _movieSearch.MapMovieToTmdbMovie(movie); var mapped = _movieSearch.MapMovieToTmdbMovie(movie);
if (mapped != null && !importExclusions.Any(x => x == mapped.TmdbId.ToString())) if (mapped != null && !importExclusions.Any(x => x == mapped.TmdbId.ToString()))
{ {
List<DownloadDecision> decisions; //List<DownloadDecision> decisions;
mapped.AddOptions = new AddMovieOptions {SearchForMovie = true}; //mapped.AddOptions = new AddMovieOptions {SearchForMovie = true};
_movieService.AddMovie(mapped); _movieService.AddMovie(mapped);
// Search for movie //// Search for movie
try //try
{ //{
decisions = _nzbSearchService.MovieSearch(mapped.Id, false); // decisions = _nzbSearchService.MovieSearch(mapped.Id, false);
} //}
catch (Exception ex) //catch (Exception ex)
{ //{
_logger.Error(ex, $"Unable to search in list for movie {mapped.Id}"); // _logger.Error(ex, $"Unable to search in list for movie {mapped.Id}");
continue; // continue;
} //}
var processed = _processDownloadDecisions.ProcessDecisions(decisions); //var processed = _processDownloadDecisions.ProcessDecisions(decisions);
downloadedCount += processed.Grabbed.Count; //downloadedCount += processed.Grabbed.Count;
} }
else else
{ {
@ -147,7 +147,7 @@ namespace NzbDrone.Core.NetImport
} }
} }
_logger.ProgressInfo("Movie search completed. {0} reports downloaded.", downloadedCount); //_logger.ProgressInfo("Movie search completed. {0} reports downloaded.", downloadedCount);
} }
private void CleanLibrary(List<Movie> movies) private void CleanLibrary(List<Movie> movies)

@ -2,15 +2,12 @@
<div class="row"> <div class="row">
<div class="well col-md-12"> <div class="well col-md-12">
<i class="icon-sonarr-comment"/> <i class="icon-sonarr-comment"/>
You must be new around here, You should add some movies. &nbsp;You must be new around here, before you start adding movies you may want to check out the following links on our <a href="https://github.com/Radarr/Radarr/wiki">wiki</a>:
</div> <ul>
</div> <li><a href="https://github.com/Radarr/Radarr/wiki/Setup-Guide">Our setup guide</a></li>
<div class="row"> <li><a href="https://github.com/Radarr/Radarr/wiki/Common-Problems">Common Problems</a></li>
<div class="col-md-4 col-md-offset-4"> <li><a href="https://github.com/Radarr/Radarr/wiki/FAQ">FAQ</a></li>
<a href="/addmovies" class='btn btn-lg btn-block btn-success x-add-movies'> </ul>
<i class='icon-sonarr-add'></i>
Add Movie
</a>
</div> </div>
</div> </div>
</div> </div>

Loading…
Cancel
Save