mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-25 22:37:27 -04:00
Reformat and apply Stylecop rules
This commit is contained in:
@@ -40,6 +40,7 @@ namespace NzbDrone.Core.NetImport.CouchPotato
|
||||
public bool? via_tmdb { get; set; }
|
||||
public string[] actors { get; set; }
|
||||
public string[] writers { get; set; }
|
||||
|
||||
//public int? runtime { get; set; }
|
||||
public string type { get; set; }
|
||||
public string released { get; set; }
|
||||
|
||||
@@ -13,7 +13,8 @@ namespace NzbDrone.Core.NetImport.CouchPotato
|
||||
|
||||
public CouchPotatoImport(IHttpClient httpClient, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||
: base(httpClient, configService, parsingService, logger)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
public override INetImportRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Core.NetImport.Exceptions;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.NetImport.Exceptions;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.CouchPotato
|
||||
{
|
||||
@@ -92,6 +92,5 @@ namespace NzbDrone.Core.NetImport.CouchPotato
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using NzbDrone.Common.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Common.Http;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.CouchPotato
|
||||
{
|
||||
|
||||
@@ -5,7 +5,6 @@ using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.CouchPotato
|
||||
{
|
||||
|
||||
public class CouchPotatoSettingsValidator : AbstractValidator<CouchPotatoSettings>
|
||||
{
|
||||
public CouchPotatoSettingsValidator()
|
||||
@@ -48,5 +47,4 @@ namespace NzbDrone.Core.NetImport.CouchPotato
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.NetImport.Exceptions;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Movies;
|
||||
|
||||
namespace NzbDrone.Core.NetImport
|
||||
{
|
||||
@@ -102,10 +102,10 @@ namespace NzbDrone.Core.NetImport
|
||||
{
|
||||
anyFailure = true;
|
||||
feedEx.Data.Add("FeedUrl", url);
|
||||
_logger.Error(feedEx, "An error occurred while processing list feed {0}", url);
|
||||
_logger.Error(feedEx, "An error occurred while processing list feed {0}", url);
|
||||
}
|
||||
|
||||
return new NetImportFetchResult {Movies = movies, AnyFailure = anyFailure};
|
||||
return new NetImportFetchResult { Movies = movies, AnyFailure = anyFailure };
|
||||
}
|
||||
|
||||
protected virtual IList<Movie> FetchPage(NetImportRequest request, IParseNetImportResponse parser)
|
||||
@@ -114,11 +114,11 @@ namespace NzbDrone.Core.NetImport
|
||||
|
||||
return parser.ParseResponse(response).ToList().Select(m =>
|
||||
{
|
||||
m.RootFolderPath = ((NetImportDefinition) Definition).RootFolderPath;
|
||||
m.ProfileId = ((NetImportDefinition) Definition).ProfileId;
|
||||
m.Monitored = ((NetImportDefinition) Definition).ShouldMonitor;
|
||||
m.MinimumAvailability = ((NetImportDefinition) Definition).MinimumAvailability;
|
||||
m.Tags = ((NetImportDefinition) Definition).Tags;
|
||||
m.RootFolderPath = ((NetImportDefinition)Definition).RootFolderPath;
|
||||
m.ProfileId = ((NetImportDefinition)Definition).ProfileId;
|
||||
m.Monitored = ((NetImportDefinition)Definition).ShouldMonitor;
|
||||
m.MinimumAvailability = ((NetImportDefinition)Definition).MinimumAvailability;
|
||||
m.Tags = ((NetImportDefinition)Definition).Tags;
|
||||
return m;
|
||||
}).ToList();
|
||||
}
|
||||
@@ -171,5 +171,4 @@ namespace NzbDrone.Core.NetImport
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace NzbDrone.Core.NetImport.ImportExclusions
|
||||
public string MovieTitle { get; set; }
|
||||
public int MovieYear { get; set; }
|
||||
|
||||
new public string ToString()
|
||||
public new string ToString()
|
||||
{
|
||||
return string.Format("Excluded Movie: [{0}][{1} {2}]", TmdbId, MovieTitle, MovieYear);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.ImportExclusions
|
||||
{
|
||||
@@ -22,7 +22,6 @@ namespace NzbDrone.Core.NetImport.ImportExclusions
|
||||
private readonly IEventAggregator _eventAggregator;
|
||||
private readonly Logger _logger;
|
||||
|
||||
|
||||
public ImportExclusionsService(IImportExclusionsRepository exclusionRepository,
|
||||
IEventAggregator eventAggregator,
|
||||
IConfigService configService,
|
||||
@@ -40,6 +39,7 @@ namespace NzbDrone.Core.NetImport.ImportExclusions
|
||||
{
|
||||
return _exclusionRepository.GetByTmdbid(exclusion.TmdbId);
|
||||
}
|
||||
|
||||
return _exclusionRepository.Insert(exclusion);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ using System.Collections.Generic;
|
||||
using FluentValidation.Results;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Movies;
|
||||
|
||||
namespace NzbDrone.Core.NetImport
|
||||
{
|
||||
@@ -47,7 +47,7 @@ namespace NzbDrone.Core.NetImport
|
||||
|
||||
yield return new NetImportDefinition
|
||||
{
|
||||
Name = this.Name,
|
||||
Name = Name,
|
||||
Enabled = config.Validate().IsValid && Enabled,
|
||||
EnableAuto = true,
|
||||
ProfileId = 1,
|
||||
@@ -60,7 +60,10 @@ namespace NzbDrone.Core.NetImport
|
||||
|
||||
public virtual ProviderDefinition Definition { get; set; }
|
||||
|
||||
public virtual object RequestAction(string action, IDictionary<string, string> query) { return null; }
|
||||
public virtual object RequestAction(string action, IDictionary<string, string> query)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
protected TSettings Settings => (TSettings)Definition.Settings;
|
||||
|
||||
@@ -87,6 +90,5 @@ namespace NzbDrone.Core.NetImport
|
||||
{
|
||||
return Definition.Name;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Marr.Data;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Movies;
|
||||
|
||||
namespace NzbDrone.Core.NetImport
|
||||
{
|
||||
|
||||
@@ -27,7 +27,10 @@ namespace NzbDrone.Core.NetImport
|
||||
|
||||
public void Add(IEnumerable<NetImportRequest> request)
|
||||
{
|
||||
if (request == null) return;
|
||||
if (request == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_chains.Last().Add(new NetImportPageableRequest(request));
|
||||
}
|
||||
@@ -40,7 +43,10 @@ namespace NzbDrone.Core.NetImport
|
||||
|
||||
public void AddTier()
|
||||
{
|
||||
if (_chains.Last().Count == 0) return;
|
||||
if (_chains.Last().Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_chains.Add(new List<NetImportPageableRequest>());
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
|
||||
|
||||
namespace NzbDrone.Core.NetImport
|
||||
{
|
||||
public interface INetImportRepository : IProviderRepository<NetImportDefinition>
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.IndexerSearch;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.NetImport.ImportExclusions;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
|
||||
namespace NzbDrone.Core.NetImport
|
||||
{
|
||||
@@ -31,10 +31,13 @@ namespace NzbDrone.Core.NetImport
|
||||
private readonly IProcessDownloadDecisions _processDownloadDecisions;
|
||||
private readonly IImportExclusionsService _exclusionService;
|
||||
|
||||
|
||||
public NetImportSearchService(INetImportFactory netImportFactory, IMovieService movieService,
|
||||
ISearchForNewMovie movieSearch, IRootFolderService rootFolder, ISearchForNzb nzbSearchService,
|
||||
IProcessDownloadDecisions processDownloadDecisions, IConfigService configService,
|
||||
public NetImportSearchService(INetImportFactory netImportFactory,
|
||||
IMovieService movieService,
|
||||
ISearchForNewMovie movieSearch,
|
||||
IRootFolderService rootFolder,
|
||||
ISearchForNzb nzbSearchService,
|
||||
IProcessDownloadDecisions processDownloadDecisions,
|
||||
IConfigService configService,
|
||||
IImportExclusionsService exclusionService,
|
||||
Logger logger)
|
||||
{
|
||||
@@ -49,7 +52,6 @@ namespace NzbDrone.Core.NetImport
|
||||
_configService = configService;
|
||||
}
|
||||
|
||||
|
||||
public NetImportFetchResult Fetch(int listId, bool onlyEnableAuto = false)
|
||||
{
|
||||
return MovieListSearch(listId, onlyEnableAuto);
|
||||
@@ -105,12 +107,10 @@ namespace NzbDrone.Core.NetImport
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Execute(NetImportSyncCommand message)
|
||||
{
|
||||
//if there are no lists that are enabled for automatic import then dont do anything
|
||||
if((_netImportFactory.GetAvailableProviders()).Where(a => ((NetImportDefinition)a.Definition).EnableAuto).Empty())
|
||||
if (_netImportFactory.GetAvailableProviders().Where(a => ((NetImportDefinition)a.Definition).EnableAuto).Empty())
|
||||
{
|
||||
_logger.Info("No lists are enabled for auto-import.");
|
||||
return;
|
||||
@@ -182,8 +182,8 @@ namespace NzbDrone.Core.NetImport
|
||||
foundMatch = true;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!foundMatch)
|
||||
{
|
||||
switch (_configService.ListSyncLevel)
|
||||
@@ -203,6 +203,7 @@ namespace NzbDrone.Core.NetImport
|
||||
case "removeAndDelete":
|
||||
_logger.Info("{0} was in your library, but not found in your lists --> Removing from library and deleting files", movie);
|
||||
_movieService.DeleteMovie(movie.Id, true);
|
||||
|
||||
//TODO: for some reason the files are not deleted in this case... any idea why?
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -4,9 +4,8 @@ namespace NzbDrone.Core.NetImport
|
||||
{
|
||||
public class NetImportSyncCommand : Command
|
||||
{
|
||||
|
||||
public override bool SendUpdatesToClient => true;
|
||||
|
||||
public int listId = 0;
|
||||
public int ListId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@ namespace NzbDrone.Core.NetImport.RSSImport
|
||||
|
||||
public RSSImport(IHttpClient httpClient, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||
: base(httpClient, configService, parsingService, logger)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
public override IEnumerable<ProviderDefinition> DefaultDefinitions
|
||||
{
|
||||
@@ -25,6 +26,7 @@ namespace NzbDrone.Core.NetImport.RSSImport
|
||||
{
|
||||
yield return def;
|
||||
}
|
||||
|
||||
yield return new NetImportDefinition
|
||||
{
|
||||
Name = "IMDb List",
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using NzbDrone.Core.NetImport.Exceptions;
|
||||
using NzbDrone.Core.Movies;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -13,6 +11,8 @@ using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Indexers.Exceptions;
|
||||
using NzbDrone.Core.Movies;
|
||||
using NzbDrone.Core.NetImport.Exceptions;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.RSSImport
|
||||
{
|
||||
@@ -128,7 +128,6 @@ namespace NzbDrone.Core.NetImport.RSSImport
|
||||
releaseInfo = ProcessItem(item, releaseInfo);
|
||||
|
||||
//_logger.Trace("Parsed: {0}", releaseInfo.Title);
|
||||
|
||||
return PostProcess(item, releaseInfo);
|
||||
}
|
||||
|
||||
@@ -143,7 +142,7 @@ namespace NzbDrone.Core.NetImport.RSSImport
|
||||
}
|
||||
|
||||
releaseInfo.Title = title;
|
||||
var result = Parser.Parser.ParseMovieTitle(title, false);//Depreciated anyways
|
||||
var result = Parser.Parser.ParseMovieTitle(title, false); //Depreciated anyways
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
@@ -158,7 +157,6 @@ namespace NzbDrone.Core.NetImport.RSSImport
|
||||
{
|
||||
releaseInfo.ImdbId = GetImdbId(item);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -197,6 +195,7 @@ namespace NzbDrone.Core.NetImport.RSSImport
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return Parser.Parser.ParseImdbId(url);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ namespace NzbDrone.Core.NetImport.RSSImport
|
||||
//{
|
||||
// return new NetImportPageableRequestChain();
|
||||
//}
|
||||
|
||||
private IEnumerable<NetImportRequest> GetMovies(string searchParameters)
|
||||
{
|
||||
var request = new NetImportRequest($"{Settings.Link.Trim()}", HttpAccept.Rss);
|
||||
|
||||
@@ -2,10 +2,9 @@ using System.Collections.Generic;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
|
||||
|
||||
namespace NzbDrone.Core.NetImport.Radarr
|
||||
{
|
||||
@@ -17,7 +16,10 @@ namespace NzbDrone.Core.NetImport.Radarr
|
||||
|
||||
private readonly ISearchForNewMovie _skyhookProxy;
|
||||
|
||||
public RadarrLists(IHttpClient httpClient, IConfigService configService, IParsingService parsingService, ISearchForNewMovie skyhookProxy,
|
||||
public RadarrLists(IHttpClient httpClient,
|
||||
IConfigService configService,
|
||||
IParsingService parsingService,
|
||||
ISearchForNewMovie skyhookProxy,
|
||||
Logger logger)
|
||||
: base(httpClient, configService, parsingService, logger)
|
||||
{
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.MetadataSource.SkyHook.Resource;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.MetadataSource.RadarrAPI;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.MetadataSource.SkyHook.Resource;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.Radarr
|
||||
{
|
||||
public class RadarrParser : IParseNetImportResponse
|
||||
{
|
||||
private readonly RadarrSettings _settings;
|
||||
private NetImportResponse _importResponse;
|
||||
private readonly ISearchForNewMovie _skyhookProxy;
|
||||
private NetImportResponse _importResponse;
|
||||
|
||||
public RadarrParser(RadarrSettings settings, ISearchForNewMovie skyhookProxy)
|
||||
{
|
||||
_skyhookProxy = skyhookProxy;//TinyIoC.TinyIoCContainer.Current.Resolve<ISearchForNewMovie>();
|
||||
_skyhookProxy = skyhookProxy;
|
||||
_settings = settings;
|
||||
}
|
||||
|
||||
@@ -40,8 +40,6 @@ namespace NzbDrone.Core.NetImport.Radarr
|
||||
}
|
||||
|
||||
return jsonResponse.SelectList(_skyhookProxy.MapMovie);
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected virtual bool PreProcess(NetImportResponse indexerResponse)
|
||||
@@ -60,7 +58,6 @@ namespace NzbDrone.Core.NetImport.Radarr
|
||||
//No error!
|
||||
}
|
||||
|
||||
|
||||
if (indexerResponse.HttpResponse.StatusCode != System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
throw new HttpException(indexerResponse.HttpRequest, indexerResponse.HttpResponse);
|
||||
@@ -68,6 +65,5 @@ namespace NzbDrone.Core.NetImport.Radarr
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using NzbDrone.Common.Http;
|
||||
using System.Collections.Generic;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Http;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.Radarr
|
||||
{
|
||||
|
||||
@@ -5,7 +5,6 @@ using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.Radarr
|
||||
{
|
||||
|
||||
public class RadarrSettingsValidator : AbstractValidator<RadarrSettings>
|
||||
{
|
||||
public RadarrSettingsValidator()
|
||||
@@ -35,5 +34,4 @@ namespace NzbDrone.Core.NetImport.Radarr
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ namespace NzbDrone.Core.NetImport.StevenLu
|
||||
|
||||
public StevenLuImport(IHttpClient httpClient, IConfigService configService, IParsingService parsingService, Logger logger)
|
||||
: base(httpClient, configService, parsingService, logger)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
public override INetImportRequestGenerator GetRequestGenerator()
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Core.NetImport.Exceptions;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.NetImport.Exceptions;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.StevenLu
|
||||
{
|
||||
@@ -62,6 +62,5 @@ namespace NzbDrone.Core.NetImport.StevenLu
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using NzbDrone.Common.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Common.Http;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.StevenLu
|
||||
{
|
||||
|
||||
@@ -5,7 +5,6 @@ using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.StevenLu
|
||||
{
|
||||
|
||||
public class StevenLuSettingsValidator : AbstractValidator<StevenLuSettings>
|
||||
{
|
||||
public StevenLuSettingsValidator()
|
||||
@@ -30,7 +29,5 @@ namespace NzbDrone.Core.NetImport.StevenLu
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Parser;
|
||||
|
||||
|
||||
namespace NzbDrone.Core.NetImport.TMDb
|
||||
{
|
||||
public class TMDbImport : HttpNetImportBase<TMDbSettings>
|
||||
@@ -15,7 +14,10 @@ namespace NzbDrone.Core.NetImport.TMDb
|
||||
|
||||
private readonly ISearchForNewMovie _skyhookProxy;
|
||||
|
||||
public TMDbImport(IHttpClient httpClient, IConfigService configService, IParsingService parsingService, ISearchForNewMovie skyhookProxy,
|
||||
public TMDbImport(IHttpClient httpClient,
|
||||
IConfigService configService,
|
||||
IParsingService parsingService,
|
||||
ISearchForNewMovie skyhookProxy,
|
||||
Logger logger)
|
||||
: base(httpClient, configService, parsingService, logger)
|
||||
{
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Core.NetImport.Exceptions;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.MetadataSource.SkyHook.Resource;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.MetadataSource.SkyHook.Resource;
|
||||
using NzbDrone.Core.NetImport.Exceptions;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.TMDb
|
||||
{
|
||||
public class TMDbParser : IParseNetImportResponse
|
||||
{
|
||||
private readonly TMDbSettings _settings;
|
||||
private NetImportResponse _importResponse;
|
||||
private readonly ISearchForNewMovie _skyhookProxy;
|
||||
private NetImportResponse _importResponse;
|
||||
|
||||
public TMDbParser(TMDbSettings settings, ISearchForNewMovie skyhookProxy)
|
||||
{
|
||||
@@ -71,7 +71,6 @@ namespace NzbDrone.Core.NetImport.TMDb
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return movies;
|
||||
}
|
||||
|
||||
@@ -90,6 +89,5 @@ namespace NzbDrone.Core.NetImport.TMDb
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using NzbDrone.Common.Http;
|
||||
using System.Collections.Generic;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.MetadataSource.SkyHook.Resource;
|
||||
|
||||
@@ -72,6 +72,7 @@ namespace NzbDrone.Core.NetImport.TMDb
|
||||
requestBuilder.Resource(tmdbParams);
|
||||
|
||||
var request = requestBuilder
|
||||
|
||||
// .AddQueryParam("api_key", "1a7373301961d03f97f853a876dd1212")
|
||||
.Accept(HttpAccept.Json)
|
||||
.Build();
|
||||
@@ -112,7 +113,6 @@ namespace NzbDrone.Core.NetImport.TMDb
|
||||
Logger.Info($"Importing TMDb movies from: {baseUrl}");
|
||||
yield return new NetImportRequest($"{baseUrl}", HttpAccept.Json);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
using FluentValidation;
|
||||
using System.Text.RegularExpressions;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.TMDb
|
||||
{
|
||||
|
||||
public class TMDbSettingsValidator : AbstractValidator<TMDbSettings>
|
||||
{
|
||||
public TMDbSettingsValidator()
|
||||
@@ -49,7 +48,6 @@ namespace NzbDrone.Core.NetImport.TMDb
|
||||
.Matches(@"^\d+([,|]\d+)*$", RegexOptions.IgnoreCase)
|
||||
.When(c => c.ExcludeGenreIds.IsNotNullOrWhiteSpace())
|
||||
.WithMessage("Genre Ids must be comma (,) or pipe (|) separated number ids");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,5 +96,4 @@ namespace NzbDrone.Core.NetImport.TMDb
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Validation;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.Trakt
|
||||
{
|
||||
@@ -57,7 +57,6 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||
{
|
||||
_logger.Warn($"Error refreshing trakt access token");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public override INetImportRequestGenerator GetRequestGenerator()
|
||||
@@ -70,7 +69,7 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||
RefreshToken();
|
||||
}
|
||||
|
||||
return new TraktRequestGenerator() { Settings = Settings, _configService=_configService, HttpClient = _httpClient, };
|
||||
return new TraktRequestGenerator() { Settings = Settings, _configService = _configService, HttpClient = _httpClient, };
|
||||
}
|
||||
|
||||
public override IParseNetImportResponse GetParser()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Core.NetImport.Exceptions;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.NetImport.Exceptions;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.Trakt
|
||||
{
|
||||
@@ -27,7 +27,7 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||
return movies;
|
||||
}
|
||||
|
||||
if (_settings.ListType == (int) TraktListType.Popular)
|
||||
if (_settings.ListType == (int)TraktListType.Popular)
|
||||
{
|
||||
var jsonResponse = JsonConvert.DeserializeObject<List<Movie>>(_importResponse.Content);
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||
Title = movie.title,
|
||||
ImdbId = movie.ids.imdb,
|
||||
TmdbId = movie.ids.tmdb,
|
||||
Year = (movie.year ?? 0)
|
||||
Year = movie.year ?? 0
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -59,13 +59,12 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||
Title = movie.movie.title,
|
||||
ImdbId = movie.movie.ids.imdb,
|
||||
TmdbId = movie.movie.ids.tmdb,
|
||||
Year = (movie.movie.year ?? 0)
|
||||
Year = movie.movie.year ?? 0
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return movies;
|
||||
|
||||
}
|
||||
|
||||
protected virtual bool PreProcess(NetImportResponse indexerResponse)
|
||||
@@ -83,6 +82,5 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
using NzbDrone.Common.Http;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
|
||||
namespace NzbDrone.Core.NetImport.Trakt
|
||||
{
|
||||
public class RefreshRequestResponse
|
||||
@@ -24,6 +23,7 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||
public TraktRequestGenerator()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual NetImportPageableRequestChain GetMovies()
|
||||
{
|
||||
var pageableRequests = new NetImportPageableRequestChain();
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
using FluentValidation;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using FluentValidation;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace NzbDrone.Core.NetImport.Trakt
|
||||
{
|
||||
|
||||
public class TraktSettingsValidator : AbstractValidator<TraktSettings>
|
||||
{
|
||||
public TraktSettingsValidator()
|
||||
@@ -51,6 +50,7 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||
// Limit not smaller than 1 and not larger than 100
|
||||
RuleFor(c => c.Limit)
|
||||
.GreaterThan(0)
|
||||
|
||||
// .InclusiveBetween(1, 500)
|
||||
.WithMessage("Must be integer greater than 0");
|
||||
}
|
||||
@@ -121,13 +121,9 @@ namespace NzbDrone.Core.NetImport.Trakt
|
||||
[FieldDefinition(99, Label = "Authenticate with Trakt", Type = FieldType.OAuth)]
|
||||
public string SignIn { get; set; }
|
||||
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
{
|
||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user