mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Added some update APIs to check for updates and download and extract the update package.
Todo: apply updated, UI.
This commit is contained in:
parent
e5c4f34e0e
commit
8f9946eb63
31 changed files with 18597 additions and 95 deletions
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
|
@ -50,19 +51,29 @@ namespace NzbDrone.Core.Providers.Core
|
|||
return response.GetResponseStream();
|
||||
}
|
||||
|
||||
public virtual bool DownloadFile(string address, string fileName)
|
||||
public virtual void DownloadFile(string url, string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fileInfo = new FileInfo(fileName);
|
||||
if (!fileInfo.Directory.Exists)
|
||||
{
|
||||
fileInfo.Directory.Create();
|
||||
}
|
||||
|
||||
Logger.Trace("Downloading [{0}] to [{1}]", url, fileName);
|
||||
|
||||
var stopWatch = Stopwatch.StartNew();
|
||||
var webClient = new WebClient();
|
||||
webClient.DownloadFile(address, fileName);
|
||||
return true;
|
||||
webClient.DownloadFile(url, fileName);
|
||||
stopWatch.Stop();
|
||||
Logger.Trace("Downloading Completed. took {0:0}s", stopWatch.Elapsed.Seconds);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Warn("Failed to get response from: {0}", address);
|
||||
Logger.Warn("Failed to get response from: {0}", url);
|
||||
Logger.TraceException(ex.Message, ex);
|
||||
return false;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue