|
|
@ -1,5 +1,4 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using NLog;
|
|
|
|
using NLog;
|
|
|
|
using NzbDrone.Common.Http;
|
|
|
|
using NzbDrone.Common.Http;
|
|
|
@ -74,9 +73,6 @@ namespace NzbDrone.Core.Download
|
|
|
|
GrabTrigger = source == "Prowlarr" ? GrabTrigger.Manual : GrabTrigger.Api
|
|
|
|
GrabTrigger = source == "Prowlarr" ? GrabTrigger.Manual : GrabTrigger.Api
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var sw = new Stopwatch();
|
|
|
|
|
|
|
|
sw.Start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string downloadClientId;
|
|
|
|
string downloadClientId;
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -115,11 +111,6 @@ namespace NzbDrone.Core.Download
|
|
|
|
|
|
|
|
|
|
|
|
throw;
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
finally
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sw.Stop();
|
|
|
|
|
|
|
|
grabEvent.ElapsedTime = sw.ElapsedMilliseconds;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.ProgressInfo("Report sent to {0}. {1}", downloadClient.Definition.Name, downloadTitle);
|
|
|
|
_logger.ProgressInfo("Report sent to {0}. {1}", downloadClient.Definition.Name, downloadTitle);
|
|
|
|
|
|
|
|
|
|
|
@ -153,16 +144,15 @@ namespace NzbDrone.Core.Download
|
|
|
|
GrabTrigger = source == "Prowlarr" ? GrabTrigger.Manual : GrabTrigger.Api
|
|
|
|
GrabTrigger = source == "Prowlarr" ? GrabTrigger.Manual : GrabTrigger.Api
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var sw = new Stopwatch();
|
|
|
|
|
|
|
|
sw.Start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] downloadedBytes;
|
|
|
|
byte[] downloadedBytes;
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
downloadedBytes = await indexer.Download(url);
|
|
|
|
var downloadResponse = await indexer.Download(url);
|
|
|
|
|
|
|
|
downloadedBytes = downloadResponse.Data;
|
|
|
|
_indexerStatusService.RecordSuccess(indexerId);
|
|
|
|
_indexerStatusService.RecordSuccess(indexerId);
|
|
|
|
grabEvent.Successful = true;
|
|
|
|
grabEvent.Successful = true;
|
|
|
|
|
|
|
|
grabEvent.ElapsedTime = downloadResponse.ElapsedTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (ReleaseUnavailableException)
|
|
|
|
catch (ReleaseUnavailableException)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -184,11 +174,6 @@ namespace NzbDrone.Core.Download
|
|
|
|
_eventAggregator.PublishEvent(grabEvent);
|
|
|
|
_eventAggregator.PublishEvent(grabEvent);
|
|
|
|
throw;
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
finally
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
sw.Stop();
|
|
|
|
|
|
|
|
grabEvent.ElapsedTime = sw.ElapsedMilliseconds;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Trace("Downloaded {0} bytes from {1}", downloadedBytes.Length, link);
|
|
|
|
_logger.Trace("Downloaded {0} bytes from {1}", downloadedBytes.Length, link);
|
|
|
|
_eventAggregator.PublishEvent(grabEvent);
|
|
|
|
_eventAggregator.PublishEvent(grabEvent);
|
|
|
|