1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 09:49:00 +00:00

#146 search imdbid for usenet indexers that support it

This commit is contained in:
Devin Buhl 2017-01-11 08:42:29 -05:00
parent 9513068467
commit 1d88313424
3 changed files with 9 additions and 22 deletions

View file

@ -92,7 +92,7 @@ private bool SupportsMovieSearch
var capabilities = _capabilitiesProvider.GetCapabilities(Settings);
return capabilities.SupportedMovieSearchParamters != null &&
capabilities.SupportedMovieSearchParamters.Contains("imdb");
capabilities.SupportedMovieSearchParamters.Contains("imdbid");
}
}

View file

@ -48,9 +48,7 @@ protected override bool PreProcess(IndexerResponse indexerResponse)
protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo)
{
releaseInfo = base.ProcessItem(item, releaseInfo);
releaseInfo.TvdbId = GetTvdbId(item);
releaseInfo.TvRageId = GetTvRageId(item);
releaseInfo.ImdbId = GetImdbId(item);
return releaseInfo;
}
@ -114,27 +112,14 @@ protected override string GetDownloadUrl(XElement item)
return url;
}
protected virtual int GetTvdbId(XElement item)
protected virtual int GetImdbId(XElement item)
{
var tvdbIdString = TryGetNewznabAttribute(item, "tvdbid");
int tvdbId;
var imdbIdString = TryGetNewznabAttribute(item, "imdb");
int imdbId;
if (!tvdbIdString.IsNullOrWhiteSpace() && int.TryParse(tvdbIdString, out tvdbId))
if (!imdbIdString.IsNullOrWhiteSpace() && int.TryParse(imdbIdString, out imdbId))
{
return tvdbId;
}
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 imdbId;
}
return 0;

View file

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