|
|
@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Xml.Linq;
|
|
|
|
using System.Xml.Linq;
|
|
|
|
using System.Xml.XPath;
|
|
|
|
using System.Xml.XPath;
|
|
|
|
|
|
|
|
using NzbDrone.Common.Extensions;
|
|
|
|
using NzbDrone.Common.Http;
|
|
|
|
using NzbDrone.Common.Http;
|
|
|
|
using NzbDrone.Core.Download.Extensions;
|
|
|
|
using NzbDrone.Core.Download.Extensions;
|
|
|
|
|
|
|
|
|
|
|
@ -95,8 +96,14 @@ namespace NzbDrone.Core.Download.Clients.Aria2
|
|
|
|
|
|
|
|
|
|
|
|
public string AddUri(Aria2Settings settings, string magnet)
|
|
|
|
public string AddUri(Aria2Settings settings, string magnet)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var response = ExecuteRequest(settings, "aria2.addUri", GetToken(settings), new List<string> { magnet });
|
|
|
|
var options = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (settings.Directory.IsNotNullOrWhiteSpace())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options.Add("dir", settings.Directory);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var response = ExecuteRequest(settings, "aria2.addUri", GetToken(settings), new List<string> { magnet }, options);
|
|
|
|
var gid = response.GetStringResponse();
|
|
|
|
var gid = response.GetStringResponse();
|
|
|
|
|
|
|
|
|
|
|
|
return gid;
|
|
|
|
return gid;
|
|
|
@ -104,8 +111,16 @@ namespace NzbDrone.Core.Download.Clients.Aria2
|
|
|
|
|
|
|
|
|
|
|
|
public string AddTorrent(Aria2Settings settings, byte[] torrent)
|
|
|
|
public string AddTorrent(Aria2Settings settings, byte[] torrent)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var response = ExecuteRequest(settings, "aria2.addTorrent", GetToken(settings), torrent);
|
|
|
|
// Aria2's second parameter is an array of URIs and needs to be sent if options are provided, this satisfies that requirement.
|
|
|
|
|
|
|
|
var emptyListOfUris = new List<string>();
|
|
|
|
|
|
|
|
var options = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (settings.Directory.IsNotNullOrWhiteSpace())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options.Add("dir", settings.Directory);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var response = ExecuteRequest(settings, "aria2.addTorrent", GetToken(settings), torrent, emptyListOfUris, options);
|
|
|
|
var gid = response.GetStringResponse();
|
|
|
|
var gid = response.GetStringResponse();
|
|
|
|
|
|
|
|
|
|
|
|
return gid;
|
|
|
|
return gid;
|
|
|
|