parent
feda4a9b67
commit
25e2c98c45
@ -0,0 +1,29 @@
|
|||||||
|
using System;
|
||||||
|
using NzbDrone.Api.REST;
|
||||||
|
using NzbDrone.Core.Datastore.Events;
|
||||||
|
|
||||||
|
namespace NzbDrone.Api
|
||||||
|
{
|
||||||
|
public class ResourceChangeMessage<TResource> where TResource : RestResource
|
||||||
|
{
|
||||||
|
public TResource Resource { get; private set; }
|
||||||
|
public ModelAction Action { get; private set; }
|
||||||
|
|
||||||
|
public ResourceChangeMessage(ModelAction action)
|
||||||
|
{
|
||||||
|
if (action != ModelAction.Deleted || action != ModelAction.Sync)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Resource message without a resource needs to have Delete or Sync as action");
|
||||||
|
}
|
||||||
|
|
||||||
|
Action = action;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourceChangeMessage(TResource resource, ModelAction action)
|
||||||
|
{
|
||||||
|
Resource = resource;
|
||||||
|
Action = action;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,37 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNet.SignalR;
|
|
||||||
using Microsoft.AspNet.SignalR.Infrastructure;
|
|
||||||
using NLog;
|
|
||||||
using NzbDrone.Common.Instrumentation;
|
|
||||||
using NzbDrone.Common.Messaging;
|
|
||||||
using NzbDrone.Core.Datastore;
|
|
||||||
using NzbDrone.Core.Datastore.Events;
|
|
||||||
|
|
||||||
namespace NzbDrone.Api.SignalR
|
|
||||||
{
|
|
||||||
public abstract class BasicResourceConnection<T> :
|
|
||||||
NzbDronePersistentConnection,
|
|
||||||
IHandleAsync<ModelEvent<T>>
|
|
||||||
where T : ModelBase
|
|
||||||
{
|
|
||||||
private readonly Logger _logger;
|
|
||||||
|
|
||||||
|
|
||||||
public BasicResourceConnection()
|
|
||||||
{
|
|
||||||
_logger = NzbDroneLogger.GetLogger(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Task OnConnected(IRequest request, string connectionId)
|
|
||||||
{
|
|
||||||
_logger.Trace("SignalR client connected. ID:{0}", connectionId);
|
|
||||||
return base.OnConnected(request, connectionId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void HandleAsync(ModelEvent<T> message)
|
|
||||||
{
|
|
||||||
var context = ((ConnectionManager)GlobalHost.ConnectionManager).GetConnection(GetType());
|
|
||||||
context.Connection.Broadcast(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
using Microsoft.AspNet.SignalR;
|
|
||||||
|
|
||||||
namespace NzbDrone.Api.SignalR
|
|
||||||
{
|
|
||||||
public abstract class NzbDronePersistentConnection : PersistentConnection
|
|
||||||
{
|
|
||||||
public abstract string Resource { get; }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace NzbDrone.Common.Messaging
|
|
||||||
{
|
|
||||||
public interface ICommand : IMessage
|
|
||||||
{
|
|
||||||
String CommandId { get; }
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
@ -1,22 +1,26 @@
|
|||||||
|
using System;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Test.Framework;
|
using NzbDrone.Core.Test.Framework;
|
||||||
using NzbDrone.Core.Update;
|
using NzbDrone.Core.Update;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.Test.UpdateTests
|
namespace NzbDrone.Core.Test.UpdateTests
|
||||||
{
|
{
|
||||||
public class UpdatePackageProviderFixture : CoreTest<UpdatePackageProvider>
|
public class UpdatePackageProviderFixture : CoreTest<UpdatePackageProvider>
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void should_get_list_of_available_updates()
|
public void no_update_when_version_higher()
|
||||||
{
|
{
|
||||||
UseRealHttp();
|
UseRealHttp();
|
||||||
|
Subject.GetLatestUpdate("master", new Version(10,0)).Should().BeNull();
|
||||||
|
}
|
||||||
|
|
||||||
Mocker.GetMock<IConfigFileProvider>().SetupGet(c => c.Branch).Returns("master");
|
[Test]
|
||||||
|
public void finds_update_when_version_lower()
|
||||||
Subject.GetLatestUpdate().Should().BeNull();
|
{
|
||||||
|
UseRealHttp();
|
||||||
|
Subject.GetLatestUpdate("master", new Version(1, 0)).Should().NotBeNull();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Messaging;
|
using NzbDrone.Core.Messaging;
|
||||||
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
|
|
||||||
namespace NzbDrone.Core.DataAugmentation.Scene
|
namespace NzbDrone.Core.DataAugmentation.Scene
|
||||||
{
|
{
|
||||||
public class UpdateSceneMappingCommand : ICommand
|
public class UpdateSceneMappingCommand : Command
|
||||||
{
|
{
|
||||||
public String CommandId { get; private set; }
|
|
||||||
|
|
||||||
public UpdateSceneMappingCommand()
|
|
||||||
{
|
|
||||||
CommandId = HashUtil.GenerateCommandId();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.MediaFiles.Commands
|
||||||
|
{
|
||||||
|
public class BackendCommandAttribute : Attribute
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -1,22 +1,16 @@
|
|||||||
using System;
|
using System;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Messaging;
|
using NzbDrone.Core.Messaging;
|
||||||
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.Commands
|
namespace NzbDrone.Core.MediaFiles.Commands
|
||||||
{
|
{
|
||||||
public class CleanMediaFileDb : ICommand
|
public class CleanMediaFileDb : Command
|
||||||
{
|
{
|
||||||
public String CommandId { get; private set; }
|
|
||||||
public int SeriesId { get; private set; }
|
public int SeriesId { get; private set; }
|
||||||
|
|
||||||
public CleanMediaFileDb()
|
|
||||||
{
|
|
||||||
CommandId = HashUtil.GenerateCommandId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CleanMediaFileDb(int seriesId)
|
public CleanMediaFileDb(int seriesId)
|
||||||
{
|
{
|
||||||
CommandId = HashUtil.GenerateCommandId();
|
|
||||||
SeriesId = seriesId;
|
SeriesId = seriesId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Messaging;
|
using NzbDrone.Core.Messaging;
|
||||||
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.Commands
|
namespace NzbDrone.Core.MediaFiles.Commands
|
||||||
{
|
{
|
||||||
public class CleanUpRecycleBinCommand : ICommand
|
public class CleanUpRecycleBinCommand : Command
|
||||||
{
|
{
|
||||||
public String CommandId { get; private set; }
|
|
||||||
|
|
||||||
public CleanUpRecycleBinCommand()
|
|
||||||
{
|
|
||||||
CommandId = HashUtil.GenerateCommandId();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,16 +1,9 @@
|
|||||||
using System;
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
using NzbDrone.Common;
|
|
||||||
using NzbDrone.Common.Messaging;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.Commands
|
namespace NzbDrone.Core.MediaFiles.Commands
|
||||||
{
|
{
|
||||||
public class DownloadedEpisodesScanCommand : ICommand
|
public class DownloadedEpisodesScanCommand : Command
|
||||||
{
|
{
|
||||||
public String CommandId { get; private set; }
|
|
||||||
|
|
||||||
public DownloadedEpisodesScanCommand()
|
|
||||||
{
|
|
||||||
CommandId = HashUtil.GenerateCommandId();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,22 +1,26 @@
|
|||||||
using System;
|
using NzbDrone.Core.Messaging;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Core.Messaging.Commands;
|
||||||
using NzbDrone.Common.Messaging;
|
|
||||||
|
|
||||||
namespace NzbDrone.Core.MediaFiles.Commands
|
namespace NzbDrone.Core.MediaFiles.Commands
|
||||||
{
|
{
|
||||||
public class RenameSeriesCommand : ICommand
|
public class RenameSeriesCommand : Command
|
||||||
{
|
{
|
||||||
public String CommandId { get; private set; }
|
|
||||||
public int SeriesId { get; set; }
|
public int SeriesId { get; set; }
|
||||||
|
|
||||||
|
public override bool SendUpdatesToClient
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public RenameSeriesCommand()
|
public RenameSeriesCommand()
|
||||||
{
|
{
|
||||||
CommandId = HashUtil.GenerateCommandId();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RenameSeriesCommand(int seriesId)
|
public RenameSeriesCommand(int seriesId)
|
||||||
{
|
{
|
||||||
CommandId = HashUtil.GenerateCommandId();
|
|
||||||
SeriesId = seriesId;
|
SeriesId = seriesId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue