1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-04 10:02:40 +01:00

Update Torznab to work with movies

This commit is contained in:
Devin Buhl 2017-01-13 17:34:27 -05:00
parent f7471940c4
commit 4260b58535
2 changed files with 5 additions and 28 deletions

View File

@ -97,8 +97,7 @@ protected virtual ValidationFailure TestCapabilities()
} }
if (capabilities.SupportedTvSearchParameters != null && if (capabilities.SupportedTvSearchParameters != null &&
new[] { "q", "tvdbid", "rid" }.Any(v => capabilities.SupportedTvSearchParameters.Contains(v)) && new[] { "q", "imdbid" }.Any(v => capabilities.SupportedTvSearchParameters.Contains(v)))
new[] { "season", "ep" }.All(v => capabilities.SupportedTvSearchParameters.Contains(v)))
{ {
return null; return null;
} }

View File

@ -39,10 +39,7 @@ protected override bool PreProcess(IndexerResponse indexerResponse)
protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo) protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInfo)
{ {
var torrentInfo = base.ProcessItem(item, releaseInfo) as TorrentInfo; var torrentInfo = base.ProcessItem(item, releaseInfo) as TorrentInfo;
torrentInfo.ImdbId = int.Parse(GetImdbId(item).Substring(2));
torrentInfo.TvdbId = GetTvdbId(item);
torrentInfo.TvRageId = GetTvRageId(item);
return torrentInfo; return torrentInfo;
} }
@ -100,31 +97,12 @@ protected override string GetDownloadUrl(XElement item)
return url; return url;
} }
protected virtual int GetTvdbId(XElement item) protected virtual string GetImdbId(XElement item)
{ {
var tvdbIdString = TryGetTorznabAttribute(item, "tvdbid"); var imdbIdString = TryGetTorznabAttribute(item, "imdbid");
int tvdbId; return (!imdbIdString.IsNullOrWhiteSpace() ? imdbIdString.Substring(2) : null);
if (!tvdbIdString.IsNullOrWhiteSpace() && int.TryParse(tvdbIdString, out tvdbId))
{
return tvdbId;
}
return 0;
} }
protected virtual int GetTvRageId(XElement item)
{
var tvRageIdString = TryGetTorznabAttribute(item, "rageid");
int tvRageId;
if (!tvRageIdString.IsNullOrWhiteSpace() && int.TryParse(tvRageIdString, out tvRageId))
{
return tvRageId;
}
return 0;
}
protected override string GetInfoHash(XElement item) protected override string GetInfoHash(XElement item)
{ {
return TryGetTorznabAttribute(item, "infohash"); return TryGetTorznabAttribute(item, "infohash");