Show warning message for rTorrent that it doesn't support torrent removal

pull/4/head
Mark McDowall 10 years ago
parent 873fadbcaa
commit 14b9a031bb

@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Api.ClientSchema; using NzbDrone.Api.ClientSchema;
using NzbDrone.Api.REST; using NzbDrone.Api.REST;
using NzbDrone.Core.ThingiProvider;
namespace NzbDrone.Api namespace NzbDrone.Api
{ {
@ -12,6 +13,7 @@ namespace NzbDrone.Api
public string Implementation { get; set; } public string Implementation { get; set; }
public string ConfigContract { get; set; } public string ConfigContract { get; set; }
public string InfoLink { get; set; } public string InfoLink { get; set; }
public ProviderMessage Message { get; set; }
public List<ProviderResource> Presets { get; set; } public List<ProviderResource> Presets { get; set; }
} }

@ -10,9 +10,9 @@ using NzbDrone.Core.MediaFiles.TorrentInfo;
using NLog; using NLog;
using NzbDrone.Core.Validation; using NzbDrone.Core.Validation;
using FluentValidation.Results; using FluentValidation.Results;
using System.Net;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.RemotePathMappings;
using NzbDrone.Core.ThingiProvider;
namespace NzbDrone.Core.Download.Clients.RTorrent namespace NzbDrone.Core.Download.Clients.RTorrent
{ {
@ -92,6 +92,14 @@ namespace NzbDrone.Core.Download.Clients.RTorrent
} }
} }
public override ProviderMessage Message
{
get
{
return new ProviderMessage("Sonarr is unable to remove torrents that have finished seeding when using rTorrent", ProviderMessageType.Warning);
}
}
public override IEnumerable<DownloadClientItem> GetItems() public override IEnumerable<DownloadClientItem> GetItems()
{ {
try try

@ -32,6 +32,14 @@ namespace NzbDrone.Core.Download
} }
} }
public virtual ProviderMessage Message
{
get
{
return null;
}
}
public IEnumerable<ProviderDefinition> DefaultDefinitions public IEnumerable<ProviderDefinition> DefaultDefinitions
{ {
get get

@ -37,6 +37,14 @@ namespace NzbDrone.Core.Indexers
get { return typeof(TSettings); } get { return typeof(TSettings); }
} }
public virtual ProviderMessage Message
{
get
{
return null;
}
}
public virtual IEnumerable<ProviderDefinition> DefaultDefinitions public virtual IEnumerable<ProviderDefinition> DefaultDefinitions
{ {
get get

@ -20,6 +20,14 @@ namespace NzbDrone.Core.Metadata
} }
} }
public virtual ProviderMessage Message
{
get
{
return null;
}
}
public IEnumerable<ProviderDefinition> DefaultDefinitions public IEnumerable<ProviderDefinition> DefaultDefinitions
{ {
get get

@ -18,6 +18,14 @@ namespace NzbDrone.Core.Notifications
} }
} }
public virtual ProviderMessage Message
{
get
{
return null;
}
}
public IEnumerable<ProviderDefinition> DefaultDefinitions public IEnumerable<ProviderDefinition> DefaultDefinitions
{ {
get get

@ -887,6 +887,7 @@
<Compile Include="ThingiProvider\NullConfig.cs" /> <Compile Include="ThingiProvider\NullConfig.cs" />
<Compile Include="ThingiProvider\ProviderDefinition.cs" /> <Compile Include="ThingiProvider\ProviderDefinition.cs" />
<Compile Include="ThingiProvider\ProviderFactory.cs" /> <Compile Include="ThingiProvider\ProviderFactory.cs" />
<Compile Include="ThingiProvider\ProviderMessage.cs" />
<Compile Include="ThingiProvider\ProviderRepository.cs" /> <Compile Include="ThingiProvider\ProviderRepository.cs" />
<Compile Include="Tv\Actor.cs" /> <Compile Include="Tv\Actor.cs" />
<Compile Include="Tv\AddSeriesOptions.cs" /> <Compile Include="Tv\AddSeriesOptions.cs" />

@ -8,7 +8,7 @@ namespace NzbDrone.Core.ThingiProvider
{ {
string Name { get; } string Name { get; }
Type ConfigContract { get; } Type ConfigContract { get; }
ProviderMessage Message { get; }
IEnumerable<ProviderDefinition> DefaultDefinitions { get; } IEnumerable<ProviderDefinition> DefaultDefinitions { get; }
ProviderDefinition Definition { get; set; } ProviderDefinition Definition { get; set; }
ValidationResult Test(); ValidationResult Test();

@ -11,6 +11,7 @@ namespace NzbDrone.Core.ThingiProvider
public string Implementation { get; set; } public string Implementation { get; set; }
public string ConfigContract { get; set; } public string ConfigContract { get; set; }
public virtual bool Enable { get; set; } public virtual bool Enable { get; set; }
public ProviderMessage Message { get; set; }
public IProviderConfig Settings public IProviderConfig Settings
{ {

@ -141,6 +141,7 @@ namespace NzbDrone.Core.ThingiProvider
public virtual TProviderDefinition GetProviderCharacteristics(TProvider provider, TProviderDefinition definition) public virtual TProviderDefinition GetProviderCharacteristics(TProvider provider, TProviderDefinition definition)
{ {
definition.ImplementationName = provider.Name; definition.ImplementationName = provider.Name;
definition.Message = provider.Message;
return definition; return definition;
} }

@ -0,0 +1,21 @@
namespace NzbDrone.Core.ThingiProvider
{
public class ProviderMessage
{
public string Message { get; set; }
public ProviderMessageType Type { get; set; }
public ProviderMessage(string message, ProviderMessageType type)
{
Message = message;
Type = type;
}
}
public enum ProviderMessageType
{
Info,
Warning,
Error
}
}

@ -1,6 +1,7 @@
var Marionette = require('marionette'); var Marionette = require('marionette');
var Handlebars = require('handlebars'); var Handlebars = require('handlebars');
var _ = require('underscore'); var _ = require('underscore');
require('./FormMessage');
var _templateRenderer = function(templateName) { var _templateRenderer = function(templateName) {
var templateFunction = Marionette.TemplateCache.get(templateName); var templateFunction = Marionette.TemplateCache.get(templateName);

@ -0,0 +1,17 @@
var Handlebars = require('handlebars');
Handlebars.registerHelper('formMessage', function(message) {
if (!message) {
return '';
}
var level = message.type;
if (message.type === 'error') {
level = 'danger';
}
var messageHtml = '<div class="alert alert-{0}" role="alert">{1}</div>'.format(level, message.message);
return new Handlebars.SafeString(messageHtml);
});

@ -8,6 +8,8 @@
{{/if}} {{/if}}
</div> </div>
<div class="modal-body download-client-modal"> <div class="modal-body download-client-modal">
{{formMessage message}}
<div class="form-horizontal"> <div class="form-horizontal">
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">Name</label> <label class="col-sm-3 control-label">Name</label>

Loading…
Cancel
Save