예제 #1
0
        public AddMoviesToTheQueue()
        {
            this._movieContextDownloadQueue = new MovieContext();
            this._movieContextUpdate        = new MovieContext();

            this._aria2Client = new Aria2Client(Config.Aria2Url, Config.Aria2Port);
        }
예제 #2
0
        static async Task Main(string[] args)
        {
            RunAria2();
            _client = new Aria2Client("localhost", _aria2Port);

            var gid = await Demo.UriDownload(_client);

            await Task.Delay(3000);

            //wait 3 sec
            var downloadStatus = await Demo.GetStatus(_client, gid);

            Console.WriteLine($@"
Dir:{downloadStatus.Dir}
Speed:{downloadStatus.DownloadSpeed}
Length:{downloadStatus.TotalLength}
");

            await Task.Delay(1000);

            downloadStatus = await Demo.GetStatus(_client, gid);

            Console.WriteLine($@"
Dir:{downloadStatus.Dir}
Speed:{downloadStatus.DownloadSpeed}
Length:{downloadStatus.TotalLength}
");

            Console.ReadKey();
            _client.Shutdown();
        }
예제 #3
0
 public DownloadProgress(ILogger <DownloadProgress> logger, IHubContext <DownloadProgressHub> downloadProgressHub)
 {
     _logger           = logger;
     this._aria2Client = new Aria2Client(Config.Aria2Url, Config.Aria2Port);
     _logger.LogInformation("ARIA2 " + this._aria2Client);
     _downloadProgressHub       = downloadProgressHub;
     this._movieContext         = new MovieContext();
     this._movieContextReadOnly = new MovieContext();
 }
예제 #4
0
 public HomeController(
     ILogger<HomeController> logger,
     IHubContext<DownloadProgressHub> downloadProgressHub,
     MovieContext _movieContext,
     ILogger<DownloadProgress> loggerDownloadProcessor
     )
 {
     _logger = logger;
     this._aria2Client = new Aria2Client("http://127.0.0.1", 6800);
     _logger.LogInformation("amohammed " + this._aria2Client);
     _downloadProgressHub = downloadProgressHub;
     this._movieContext = _movieContext;
     this.LoggerDownloadProcessor = loggerDownloadProcessor;
     this._movieContextReadOnly = new MovieContext();
 }
예제 #5
0
 public static async Task <string> UriDownload(Aria2Client client)
 {
     return(await client.AddUri("https://speed.hetzner.de/1GB.bin"));
 }
예제 #6
0
 public static async Task <DownloadStatusModel> GetStatus(Aria2Client client, string gid)
 {
     return(await client.TellStatus(gid));
 }
예제 #7
0
 public static void Shutdown(Aria2Client aria2)
 {
     aria2?.Shutdown();
 }