mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-22 07:42:28 +00:00
Cleaned up RssItemProcessingProvider, will actually process Season NZBs now.
Added Newzbin ID parsing.
This commit is contained in:
parent
1076b3ab58
commit
caa99540a6
2 changed files with 25 additions and 23 deletions
|
@ -10,6 +10,7 @@ public class NzbSiteModel
|
|||
{
|
||||
private static readonly IList<NzbSiteModel> Sites = new List<NzbSiteModel>
|
||||
{
|
||||
new NzbSiteModel {Name = "newzbin", Url = "newzbin.com", Pattern = @"\d{7,10}"},
|
||||
new NzbSiteModel {Name = "nzbmatrix", Url = "nzbmatrix.com", Pattern = @"\d{6,10}"},
|
||||
new NzbSiteModel {Name = "nzbsDotOrg", Url = "nzbs.org", Pattern = @"\d{5,10}"},
|
||||
new NzbSiteModel {Name = "nzbsrus", Url = "nzbsrus.com", Pattern = @"\d{6,10}"},
|
||||
|
|
|
@ -60,11 +60,11 @@ public void DownloadIfWanted(NzbInfoModel nzb, Indexer indexer)
|
|||
}
|
||||
|
||||
//Handles Full Season NZBs
|
||||
var seasonParsedResult = Parser.ParseSeasonInfo(nzb.Title);
|
||||
var seasonParseResult = Parser.ParseSeasonInfo(nzb.Title);
|
||||
|
||||
if (seasonParsedResult != null)
|
||||
if (seasonParseResult != null)
|
||||
{
|
||||
//ProcessFullSeasonItem
|
||||
ProcessFullSeasonItem(nzb, indexer, seasonParseResult);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -180,13 +180,14 @@ private void ProcessStandardItem(NzbInfoModel nzb, Indexer indexer, List<Episode
|
|||
|
||||
if (indexer.IndexerName != "Newzbin")
|
||||
{
|
||||
if (AddByUrl(nzb))
|
||||
if (_sabProvider.AddByUrl(nzb.Link.ToString(), nzb.TitleFix))
|
||||
AddToHistory(episodeParseResults, series, nzb, indexer);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//Send to SAB using Newzbin ID
|
||||
if (_sabProvider.AddById(nzb.Id, nzb.TitleFix))
|
||||
AddToHistory(episodeParseResults, series, nzb, indexer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -264,6 +265,7 @@ private void ProcessFullSeasonItem(NzbInfoModel nzb, Indexer indexer, SeasonPars
|
|||
episodesNeeded--; //Decrement the number of downloads we need, used if we want to replace all existing episodes if this will upgrade over X% of files
|
||||
break; //We only want to download this NZB if ALL episodes can be upgraded by this Season NZB
|
||||
}
|
||||
downloadWholeSeason = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -275,12 +277,7 @@ private void ProcessFullSeasonItem(NzbInfoModel nzb, Indexer indexer, SeasonPars
|
|||
{
|
||||
if (DownloadNzb(nzb))
|
||||
{
|
||||
var episodeParseResults = new List<EpisodeParseResult>();
|
||||
episodeParseResults.AddRange(
|
||||
season.Episodes.Select(
|
||||
e =>
|
||||
new EpisodeParseResult {EpisodeNumber = e.EpisodeNumber, SeasonNumber = e.SeasonNumber}));
|
||||
|
||||
var episodeParseResults = GetEpisodeParseList(season.Episodes);
|
||||
AddToHistory(episodeParseResults, series, nzb, indexer);
|
||||
}
|
||||
}
|
||||
|
@ -293,14 +290,9 @@ private void ProcessFullSeasonItem(NzbInfoModel nzb, Indexer indexer, SeasonPars
|
|||
|
||||
if (indexer.IndexerName != "Newzbin")
|
||||
{
|
||||
if (AddByUrl(nzb))
|
||||
if (_sabProvider.AddByUrl(nzb.Link.ToString(), nzb.TitleFix))
|
||||
{
|
||||
var episodeParseResults = new List<EpisodeParseResult>();
|
||||
episodeParseResults.AddRange(
|
||||
season.Episodes.Select(
|
||||
e =>
|
||||
new EpisodeParseResult { EpisodeNumber = e.EpisodeNumber, SeasonNumber = e.SeasonNumber }));
|
||||
|
||||
var episodeParseResults = GetEpisodeParseList(season.Episodes);
|
||||
AddToHistory(episodeParseResults, series, nzb, indexer);
|
||||
}
|
||||
|
||||
|
@ -308,18 +300,27 @@ private void ProcessFullSeasonItem(NzbInfoModel nzb, Indexer indexer, SeasonPars
|
|||
|
||||
else
|
||||
{
|
||||
//Send to SAB using Newzbin ID
|
||||
if (_sabProvider.AddById(nzb.Id, nzb.TitleFix))
|
||||
{
|
||||
var episodeParseResults = GetEpisodeParseList(season.Episodes);
|
||||
AddToHistory(episodeParseResults, series, nzb, indexer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Possibly grab the whole season if a certain % of the season is missing, rather than for 1 or 2 episodes
|
||||
throw new NotImplementedException("NzbDrone is currently not able to handle downloadinga whole season when less than a whole season it missing");
|
||||
//Possibly grab the whole season if a certain % of the season is missing, rather than for 1 or 2 episodes
|
||||
}
|
||||
|
||||
private bool AddByUrl(NzbInfoModel nzb)
|
||||
private List<EpisodeParseResult> GetEpisodeParseList(List<Episode> episodes)
|
||||
{
|
||||
return _sabProvider.AddByUrl(nzb.Link.ToString(), nzb.TitleFix);
|
||||
var episodeParseResults = new List<EpisodeParseResult>();
|
||||
episodeParseResults.AddRange(
|
||||
episodes.Select(
|
||||
e =>
|
||||
new EpisodeParseResult { EpisodeNumber = e.EpisodeNumber, SeasonNumber = e.SeasonNumber }));
|
||||
|
||||
return episodeParseResults;
|
||||
}
|
||||
|
||||
private void AddToHistory(List<EpisodeParseResult> episodeParseResults, Series series, NzbInfoModel nzb, Indexer indexer)
|
||||
|
|
Loading…
Reference in a new issue