mirror of https://github.com/Radarr/Radarr
Merge pull request #23 from fedoranimus/develop
Fix newznab indexers and nzbget
This commit is contained in:
commit
cbd87dcc38
|
@ -44,6 +44,21 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override string AddFromNzbFile(RemoteMovie remoteMovie, string filename, byte[] fileContents)
|
||||||
|
{
|
||||||
|
var category = Settings.TvCategory; //could update this to MovieCategory
|
||||||
|
var priority = Settings.RecentTvPriority;
|
||||||
|
|
||||||
|
var response = _proxy.DownloadNzb(fileContents, filename, category, priority, Settings);
|
||||||
|
|
||||||
|
if(response == null)
|
||||||
|
{
|
||||||
|
throw new DownloadClientException("Failed to add nzb {0}", filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
private IEnumerable<DownloadClientItem> GetQueue()
|
private IEnumerable<DownloadClientItem> GetQueue()
|
||||||
{
|
{
|
||||||
NzbgetGlobalStatus globalStatus;
|
NzbgetGlobalStatus globalStatus;
|
||||||
|
@ -72,13 +87,14 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
|
||||||
|
|
||||||
var droneParameter = item.Parameters.SingleOrDefault(p => p.Name == "drone");
|
var droneParameter = item.Parameters.SingleOrDefault(p => p.Name == "drone");
|
||||||
|
|
||||||
var queueItem = new DownloadClientItem();
|
var queueItem = new DownloadClientItem()
|
||||||
queueItem.DownloadId = droneParameter == null ? item.NzbId.ToString() : droneParameter.Value.ToString();
|
{
|
||||||
queueItem.Title = item.NzbName;
|
DownloadId = droneParameter == null ? item.NzbId.ToString() : droneParameter.Value.ToString(),
|
||||||
queueItem.TotalSize = totalSize;
|
Title = item.NzbName,
|
||||||
queueItem.Category = item.Category;
|
TotalSize = totalSize,
|
||||||
queueItem.DownloadClient = Definition.Name;
|
Category = item.Category,
|
||||||
|
DownloadClient = Definition.Name
|
||||||
|
};
|
||||||
if (globalStatus.DownloadPaused || remainingSize == pausedSize && remainingSize != 0)
|
if (globalStatus.DownloadPaused || remainingSize == pausedSize && remainingSize != 0)
|
||||||
{
|
{
|
||||||
queueItem.Status = DownloadItemStatus.Paused;
|
queueItem.Status = DownloadItemStatus.Paused;
|
||||||
|
@ -131,17 +147,18 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
|
||||||
{
|
{
|
||||||
var droneParameter = item.Parameters.SingleOrDefault(p => p.Name == "drone");
|
var droneParameter = item.Parameters.SingleOrDefault(p => p.Name == "drone");
|
||||||
|
|
||||||
var historyItem = new DownloadClientItem();
|
var historyItem = new DownloadClientItem()
|
||||||
historyItem.DownloadClient = Definition.Name;
|
{
|
||||||
historyItem.DownloadId = droneParameter == null ? item.Id.ToString() : droneParameter.Value.ToString();
|
DownloadClient = Definition.Name,
|
||||||
historyItem.Title = item.Name;
|
DownloadId = droneParameter == null ? item.Id.ToString() : droneParameter.Value.ToString(),
|
||||||
historyItem.TotalSize = MakeInt64(item.FileSizeHi, item.FileSizeLo);
|
Title = item.Name,
|
||||||
historyItem.OutputPath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(item.DestDir));
|
TotalSize = MakeInt64(item.FileSizeHi, item.FileSizeLo),
|
||||||
historyItem.Category = item.Category;
|
OutputPath = _remotePathMappingService.RemapRemoteToLocal(Settings.Host, new OsPath(item.DestDir)),
|
||||||
historyItem.Message = string.Format("PAR Status: {0} - Unpack Status: {1} - Move Status: {2} - Script Status: {3} - Delete Status: {4} - Mark Status: {5}", item.ParStatus, item.UnpackStatus, item.MoveStatus, item.ScriptStatus, item.DeleteStatus, item.MarkStatus);
|
Category = item.Category,
|
||||||
historyItem.Status = DownloadItemStatus.Completed;
|
Message = string.Format("PAR Status: {0} - Unpack Status: {1} - Move Status: {2} - Script Status: {3} - Delete Status: {4} - Mark Status: {5}", item.ParStatus, item.UnpackStatus, item.MoveStatus, item.ScriptStatus, item.DeleteStatus, item.MarkStatus),
|
||||||
historyItem.RemainingTime = TimeSpan.Zero;
|
Status = DownloadItemStatus.Completed,
|
||||||
|
RemainingTime = TimeSpan.Zero
|
||||||
|
};
|
||||||
if (item.DeleteStatus == "MANUAL")
|
if (item.DeleteStatus == "MANUAL")
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -26,7 +26,9 @@ namespace NzbDrone.Core.Download.Clients.Nzbget
|
||||||
{
|
{
|
||||||
Host = "localhost";
|
Host = "localhost";
|
||||||
Port = 6789;
|
Port = 6789;
|
||||||
TvCategory = "tv";
|
TvCategory = "Movies";
|
||||||
|
Username = "nzbget";
|
||||||
|
Password = "tegbzn6789";
|
||||||
RecentTvPriority = (int)NzbgetPriority.Normal;
|
RecentTvPriority = (int)NzbgetPriority.Normal;
|
||||||
OlderTvPriority = (int)NzbgetPriority.Normal;
|
OlderTvPriority = (int)NzbgetPriority.Normal;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -249,15 +249,15 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
|
|
||||||
private TSpec Get<TSpec>(Series series, List<Episode> episodes, bool userInvokedSearch) where TSpec : SearchCriteriaBase, new()
|
private TSpec Get<TSpec>(Series series, List<Episode> episodes, bool userInvokedSearch) where TSpec : SearchCriteriaBase, new()
|
||||||
{
|
{
|
||||||
var spec = new TSpec();
|
var spec = new TSpec()
|
||||||
|
{
|
||||||
spec.Series = series;
|
Series = series,
|
||||||
spec.SceneTitles = _sceneMapping.GetSceneNames(series.TvdbId,
|
SceneTitles = _sceneMapping.GetSceneNames(series.TvdbId,
|
||||||
episodes.Select(e => e.SeasonNumber).Distinct().ToList(),
|
episodes.Select(e => e.SeasonNumber).Distinct().ToList(),
|
||||||
episodes.Select(e => e.SceneSeasonNumber ?? e.SeasonNumber).Distinct().ToList());
|
episodes.Select(e => e.SceneSeasonNumber ?? e.SeasonNumber).Distinct().ToList()),
|
||||||
|
|
||||||
spec.Episodes = episodes;
|
|
||||||
|
|
||||||
|
Episodes = episodes
|
||||||
|
};
|
||||||
spec.SceneTitles.Add(series.Title);
|
spec.SceneTitles.Add(series.Title);
|
||||||
spec.UserInvokedSearch = userInvokedSearch;
|
spec.UserInvokedSearch = userInvokedSearch;
|
||||||
|
|
||||||
|
@ -266,9 +266,9 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
|
|
||||||
private TSpec Get<TSpec>(Movie movie, bool userInvokedSearch) where TSpec : SearchCriteriaBase, new()
|
private TSpec Get<TSpec>(Movie movie, bool userInvokedSearch) where TSpec : SearchCriteriaBase, new()
|
||||||
{
|
{
|
||||||
var spec = new TSpec();
|
var spec = new TSpec()
|
||||||
|
{
|
||||||
spec.Movie = movie;
|
Movie = movie,
|
||||||
/*spec.SceneTitles = _sceneMapping.GetSceneNames(series.TvdbId,
|
/*spec.SceneTitles = _sceneMapping.GetSceneNames(series.TvdbId,
|
||||||
episodes.Select(e => e.SeasonNumber).Distinct().ToList(),
|
episodes.Select(e => e.SeasonNumber).Distinct().ToList(),
|
||||||
episodes.Select(e => e.SceneSeasonNumber ?? e.SeasonNumber).Distinct().ToList());
|
episodes.Select(e => e.SceneSeasonNumber ?? e.SeasonNumber).Distinct().ToList());
|
||||||
|
@ -276,8 +276,8 @@ namespace NzbDrone.Core.IndexerSearch
|
||||||
spec.Episodes = episodes;
|
spec.Episodes = episodes;
|
||||||
|
|
||||||
spec.SceneTitles.Add(series.Title);*/
|
spec.SceneTitles.Add(series.Title);*/
|
||||||
spec.UserInvokedSearch = userInvokedSearch;
|
UserInvokedSearch = userInvokedSearch
|
||||||
|
};
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,8 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
}
|
}
|
||||||
|
|
||||||
if (capabilities.SupportedTvSearchParameters != null &&
|
if (capabilities.SupportedTvSearchParameters != null &&
|
||||||
new[] { "q", "tvdbid", "rid" }.Any(v => capabilities.SupportedTvSearchParameters.Contains(v)) &&
|
new[] { "q", "imdb" }.Any(v => capabilities.SupportedMovieSearchParamters.Contains(v)) &&
|
||||||
new[] { "season", "ep" }.All(v => capabilities.SupportedTvSearchParameters.Contains(v)))
|
new[] { "imdbtitle", "imdbyear" }.All(v => capabilities.SupportedMovieSearchParamters.Contains(v)))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
public int MaxPageSize { get; set; }
|
public int MaxPageSize { get; set; }
|
||||||
public string[] SupportedSearchParameters { get; set; }
|
public string[] SupportedSearchParameters { get; set; }
|
||||||
public string[] SupportedTvSearchParameters { get; set; }
|
public string[] SupportedTvSearchParameters { get; set; }
|
||||||
|
public string[] SupportedMovieSearchParamters { get; set; }
|
||||||
public bool SupportsAggregateIdSearch { get; set; }
|
public bool SupportsAggregateIdSearch { get; set; }
|
||||||
public List<NewznabCategory> Categories { get; set; }
|
public List<NewznabCategory> Categories { get; set; }
|
||||||
|
|
||||||
|
@ -16,6 +17,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
DefaultPageSize = 100;
|
DefaultPageSize = 100;
|
||||||
MaxPageSize = 100;
|
MaxPageSize = 100;
|
||||||
SupportedSearchParameters = new[] { "q" };
|
SupportedSearchParameters = new[] { "q" };
|
||||||
|
SupportedMovieSearchParamters = new[] { "q", "imdb", "imdbtitle", "imdbyear" };
|
||||||
SupportedTvSearchParameters = new[] { "q", "rid", "season", "ep" }; // This should remain 'rid' for older newznab installs.
|
SupportedTvSearchParameters = new[] { "q", "rid", "season", "ep" }; // This should remain 'rid' for older newznab installs.
|
||||||
SupportsAggregateIdSearch = false;
|
SupportsAggregateIdSearch = false;
|
||||||
Categories = new List<NewznabCategory>();
|
Categories = new List<NewznabCategory>();
|
||||||
|
|
|
@ -85,6 +85,19 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool SupportsMovieSearch
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var capabilities = _capabilitiesProvider.GetCapabilities(Settings);
|
||||||
|
|
||||||
|
return capabilities.SupportedMovieSearchParamters != null &&
|
||||||
|
capabilities.SupportedMovieSearchParamters.Contains("imdb") &&
|
||||||
|
capabilities.SupportedMovieSearchParamters.Contains("imdbtitle") &&
|
||||||
|
capabilities.SupportedMovieSearchParamters.Contains("imdbyear");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool SupportsAggregatedIdSearch
|
private bool SupportsAggregatedIdSearch
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -109,6 +122,19 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
return pageableRequests;
|
return pageableRequests;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
||||||
|
{
|
||||||
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
|
|
||||||
|
if(SupportsMovieSearch)
|
||||||
|
{
|
||||||
|
pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "movie",
|
||||||
|
string.Format("&imdbid={0}", searchCriteria.Movie.ImdbId.Substring(2)))); //strip off the "tt" - VERY HACKY
|
||||||
|
}
|
||||||
|
|
||||||
|
return pageableRequests;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
|
public virtual IndexerPageableRequestChain GetSearchRequests(SingleEpisodeSearchCriteria searchCriteria)
|
||||||
{
|
{
|
||||||
var pageableRequests = new IndexerPageableRequestChain();
|
var pageableRequests = new IndexerPageableRequestChain();
|
||||||
|
@ -274,10 +300,5 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
{
|
{
|
||||||
return title.Replace("+", "%20");
|
return title.Replace("+", "%20");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IndexerPageableRequestChain GetSearchRequests(MovieSearchCriteria searchCriteria)
|
|
||||||
{
|
|
||||||
return new IndexerPageableRequestChain();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using FluentValidation;
|
using FluentValidation;
|
||||||
|
@ -60,7 +60,7 @@ namespace NzbDrone.Core.Indexers.Newznab
|
||||||
|
|
||||||
public NewznabSettings()
|
public NewznabSettings()
|
||||||
{
|
{
|
||||||
Categories = new[] { 5030, 5040 };
|
Categories = new[] { 2030, 2040, 2050 };
|
||||||
AnimeCategories = Enumerable.Empty<int>();
|
AnimeCategories = Enumerable.Empty<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue