Merge pull request #148 from Radarr/patch/newznab-imdb

search imdbid for usenet indexers that support it
This commit is contained in:
Devin Buhl 2017-01-11 08:53:28 -05:00 committed by GitHub
commit cfe55d00ae
3 changed files with 9 additions and 22 deletions

View File

@ -92,7 +92,7 @@ namespace NzbDrone.Core.Indexers.Newznab
var capabilities = _capabilitiesProvider.GetCapabilities(Settings); var capabilities = _capabilitiesProvider.GetCapabilities(Settings);
return capabilities.SupportedMovieSearchParamters != null && return capabilities.SupportedMovieSearchParamters != null &&
capabilities.SupportedMovieSearchParamters.Contains("imdb"); capabilities.SupportedMovieSearchParamters.Contains("imdbid");
} }
} }

View File

@ -48,9 +48,7 @@ namespace NzbDrone.Core.Indexers.Newznab
protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo) protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo)
{ {
releaseInfo = base.ProcessItem(item, releaseInfo); releaseInfo = base.ProcessItem(item, releaseInfo);
releaseInfo.ImdbId = GetImdbId(item);
releaseInfo.TvdbId = GetTvdbId(item);
releaseInfo.TvRageId = GetTvRageId(item);
return releaseInfo; return releaseInfo;
} }
@ -114,27 +112,14 @@ namespace NzbDrone.Core.Indexers.Newznab
return url; return url;
} }
protected virtual int GetTvdbId(XElement item) protected virtual int GetImdbId(XElement item)
{ {
var tvdbIdString = TryGetNewznabAttribute(item, "tvdbid"); var imdbIdString = TryGetNewznabAttribute(item, "imdb");
int tvdbId; int imdbId;
if (!tvdbIdString.IsNullOrWhiteSpace() && int.TryParse(tvdbIdString, out tvdbId)) if (!imdbIdString.IsNullOrWhiteSpace() && int.TryParse(imdbIdString, out imdbId))
{ {
return tvdbId; return imdbId;
}
return 0;
}
protected virtual int GetTvRageId(XElement item)
{
var tvRageIdString = TryGetNewznabAttribute(item, "rageid");
int tvRageId;
if (!tvRageIdString.IsNullOrWhiteSpace() && int.TryParse(tvRageIdString, out tvRageId))
{
return tvRageId;
} }
return 0; return 0;

View File

@ -17,6 +17,7 @@ namespace NzbDrone.Core.Parser.Model
public DownloadProtocol DownloadProtocol { get; set; } public DownloadProtocol DownloadProtocol { get; set; }
public int TvdbId { get; set; } public int TvdbId { get; set; }
public int TvRageId { get; set; } public int TvRageId { get; set; }
public int ImdbId { get; set; }
public DateTime PublishDate { get; set; } public DateTime PublishDate { get; set; }
public string Origin { get; set; } public string Origin { get; set; }
@ -82,6 +83,7 @@ namespace NzbDrone.Core.Parser.Model
stringBuilder.AppendLine("DownloadProtocol: " + DownloadProtocol ?? "Empty"); stringBuilder.AppendLine("DownloadProtocol: " + DownloadProtocol ?? "Empty");
stringBuilder.AppendLine("TvdbId: " + TvdbId ?? "Empty"); stringBuilder.AppendLine("TvdbId: " + TvdbId ?? "Empty");
stringBuilder.AppendLine("TvRageId: " + TvRageId ?? "Empty"); stringBuilder.AppendLine("TvRageId: " + TvRageId ?? "Empty");
stringBuilder.AppendLine("ImdbId: " + ImdbId ?? "Empty");
stringBuilder.AppendLine("PublishDate: " + PublishDate ?? "Empty"); stringBuilder.AppendLine("PublishDate: " + PublishDate ?? "Empty");
return stringBuilder.ToString(); return stringBuilder.ToString();
default: default: