Implement `AddTorrentFromUrl`
This commit is contained in:
parent
c77566fc43
commit
9bff767feb
|
@ -227,5 +227,11 @@ namespace NzbDrone.Core.Download.Clients.Putio
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void MarkItemAsImported(DownloadClientItem downloadClientItem)
|
||||||
|
{
|
||||||
|
// What to do here? Maybe delete the file and transfer from put.io?
|
||||||
|
base.MarkItemAsImported(downloadClientItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using NzbDrone.Common.Extensions;
|
||||||
using NzbDrone.Common.Http;
|
using NzbDrone.Common.Http;
|
||||||
|
|
||||||
namespace NzbDrone.Core.Download.Clients.Putio
|
namespace NzbDrone.Core.Download.Clients.Putio
|
||||||
|
@ -35,9 +36,15 @@ namespace NzbDrone.Core.Download.Clients.Putio
|
||||||
|
|
||||||
public void AddTorrentFromUrl(string torrentUrl, PutioSettings settings)
|
public void AddTorrentFromUrl(string torrentUrl, PutioSettings settings)
|
||||||
{
|
{
|
||||||
// var arguments = new Dictionary<string, object>();
|
var request = BuildRequest(HttpMethod.Post, "transfers/add", settings);
|
||||||
// arguments.Add("url", torrentUrl);
|
request.AddFormParameter("url", torrentUrl);
|
||||||
// ProcessRequest<PutioGenericResponse>(Method.POST, "transfers/add", arguments, settings);
|
|
||||||
|
if (settings.SaveParentId.IsNotNullOrWhiteSpace())
|
||||||
|
{
|
||||||
|
request.AddFormParameter("save_parent_id", settings.SaveParentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
Execute<PutioGenericResponse>(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddTorrentFromData(byte[] torrentData, PutioSettings settings)
|
public void AddTorrentFromData(byte[] torrentData, PutioSettings settings)
|
||||||
|
@ -78,9 +85,16 @@ namespace NzbDrone.Core.Download.Clients.Putio
|
||||||
request.LogResponseContent = true;
|
request.LogResponseContent = true;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if (requestBuilder.Method == HttpMethod.Post)
|
||||||
|
{
|
||||||
|
return _httpClient.Post<TResult>(request);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return _httpClient.Get<TResult>(request);
|
return _httpClient.Get<TResult>(request);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (HttpException ex)
|
catch (HttpException ex)
|
||||||
{
|
{
|
||||||
if (ex.Response.StatusCode == HttpStatusCode.Unauthorized)
|
if (ex.Response.StatusCode == HttpStatusCode.Unauthorized)
|
||||||
|
|
Loading…
Reference in New Issue