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; }

@ -1,57 +1,63 @@
{ {
"status": 0, "status": 0,
"data": [ "data": [
{ {
"id": 257142, "id": 257142,
"hash": "EABC50AEF9F53CEDED84ADF14144D3368E586F3A", "hash": "EABC50AEF9F53CEDED84ADF14144D3368E586F3A",
"leechers": 1, "leechers": 1,
"seeders": 46, "seeders": 46,
"name": "Supernatural S10E17 1080p WEB-DL DD5.1 H.264-ECI", "name": "Supernatural S10E17 1080p WEB-DL DD5.1 H.264-ECI",
"times_completed": 49, "times_completed": 49,
"size": 1718009717, "size": 1718009717,
"utadded": 1428179446, "utadded": 1428179446,
"added": "2015-04-04T20:30:46+0000", "added": "2015-04-04T20:30:46+0000",
"comments": 0, "comments": 0,
"numfiles": 1, "numfiles": 1,
"filename": "Supernatural.S10E17.1080p.WEB-DL.DD5.1.H.264-ECI.torrent", "filename": "Supernatural.S10E17.1080p.WEB-DL.DD5.1.H.264-ECI.torrent",
"freeleech": "no", "freeleech": "no",
"type_category": 2, "type_category": 2,
"type_codec": 1, "type_codec": 1,
"type_medium": 6, "type_medium": 6,
"type_origin": 0, "type_origin": 0,
"username": "abc", "username": "abc",
"owner": 1107944, "owner": 1107944,
"tvdb": { "tvdb": {
"id": 78901, "id": 78901,
"season": 10, "season": 10,
"episode": 17 "episode": 17
}
}, },
{ "imdb": {
"id": 257140, "id": 78901
"hash": "BE3BA5396B9A30544353B55FDD89EDE46C8FB72A",
"leechers": 0,
"seeders": 18,
"name": "Scandal S04E18 1080p WEB-DL DD5.1 H.264-ECI",
"times_completed": 19,
"size": 1789106197,
"utadded": 1428179128,
"added": "2015-04-04T20:25:28+0000",
"comments": 0,
"numfiles": 1,
"filename": "Scandal.2012.S04E18.1080p.WEB-DL.DD5.1.H.264-ECI.torrent",
"freeleech": "no",
"type_category": 2,
"type_codec": 1,
"type_medium": 6,
"type_origin": 0,
"username": "abc",
"owner": 1107944,
"tvdb": {
"id": 248841,
"season": 4,
"episode": 18
}
} }
},
{
"id": 257140,
"hash": "BE3BA5396B9A30544353B55FDD89EDE46C8FB72A",
"leechers": 0,
"seeders": 18,
"name": "Scandal S04E18 1080p WEB-DL DD5.1 H.264-ECI",
"times_completed": 19,
"size": 1789106197,
"utadded": 1428179128,
"added": "2015-04-04T20:25:28+0000",
"comments": 0,
"numfiles": 1,
"filename": "Scandal.2012.S04E18.1080p.WEB-DL.DD5.1.H.264-ECI.torrent",
"freeleech": "no",
"type_category": 2,
"type_codec": 1,
"type_medium": 6,
"type_origin": 0,
"username": "abc",
"owner": 1107944,
"tvdb": {
"id": 248841,
"season": 4,
"episode": 18
},
"imdb": {
"id": 78901
}
}
] ]
} }

@ -1,57 +1,63 @@
{ {
"status": 0, "status": 0,
"data": [ "data": [
{ {
"id": "257142", "id": "257142",
"hash": "EABC50AEF9F53CEDED84ADF14144D3368E586F3A", "hash": "EABC50AEF9F53CEDED84ADF14144D3368E586F3A",
"leechers": 1, "leechers": 1,
"seeders": 46, "seeders": 46,
"name": "Supernatural S10E17 1080p WEB-DL DD5.1 H.264-ECI", "name": "Supernatural S10E17 1080p WEB-DL DD5.1 H.264-ECI",
"times_completed": 49, "times_completed": 49,
"size": 1718009717, "size": 1718009717,
"utadded": 1428179446, "utadded": 1428179446,
"added": "2015-04-04T20:30:46+0000", "added": "2015-04-04T20:30:46+0000",
"comments": 0, "comments": 0,
"numfiles": 1, "numfiles": 1,
"filename": "Supernatural.S10E17.1080p.WEB-DL.DD5.1.H.264-ECI.torrent", "filename": "Supernatural.S10E17.1080p.WEB-DL.DD5.1.H.264-ECI.torrent",
"freeleech": "no", "freeleech": "no",
"type_category": 2, "type_category": 2,
"type_codec": 1, "type_codec": 1,
"type_medium": 6, "type_medium": 6,
"type_origin": 0, "type_origin": 0,
"username": "abc", "username": "abc",
"owner": 1107944, "owner": 1107944,
"tvdb": { "tvdb": {
"id": 78901, "id": 78901,
"season": 10, "season": 10,
"episode": 17 "episode": 17
}
}, },
{ "imdb": {
"id": "257140", "id": 78901
"hash": "BE3BA5396B9A30544353B55FDD89EDE46C8FB72A",
"leechers": 0,
"seeders": 18,
"name": "Scandal S04E18 1080p WEB-DL DD5.1 H.264-ECI",
"times_completed": 19,
"size": 1789106197,
"utadded": 1428179128,
"added": "2015-04-04T20:25:28+0000",
"comments": 0,
"numfiles": 1,
"filename": "Scandal.2012.S04E18.1080p.WEB-DL.DD5.1.H.264-ECI.torrent",
"freeleech": "no",
"type_category": 2,
"type_codec": 1,
"type_medium": 6,
"type_origin": 0,
"username": "abc",
"owner": 1107944,
"tvdb": {
"id": 248841,
"season": 4,
"episode": 18
}
} }
},
{
"id": "257140",
"hash": "BE3BA5396B9A30544353B55FDD89EDE46C8FB72A",
"leechers": 0,
"seeders": 18,
"name": "Scandal S04E18 1080p WEB-DL DD5.1 H.264-ECI",
"times_completed": 19,
"size": 1789106197,
"utadded": 1428179128,
"added": "2015-04-04T20:25:28+0000",
"comments": 0,
"numfiles": 1,
"filename": "Scandal.2012.S04E18.1080p.WEB-DL.DD5.1.H.264-ECI.torrent",
"freeleech": "no",
"type_category": 2,
"type_codec": 1,
"type_medium": 6,
"type_origin": 0,
"username": "abc",
"owner": 1107944,
"tvdb": {
"id": 248841,
"season": 4,
"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